@lumx/react 4.22.1-alpha.0 → 4.22.1-next.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.
- package/index.d.ts +1 -0
- package/index.js +7 -23
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -3362,6 +3362,7 @@ declare function useImageLightbox<P extends Partial<ImageLightboxProps>>(props:
|
|
|
3362
3362
|
getTriggerProps: (options?: TriggerOptions) => {
|
|
3363
3363
|
onClick: (ev?: React__default.MouseEvent) => void;
|
|
3364
3364
|
ref: React__default.Ref<any>;
|
|
3365
|
+
'aria-haspopup': 'dialog';
|
|
3365
3366
|
};
|
|
3366
3367
|
/** Props to forward to the ImageLightbox */
|
|
3367
3368
|
imageLightboxProps: ManagedProps & P;
|
package/index.js
CHANGED
|
@@ -2760,37 +2760,20 @@ const useOverflowTooltipLabel = content => {
|
|
|
2760
2760
|
*/
|
|
2761
2761
|
const isComponentType = type => node => /*#__PURE__*/React__default.isValidElement(node) && node.type === type;
|
|
2762
2762
|
|
|
2763
|
-
/**
|
|
2764
|
-
|
|
2765
|
-
*
|
|
2766
|
-
* `isFirst`/`isLast` tell whether the given children are at the very start/end of the whole
|
|
2767
|
-
* children tree, so that an icon on an edge is detected even when nested in a fragment or element.
|
|
2768
|
-
*/
|
|
2769
|
-
function wrap(children, isFirst, isLast) {
|
|
2763
|
+
/** Force wrap spaces around icons to make sure they are never stuck against text. */
|
|
2764
|
+
function wrapChildrenIconWithSpaces(children) {
|
|
2770
2765
|
if (children === null || children === undefined) return undefined;
|
|
2771
|
-
|
|
2772
|
-
return childArray.flatMap((child, index) => {
|
|
2773
|
-
const childIsFirst = isFirst && index === 0;
|
|
2774
|
-
const childIsLast = isLast && index === childArray.length - 1;
|
|
2766
|
+
return Children.toArray(children).flatMap(child => {
|
|
2775
2767
|
if (isComponentType(Icon)(child)) {
|
|
2776
|
-
|
|
2777
|
-
return [...(childIsFirst ? [] : [' ']), child, ...(childIsLast ? [] : [' '])];
|
|
2768
|
+
return [' ', child, ' '];
|
|
2778
2769
|
}
|
|
2779
2770
|
if (/*#__PURE__*/React__default.isValidElement(child) && child.props && typeof child.props === 'object' && 'children' in child.props) {
|
|
2780
|
-
return /*#__PURE__*/React__default.cloneElement(child, undefined,
|
|
2771
|
+
return /*#__PURE__*/React__default.cloneElement(child, undefined, wrapChildrenIconWithSpaces(child.props.children));
|
|
2781
2772
|
}
|
|
2782
2773
|
return child;
|
|
2783
2774
|
});
|
|
2784
2775
|
}
|
|
2785
2776
|
|
|
2786
|
-
/**
|
|
2787
|
-
* Force wrap spaces around icons to make sure they are never stuck against text.
|
|
2788
|
-
* Icons at the very start or end of the text are not padded on that side.
|
|
2789
|
-
*/
|
|
2790
|
-
function wrapChildrenIconWithSpaces(children) {
|
|
2791
|
-
return wrap(children, true, true);
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
2777
|
/**
|
|
2795
2778
|
* Defines the props of the component.
|
|
2796
2779
|
*/
|
|
@@ -14591,7 +14574,8 @@ function useImageLightbox(props) {
|
|
|
14591
14574
|
},
|
|
14592
14575
|
onClick(e) {
|
|
14593
14576
|
open(e?.target, options);
|
|
14594
|
-
}
|
|
14577
|
+
},
|
|
14578
|
+
'aria-haspopup': 'dialog'
|
|
14595
14579
|
}));
|
|
14596
14580
|
}, []);
|
|
14597
14581
|
return {
|