@duro-app/ui 5.34.3 → 5.35.0

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.
@@ -1,4 +1,4 @@
1
1
  import { SwitchProps } from './Switch.types';
2
2
  export type { SwitchProps } from './Switch.types';
3
- export declare function Switch({ checked: controlledChecked, defaultChecked, onCheckedChange, disabled, name, value, children, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
3
+ export declare function Switch({ checked: controlledChecked, defaultChecked, onCheckedChange, disabled, name, value, children, 'aria-label': ariaLabel, }: SwitchProps): import("react/jsx-runtime").JSX.Element;
4
4
  //# sourceMappingURL=Switch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAE/C,YAAY,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAE/C,wBAAgB,MAAM,CAAC,EACrB,OAAO,EAAE,iBAAiB,EAC1B,cAAsB,EACtB,eAAe,EACf,QAAgB,EAChB,IAAI,EACJ,KAAK,EACL,QAAQ,GACT,EAAE,WAAW,2CAiDb"}
1
+ {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAE/C,YAAY,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAA;AAE/C,wBAAgB,MAAM,CAAC,EACrB,OAAO,EAAE,iBAAiB,EAC1B,cAAsB,EACtB,eAAe,EACf,QAAgB,EAChB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,YAAY,EAAE,SAAS,GACxB,EAAE,WAAW,2CAkDb"}
@@ -5,6 +5,8 @@ export default meta;
5
5
  type Story = StoryObj<typeof Switch>;
6
6
  export declare const Default: Story;
7
7
  export declare const Checked: Story;
8
+ /** No visible label: a settings row shows the title, and `aria-label` names the switch. */
9
+ export declare const Labelled: Story;
8
10
  export declare const Disabled: Story;
9
11
  export declare const DisabledChecked: Story;
10
12
  export declare const WithoutLabel: Story;
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAGpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAG/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAW7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AAEpC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAO7B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAA;AAMD,eAAO,MAAM,WAAW,EAAE,KAezB,CAAA"}
1
+ {"version":3,"file":"Switch.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AAGpD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAG/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAW7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AAEpC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAStB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAO7B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAA;AAMD,eAAO,MAAM,WAAW,EAAE,KAezB,CAAA"}
@@ -14,5 +14,7 @@ export interface SwitchProps {
14
14
  value?: string;
15
15
  /** Label content rendered beside the switch. */
16
16
  children?: ReactNode;
17
+ /** Names the switch when it has no visible label (`children`), e.g. a row whose title already shows it. */
18
+ 'aria-label'?: string;
17
19
  }
18
20
  //# sourceMappingURL=Switch.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.types.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AAEpC,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,qDAAqD;IACrD,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB"}
1
+ {"version":3,"file":"Switch.types.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAA;AAEpC,MAAM,WAAW,WAAW;IAC1B,gCAAgC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,qDAAqD;IACrD,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5C,iCAAiC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,2GAA2G;IAC3G,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
package/dist/index.js CHANGED
@@ -16585,47 +16585,48 @@ const j2 = {
16585
16585
  }
16586
16586
  };
16587
16587
  function R2(o) {
16588
- const t = B.c(33), {
16588
+ const t = B.c(34), {
16589
16589
  checked: e,
16590
16590
  defaultChecked: s,
16591
16591
  onCheckedChange: i,
16592
16592
  disabled: n,
16593
16593
  name: r,
16594
16594
  value: l,
16595
- children: a
16596
- } = o, d = s === void 0 ? !1 : s, c = n === void 0 ? !1 : n, [u, x] = Xt(e, d, i), p = G(null);
16597
- let f;
16598
- t[0] !== u || t[1] !== c || t[2] !== x ? (f = () => {
16599
- c || (x(!u), p.current && (p.current.checked = !u));
16600
- }, t[0] = u, t[1] = c, t[2] = x, t[3] = f) : f = t[3];
16601
- const h = f, g = c && pe.rootDisabled;
16602
- let k;
16603
- t[4] !== g ? (k = [pe.root, g], t[4] = g, t[5] = k) : k = t[5];
16604
- const m = e !== void 0 ? e : void 0, y = e === void 0 ? d : void 0;
16605
- let b;
16606
- t[6] !== i ? (b = (D) => {
16607
- i?.(D.target.checked);
16608
- }, t[6] = i, t[7] = b) : b = t[7];
16609
- let $;
16610
- t[8] === Symbol.for("react.memo_cache_sentinel") ? ($ = [Ft.base, pe.input], t[8] = $) : $ = t[8];
16595
+ children: a,
16596
+ "aria-label": d
16597
+ } = o, c = s === void 0 ? !1 : s, u = n === void 0 ? !1 : n, [x, p] = Xt(e, c, i), f = G(null);
16598
+ let h;
16599
+ t[0] !== x || t[1] !== u || t[2] !== p ? (h = () => {
16600
+ u || (p(!x), f.current && (f.current.checked = !x));
16601
+ }, t[0] = x, t[1] = u, t[2] = p, t[3] = h) : h = t[3];
16602
+ const g = h, k = u && pe.rootDisabled;
16603
+ let m;
16604
+ t[4] !== k ? (m = [pe.root, k], t[4] = k, t[5] = m) : m = t[5];
16605
+ const y = e !== void 0 ? e : void 0, b = e === void 0 ? c : void 0, $ = a ? void 0 : d;
16611
16606
  let C;
16612
- t[9] !== u || t[10] !== c || t[11] !== r || t[12] !== m || t[13] !== y || t[14] !== b || t[15] !== l ? (C = /* @__PURE__ */ v("input", { "data-element-src": "Switch/Switch.tsx:39", ref: p, type: "checkbox", role: "switch", name: r, value: l, checked: m, defaultChecked: y, disabled: c, "aria-checked": u, onChange: b, ...L(I.input, $), dir: "auto" }), t[9] = u, t[10] = c, t[11] = r, t[12] = m, t[13] = y, t[14] = b, t[15] = l, t[16] = C) : C = t[16];
16613
- const A = u ? pe.trackChecked : pe.trackUnchecked;
16607
+ t[6] !== i ? (C = (W) => {
16608
+ i?.(W.target.checked);
16609
+ }, t[6] = i, t[7] = C) : C = t[7];
16610
+ let A;
16611
+ t[8] === Symbol.for("react.memo_cache_sentinel") ? (A = [Ft.base, pe.input], t[8] = A) : A = t[8];
16614
16612
  let w;
16615
- t[17] !== A ? (w = [pe.track, A], t[17] = A, t[18] = w) : w = t[18];
16616
- const S = u && pe.thumbChecked;
16613
+ t[9] !== x || t[10] !== u || t[11] !== r || t[12] !== y || t[13] !== b || t[14] !== $ || t[15] !== C || t[16] !== l ? (w = /* @__PURE__ */ v("input", { "data-element-src": "Switch/Switch.tsx:40", ref: f, type: "checkbox", role: "switch", name: r, value: l, checked: y, defaultChecked: b, disabled: u, "aria-checked": x, "aria-label": $, onChange: C, ...L(I.input, A), dir: "auto" }), t[9] = x, t[10] = u, t[11] = r, t[12] = y, t[13] = b, t[14] = $, t[15] = C, t[16] = l, t[17] = w) : w = t[17];
16614
+ const S = x ? pe.trackChecked : pe.trackUnchecked;
16617
16615
  let M;
16618
- t[19] !== S ? (M = /* @__PURE__ */ v("span", { "data-element-src": "Switch/Switch.tsx:62", ...L(I.span, pe.thumb, S) }), t[19] = S, t[20] = M) : M = t[20];
16619
- let T;
16620
- t[21] !== c || t[22] !== h || t[23] !== w || t[24] !== M ? (T = /* @__PURE__ */ v("button", { "data-element-src": "Switch/Switch.tsx:54", type: "button", tabIndex: -1, "aria-hidden": !0, disabled: c, onClick: h, ...L(I.button, w), children: M }), t[21] = c, t[22] = h, t[23] = w, t[24] = M, t[25] = T) : T = t[25];
16616
+ t[18] !== S ? (M = [pe.track, S], t[18] = S, t[19] = M) : M = t[19];
16617
+ const T = x && pe.thumbChecked;
16621
16618
  let z;
16622
- t[26] !== a ? (z = a && /* @__PURE__ */ v("span", { "data-element-src": "Switch/Switch.tsx:64", ...L(I.span), children: a }), t[26] = a, t[27] = z) : z = t[27];
16619
+ t[20] !== T ? (z = /* @__PURE__ */ v("span", { "data-element-src": "Switch/Switch.tsx:64", ...L(I.span, pe.thumb, T) }), t[20] = T, t[21] = z) : z = t[21];
16623
16620
  let H;
16624
- return t[28] !== C || t[29] !== T || t[30] !== z || t[31] !== k ? (H = /* @__PURE__ */ F("label", { "data-element-src": "Switch/Switch.tsx:36", ...L(I.label, k), children: [
16625
- C,
16626
- T,
16627
- z
16628
- ] }), t[28] = C, t[29] = T, t[30] = z, t[31] = k, t[32] = H) : H = t[32], H;
16621
+ t[22] !== u || t[23] !== g || t[24] !== M || t[25] !== z ? (H = /* @__PURE__ */ v("button", { "data-element-src": "Switch/Switch.tsx:56", type: "button", tabIndex: -1, "aria-hidden": !0, disabled: u, onClick: g, ...L(I.button, M), children: z }), t[22] = u, t[23] = g, t[24] = M, t[25] = z, t[26] = H) : H = t[26];
16622
+ let D;
16623
+ t[27] !== a ? (D = a && /* @__PURE__ */ v("span", { "data-element-src": "Switch/Switch.tsx:66", ...L(I.span), children: a }), t[27] = a, t[28] = D) : D = t[28];
16624
+ let V;
16625
+ return t[29] !== w || t[30] !== H || t[31] !== D || t[32] !== m ? (V = /* @__PURE__ */ F("label", { "data-element-src": "Switch/Switch.tsx:37", ...L(I.label, m), children: [
16626
+ w,
16627
+ H,
16628
+ D
16629
+ ] }), t[29] = w, t[30] = H, t[31] = D, t[32] = m, t[33] = V) : V = t[33], V;
16629
16630
  }
16630
16631
  const Vt = {
16631
16632
  base: {