@mirohq/design-system-utils
Advanced tools
Comparing version 0.15.0-forms.0 to 0.15.0-forms.1
@@ -80,3 +80,7 @@ 'use strict'; | ||
}; | ||
const booleanishAttrValue = (x) => booleanify(x) ? "" : void 0; | ||
const booleanAttrValue = (x) => booleanify(x) ? "" : void 0; | ||
const mergeAriaDescribedBy = (...ids) => { | ||
const str = ids.filter((x) => x != null && x !== false).join(" ").trim(); | ||
return str !== "" ? str : void 0; | ||
}; | ||
@@ -106,4 +110,4 @@ const createConstants = (...constants) => constants.reduce( | ||
exports.areRectanglesOverlapping = areRectanglesOverlapping; | ||
exports.booleanAttrValue = booleanAttrValue; | ||
exports.booleanify = booleanify; | ||
exports.booleanishAttrValue = booleanishAttrValue; | ||
exports.createConstants = createConstants; | ||
@@ -114,4 +118,5 @@ exports.getPointClientRect = getPointClientRect; | ||
exports.mapKeysToVariants = mapKeysToVariants; | ||
exports.mergeAriaDescribedBy = mergeAriaDescribedBy; | ||
exports.mergeRefs = mergeRefs; | ||
exports.removeEventProps = removeEventProps; | ||
//# sourceMappingURL=main.js.map |
@@ -76,3 +76,7 @@ import { Fragment, Children, cloneElement } from 'react'; | ||
}; | ||
const booleanishAttrValue = (x) => booleanify(x) ? "" : void 0; | ||
const booleanAttrValue = (x) => booleanify(x) ? "" : void 0; | ||
const mergeAriaDescribedBy = (...ids) => { | ||
const str = ids.filter((x) => x != null && x !== false).join(" ").trim(); | ||
return str !== "" ? str : void 0; | ||
}; | ||
@@ -100,3 +104,3 @@ const createConstants = (...constants) => constants.reduce( | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanify, booleanishAttrValue, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants, mergeRefs, removeEventProps }; | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanAttrValue, booleanify, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants, mergeAriaDescribedBy, mergeRefs, removeEventProps }; | ||
//# sourceMappingURL=module.js.map |
@@ -51,7 +51,34 @@ import * as react from 'react'; | ||
* | ||
* <button data-disabled={disabled} /> | ||
* @param x - The value to convert to a boolean attribute value. | ||
* @returns An empty string if the value is truthy, otherwise undefined. | ||
* | ||
* @example | ||
* true <button data-disabled /> | ||
* @example | ||
* false <button /> | ||
* @example | ||
* undefined <button /> | ||
*/ | ||
declare const booleanishAttrValue: (x?: Booleanish) => '' | undefined; | ||
declare const booleanAttrValue: (x?: Booleanish) => '' | undefined; | ||
/** | ||
* Joins provided ids for aria-describedBy attribute | ||
* | ||
* @param ids - array of a string ids. Id could be null/undefined or false. | ||
* False is useful when id should be provided only when the element is rendered | ||
* | ||
* @example | ||
* mergeAriaDescribedBy('id-1', 'id-2') | ||
* returns 'id-1 id-2' | ||
* @example | ||
* mergeAriaDescribedBy(undefined, 'id-2') | ||
* returns 'id-2' | ||
* @example | ||
* mergeAriaDescribedBy('', ' ') | ||
* returns undefined | ||
* @example | ||
* mergeAriaDescribedBy('id', badgeElement != null && 'badge-id') | ||
* returns 'id' when badgeElement == null | ||
* returns 'id badge-id' when badgeElement != null | ||
*/ | ||
declare const mergeAriaDescribedBy: (...ids: Array<string | undefined | null | false>) => string | undefined; | ||
@@ -81,2 +108,2 @@ declare const createConstants: <T extends string | number>(...constants: readonly T[]) => { [K in T]: K; }; | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanify, booleanishAttrValue, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants, mergeRefs, removeEventProps }; | ||
export { addPropsToChildren, areRectanglesOverlapping, booleanAttrValue, booleanify, createConstants, getPointClientRect, isFragment, isOverTarget, mapKeysToVariants, mergeAriaDescribedBy, mergeRefs, removeEventProps }; |
{ | ||
"name": "@mirohq/design-system-utils", | ||
"version": "0.15.0-forms.0", | ||
"version": "0.15.0-forms.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Miro", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36828
321