@octaviaflow/core 3.1.0-beta.57 → 3.1.0-beta.58
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/index.cjs +1305 -1294
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/a11y.d.ts +15 -1
- package/dist/utils/a11y.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2222,6 +2222,17 @@ function $6b915bde6cd300dd$var$toggleKey(set, key) {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
|
|
2224
2224
|
// src/utils/a11y.ts
|
|
2225
|
+
import { isValidElement as isValidElement2 } from "react";
|
|
2226
|
+
function hasRenderableText(node) {
|
|
2227
|
+
if (node === null || node === void 0 || typeof node === "boolean") return false;
|
|
2228
|
+
if (typeof node === "string") return node.trim().length > 0;
|
|
2229
|
+
if (typeof node === "number") return true;
|
|
2230
|
+
if (Array.isArray(node)) return node.some(hasRenderableText);
|
|
2231
|
+
if (isValidElement2(node)) {
|
|
2232
|
+
return hasRenderableText(node.props.children);
|
|
2233
|
+
}
|
|
2234
|
+
return false;
|
|
2235
|
+
}
|
|
2225
2236
|
function resolveAccessibleName(input) {
|
|
2226
2237
|
if (input.ariaLabelledby) {
|
|
2227
2238
|
return { "aria-labelledby": input.ariaLabelledby };
|
|
@@ -4291,7 +4302,7 @@ var Button = forwardRef13(function Button2({
|
|
|
4291
4302
|
const hasAction = Boolean(props.onClick) || type === "submit" || type === "reset";
|
|
4292
4303
|
const resolvedCursor = cursor ?? (disabled ? "not-allowed" : loading ? "progress" : hasAction ? "pointer" : "default");
|
|
4293
4304
|
const resolvedType = type ?? "button";
|
|
4294
|
-
const hasVisibleText =
|
|
4305
|
+
const hasVisibleText = hasRenderableText(children);
|
|
4295
4306
|
const needsAriaName = !hasVisibleText && !asChild;
|
|
4296
4307
|
const ariaNameProps = needsAriaName ? resolveAccessibleName({
|
|
4297
4308
|
ariaLabel: props["aria-label"],
|
|
@@ -4419,7 +4430,7 @@ import { CheckmarkIcon, ChevronDownIcon as ChevronDownIcon2 } from "@octaviaflow
|
|
|
4419
4430
|
import { AnimatePresence as AnimatePresence4, motion as motion7 } from "framer-motion";
|
|
4420
4431
|
import {
|
|
4421
4432
|
cloneElement as cloneElement2,
|
|
4422
|
-
isValidElement as
|
|
4433
|
+
isValidElement as isValidElement3,
|
|
4423
4434
|
useCallback as useCallback6,
|
|
4424
4435
|
useEffect as useEffect2,
|
|
4425
4436
|
useId as useId8,
|
|
@@ -4601,7 +4612,7 @@ function Tooltip({
|
|
|
4601
4612
|
state,
|
|
4602
4613
|
triggerRef
|
|
4603
4614
|
);
|
|
4604
|
-
if (!
|
|
4615
|
+
if (!isValidElement3(children)) {
|
|
4605
4616
|
return /* @__PURE__ */ jsx15(Fragment7, { children });
|
|
4606
4617
|
}
|
|
4607
4618
|
const childProps = children.props;
|