@watermarkinsights/ripple-react 5.14.0-alpha.0 → 5.14.0-alpha.3
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/README.md +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/stencil-generated/index.d.ts +1 -0
- package/dist/components/stencil-generated/index.js +29 -0
- package/dist/components/stencil-generated/index.js.map +1 -0
- package/dist/components.d.ts +49 -0
- package/dist/components.js +52 -0
- package/dist/components.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/react-component-lib/ReactProps.d.ts +3 -0
- package/dist/react-component-lib/ReactProps.js +2 -0
- package/dist/react-component-lib/ReactProps.js.map +1 -0
- package/dist/react-component-lib/attachProps.d.ts +16 -0
- package/dist/react-component-lib/attachProps.js +109 -0
- package/dist/react-component-lib/attachProps.js.map +1 -0
- package/dist/react-component-lib/case.d.ts +2 -0
- package/dist/react-component-lib/case.js +9 -0
- package/dist/react-component-lib/case.js.map +1 -0
- package/dist/react-component-lib/createComponent.d.ts +10 -0
- package/dist/react-component-lib/createComponent.js +108 -0
- package/dist/react-component-lib/createComponent.js.map +1 -0
- package/dist/react-component-lib/createControllerComponent.d.ts +43 -0
- package/dist/react-component-lib/createControllerComponent.js +148 -0
- package/dist/react-component-lib/createControllerComponent.js.map +1 -0
- package/dist/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/dist/react-component-lib/createOverlayComponent.js +191 -0
- package/dist/react-component-lib/createOverlayComponent.js.map +1 -0
- package/dist/react-component-lib/dev.d.ts +2 -0
- package/dist/react-component-lib/dev.js +13 -0
- package/dist/react-component-lib/dev.js.map +1 -0
- package/dist/react-component-lib/index.d.ts +2 -0
- package/dist/react-component-lib/index.js +3 -0
- package/dist/react-component-lib/index.js.map +1 -0
- package/dist/react-component-lib/interfaces.d.ts +29 -0
- package/dist/react-component-lib/interfaces.js +2 -0
- package/dist/react-component-lib/interfaces.js.map +1 -0
- package/dist/react-component-lib/utils/attachEventProps.d.ts +8 -0
- package/dist/react-component-lib/utils/attachEventProps.js +79 -0
- package/dist/react-component-lib/utils/attachEventProps.js.map +1 -0
- package/dist/react-component-lib/utils/attachProps.d.ts +16 -0
- package/dist/react-component-lib/utils/attachProps.js +109 -0
- package/dist/react-component-lib/utils/attachProps.js.map +1 -0
- package/dist/react-component-lib/utils/case.d.ts +2 -0
- package/dist/react-component-lib/utils/case.js +9 -0
- package/dist/react-component-lib/utils/case.js.map +1 -0
- package/dist/react-component-lib/utils/dev.d.ts +2 -0
- package/dist/react-component-lib/utils/dev.js +13 -0
- package/dist/react-component-lib/utils/dev.js.map +1 -0
- package/dist/react-component-lib/utils/index.d.ts +10 -0
- package/dist/react-component-lib/utils/index.js +47 -0
- package/dist/react-component-lib/utils/index.js.map +1 -0
- package/package.json +34 -13
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __assign = (this && this.__assign) || function () {
|
|
17
|
+
__assign = Object.assign || function(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
return __assign.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
37
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
38
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
39
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
40
|
+
function step(op) {
|
|
41
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
42
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
43
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
44
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
45
|
+
switch (op[0]) {
|
|
46
|
+
case 0: case 1: t = op; break;
|
|
47
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
48
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
49
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
50
|
+
default:
|
|
51
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
52
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
53
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
54
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
55
|
+
if (t[2]) _.ops.pop();
|
|
56
|
+
_.trys.pop(); continue;
|
|
57
|
+
}
|
|
58
|
+
op = body.call(thisArg, _);
|
|
59
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
60
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
64
|
+
var t = {};
|
|
65
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
66
|
+
t[p] = s[p];
|
|
67
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
68
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
69
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
70
|
+
t[p[i]] = s[p[i]];
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
};
|
|
74
|
+
import React from 'react';
|
|
75
|
+
import { attachEventProps } from './utils/attachEventProps';
|
|
76
|
+
export function createControllerComponent(displayName, controller) {
|
|
77
|
+
var dismissEventName = "on".concat(displayName, "DidDismiss");
|
|
78
|
+
return /** @class */ (function (_super) {
|
|
79
|
+
__extends(ReactControllerComponent, _super);
|
|
80
|
+
function ReactControllerComponent(props) {
|
|
81
|
+
return _super.call(this, props) || this;
|
|
82
|
+
}
|
|
83
|
+
Object.defineProperty(ReactControllerComponent, "displayName", {
|
|
84
|
+
get: function () {
|
|
85
|
+
return displayName;
|
|
86
|
+
},
|
|
87
|
+
enumerable: false,
|
|
88
|
+
configurable: true
|
|
89
|
+
});
|
|
90
|
+
ReactControllerComponent.prototype.componentDidMount = function () {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var isOpen;
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
isOpen = this.props.isOpen;
|
|
95
|
+
if (isOpen) {
|
|
96
|
+
this.present();
|
|
97
|
+
}
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
ReactControllerComponent.prototype.componentDidUpdate = function (prevProps) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
108
|
+
this.present(prevProps);
|
|
109
|
+
}
|
|
110
|
+
if (!(this.controller &&
|
|
111
|
+
prevProps.isOpen !== this.props.isOpen &&
|
|
112
|
+
this.props.isOpen === false)) return [3 /*break*/, 2];
|
|
113
|
+
return [4 /*yield*/, this.controller.dismiss()];
|
|
114
|
+
case 1:
|
|
115
|
+
_a.sent();
|
|
116
|
+
_a.label = 2;
|
|
117
|
+
case 2: return [2 /*return*/];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
ReactControllerComponent.prototype.present = function (prevProps) {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
var _a, isOpen, onDidDismiss, cProps, elementProps, _b;
|
|
125
|
+
var _c;
|
|
126
|
+
return __generator(this, function (_d) {
|
|
127
|
+
switch (_d.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
_a = this.props, isOpen = _a.isOpen, onDidDismiss = _a.onDidDismiss, cProps = __rest(_a, ["isOpen", "onDidDismiss"]);
|
|
130
|
+
elementProps = __assign(__assign({}, cProps), (_c = {}, _c[dismissEventName] = onDidDismiss, _c));
|
|
131
|
+
_b = this;
|
|
132
|
+
return [4 /*yield*/, controller.create(__assign({}, elementProps))];
|
|
133
|
+
case 1:
|
|
134
|
+
_b.controller = _d.sent();
|
|
135
|
+
attachEventProps(this.controller, elementProps, prevProps);
|
|
136
|
+
this.controller.present();
|
|
137
|
+
return [2 /*return*/];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
ReactControllerComponent.prototype.render = function () {
|
|
143
|
+
return null;
|
|
144
|
+
};
|
|
145
|
+
return ReactControllerComponent;
|
|
146
|
+
}(React.Component));
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=createControllerComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createControllerComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createControllerComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAY5D,MAAM,UAAU,yBAAyB,CAIvC,WAAmB,EAAE,UAAqE;IAC1F,IAAM,gBAAgB,GAAG,YAAK,WAAW,eAAY,CAAC;IAItD;QAA8C,4CAAsB;QAGlE,kCAAY,KAAY;mBACtB,kBAAM,KAAK,CAAC;QACd,CAAC;QAED,sBAAW,uCAAW;iBAAtB;gBACE,OAAO,WAAW,CAAC;YACrB,CAAC;;;WAAA;QAEK,oDAAiB,GAAvB;;;;oBACU,MAAM,GAAK,IAAI,CAAC,K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+
import { OverlayEventDetail } from './interfaces';
|
|
3
|
+
import { StencilReactForwardedRef } from './utils';
|
|
4
|
+
interface OverlayElement extends HTMLElement {
|
|
5
|
+
present: () => Promise<void>;
|
|
6
|
+
dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export interface ReactOverlayProps {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
onDidDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
12
|
+
onDidPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
13
|
+
onWillDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
14
|
+
onWillPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const createOverlayComponent: <OverlayComponent extends object, OverlayType extends OverlayElement>(tagName: string, controller: {
|
|
17
|
+
create: (options: any) => Promise<OverlayType>;
|
|
18
|
+
}, customElement?: any) => React.ForwardRefExoticComponent<React.PropsWithoutRef<OverlayComponent & ReactOverlayProps & {
|
|
19
|
+
forwardedRef?: StencilReactForwardedRef<OverlayType>;
|
|
20
|
+
}> & React.RefAttributes<OverlayType>>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __assign = (this && this.__assign) || function () {
|
|
17
|
+
__assign = Object.assign || function(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
return __assign.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
37
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
38
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
39
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
40
|
+
function step(op) {
|
|
41
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
42
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
43
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
44
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
45
|
+
switch (op[0]) {
|
|
46
|
+
case 0: case 1: t = op; break;
|
|
47
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
48
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
49
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
50
|
+
default:
|
|
51
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
52
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
53
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
54
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
55
|
+
if (t[2]) _.ops.pop();
|
|
56
|
+
_.trys.pop(); continue;
|
|
57
|
+
}
|
|
58
|
+
op = body.call(thisArg, _);
|
|
59
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
60
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
64
|
+
var t = {};
|
|
65
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
66
|
+
t[p] = s[p];
|
|
67
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
68
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
69
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
70
|
+
t[p[i]] = s[p[i]];
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
};
|
|
74
|
+
import React from 'react';
|
|
75
|
+
import ReactDOM from 'react-dom';
|
|
76
|
+
import { attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
|
|
77
|
+
export var createOverlayComponent = function (tagName, controller, customElement) {
|
|
78
|
+
defineCustomElement(tagName, customElement);
|
|
79
|
+
var displayName = dashToPascalCase(tagName);
|
|
80
|
+
var didDismissEventName = "on".concat(displayName, "DidDismiss");
|
|
81
|
+
var didPresentEventName = "on".concat(displayName, "DidPresent");
|
|
82
|
+
var willDismissEventName = "on".concat(displayName, "WillDismiss");
|
|
83
|
+
var willPresentEventName = "on".concat(displayName, "WillPresent");
|
|
84
|
+
var isDismissing = false;
|
|
85
|
+
var Overlay = /** @class */ (function (_super) {
|
|
86
|
+
__extends(Overlay, _super);
|
|
87
|
+
function Overlay(props) {
|
|
88
|
+
var _this = _super.call(this, props) || this;
|
|
89
|
+
if (typeof document !== 'undefined') {
|
|
90
|
+
_this.el = document.createElement('div');
|
|
91
|
+
}
|
|
92
|
+
_this.handleDismiss = _this.handleDismiss.bind(_this);
|
|
93
|
+
return _this;
|
|
94
|
+
}
|
|
95
|
+
Object.defineProperty(Overlay, "displayName", {
|
|
96
|
+
get: function () {
|
|
97
|
+
return displayName;
|
|
98
|
+
},
|
|
99
|
+
enumerable: false,
|
|
100
|
+
configurable: true
|
|
101
|
+
});
|
|
102
|
+
Overlay.prototype.componentDidMount = function () {
|
|
103
|
+
if (this.props.isOpen) {
|
|
104
|
+
this.present();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
Overlay.prototype.componentWillUnmount = function () {
|
|
108
|
+
if (this.overlay) {
|
|
109
|
+
this.overlay.dismiss();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
Overlay.prototype.handleDismiss = function (event) {
|
|
113
|
+
if (this.props.onDidDismiss) {
|
|
114
|
+
this.props.onDidDismiss(event);
|
|
115
|
+
}
|
|
116
|
+
setRef(this.props.forwardedRef, null);
|
|
117
|
+
};
|
|
118
|
+
Overlay.prototype.shouldComponentUpdate = function (nextProps) {
|
|
119
|
+
// Check if the overlay component is about to dismiss
|
|
120
|
+
if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
|
|
121
|
+
isDismissing = true;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
};
|
|
125
|
+
Overlay.prototype.componentDidUpdate = function (prevProps) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0:
|
|
130
|
+
if (this.overlay) {
|
|
131
|
+
attachProps(this.overlay, this.props, prevProps);
|
|
132
|
+
}
|
|
133
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
134
|
+
this.present(prevProps);
|
|
135
|
+
}
|
|
136
|
+
if (!(this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false)) return [3 /*break*/, 2];
|
|
137
|
+
return [4 /*yield*/, this.overlay.dismiss()];
|
|
138
|
+
case 1:
|
|
139
|
+
_a.sent();
|
|
140
|
+
isDismissing = false;
|
|
141
|
+
/**
|
|
142
|
+
* Now that the overlay is dismissed
|
|
143
|
+
* we need to render again so that any
|
|
144
|
+
* inner components will be unmounted
|
|
145
|
+
*/
|
|
146
|
+
this.forceUpdate();
|
|
147
|
+
_a.label = 2;
|
|
148
|
+
case 2: return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
Overlay.prototype.present = function (prevProps) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var _a, children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent, cProps, elementProps, _b;
|
|
156
|
+
var _c;
|
|
157
|
+
var _this = this;
|
|
158
|
+
return __generator(this, function (_d) {
|
|
159
|
+
switch (_d.label) {
|
|
160
|
+
case 0:
|
|
161
|
+
_a = this.props, children = _a.children, isOpen = _a.isOpen, onDidDismiss = _a.onDidDismiss, onDidPresent = _a.onDidPresent, onWillDismiss = _a.onWillDismiss, onWillPresent = _a.onWillPresent, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss", "onDidPresent", "onWillDismiss", "onWillPresent"]);
|
|
162
|
+
elementProps = __assign(__assign({}, cProps), (_c = { ref: this.props.forwardedRef }, _c[didDismissEventName] = this.handleDismiss, _c[didPresentEventName] = function (e) { return _this.props.onDidPresent && _this.props.onDidPresent(e); }, _c[willDismissEventName] = function (e) { return _this.props.onWillDismiss && _this.props.onWillDismiss(e); }, _c[willPresentEventName] = function (e) { return _this.props.onWillPresent && _this.props.onWillPresent(e); }, _c));
|
|
163
|
+
_b = this;
|
|
164
|
+
return [4 /*yield*/, controller.create(__assign(__assign({}, elementProps), { component: this.el, componentProps: {} }))];
|
|
165
|
+
case 1:
|
|
166
|
+
_b.overlay = _d.sent();
|
|
167
|
+
setRef(this.props.forwardedRef, this.overlay);
|
|
168
|
+
attachProps(this.overlay, elementProps, prevProps);
|
|
169
|
+
return [4 /*yield*/, this.overlay.present()];
|
|
170
|
+
case 2:
|
|
171
|
+
_d.sent();
|
|
172
|
+
return [2 /*return*/];
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
Overlay.prototype.render = function () {
|
|
178
|
+
/**
|
|
179
|
+
* Continue to render the component even when
|
|
180
|
+
* overlay is dismissing otherwise component
|
|
181
|
+
* will be hidden before animation is done.
|
|
182
|
+
*/
|
|
183
|
+
return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
|
|
184
|
+
};
|
|
185
|
+
return Overlay;
|
|
186
|
+
}(React.Component));
|
|
187
|
+
return React.forwardRef(function (props, ref) {
|
|
188
|
+
return React.createElement(Overlay, __assign({}, props, { forwardedRef: ref }));
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=createOverlayComponent.js.map
|
|
@@ -0,0 +1 @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EnD,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAA;;4BAA5B,SAA4B,CAAC;;;;;SAC9B;QAED,wBAAM,GAAN;YACE;;;;eAIG;YACH,OAAO,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACxG,CAAC;QACH,cAAC;IAAD,CAAC,AAhGD,CAAsB,KAAK,CAAC,SAAS,GAgGpC;IAED,OAAO,KAAK,CAAC,UAAU,CAAqB,UAAC,KAAK,EAAE,GAAG;QACrD,OAAO,oBAAC,OAAO,eAAK,KAAK,IAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var isDevMode = function () {
|
|
2
|
+
return process && process.env && process.env.NODE_ENV === 'development';
|
|
3
|
+
};
|
|
4
|
+
var warnings = {};
|
|
5
|
+
export var deprecationWarning = function (key, message) {
|
|
6
|
+
if (isDevMode()) {
|
|
7
|
+
if (!warnings[key]) {
|
|
8
|
+
console.warn(message);
|
|
9
|
+
warnings[key] = true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/react-component-lib/dev.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG;IACvB,OAAO,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAC1E,CAAC,CAAC;AAEF,IAAM,QAAQ,GAA+B,EAAE,CAAC;AAEhD,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAAC,GAAW,EAAE,OAAe;IAC7D,IAAI,SAAS,EAAE,EAAE;QACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAClB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;SACtB;KACF;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-component-lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface EventEmitter<T = any> {
|
|
2
|
+
emit: (data?: T) => CustomEvent<T>;
|
|
3
|
+
}
|
|
4
|
+
export interface StyleReactProps {
|
|
5
|
+
class?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface OverlayEventDetail<T = any> {
|
|
12
|
+
data?: T;
|
|
13
|
+
role?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface OverlayInterface {
|
|
16
|
+
el: HTMLElement;
|
|
17
|
+
animated: boolean;
|
|
18
|
+
keyboardClose: boolean;
|
|
19
|
+
overlayIndex: number;
|
|
20
|
+
presented: boolean;
|
|
21
|
+
enterAnimation?: any;
|
|
22
|
+
leaveAnimation?: any;
|
|
23
|
+
didPresent: EventEmitter<void>;
|
|
24
|
+
willPresent: EventEmitter<void>;
|
|
25
|
+
willDismiss: EventEmitter<OverlayEventDetail>;
|
|
26
|
+
didDismiss: EventEmitter<OverlayEventDetail>;
|
|
27
|
+
present(): Promise<void>;
|
|
28
|
+
dismiss(data?: any, role?: string): Promise<boolean>;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/react-component-lib/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function attachEventProps(node: HTMLElement, newProps: any, oldProps?: any): void;
|
|
2
|
+
export declare function getClassName(classList: DOMTokenList, newProps: any, oldProps: any): string;
|
|
3
|
+
/**
|
|
4
|
+
* Checks if an event is supported in the current execution environment.
|
|
5
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
6
|
+
*/
|
|
7
|
+
export declare function isCoveredByReact(eventNameSuffix: string, doc?: Document): boolean;
|
|
8
|
+
export declare function syncEvent(node: Element, eventName: string, newEventHandler: (e: Event) => any): void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export function attachEventProps(node, newProps, oldProps) {
|
|
2
|
+
if (oldProps === void 0) { oldProps = {}; }
|
|
3
|
+
var className = getClassName(node.classList, newProps, oldProps);
|
|
4
|
+
if (className) {
|
|
5
|
+
node.className = className;
|
|
6
|
+
}
|
|
7
|
+
Object.keys(newProps).forEach(function (name) {
|
|
8
|
+
if (name === 'children' || name === 'style' || name === 'ref' || name === 'className') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
12
|
+
var eventName = name.substring(2);
|
|
13
|
+
var eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
14
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
15
|
+
syncEvent(node, eventNameLc, newProps[name]);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
node[name] = newProps[name];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function getClassName(classList, newProps, oldProps) {
|
|
24
|
+
// map the classes to Maps for performance
|
|
25
|
+
var currentClasses = arrayToMap(classList);
|
|
26
|
+
var incomingPropClasses = arrayToMap(newProps.className ? newProps.className.split(' ') : []);
|
|
27
|
+
var oldPropClasses = arrayToMap(oldProps.className ? oldProps.className.split(' ') : []);
|
|
28
|
+
var finalClassNames = [];
|
|
29
|
+
// loop through each of the current classes on the component
|
|
30
|
+
// to see if it should be a part of the classNames added
|
|
31
|
+
currentClasses.forEach(function (currentClass) {
|
|
32
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
33
|
+
// add it as its already included in classnames coming in from newProps
|
|
34
|
+
finalClassNames.push(currentClass);
|
|
35
|
+
incomingPropClasses.delete(currentClass);
|
|
36
|
+
}
|
|
37
|
+
else if (!oldPropClasses.has(currentClass)) {
|
|
38
|
+
// add it as it has NOT been removed by user
|
|
39
|
+
finalClassNames.push(currentClass);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
incomingPropClasses.forEach(function (s) { return finalClassNames.push(s); });
|
|
43
|
+
return finalClassNames.join(' ');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Checks if an event is supported in the current execution environment.
|
|
47
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
48
|
+
*/
|
|
49
|
+
export function isCoveredByReact(eventNameSuffix, doc) {
|
|
50
|
+
if (doc === void 0) { doc = document; }
|
|
51
|
+
var eventName = 'on' + eventNameSuffix;
|
|
52
|
+
var isSupported = eventName in doc;
|
|
53
|
+
if (!isSupported) {
|
|
54
|
+
var element = doc.createElement('div');
|
|
55
|
+
element.setAttribute(eventName, 'return;');
|
|
56
|
+
isSupported = typeof element[eventName] === 'function';
|
|
57
|
+
}
|
|
58
|
+
return isSupported;
|
|
59
|
+
}
|
|
60
|
+
export function syncEvent(node, eventName, newEventHandler) {
|
|
61
|
+
var eventStore = node.__events || (node.__events = {});
|
|
62
|
+
var oldEventHandler = eventStore[eventName];
|
|
63
|
+
// Remove old listener so they don't double up.
|
|
64
|
+
if (oldEventHandler) {
|
|
65
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
66
|
+
}
|
|
67
|
+
if (newEventHandler != null) {
|
|
68
|
+
// Bind new listener.
|
|
69
|
+
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
70
|
+
newEventHandler.call(this, e);
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function arrayToMap(arr) {
|
|
75
|
+
var map = new Map();
|
|
76
|
+
arr.forEach(function (s) { return map.set(s, s); });
|
|
77
|
+
return map;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=attachEventProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachEventProps.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/attachEventProps.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,gBAAgB,CAAC,IAAiB,EAAE,QAAa,EAAE,QAAkB;IAAlB,yBAAA,EAAA,aAAkB;IACnF,IAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnE,IAAI,SAAS,EAAE;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC5B;IAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAA,IAAI;QAChC,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,WAAW,EAAE;YACrF,OAAO;SACR;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;YACjE,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACpC,IAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAExE,IAAI,CAAC,gBAAgB,C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,CAAS,IAAK,OAAA,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAb,CAAa,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const attachProps: (node: HTMLElement, newProps: any, oldProps?: any) => void;
|
|
2
|
+
export declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: any) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Transforms a React event name to a browser event name.
|
|
5
|
+
*/
|
|
6
|
+
export declare const transformReactEventName: (eventNameSuffix: string) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if an event is supported in the current execution environment.
|
|
9
|
+
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
10
|
+
*/
|
|
11
|
+
export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
|
|
12
|
+
export declare const syncEvent: (node: Element & {
|
|
13
|
+
__events?: {
|
|
14
|
+
[key: string]: (e: Event) => any;
|
|
15
|
+
};
|
|
16
|
+
}, eventName: string, newEventHandler?: (e: Event) => any) => void;
|