@octaviaflow/core 3.0.5 → 3.0.7
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/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +9 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/index.cjs +124 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -29
- package/dist/index.js.map +1 -1
- package/dist/stories/state-matrix.d.ts +74 -0
- package/dist/stories/state-matrix.d.ts.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/a11y.d.ts +70 -0
- package/dist/utils/a11y.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAK1E,MAAM,WAAW,WACf,SAAQ,IAAI,CACV,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,QAAQ,GAAG,aAAa,GAAG,WAAW,GAAG,kBAAkB,CAC5D;IACD,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,SAAiB,EACjB,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,WAAW,2CA2Gb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAMzE,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,aAAqB,EACrB,QAAgB,EAChB,KAAK,EACL,IAAW,EACX,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,2CA6Gf"}
|
|
@@ -12,6 +12,14 @@ export interface DropdownMenuProps {
|
|
|
12
12
|
items: DropdownMenuItem[];
|
|
13
13
|
align?: "start" | "end";
|
|
14
14
|
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Accessible name for the trigger button. Required when `trigger` is not
|
|
17
|
+
* a plain string (e.g. an icon-only trigger). When omitted and `trigger`
|
|
18
|
+
* is a string, the string content is used automatically.
|
|
19
|
+
*/
|
|
20
|
+
"aria-label"?: string;
|
|
21
|
+
/** id of an element that labels the trigger; alternative to aria-label. */
|
|
22
|
+
"aria-labelledby"?: string;
|
|
15
23
|
}
|
|
16
|
-
export declare function DropdownMenu({ trigger, items, align, className }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function DropdownMenu({ trigger, items, align, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
17
25
|
//# sourceMappingURL=DropdownMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownMenu/DropdownMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAQ/C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAsID,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,KAAe,EACf,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,GAClC,EAAE,iBAAiB,2CAsCnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/Radio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAU,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../src/components/Radio/Radio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAU,MAAM,OAAO,CAAC;AAMzD,MAAM,WAAW,UACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;IAC3F,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,UAAU,2CAyDZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAC;AAO1F,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AA+FD,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,WAAmC,EACnC,UAAkB,EAClB,KAAK,EACL,KAAa,EACb,YAAY,EACZ,QAAgB,EAChB,IAAW,EACX,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,IAAI,EACJ,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,GACpC,EAAE,WAAW,2CAyMb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAMzE,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACxE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAgB,EAChB,IAAW,EACX,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,2CAkEb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,sBAAsB,EAA2B,MAAM,OAAO,CAAC;AAK7E,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAa,EACb,YAAY,EACZ,MAAa,EACb,SAAS,EACT,IAAW,EACX,IAAQ,EACR,QAAgB,EAChB,SAAS,EACT,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,2CAgFf"}
|
package/dist/index.cjs
CHANGED
|
@@ -777,6 +777,32 @@ function Breadcrumb({
|
|
|
777
777
|
var import_framer_motion2 = require("framer-motion");
|
|
778
778
|
var import_react4 = require("react");
|
|
779
779
|
var import_react_aria3 = require("react-aria");
|
|
780
|
+
|
|
781
|
+
// src/utils/a11y.ts
|
|
782
|
+
function resolveAccessibleName(input) {
|
|
783
|
+
if (input.ariaLabelledby) {
|
|
784
|
+
return { "aria-labelledby": input.ariaLabelledby };
|
|
785
|
+
}
|
|
786
|
+
if (input.ariaLabel) {
|
|
787
|
+
return { "aria-label": input.ariaLabel };
|
|
788
|
+
}
|
|
789
|
+
if (typeof input.label === "string" && input.label.trim().length > 0) {
|
|
790
|
+
return { "aria-label": input.label };
|
|
791
|
+
}
|
|
792
|
+
for (const candidate of input.fallbacks ?? []) {
|
|
793
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
794
|
+
return { "aria-label": candidate };
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (process.env.NODE_ENV !== "production") {
|
|
798
|
+
console.error(
|
|
799
|
+
`[@octaviaflow/core ${input.componentName}] No accessible name. Pass a string \`label\`, or \`aria-label\`, or \`aria-labelledby\` so screen readers can announce this control.`
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
return { "aria-label": `Unlabeled ${input.componentName}` };
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// src/components/Button/Button.tsx
|
|
780
806
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
781
807
|
function Button({
|
|
782
808
|
variant = "primary",
|
|
@@ -794,11 +820,19 @@ function Button({
|
|
|
794
820
|
const ref = (0, import_react4.useRef)(null);
|
|
795
821
|
const isDisabled = disabled || loading;
|
|
796
822
|
const resolvedType = type ?? "button";
|
|
823
|
+
const hasVisibleText = typeof children === "string" ? children.trim().length > 0 : Boolean(children);
|
|
824
|
+
const needsAriaName = !hasVisibleText;
|
|
825
|
+
const ariaNameProps = needsAriaName ? resolveAccessibleName({
|
|
826
|
+
ariaLabel: props["aria-label"],
|
|
827
|
+
ariaLabelledby: props["aria-labelledby"],
|
|
828
|
+
componentName: "Button"
|
|
829
|
+
}) : void 0;
|
|
797
830
|
const { buttonProps } = (0, import_react_aria3.useButton)(
|
|
798
831
|
{
|
|
799
832
|
isDisabled,
|
|
800
833
|
onPress: props.onClick,
|
|
801
|
-
type: resolvedType
|
|
834
|
+
type: resolvedType,
|
|
835
|
+
...ariaNameProps ?? {}
|
|
802
836
|
},
|
|
803
837
|
ref
|
|
804
838
|
);
|
|
@@ -814,7 +848,7 @@ function Button({
|
|
|
814
848
|
onBlur: _onBlur,
|
|
815
849
|
...passthroughProps
|
|
816
850
|
} = props;
|
|
817
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.
|
|
851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
818
852
|
import_framer_motion2.motion.button,
|
|
819
853
|
{
|
|
820
854
|
...passthroughProps,
|
|
@@ -832,27 +866,32 @@ function Button({
|
|
|
832
866
|
"data-loading": loading || void 0,
|
|
833
867
|
whileTap: isDisabled ? void 0 : { scale: 0.97 },
|
|
834
868
|
transition: { duration: 0.1 },
|
|
835
|
-
children: [
|
|
836
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.
|
|
837
|
-
|
|
838
|
-
children && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ods-btn__label", children }),
|
|
839
|
-
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ods-btn__icon ods-btn__icon--right", children: rightIcon })
|
|
840
|
-
] }),
|
|
841
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ods-btn__spinner", role: "status", "aria-label": "Loading", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
842
|
-
"circle",
|
|
869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "ods-btn__content", children: [
|
|
870
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
871
|
+
"span",
|
|
843
872
|
{
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
873
|
+
className: "ods-btn__icon ods-btn__icon--left ods-btn__icon--spinner",
|
|
874
|
+
role: "status",
|
|
875
|
+
"aria-label": "Loading",
|
|
876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { viewBox: "0 0 24 24", width: "16", height: "16", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
877
|
+
"circle",
|
|
878
|
+
{
|
|
879
|
+
cx: "12",
|
|
880
|
+
cy: "12",
|
|
881
|
+
r: "10",
|
|
882
|
+
fill: "none",
|
|
883
|
+
stroke: "currentColor",
|
|
884
|
+
strokeWidth: "2.5",
|
|
885
|
+
strokeLinecap: "round",
|
|
886
|
+
strokeDasharray: "32",
|
|
887
|
+
strokeDashoffset: "12"
|
|
888
|
+
}
|
|
889
|
+
) })
|
|
853
890
|
}
|
|
854
|
-
)
|
|
855
|
-
|
|
891
|
+
) : leftIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ods-btn__icon ods-btn__icon--left", children: leftIcon }),
|
|
892
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ods-btn__label", children }),
|
|
893
|
+
rightIcon && !loading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "ods-btn__icon ods-btn__icon--right", children: rightIcon })
|
|
894
|
+
] })
|
|
856
895
|
}
|
|
857
896
|
);
|
|
858
897
|
}
|
|
@@ -2624,13 +2663,19 @@ function Checkbox({
|
|
|
2624
2663
|
defaultSelected: defaultChecked,
|
|
2625
2664
|
onChange
|
|
2626
2665
|
});
|
|
2666
|
+
const ariaNameProps = resolveAccessibleName({
|
|
2667
|
+
label,
|
|
2668
|
+
ariaLabel: props["aria-label"],
|
|
2669
|
+
ariaLabelledby: props["aria-labelledby"],
|
|
2670
|
+
componentName: "Checkbox"
|
|
2671
|
+
});
|
|
2627
2672
|
const { inputProps } = (0, import_react_aria4.useCheckbox)(
|
|
2628
2673
|
{
|
|
2629
2674
|
isSelected: state.isSelected,
|
|
2630
2675
|
isIndeterminate: indeterminate,
|
|
2631
2676
|
isDisabled: disabled,
|
|
2632
2677
|
onChange,
|
|
2633
|
-
|
|
2678
|
+
...ariaNameProps
|
|
2634
2679
|
},
|
|
2635
2680
|
state,
|
|
2636
2681
|
ref
|
|
@@ -6514,11 +6559,27 @@ function MenuPopup({
|
|
|
6514
6559
|
}
|
|
6515
6560
|
return null;
|
|
6516
6561
|
}
|
|
6517
|
-
function DropdownMenu({
|
|
6562
|
+
function DropdownMenu({
|
|
6563
|
+
trigger,
|
|
6564
|
+
items,
|
|
6565
|
+
align = "start",
|
|
6566
|
+
className,
|
|
6567
|
+
"aria-label": ariaLabel,
|
|
6568
|
+
"aria-labelledby": ariaLabelledby
|
|
6569
|
+
}) {
|
|
6518
6570
|
const triggerRef = (0, import_react31.useRef)(null);
|
|
6519
6571
|
const state = $e3403870bfb691da$export$79fefeb1c2091ac3({});
|
|
6520
6572
|
const { menuTriggerProps } = (0, import_react_aria7.useMenuTrigger)({}, state, triggerRef);
|
|
6521
|
-
const
|
|
6573
|
+
const ariaNameProps = resolveAccessibleName({
|
|
6574
|
+
ariaLabel,
|
|
6575
|
+
ariaLabelledby,
|
|
6576
|
+
componentName: "DropdownMenu",
|
|
6577
|
+
fallbacks: [typeof trigger === "string" ? trigger : void 0]
|
|
6578
|
+
});
|
|
6579
|
+
const { buttonProps } = (0, import_react_aria7.useButton)(
|
|
6580
|
+
{ ...menuTriggerProps, ...ariaNameProps },
|
|
6581
|
+
triggerRef
|
|
6582
|
+
);
|
|
6522
6583
|
const { onDrag, onDragStart, onDragEnd, onAnimationStart, ...safeTriggerProps } = buttonProps;
|
|
6523
6584
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
6524
6585
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { ...safeTriggerProps, ref: triggerRef, className: "ods-dropdown__trigger", children: trigger }),
|
|
@@ -10300,11 +10361,18 @@ function Radio({
|
|
|
10300
10361
|
}) {
|
|
10301
10362
|
const state = useRadioGroupContext();
|
|
10302
10363
|
const ref = (0, import_react48.useRef)(null);
|
|
10364
|
+
const ariaNameProps = resolveAccessibleName({
|
|
10365
|
+
label,
|
|
10366
|
+
ariaLabel: props["aria-label"],
|
|
10367
|
+
ariaLabelledby: props["aria-labelledby"],
|
|
10368
|
+
componentName: "Radio",
|
|
10369
|
+
fallbacks: [value]
|
|
10370
|
+
});
|
|
10303
10371
|
const { inputProps } = (0, import_react_aria9.useRadio)(
|
|
10304
10372
|
{
|
|
10305
10373
|
value,
|
|
10306
10374
|
isDisabled: disabled,
|
|
10307
|
-
|
|
10375
|
+
...ariaNameProps
|
|
10308
10376
|
},
|
|
10309
10377
|
state,
|
|
10310
10378
|
ref
|
|
@@ -10897,6 +10965,15 @@ function Select({
|
|
|
10897
10965
|
(o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q)
|
|
10898
10966
|
);
|
|
10899
10967
|
}, [options, searchQuery, searchable]);
|
|
10968
|
+
const ariaNameProps = (0, import_react51.useMemo)(
|
|
10969
|
+
() => resolveAccessibleName({
|
|
10970
|
+
label,
|
|
10971
|
+
ariaLabel,
|
|
10972
|
+
ariaLabelledby: ariaLabelledBy,
|
|
10973
|
+
componentName: "Select"
|
|
10974
|
+
}),
|
|
10975
|
+
[label, ariaLabel, ariaLabelledBy]
|
|
10976
|
+
);
|
|
10900
10977
|
const ariaProps = (0, import_react51.useMemo)(() => {
|
|
10901
10978
|
const items = filteredOptions.map((o) => ({
|
|
10902
10979
|
key: o.value,
|
|
@@ -10905,7 +10982,10 @@ function Select({
|
|
|
10905
10982
|
isDisabled: o.disabled
|
|
10906
10983
|
}));
|
|
10907
10984
|
const props = {
|
|
10908
|
-
|
|
10985
|
+
// Visible string label when present; otherwise rely on the aria-*
|
|
10986
|
+
// props for screen-reader name.
|
|
10987
|
+
label: typeof label === "string" ? label : void 0,
|
|
10988
|
+
...ariaNameProps,
|
|
10909
10989
|
items,
|
|
10910
10990
|
children: (item) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)($05678f3aee5e7d1a$export$6d08773d2e66f8f2, { textValue: item.label, children: item.label }, item.key),
|
|
10911
10991
|
isDisabled: disabled,
|
|
@@ -10921,7 +11001,7 @@ function Select({
|
|
|
10921
11001
|
props.defaultSelectedKey = defaultValue;
|
|
10922
11002
|
}
|
|
10923
11003
|
return props;
|
|
10924
|
-
}, [filteredOptions, label, disabled, value, defaultValue, onChange]);
|
|
11004
|
+
}, [filteredOptions, label, disabled, value, defaultValue, onChange, ariaNameProps]);
|
|
10925
11005
|
const state = $29256f53a2edafe9$export$5159ec8b34d4ec12(ariaProps);
|
|
10926
11006
|
const { triggerProps, menuProps } = (0, import_react_aria10.useSelect)(ariaProps, state, triggerRef);
|
|
10927
11007
|
const { buttonProps } = (0, import_react_aria10.useButton)(triggerProps, triggerRef);
|
|
@@ -12275,12 +12355,18 @@ function Switch({
|
|
|
12275
12355
|
defaultSelected: defaultChecked,
|
|
12276
12356
|
onChange
|
|
12277
12357
|
});
|
|
12358
|
+
const ariaNameProps = resolveAccessibleName({
|
|
12359
|
+
label,
|
|
12360
|
+
ariaLabel: props["aria-label"],
|
|
12361
|
+
ariaLabelledby: props["aria-labelledby"],
|
|
12362
|
+
componentName: "Switch"
|
|
12363
|
+
});
|
|
12278
12364
|
const { inputProps } = (0, import_react_aria12.useSwitch)(
|
|
12279
12365
|
{
|
|
12280
12366
|
isSelected: state.isSelected,
|
|
12281
12367
|
isDisabled: disabled,
|
|
12282
12368
|
onChange,
|
|
12283
|
-
|
|
12369
|
+
...ariaNameProps
|
|
12284
12370
|
},
|
|
12285
12371
|
state,
|
|
12286
12372
|
ref
|
|
@@ -12726,9 +12812,18 @@ function Textarea({
|
|
|
12726
12812
|
const ref = (0, import_react60.useRef)(null);
|
|
12727
12813
|
const errorId = (0, import_react60.useId)();
|
|
12728
12814
|
const [charCount, setCharCount] = (0, import_react60.useState)(() => String(value ?? defaultValue ?? "").length);
|
|
12815
|
+
const ariaNameProps = resolveAccessibleName({
|
|
12816
|
+
label,
|
|
12817
|
+
ariaLabel: props["aria-label"],
|
|
12818
|
+
ariaLabelledby: props["aria-labelledby"],
|
|
12819
|
+
componentName: "Textarea"
|
|
12820
|
+
});
|
|
12729
12821
|
const { labelProps, inputProps } = (0, import_react_aria14.useTextField)(
|
|
12730
12822
|
{
|
|
12731
|
-
|
|
12823
|
+
// Pass a string `label` only when caller gave a string; otherwise rely
|
|
12824
|
+
// on the aria-* props from resolveAccessibleName.
|
|
12825
|
+
label: typeof label === "string" ? label : void 0,
|
|
12826
|
+
...ariaNameProps,
|
|
12732
12827
|
isDisabled: disabled,
|
|
12733
12828
|
errorMessage,
|
|
12734
12829
|
validationState: error ? "invalid" : void 0,
|