@ionic/react 8.8.19-dev.11786832241.150538c7 → 8.8.19-dev.11787007863.1976a30e
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/index.js +4 -32
- package/dist/index.js.map +1 -1
- package/dist/types/hooks/__tests__/overlay-hook-types.spec.d.ts +1 -0
- package/dist/types/hooks/useIonModal.d.ts +10 -3
- package/dist/types/hooks/useIonPopover.d.ts +11 -4
- package/dist/types/models/ReactComponentOrElement.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1084,13 +1084,6 @@ const NON_BOOLEAN_FALSE_ATTRIBUTES = new Set(['draggable', 'translate', 'spell-c
|
|
|
1084
1084
|
* can be removed once React 18 support is dropped.
|
|
1085
1085
|
*/
|
|
1086
1086
|
const isStaleFalseBooleanAttribute = (attribute) => !attribute.startsWith('aria-') && !attribute.startsWith('data-') && !NON_BOOLEAN_FALSE_ATTRIBUTES.has(attribute);
|
|
1087
|
-
/**
|
|
1088
|
-
* Assigning `undefined` or `null` to a reflected prop like `id` writes the stringified value, so
|
|
1089
|
-
* the element ends up with `id="undefined"` or `id="null"`. Only native properties are cleaned up
|
|
1090
|
-
* here: a nullish component prop still has to reach the component, and Stencil clears the
|
|
1091
|
-
* attribute for props declared `reflect: true`.
|
|
1092
|
-
*/
|
|
1093
|
-
const isNativeElementProperty = (name) => name in HTMLElement.prototype;
|
|
1094
1087
|
const attachProps = (node, newProps, oldProps = {}) => {
|
|
1095
1088
|
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
|
|
1096
1089
|
if (node instanceof Element) {
|
|
@@ -1116,19 +1109,12 @@ const attachProps = (node, newProps, oldProps = {}) => {
|
|
|
1116
1109
|
}
|
|
1117
1110
|
}
|
|
1118
1111
|
else {
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
if ((value === undefined || value === null) && isNativeElementProperty(name)) {
|
|
1122
|
-
// Remove both spellings: the property reflects `accesskey`, and dash-casing writes `access-key`.
|
|
1123
|
-
node.removeAttribute(name);
|
|
1124
|
-
node.removeAttribute(camelToDashCase(name));
|
|
1125
|
-
return;
|
|
1126
|
-
}
|
|
1127
|
-
const propType = typeof value;
|
|
1112
|
+
node[name] = newProps[name];
|
|
1113
|
+
const propType = typeof newProps[name];
|
|
1128
1114
|
if (propType === 'string') {
|
|
1129
|
-
node.setAttribute(camelToDashCase(name),
|
|
1115
|
+
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
1130
1116
|
}
|
|
1131
|
-
else if (
|
|
1117
|
+
else if (newProps[name] === false) {
|
|
1132
1118
|
const attribute = camelToDashCase(name);
|
|
1133
1119
|
if (isStaleFalseBooleanAttribute(attribute)) {
|
|
1134
1120
|
node.removeAttribute(attribute);
|
|
@@ -2949,13 +2935,6 @@ function useOverlay(displayName, controller, defineCustomElement, component, com
|
|
|
2949
2935
|
};
|
|
2950
2936
|
}
|
|
2951
2937
|
|
|
2952
|
-
// TODO(FW-2959): types
|
|
2953
|
-
/**
|
|
2954
|
-
* A hook for presenting/dismissing an IonModal component
|
|
2955
|
-
* @param component The component that the modal will show. Can be a React Component, a functional component, or a JSX Element
|
|
2956
|
-
* @param componentProps The props that will be passed to the component, if required
|
|
2957
|
-
* @returns Returns the present and dismiss methods in an array
|
|
2958
|
-
*/
|
|
2959
2938
|
function useIonModal(component, componentProps) {
|
|
2960
2939
|
const controller = useOverlay('IonModal', modalController, defineCustomElement$1c, component, componentProps);
|
|
2961
2940
|
const present = useCallback((options = {}) => {
|
|
@@ -2964,13 +2943,6 @@ function useIonModal(component, componentProps) {
|
|
|
2964
2943
|
return [present, controller.dismiss];
|
|
2965
2944
|
}
|
|
2966
2945
|
|
|
2967
|
-
// TODO(FW-2959): types
|
|
2968
|
-
/**
|
|
2969
|
-
* A hook for presenting/dismissing an IonPicker component
|
|
2970
|
-
* @param component The component that the popover will show. Can be a React Component, a functional component, or a JSX Element
|
|
2971
|
-
* @param componentProps The props that will be passed to the component, if required
|
|
2972
|
-
* @returns Returns the present and dismiss methods in an array
|
|
2973
|
-
*/
|
|
2974
2946
|
function useIonPopover(component, componentProps) {
|
|
2975
2947
|
const controller = useOverlay('IonPopover', popoverController, defineCustomElement$1d, component, componentProps);
|
|
2976
2948
|
const present = useCallback((options = {}) => {
|