@agregio-solutions/design-system 1.15.0 → 1.15.1

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.
@@ -852,7 +852,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Tr]+=1);function z1(e){return
852
852
  display: flex;
853
853
  align-items: center;
854
854
  column-gap: var(--spacing-xs);
855
- `;function Ru({nature:e,successHelperText:t,errorHelperText:r}){return e||(r?"negative":t?"positive":"default")}function Zv(){return typeof window.ResizeObserver<"u"}function Wv(e){const{ref:t,onResize:r}=e;u.useEffect(()=>{const n=t==null?void 0:t.current;if(n)if(Zv()){const o=new window.ResizeObserver(i=>{i.length&&r()});return o.observe(n),()=>{n&&o.unobserve(n)}}else return window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)}},[r,t])}function Iu(e){const{locale:t}=_t(),r=t||"";return`${r[0]}${r[1]}`.toLowerCase()==="fr"?e.fr:e.en}const Co=u.forwardRef((e,t)=>{var c,d;const r=Iu(Uv),n=Ru({nature:e.nature,successHelperText:e.successHelperText,errorHelperText:e.errorHelperText}),o={...e.wrapperProps,htmlForId:e.id,label:e.label,labelIconRight:e.labelIconRight,description:e.description,helperTextIcon:e.helperTextIcon,helperText:e.helperText,errorHelperText:e.errorHelperText,errorHelperTextIcon:e.errorHelperTextIcon,successHelperText:e.successHelperText,successHelperTextIcon:e.successHelperTextIcon,required:e.required},i=u.useRef(null),[a,l]=u.useState(null),s=u.useCallback(()=>{i.current&&l(i.current.offsetWidth+"px")},[i]);return Wv({ref:i,onResize:s}),e.mode==="multiple"?v.jsx(Po,{...o,ref:t,children:v.jsxs(P0,{defaultOpen:e.defaultOpen,isOpen:e.open,onOpenChange:e.onOpenChange,children:[v.jsxs(ga,{...e.buttonProps,type:"button",ref:i,"data-nature":n,"data-fullwidth":e.fullWidth,"data-testid":"select-trigger",isDisabled:e.disabled,children:[!((c=e.selectedKeys)!=null&&c.length)&&v.jsx("span",{children:e.placeholder||""}),!!((d=e.selectedKeys)!=null&&d.length)&&v.jsxs(Hv,{children:[v.jsx(Cu,{value:e.selectedKeys.length,nature:"informative"}),e.selectedKeys.length===1?` ${r.itemSelected}`:` ${r.itemsSelected}`]}),v.jsx(ma,{name:"expand_more","data-disabled":e.disabled})]}),v.jsx(ba,{offset:4,placement:"bottom",children:v.jsx(ya,{"aria-label":String(e.label),selectionMode:"multiple",selectedKeys:e.selectedKeys,disabledKeys:e.disabledIds,onSelectionChange:p=>{p!=="all"&&e.onSelectionChange([...p].map(String))},style:{"--trigger-width":a},children:e.children})})]})}):v.jsx(Po,{...o,children:v.jsxs(zv,{ref:t,id:e.id,isDisabled:e.disabled,isRequired:e.required,onSelectionChange:p=>{var f;return(f=e.onChange)==null?void 0:f.call(e,String(p))},selectedKey:e.value,name:e.name,disabledKeys:e.disabledIds,defaultOpen:e.defaultOpen,isOpen:e.open,onOpenChange:e.onOpenChange,"data-fullwidth":e.fullWidth,"aria-label":String(e.label),children:[v.jsxs(ga,{...e.buttonProps,type:"button","data-nature":n,"data-fullwidth":e.fullWidth,"data-testid":"select-trigger",children:[v.jsx(Vv,{children:p=>p.isPlaceholder?e.placeholder||"":p.selectedText}),v.jsx(ma,{name:"expand_more","data-disabled":e.disabled})]}),v.jsx(ba,{offset:4,placement:"bottom",children:v.jsx(ya,{children:e.children})})]})})}),Uv={en:{itemsSelected:" items selected",itemSelected:" item selected"},fr:{itemsSelected:" éléments sélectionnés",itemSelected:" élément sélectionné"}},To=K(Ve)`
855
+ `;function Ru({nature:e,successHelperText:t,errorHelperText:r}){return e||(r?"negative":t?"positive":"default")}function Zv(){return typeof window.ResizeObserver<"u"}function Wv(e){const{ref:t,onResize:r}=e;u.useEffect(()=>{const n=t==null?void 0:t.current;if(n)if(Zv()){const o=new window.ResizeObserver(i=>{i.length&&r()});return o.observe(n),()=>{n&&o.unobserve(n)}}else return window.addEventListener("resize",r,!1),()=>{window.removeEventListener("resize",r,!1)}},[r,t])}function Iu(e){const{locale:t}=_t(),r=t||"";return`${r[0]}${r[1]}`.toLowerCase()==="fr"?e.fr:e.en}const Co=u.forwardRef((e,t)=>{var d,p;const r=Iu(Uv),n=e["aria-label"]??String(e.label),o=Ru({nature:e.nature,successHelperText:e.successHelperText,errorHelperText:e.errorHelperText}),i={...e.wrapperProps,htmlForId:e.id,label:e.label,labelIconRight:e.labelIconRight,description:e.description,helperTextIcon:e.helperTextIcon,helperText:e.helperText,errorHelperText:e.errorHelperText,errorHelperTextIcon:e.errorHelperTextIcon,successHelperText:e.successHelperText,successHelperTextIcon:e.successHelperTextIcon,required:e.required},a=u.useRef(null),[l,s]=u.useState(null),c=u.useCallback(()=>{a.current&&s(a.current.offsetWidth+"px")},[a]);return Wv({ref:a,onResize:c}),e.mode==="multiple"?v.jsx(Po,{...i,ref:t,children:v.jsxs(P0,{defaultOpen:e.defaultOpen,isOpen:e.open,onOpenChange:e.onOpenChange,children:[v.jsxs(ga,{...e.buttonProps,type:"button",ref:a,"data-nature":o,"data-fullwidth":e.fullWidth,"aria-label":n,isDisabled:e.disabled,children:[!((d=e.selectedKeys)!=null&&d.length)&&v.jsx("span",{children:e.placeholder||""}),!!((p=e.selectedKeys)!=null&&p.length)&&v.jsxs(Hv,{children:[v.jsx(Cu,{value:e.selectedKeys.length,nature:"informative"}),e.selectedKeys.length===1?` ${r.itemSelected}`:` ${r.itemsSelected}`]}),v.jsx(ma,{name:"expand_more","data-disabled":e.disabled})]}),v.jsx(ba,{offset:4,placement:"bottom",children:v.jsx(ya,{"aria-label":`${r.selectionFor} ${n}`,selectionMode:"multiple",selectedKeys:e.selectedKeys,disabledKeys:e.disabledIds,onSelectionChange:f=>{f!=="all"&&e.onSelectionChange([...f].map(String))},style:{"--trigger-width":l},children:e.children})})]})}):v.jsx(Po,{...i,children:v.jsxs(zv,{ref:t,id:e.id,isDisabled:e.disabled,isRequired:e.required,onSelectionChange:f=>{var h;return(h=e.onChange)==null?void 0:h.call(e,String(f))},selectedKey:e.value,name:e.name,disabledKeys:e.disabledIds,defaultOpen:e.defaultOpen,isOpen:e.open,onOpenChange:e.onOpenChange,"data-fullwidth":e.fullWidth,"aria-label":n,children:[v.jsxs(ga,{...e.buttonProps,type:"button","data-nature":o,"data-fullwidth":e.fullWidth,children:[v.jsx(Vv,{children:f=>f.isPlaceholder?e.placeholder||"":f.selectedText}),v.jsx(ma,{name:"expand_more","data-disabled":e.disabled})]}),v.jsx(ba,{offset:4,placement:"bottom",children:v.jsx(ya,{children:e.children})})]})})}),Uv={en:{itemsSelected:" items selected",itemSelected:" item selected",selectionFor:" selection for"},fr:{itemsSelected:" éléments sélectionnés",itemSelected:" élément sélectionné",selectionFor:" sélection pour"}},To=K(Ve)`
856
856
  font-size: ${X.large};
857
857
  color: var(--color-content-neutral-primary);
858
858
  `,qv=K.div`
@@ -10506,12 +10506,12 @@ function Fu(e) {
10506
10506
  return `${r[0]}${r[1]}`.toLowerCase() === "fr" ? e.fr : e.en;
10507
10507
  }
10508
10508
  const ka = w.forwardRef((e, t) => {
10509
- var c, u;
10510
- const r = Fu(Jv), n = _u({
10509
+ var u, f;
10510
+ const r = Fu(Jv), n = e["aria-label"] ?? String(e.label), o = _u({
10511
10511
  nature: e.nature,
10512
10512
  successHelperText: e.successHelperText,
10513
10513
  errorHelperText: e.errorHelperText
10514
- }), o = {
10514
+ }), i = {
10515
10515
  ...e.wrapperProps,
10516
10516
  htmlForId: e.id,
10517
10517
  label: e.label,
@@ -10524,10 +10524,10 @@ const ka = w.forwardRef((e, t) => {
10524
10524
  successHelperText: e.successHelperText,
10525
10525
  successHelperTextIcon: e.successHelperTextIcon,
10526
10526
  required: e.required
10527
- }, i = _(null), [a, l] = ie(null), s = ce(() => {
10528
- i.current && l(i.current.offsetWidth + "px");
10529
- }, [i]);
10530
- return Xv({ ref: i, onResize: s }), e.mode === "multiple" ? /* @__PURE__ */ v(Ao, { ...o, ref: t, children: /* @__PURE__ */ re(
10527
+ }, a = _(null), [l, s] = ie(null), c = ce(() => {
10528
+ a.current && s(a.current.offsetWidth + "px");
10529
+ }, [a]);
10530
+ return Xv({ ref: a, onResize: c }), e.mode === "multiple" ? /* @__PURE__ */ v(Ao, { ...i, ref: t, children: /* @__PURE__ */ re(
10531
10531
  M0,
10532
10532
  {
10533
10533
  defaultOpen: e.defaultOpen,
@@ -10539,14 +10539,14 @@ const ka = w.forwardRef((e, t) => {
10539
10539
  {
10540
10540
  ...e.buttonProps,
10541
10541
  type: "button",
10542
- ref: i,
10543
- "data-nature": n,
10542
+ ref: a,
10543
+ "data-nature": o,
10544
10544
  "data-fullwidth": e.fullWidth,
10545
- "data-testid": "select-trigger",
10545
+ "aria-label": n,
10546
10546
  isDisabled: e.disabled,
10547
10547
  children: [
10548
- !((c = e.selectedKeys) != null && c.length) && /* @__PURE__ */ v("span", { children: e.placeholder || "" }),
10549
- !!((u = e.selectedKeys) != null && u.length) && /* @__PURE__ */ re(Gv, { children: [
10548
+ !((u = e.selectedKeys) != null && u.length) && /* @__PURE__ */ v("span", { children: e.placeholder || "" }),
10549
+ !!((f = e.selectedKeys) != null && f.length) && /* @__PURE__ */ re(Gv, { children: [
10550
10550
  /* @__PURE__ */ v(pv, { value: e.selectedKeys.length, nature: "informative" }),
10551
10551
  e.selectedKeys.length === 1 ? ` ${r.itemSelected}` : ` ${r.itemsSelected}`
10552
10552
  ] }),
@@ -10557,29 +10557,29 @@ const ka = w.forwardRef((e, t) => {
10557
10557
  /* @__PURE__ */ v(Ca, { offset: 4, placement: "bottom", children: /* @__PURE__ */ v(
10558
10558
  Ta,
10559
10559
  {
10560
- "aria-label": String(e.label),
10560
+ "aria-label": `${r.selectionFor} ${n}`,
10561
10561
  selectionMode: "multiple",
10562
10562
  selectedKeys: e.selectedKeys,
10563
10563
  disabledKeys: e.disabledIds,
10564
- onSelectionChange: (f) => {
10565
- f !== "all" && e.onSelectionChange([...f].map(String));
10564
+ onSelectionChange: (d) => {
10565
+ d !== "all" && e.onSelectionChange([...d].map(String));
10566
10566
  },
10567
- style: { "--trigger-width": a },
10567
+ style: { "--trigger-width": l },
10568
10568
  children: e.children
10569
10569
  }
10570
10570
  ) })
10571
10571
  ]
10572
10572
  }
10573
- ) }) : /* @__PURE__ */ v(Ao, { ...o, children: /* @__PURE__ */ re(
10573
+ ) }) : /* @__PURE__ */ v(Ao, { ...i, children: /* @__PURE__ */ re(
10574
10574
  Uv,
10575
10575
  {
10576
10576
  ref: t,
10577
10577
  id: e.id,
10578
10578
  isDisabled: e.disabled,
10579
10579
  isRequired: e.required,
10580
- onSelectionChange: (f) => {
10581
- var d;
10582
- return (d = e.onChange) == null ? void 0 : d.call(e, String(f));
10580
+ onSelectionChange: (d) => {
10581
+ var p;
10582
+ return (p = e.onChange) == null ? void 0 : p.call(e, String(d));
10583
10583
  },
10584
10584
  selectedKey: e.value,
10585
10585
  name: e.name,
@@ -10588,18 +10588,17 @@ const ka = w.forwardRef((e, t) => {
10588
10588
  isOpen: e.open,
10589
10589
  onOpenChange: e.onOpenChange,
10590
10590
  "data-fullwidth": e.fullWidth,
10591
- "aria-label": String(e.label),
10591
+ "aria-label": n,
10592
10592
  children: [
10593
10593
  /* @__PURE__ */ re(
10594
10594
  Ea,
10595
10595
  {
10596
10596
  ...e.buttonProps,
10597
10597
  type: "button",
10598
- "data-nature": n,
10598
+ "data-nature": o,
10599
10599
  "data-fullwidth": e.fullWidth,
10600
- "data-testid": "select-trigger",
10601
10600
  children: [
10602
- /* @__PURE__ */ v(qv, { children: (f) => f.isPlaceholder ? e.placeholder || "" : f.selectedText }),
10601
+ /* @__PURE__ */ v(qv, { children: (d) => d.isPlaceholder ? e.placeholder || "" : d.selectedText }),
10603
10602
  /* @__PURE__ */ v(Pa, { name: "expand_more", "data-disabled": e.disabled })
10604
10603
  ]
10605
10604
  }
@@ -10611,11 +10610,13 @@ const ka = w.forwardRef((e, t) => {
10611
10610
  }), Jv = {
10612
10611
  en: {
10613
10612
  itemsSelected: " items selected",
10614
- itemSelected: " item selected"
10613
+ itemSelected: " item selected",
10614
+ selectionFor: " selection for"
10615
10615
  },
10616
10616
  fr: {
10617
10617
  itemsSelected: " éléments sélectionnés",
10618
- itemSelected: " élément sélectionné"
10618
+ itemSelected: " élément sélectionné",
10619
+ selectionFor: " sélection pour"
10619
10620
  }
10620
10621
  }, Ro = K(lt)`
10621
10622
  font-size: ${ne.large};
@@ -92,6 +92,10 @@ interface GenericProps {
92
92
  * Disabled items in the dropdown, should be the item's id
93
93
  */
94
94
  disabledIds?: Array<string>;
95
+ /**
96
+ * If you give a ReactNode as label, you should then provide an aria-label as string to ensure there is no accessibility issue
97
+ */
98
+ "aria-label"?: string;
95
99
  }
96
100
  interface SelectSingleProps extends GenericProps {
97
101
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agregio-solutions/design-system",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "React Component library and Storybook that is part of the Design System for Agregio Solutions",
5
5
  "type": "module",
6
6
  "module": "dist/design-system.js",
@@ -48,7 +48,7 @@
48
48
  "@storybook/react": "^8.0.8",
49
49
  "@storybook/react-vite": "^8.0.8",
50
50
  "@storybook/test": "^8.0.8",
51
- "@storybook/test-runner": "^0.17.0",
51
+ "@storybook/test-runner": "^0.18.0",
52
52
  "@storybook/theming": "^8.0.8",
53
53
  "@tanstack/react-table": "^8.15.0",
54
54
  "@types/node": "^20.12.2",