@reykjavik/hanna-react 0.10.165 → 0.10.167
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
- ... <!-- Add new lines here. -->
|
|
6
6
|
|
|
7
|
+
## 0.10.167
|
|
8
|
+
|
|
9
|
+
_2026-02-17_
|
|
10
|
+
|
|
11
|
+
- `MainMenu2`:
|
|
12
|
+
- fix: Delete `console.log()` noise when rendering button items
|
|
13
|
+
|
|
14
|
+
## 0.10.166
|
|
15
|
+
|
|
16
|
+
_2026-02-16_
|
|
17
|
+
|
|
18
|
+
- `Modal`:
|
|
19
|
+
- feat: Allow `children` to be render function receiving `closeModal`
|
|
20
|
+
dispacther and `visible` state
|
|
21
|
+
- feat: Deprecate `render` prop in favor of `children` as render function
|
|
22
|
+
|
|
7
23
|
## 0.10.165
|
|
8
24
|
|
|
9
25
|
_2026-01-23_
|
package/MainMenu2.js
CHANGED
|
@@ -89,9 +89,6 @@ const getRenderers = (props) => {
|
|
|
89
89
|
title: labelLong,
|
|
90
90
|
lang,
|
|
91
91
|
};
|
|
92
|
-
if (button) {
|
|
93
|
-
console.log('Rendering button for menu item:', commonProps);
|
|
94
|
-
}
|
|
95
92
|
const buttonCompProps = button ? { size: 'small' } : undefined;
|
|
96
93
|
const doRenderButton = isBrowser && (onClick || (onItemClick && href == null));
|
|
97
94
|
return (react_1.default.createElement(Tag, { key: key, className: (0, hanna_utils_1.modifiedClass)(`${classPrefix}item`, item.modifier), "aria-current": item.current || undefined }, doRenderButton ? (react_1.default.createElement(ButtonTag, Object.assign({}, commonProps, { type: "button", "aria-controls": controlsId, onClick: () => {
|
|
@@ -85,12 +85,26 @@ export type AbstractModalProps = {
|
|
|
85
85
|
*/
|
|
86
86
|
portal?: boolean;
|
|
87
87
|
} & EitherObj<{
|
|
88
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use children instead (Will be removed in v0.11)
|
|
90
|
+
*
|
|
91
|
+
* Render function that receives a `closeModal` action dispatcher.
|
|
92
|
+
*/
|
|
89
93
|
render: (props: {
|
|
90
94
|
closeModal(): void;
|
|
91
95
|
}) => ReactNode;
|
|
92
96
|
}, {
|
|
93
|
-
|
|
97
|
+
/** Either a `ReactNode` or render function */
|
|
98
|
+
children: ReactNode | ((props: {
|
|
99
|
+
/** Action dispacher that initiates modal closing action */
|
|
100
|
+
closeModal(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the modal is visible or not. The `onOpen` and `onClosed`
|
|
103
|
+
* callbacks are triggered once the modal has become fully visible or
|
|
104
|
+
* fully hidden.
|
|
105
|
+
*/
|
|
106
|
+
visible: boolean;
|
|
107
|
+
}) => ReactNode);
|
|
94
108
|
}> & WrapperElmProps<'div', 'hidden' | 'role'> & SSRSupportProps;
|
|
95
109
|
type AbstractModalProps_private = AbstractModalProps & BemProps<true>;
|
|
96
110
|
export declare const AbstractModal: (props: AbstractModalProps_private) => JSX.Element;
|
|
@@ -48,7 +48,8 @@ exports.defaultAbstractModalTexts = {
|
|
|
48
48
|
// eslint-disable-next-line complexity
|
|
49
49
|
const AbstractModal = (props) => {
|
|
50
50
|
var _a;
|
|
51
|
-
const { bem, modifier, closeDelay = 500, wrapperProps = {}, ssr
|
|
51
|
+
const { bem, modifier, closeDelay = 500, wrapperProps = {}, ssr, render, // eslint-disable-line deprecation/deprecation
|
|
52
|
+
children, } = props;
|
|
52
53
|
// eslint-disable-next-line deprecation/deprecation
|
|
53
54
|
const isFickle = !((_a = props.stable) !== null && _a !== void 0 ? _a : props.fickle === false) || undefined;
|
|
54
55
|
const txt = (0, i18n_1.getTexts)(props, exports.defaultAbstractModalTexts);
|
|
@@ -128,7 +129,11 @@ const AbstractModal = (props) => {
|
|
|
128
129
|
: closeOnCurtainClick || onClick, id: domid }),
|
|
129
130
|
isBrowser && react_1.default.createElement(FocusTrap_js_1.FocusTrap, { atTop: true }),
|
|
130
131
|
react_1.default.createElement("div", { className: (0, hanna_utils_1.modifiedClass)(bem, modifier), ref: modalElmRef },
|
|
131
|
-
|
|
132
|
+
render
|
|
133
|
+
? render({ closeModal })
|
|
134
|
+
: typeof children === 'function'
|
|
135
|
+
? children({ closeModal, visible })
|
|
136
|
+
: children,
|
|
132
137
|
isBrowser && !props.noCloseButton && (react_1.default.createElement("button", { className: `${bem}__closebutton`, type: "button", onClick: closeModal, "aria-label": closeButtonLabel, "aria-controls": domid, title: closeButtonLabel }, txt.closeButton))),
|
|
133
138
|
isBrowser && react_1.default.createElement(FocusTrap_js_1.FocusTrap, null)))));
|
|
134
139
|
};
|
package/esm/MainMenu2.js
CHANGED
|
@@ -85,9 +85,6 @@ const getRenderers = (props) => {
|
|
|
85
85
|
title: labelLong,
|
|
86
86
|
lang,
|
|
87
87
|
};
|
|
88
|
-
if (button) {
|
|
89
|
-
console.log('Rendering button for menu item:', commonProps);
|
|
90
|
-
}
|
|
91
88
|
const buttonCompProps = button ? { size: 'small' } : undefined;
|
|
92
89
|
const doRenderButton = isBrowser && (onClick || (onItemClick && href == null));
|
|
93
90
|
return (React.createElement(Tag, { key: key, className: modifiedClass(`${classPrefix}item`, item.modifier), "aria-current": item.current || undefined }, doRenderButton ? (React.createElement(ButtonTag, Object.assign({}, commonProps, { type: "button", "aria-controls": controlsId, onClick: () => {
|
|
@@ -85,12 +85,26 @@ export type AbstractModalProps = {
|
|
|
85
85
|
*/
|
|
86
86
|
portal?: boolean;
|
|
87
87
|
} & EitherObj<{
|
|
88
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated Use children instead (Will be removed in v0.11)
|
|
90
|
+
*
|
|
91
|
+
* Render function that receives a `closeModal` action dispatcher.
|
|
92
|
+
*/
|
|
89
93
|
render: (props: {
|
|
90
94
|
closeModal(): void;
|
|
91
95
|
}) => ReactNode;
|
|
92
96
|
}, {
|
|
93
|
-
|
|
97
|
+
/** Either a `ReactNode` or render function */
|
|
98
|
+
children: ReactNode | ((props: {
|
|
99
|
+
/** Action dispacher that initiates modal closing action */
|
|
100
|
+
closeModal(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the modal is visible or not. The `onOpen` and `onClosed`
|
|
103
|
+
* callbacks are triggered once the modal has become fully visible or
|
|
104
|
+
* fully hidden.
|
|
105
|
+
*/
|
|
106
|
+
visible: boolean;
|
|
107
|
+
}) => ReactNode);
|
|
94
108
|
}> & WrapperElmProps<'div', 'hidden' | 'role'> & SSRSupportProps;
|
|
95
109
|
type AbstractModalProps_private = AbstractModalProps & BemProps<true>;
|
|
96
110
|
export declare const AbstractModal: (props: AbstractModalProps_private) => JSX.Element;
|
|
@@ -44,7 +44,8 @@ export const defaultAbstractModalTexts = {
|
|
|
44
44
|
// eslint-disable-next-line complexity
|
|
45
45
|
export const AbstractModal = (props) => {
|
|
46
46
|
var _a;
|
|
47
|
-
const { bem, modifier, closeDelay = 500, wrapperProps = {}, ssr
|
|
47
|
+
const { bem, modifier, closeDelay = 500, wrapperProps = {}, ssr, render, // eslint-disable-line deprecation/deprecation
|
|
48
|
+
children, } = props;
|
|
48
49
|
// eslint-disable-next-line deprecation/deprecation
|
|
49
50
|
const isFickle = !((_a = props.stable) !== null && _a !== void 0 ? _a : props.fickle === false) || undefined;
|
|
50
51
|
const txt = getTexts(props, defaultAbstractModalTexts);
|
|
@@ -124,7 +125,11 @@ export const AbstractModal = (props) => {
|
|
|
124
125
|
: closeOnCurtainClick || onClick, id: domid }),
|
|
125
126
|
isBrowser && React.createElement(FocusTrap, { atTop: true }),
|
|
126
127
|
React.createElement("div", { className: modifiedClass(bem, modifier), ref: modalElmRef },
|
|
127
|
-
|
|
128
|
+
render
|
|
129
|
+
? render({ closeModal })
|
|
130
|
+
: typeof children === 'function'
|
|
131
|
+
? children({ closeModal, visible })
|
|
132
|
+
: children,
|
|
128
133
|
isBrowser && !props.noCloseButton && (React.createElement("button", { className: `${bem}__closebutton`, type: "button", onClick: closeModal, "aria-label": closeButtonLabel, "aria-controls": domid, title: closeButtonLabel }, txt.closeButton))),
|
|
129
134
|
isBrowser && React.createElement(FocusTrap, null)))));
|
|
130
135
|
};
|