@aws-amplify/ui-react 1.2.25-unstable.1 → 2.0.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/dist/esm/index.css +1 -0
- package/dist/esm/index.css.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/legacy.js +1 -0
- package/dist/esm/legacy.js.map +7 -0
- package/dist/index.css +1 -0
- package/dist/index.css.map +7 -0
- package/dist/index.d.ts +7533 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +7 -0
- package/dist/legacy.d.ts +1 -0
- package/dist/legacy.js +1 -0
- package/dist/legacy.js.map +7 -0
- package/dist/primitives.json +22168 -0
- package/legacy/package.json +7 -0
- package/package.json +82 -40
- package/CHANGELOG.md +0 -331
- package/README.md +0 -1
- package/build.js +0 -5
- package/dist/0.js +0 -269
- package/dist/0.js.map +0 -1
- package/dist/1.js +0 -2111
- package/dist/1.js.map +0 -1
- package/dist/10.js +0 -707
- package/dist/10.js.map +0 -1
- package/dist/11.js +0 -45
- package/dist/11.js.map +0 -1
- package/dist/12.js +0 -1152
- package/dist/12.js.map +0 -1
- package/dist/13.js +0 -114
- package/dist/13.js.map +0 -1
- package/dist/14.js +0 -1194
- package/dist/14.js.map +0 -1
- package/dist/15.js +0 -61
- package/dist/15.js.map +0 -1
- package/dist/16.js +0 -37
- package/dist/16.js.map +0 -1
- package/dist/17.js +0 -127
- package/dist/17.js.map +0 -1
- package/dist/18.js +0 -90
- package/dist/18.js.map +0 -1
- package/dist/19.js +0 -267
- package/dist/19.js.map +0 -1
- package/dist/2.js +0 -766
- package/dist/2.js.map +0 -1
- package/dist/20.js +0 -74
- package/dist/20.js.map +0 -1
- package/dist/21.js +0 -50
- package/dist/21.js.map +0 -1
- package/dist/22.js +0 -57
- package/dist/22.js.map +0 -1
- package/dist/23.js +0 -50
- package/dist/23.js.map +0 -1
- package/dist/24.js +0 -271
- package/dist/24.js.map +0 -1
- package/dist/25.js +0 -102
- package/dist/25.js.map +0 -1
- package/dist/26.js +0 -64
- package/dist/26.js.map +0 -1
- package/dist/27.js +0 -379
- package/dist/27.js.map +0 -1
- package/dist/28.js +0 -47
- package/dist/28.js.map +0 -1
- package/dist/29.js +0 -46
- package/dist/29.js.map +0 -1
- package/dist/3.js +0 -2787
- package/dist/3.js.map +0 -1
- package/dist/30.js +0 -503
- package/dist/30.js.map +0 -1
- package/dist/31.js +0 -2
- package/dist/31.js.map +0 -1
- package/dist/32.js +0 -2
- package/dist/32.js.map +0 -1
- package/dist/33.js +0 -13
- package/dist/33.js.map +0 -1
- package/dist/4.js +0 -4126
- package/dist/4.js.map +0 -1
- package/dist/5.js +0 -817
- package/dist/5.js.map +0 -1
- package/dist/6.js +0 -619
- package/dist/6.js.map +0 -1
- package/dist/7.js +0 -662
- package/dist/7.js.map +0 -1
- package/dist/8.js +0 -614
- package/dist/8.js.map +0 -1
- package/dist/9.js +0 -665
- package/dist/9.js.map +0 -1
- package/dist/@aws-amplify/ui-react.js +0 -31875
- package/dist/@aws-amplify/ui-react.js.map +0 -1
- package/dist/aws-amplify-react.min.js +0 -28
- package/dist/aws-amplify-react.min.js.map +0 -1
- package/dist/polyfills-core-js.js +0 -5211
- package/dist/polyfills-core-js.js.map +0 -1
- package/dist/polyfills-css-shim.js +0 -467
- package/dist/polyfills-css-shim.js.map +0 -1
- package/dist/polyfills-dom.js +0 -2098
- package/dist/polyfills-dom.js.map +0 -1
- package/jest.config.js +0 -12
- package/lib/components.d.ts +0 -56
- package/lib/components.js +0 -64
- package/lib/components.js.map +0 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -9
- package/lib/index.js.map +0 -1
- package/lib/react-component-lib/createComponent.d.ts +0 -2
- package/lib/react-component-lib/createComponent.js +0 -91
- package/lib/react-component-lib/createComponent.js.map +0 -1
- package/lib/react-component-lib/createControllerComponent.d.ts +0 -43
- package/lib/react-component-lib/createControllerComponent.js +0 -152
- package/lib/react-component-lib/createControllerComponent.js.map +0 -1
- package/lib/react-component-lib/createOverlayComponent.d.ts +0 -45
- package/lib/react-component-lib/createOverlayComponent.js +0 -148
- package/lib/react-component-lib/createOverlayComponent.js.map +0 -1
- package/lib/react-component-lib/index.d.ts +0 -3
- package/lib/react-component-lib/index.js +0 -9
- package/lib/react-component-lib/index.js.map +0 -1
- package/lib/react-component-lib/utils/attachEventProps.d.ts +0 -8
- package/lib/react-component-lib/utils/attachEventProps.js +0 -85
- package/lib/react-component-lib/utils/attachEventProps.js.map +0 -1
- package/lib/react-component-lib/utils/index.d.ts +0 -8
- package/lib/react-component-lib/utils/index.js +0 -36
- package/lib/react-component-lib/utils/index.js.map +0 -1
- package/lib/withAuthenticator.d.ts +0 -3
- package/lib/withAuthenticator.js +0 -127
- package/lib/withAuthenticator.js.map +0 -1
- package/lib-esm/components.d.ts +0 -56
- package/lib-esm/components.js +0 -62
- package/lib-esm/components.js.map +0 -1
- package/lib-esm/index.d.ts +0 -2
- package/lib-esm/index.js +0 -3
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/react-component-lib/createComponent.d.ts +0 -2
- package/lib-esm/react-component-lib/createComponent.js +0 -86
- package/lib-esm/react-component-lib/createComponent.js.map +0 -1
- package/lib-esm/react-component-lib/createControllerComponent.d.ts +0 -43
- package/lib-esm/react-component-lib/createControllerComponent.js +0 -146
- package/lib-esm/react-component-lib/createControllerComponent.js.map +0 -1
- package/lib-esm/react-component-lib/createOverlayComponent.d.ts +0 -45
- package/lib-esm/react-component-lib/createOverlayComponent.js +0 -142
- package/lib-esm/react-component-lib/createOverlayComponent.js.map +0 -1
- package/lib-esm/react-component-lib/index.d.ts +0 -3
- package/lib-esm/react-component-lib/index.js +0 -4
- package/lib-esm/react-component-lib/index.js.map +0 -1
- package/lib-esm/react-component-lib/utils/attachEventProps.d.ts +0 -8
- package/lib-esm/react-component-lib/utils/attachEventProps.js +0 -79
- package/lib-esm/react-component-lib/utils/attachEventProps.js.map +0 -1
- package/lib-esm/react-component-lib/utils/index.d.ts +0 -8
- package/lib-esm/react-component-lib/utils/index.js +0 -28
- package/lib-esm/react-component-lib/utils/index.js.map +0 -1
- package/lib-esm/withAuthenticator.d.ts +0 -3
- package/lib-esm/withAuthenticator.js +0 -121
- package/lib-esm/withAuthenticator.js.map +0 -1
- package/src/components.ts +0 -65
- package/src/index.ts +0 -3
- package/src/react-component-lib/createComponent.tsx +0 -69
- package/src/react-component-lib/createControllerComponent.tsx +0 -71
- package/src/react-component-lib/createOverlayComponent.tsx +0 -79
- package/src/react-component-lib/index.ts +0 -3
- package/src/react-component-lib/utils/attachEventProps.ts +0 -87
- package/src/react-component-lib/utils/index.tsx +0 -31
- package/src/withAuthenticator.tsx +0 -62
- package/webpack.config.dev.js +0 -6
- package/webpack.config.js +0 -56
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface LoadingElement {
|
|
3
|
-
present: () => any;
|
|
4
|
-
dismiss: () => any;
|
|
5
|
-
}
|
|
6
|
-
interface ReactOverlayProps<E> {
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
onDidDismiss?: (event: CustomEvent<E>) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function createOverlayComponent<T extends object, LoadingElementType extends LoadingElement, OverlayEventDetail>(displayName: string, controller: {
|
|
12
|
-
create: (options: any) => Promise<LoadingElementType>;
|
|
13
|
-
}): {
|
|
14
|
-
new (props: T & ReactOverlayProps<OverlayEventDetail>): {
|
|
15
|
-
controller?: LoadingElementType;
|
|
16
|
-
el: HTMLDivElement;
|
|
17
|
-
componentDidMount(): void;
|
|
18
|
-
componentDidUpdate(prevProps: T & ReactOverlayProps<OverlayEventDetail>): Promise<void>;
|
|
19
|
-
present(prevProps?: T & ReactOverlayProps<OverlayEventDetail>): Promise<void>;
|
|
20
|
-
render(): React.ReactPortal;
|
|
21
|
-
context: any;
|
|
22
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<T & ReactOverlayProps<OverlayEventDetail>>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
|
|
23
|
-
forceUpdate(callback?: () => void): void;
|
|
24
|
-
readonly props: Readonly<T & ReactOverlayProps<OverlayEventDetail>> & Readonly<{
|
|
25
|
-
children?: React.ReactNode;
|
|
26
|
-
}>;
|
|
27
|
-
state: Readonly<{}>;
|
|
28
|
-
refs: {
|
|
29
|
-
[key: string]: React.ReactInstance;
|
|
30
|
-
};
|
|
31
|
-
shouldComponentUpdate?(nextProps: Readonly<T & ReactOverlayProps<OverlayEventDetail>>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
32
|
-
componentWillUnmount?(): void;
|
|
33
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
34
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<T & ReactOverlayProps<OverlayEventDetail>>, prevState: Readonly<{}>): any;
|
|
35
|
-
componentWillMount?(): void;
|
|
36
|
-
UNSAFE_componentWillMount?(): void;
|
|
37
|
-
componentWillReceiveProps?(nextProps: Readonly<T & ReactOverlayProps<OverlayEventDetail>>, nextContext: any): void;
|
|
38
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<T & ReactOverlayProps<OverlayEventDetail>>, nextContext: any): void;
|
|
39
|
-
componentWillUpdate?(nextProps: Readonly<T & ReactOverlayProps<OverlayEventDetail>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
40
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<T & ReactOverlayProps<OverlayEventDetail>>, nextState: Readonly<{}>, nextContext: any): void;
|
|
41
|
-
};
|
|
42
|
-
readonly displayName: string;
|
|
43
|
-
contextType?: React.Context<any>;
|
|
44
|
-
};
|
|
45
|
-
export {};
|
|
@@ -1,142 +0,0 @@
|
|
|
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (_) try {
|
|
41
|
-
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;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
62
|
-
var t = {};
|
|
63
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
64
|
-
t[p] = s[p];
|
|
65
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
66
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
67
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
68
|
-
t[p[i]] = s[p[i]];
|
|
69
|
-
}
|
|
70
|
-
return t;
|
|
71
|
-
};
|
|
72
|
-
import React from 'react';
|
|
73
|
-
import ReactDOM from 'react-dom';
|
|
74
|
-
import { attachEventProps } from './utils/attachEventProps';
|
|
75
|
-
export function createOverlayComponent(displayName, controller) {
|
|
76
|
-
var dismissEventName = "on" + displayName + "DidDismiss";
|
|
77
|
-
return /** @class */ (function (_super) {
|
|
78
|
-
__extends(ReactOverlayComponent, _super);
|
|
79
|
-
function ReactOverlayComponent(props) {
|
|
80
|
-
var _this = _super.call(this, props) || this;
|
|
81
|
-
_this.el = document.createElement('div');
|
|
82
|
-
return _this;
|
|
83
|
-
}
|
|
84
|
-
Object.defineProperty(ReactOverlayComponent, "displayName", {
|
|
85
|
-
get: function () {
|
|
86
|
-
return displayName;
|
|
87
|
-
},
|
|
88
|
-
enumerable: true,
|
|
89
|
-
configurable: true
|
|
90
|
-
});
|
|
91
|
-
ReactOverlayComponent.prototype.componentDidMount = function () {
|
|
92
|
-
if (this.props.isOpen) {
|
|
93
|
-
this.present();
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
ReactOverlayComponent.prototype.componentDidUpdate = function (prevProps) {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
-
return __generator(this, function (_a) {
|
|
99
|
-
switch (_a.label) {
|
|
100
|
-
case 0:
|
|
101
|
-
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
102
|
-
this.present(prevProps);
|
|
103
|
-
}
|
|
104
|
-
if (!(this.controller &&
|
|
105
|
-
prevProps.isOpen !== this.props.isOpen &&
|
|
106
|
-
this.props.isOpen === false)) return [3 /*break*/, 2];
|
|
107
|
-
return [4 /*yield*/, this.controller.dismiss()];
|
|
108
|
-
case 1:
|
|
109
|
-
_a.sent();
|
|
110
|
-
_a.label = 2;
|
|
111
|
-
case 2: return [2 /*return*/];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
ReactOverlayComponent.prototype.present = function (prevProps) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
118
|
-
var _a, children, isOpen, _b, onDidDismiss, cProps, elementProps, _c;
|
|
119
|
-
var _d;
|
|
120
|
-
return __generator(this, function (_e) {
|
|
121
|
-
switch (_e.label) {
|
|
122
|
-
case 0:
|
|
123
|
-
_a = this.props, children = _a.children, isOpen = _a.isOpen, _b = _a.onDidDismiss, onDidDismiss = _b === void 0 ? function () { } : _b, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss"]);
|
|
124
|
-
elementProps = __assign(__assign({}, cProps), (_d = {}, _d[dismissEventName] = onDidDismiss, _d));
|
|
125
|
-
_c = this;
|
|
126
|
-
return [4 /*yield*/, controller.create(__assign(__assign({}, elementProps), { component: this.el, componentProps: {} }))];
|
|
127
|
-
case 1:
|
|
128
|
-
_c.controller = _e.sent();
|
|
129
|
-
attachEventProps(this.controller, elementProps, prevProps);
|
|
130
|
-
this.controller.present();
|
|
131
|
-
return [2 /*return*/];
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
ReactOverlayComponent.prototype.render = function () {
|
|
137
|
-
return ReactDOM.createPortal(this.props.children, this.el);
|
|
138
|
-
};
|
|
139
|
-
return ReactOverlayComponent;
|
|
140
|
-
}(React.Component));
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=createOverlayComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createOverlayComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createOverlayComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,KAAA,EAAK,MAAM,cAAtD,sCAAwD,CAAF,CAAgB;4BACtE,YAAY,yBACb,MAAM,gBACR,gBAAgB,IAAG,YAAY,MACjC,CAAC;4BAEF,KAAA,IAAI,CAAA;4BAAc,qBAAM,UAAU,CAAC,MAAM,uBACpC,YAAY,KACf,SAAS,EAAE,IAAI,CAAC,EAAE,EAClB,cAAc,EAAE,EAAE,IAClB,EAAA;;4BAJF,GAAK,UAAU,GAAG,SAIhB,CAAC;4BAEH,gBAAgB,CAAC,IAAI,CAAC,UAAiB,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;4BAElE,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;;;;;SAC3B;QAED,sCAAM,GAAN;YACE,OAAO,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7D,CAAC;QACH,4BAAC;IAAD,CAAC,AAtDM,CAAoC,KAAK,CAAC,SAAS,GAsDxD;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachEventProps.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils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AE,SAAS,CAAC,CAAC;QAC3C,WAAW,GAAG,OAAQ,OAAe,CAAC,SAAS,CAAC,KAAK,UAAU,CAAC;KACjE;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAa,EAAE,SAAiB,EAAE,eAAkC;IAC5F,IAAM,UAAU,GAAI,IAAY,CAAC,QAAQ,IAAI,CAAE,IAAY,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;IAC3E,IAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAE9C,+CAA+C;IAC/C,IAAI,eAAe,EAAE;QACnB,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;KACtD;IAED,IAAI,eAAe,IAAI,IAAI,EAAE;QAC3B,qBAAqB;QACrB,IAAI,CAAC,gBAAgB,CACnB,SAAS,EACT,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS,OAAO,CAAC,CAAQ;YAChD,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC,CACH,CAAC;KACH;AACH,CAAC;AAED,SAAS,UAAU,CAAC,GAA4B;IAC9C,IAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrC,GAAgB,CAAC,OAAO,CAAC,UAAC,CAAS,IAAK,OAAA,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAb,CAAa,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const dashToPascalCase: (str: string) => string;
|
|
3
|
-
export interface ReactProps {
|
|
4
|
-
class?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare type IonicReactExternalProps<PropType, ElementType> = PropType & React.HTMLAttributes<ElementType> & ReactProps;
|
|
7
|
-
export declare const createForwardRef: <PropType, ElementType>(ReactComponent: any, displayName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<IonicReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
8
|
-
export * from './attachEventProps';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
export var dashToPascalCase = function (str) {
|
|
14
|
-
return str
|
|
15
|
-
.toLowerCase()
|
|
16
|
-
.split('-')
|
|
17
|
-
.map(function (segment) { return segment.charAt(0).toUpperCase() + segment.slice(1); })
|
|
18
|
-
.join('');
|
|
19
|
-
};
|
|
20
|
-
export var createForwardRef = function (ReactComponent, displayName) {
|
|
21
|
-
var forwardRef = function (props, ref) {
|
|
22
|
-
return React.createElement(ReactComponent, __assign({}, props, { forwardedRef: ref }));
|
|
23
|
-
};
|
|
24
|
-
forwardRef.displayName = displayName;
|
|
25
|
-
return React.forwardRef(forwardRef);
|
|
26
|
-
};
|
|
27
|
-
export * from './attachEventProps';
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,GAAW;IAC1C,OAAA,GAAG;SACA,WAAW,EAAE;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAlD,CAAkD,CAAC;SAClE,IAAI,CAAC,EAAE,CAAC;AAJX,CAIW,CAAC;AAQd,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAC9B,cAAmB,EACnB,WAAmB;IAEnB,IAAM,UAAU,GAAG,UACjB,KAAqD,EACrD,GAA2B;QAE3B,OAAO,oBAAC,cAAc,eAAK,KAAK,IAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC1D,CAAC,CAAC;IACF,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IAErC,OAAO,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import React, { ComponentType, ComponentPropsWithRef } from 'react';
|
|
2
|
-
import { AmplifyAuthenticator } from './';
|
|
3
|
-
export declare function withAuthenticator<T extends object>(Component: ComponentType<T>, authenticatorProps?: ComponentPropsWithRef<typeof AmplifyAuthenticator>): React.FunctionComponent<T>;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (_) try {
|
|
28
|
-
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;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
49
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
50
|
-
if (!m) return o;
|
|
51
|
-
var i = m.call(o), r, ar = [], e;
|
|
52
|
-
try {
|
|
53
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
54
|
-
}
|
|
55
|
-
catch (error) { e = { error: error }; }
|
|
56
|
-
finally {
|
|
57
|
-
try {
|
|
58
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
59
|
-
}
|
|
60
|
-
finally { if (e) throw e.error; }
|
|
61
|
-
}
|
|
62
|
-
return ar;
|
|
63
|
-
};
|
|
64
|
-
import React from 'react';
|
|
65
|
-
import { Auth, appendToCognitoUserAgent } from '@aws-amplify/auth';
|
|
66
|
-
import { AmplifyContainer, AmplifyAuthenticator, AmplifyAuthContainer } from './';
|
|
67
|
-
import { onAuthUIStateChange, AuthState } from '@aws-amplify/ui-components';
|
|
68
|
-
import { Logger } from '@aws-amplify/core';
|
|
69
|
-
var logger = new Logger('withAuthenticator');
|
|
70
|
-
export function withAuthenticator(Component, authenticatorProps) {
|
|
71
|
-
var AppWithAuthenticator = function (props) {
|
|
72
|
-
var _a = __read(React.useState(false), 2), signedIn = _a[0], setSignedIn = _a[1];
|
|
73
|
-
React.useEffect(function () {
|
|
74
|
-
appendToCognitoUserAgent('withAuthenticator');
|
|
75
|
-
// checkUser returns an "unsubscribe" function to stop side-effects
|
|
76
|
-
return checkUser();
|
|
77
|
-
}, []);
|
|
78
|
-
function checkUser() {
|
|
79
|
-
setUser();
|
|
80
|
-
return onAuthUIStateChange(function (authState) {
|
|
81
|
-
if (authState === AuthState.SignedIn) {
|
|
82
|
-
setSignedIn(true);
|
|
83
|
-
}
|
|
84
|
-
else if (authState === AuthState.SignedOut) {
|
|
85
|
-
setSignedIn(false);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function setUser() {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
-
var user, err_1;
|
|
92
|
-
return __generator(this, function (_a) {
|
|
93
|
-
switch (_a.label) {
|
|
94
|
-
case 0:
|
|
95
|
-
_a.trys.push([0, 2, , 3]);
|
|
96
|
-
return [4 /*yield*/, Auth.currentAuthenticatedUser()];
|
|
97
|
-
case 1:
|
|
98
|
-
user = _a.sent();
|
|
99
|
-
if (user)
|
|
100
|
-
setSignedIn(true);
|
|
101
|
-
return [3 /*break*/, 3];
|
|
102
|
-
case 2:
|
|
103
|
-
err_1 = _a.sent();
|
|
104
|
-
logger.debug(err_1);
|
|
105
|
-
return [3 /*break*/, 3];
|
|
106
|
-
case 3: return [2 /*return*/];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
;
|
|
112
|
-
if (!signedIn) {
|
|
113
|
-
return (React.createElement(AmplifyContainer, null,
|
|
114
|
-
React.createElement(AmplifyAuthContainer, null,
|
|
115
|
-
React.createElement(AmplifyAuthenticator, __assign({}, authenticatorProps, props)))));
|
|
116
|
-
}
|
|
117
|
-
return React.createElement(Component, __assign({}, props));
|
|
118
|
-
};
|
|
119
|
-
return AppWithAuthenticator;
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=withAuthenticator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withAuthenticator.js","sourceRoot":"","sources":["../src/withAuthenticator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,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OAAO,CACN,oBAAC,gBAAgB;gBAChB,oBAAC,oBAAoB;oBACpB,oBAAC,oBAAoB,eAAK,kBAAkB,EAAM,KAAK,EAAI,CACrC,CACL,CACnB,CAAC;SACF;QAED,OAAO,oBAAC,SAAS,eAAK,KAAK,EAAI,CAAC;IACjC,CAAC,CAAC;IAEF,OAAO,oBAAoB,CAAC;AAC7B,CAAC"}
|
package/src/components.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* tslint:disable */
|
|
3
|
-
/* auto-generated react proxies */
|
|
4
|
-
import { createReactComponent } from './react-component-lib';
|
|
5
|
-
|
|
6
|
-
import { JSX } from '@aws-amplify/ui-components';
|
|
7
|
-
|
|
8
|
-
import { defineCustomElements, applyPolyfills } from '@aws-amplify/ui-components/loader';
|
|
9
|
-
|
|
10
|
-
applyPolyfills().then(() => defineCustomElements());
|
|
11
|
-
export const AmplifyAmazonButton = /*@__PURE__*/createReactComponent<JSX.AmplifyAmazonButton, HTMLAmplifyAmazonButtonElement>('amplify-amazon-button');
|
|
12
|
-
export const AmplifyAuthContainer = /*@__PURE__*/createReactComponent<JSX.AmplifyAuthContainer, HTMLAmplifyAuthContainerElement>('amplify-auth-container');
|
|
13
|
-
export const AmplifyAuthFields = /*@__PURE__*/createReactComponent<JSX.AmplifyAuthFields, HTMLAmplifyAuthFieldsElement>('amplify-auth-fields');
|
|
14
|
-
export const AmplifyAuth0Button = /*@__PURE__*/createReactComponent<JSX.AmplifyAuth0Button, HTMLAmplifyAuth0ButtonElement>('amplify-auth0-button');
|
|
15
|
-
export const AmplifyAuthenticator = /*@__PURE__*/createReactComponent<JSX.AmplifyAuthenticator, HTMLAmplifyAuthenticatorElement>('amplify-authenticator');
|
|
16
|
-
export const AmplifyButton = /*@__PURE__*/createReactComponent<JSX.AmplifyButton, HTMLAmplifyButtonElement>('amplify-button');
|
|
17
|
-
export const AmplifyChatbot = /*@__PURE__*/createReactComponent<JSX.AmplifyChatbot, HTMLAmplifyChatbotElement>('amplify-chatbot');
|
|
18
|
-
export const AmplifyCheckbox = /*@__PURE__*/createReactComponent<JSX.AmplifyCheckbox, HTMLAmplifyCheckboxElement>('amplify-checkbox');
|
|
19
|
-
export const AmplifyCodeField = /*@__PURE__*/createReactComponent<JSX.AmplifyCodeField, HTMLAmplifyCodeFieldElement>('amplify-code-field');
|
|
20
|
-
export const AmplifyConfirmSignIn = /*@__PURE__*/createReactComponent<JSX.AmplifyConfirmSignIn, HTMLAmplifyConfirmSignInElement>('amplify-confirm-sign-in');
|
|
21
|
-
export const AmplifyConfirmSignUp = /*@__PURE__*/createReactComponent<JSX.AmplifyConfirmSignUp, HTMLAmplifyConfirmSignUpElement>('amplify-confirm-sign-up');
|
|
22
|
-
export const AmplifyContainer = /*@__PURE__*/createReactComponent<JSX.AmplifyContainer, HTMLAmplifyContainerElement>('amplify-container');
|
|
23
|
-
export const AmplifyCountryDialCode = /*@__PURE__*/createReactComponent<JSX.AmplifyCountryDialCode, HTMLAmplifyCountryDialCodeElement>('amplify-country-dial-code');
|
|
24
|
-
export const AmplifyEmailField = /*@__PURE__*/createReactComponent<JSX.AmplifyEmailField, HTMLAmplifyEmailFieldElement>('amplify-email-field');
|
|
25
|
-
export const AmplifyFacebookButton = /*@__PURE__*/createReactComponent<JSX.AmplifyFacebookButton, HTMLAmplifyFacebookButtonElement>('amplify-facebook-button');
|
|
26
|
-
export const AmplifyFederatedButtons = /*@__PURE__*/createReactComponent<JSX.AmplifyFederatedButtons, HTMLAmplifyFederatedButtonsElement>('amplify-federated-buttons');
|
|
27
|
-
export const AmplifyFederatedSignIn = /*@__PURE__*/createReactComponent<JSX.AmplifyFederatedSignIn, HTMLAmplifyFederatedSignInElement>('amplify-federated-sign-in');
|
|
28
|
-
export const AmplifyForgotPassword = /*@__PURE__*/createReactComponent<JSX.AmplifyForgotPassword, HTMLAmplifyForgotPasswordElement>('amplify-forgot-password');
|
|
29
|
-
export const AmplifyFormField = /*@__PURE__*/createReactComponent<JSX.AmplifyFormField, HTMLAmplifyFormFieldElement>('amplify-form-field');
|
|
30
|
-
export const AmplifyFormSection = /*@__PURE__*/createReactComponent<JSX.AmplifyFormSection, HTMLAmplifyFormSectionElement>('amplify-form-section');
|
|
31
|
-
export const AmplifyGoogleButton = /*@__PURE__*/createReactComponent<JSX.AmplifyGoogleButton, HTMLAmplifyGoogleButtonElement>('amplify-google-button');
|
|
32
|
-
export const AmplifyGreetings = /*@__PURE__*/createReactComponent<JSX.AmplifyGreetings, HTMLAmplifyGreetingsElement>('amplify-greetings');
|
|
33
|
-
export const AmplifyHint = /*@__PURE__*/createReactComponent<JSX.AmplifyHint, HTMLAmplifyHintElement>('amplify-hint');
|
|
34
|
-
export const AmplifyIcon = /*@__PURE__*/createReactComponent<JSX.AmplifyIcon, HTMLAmplifyIconElement>('amplify-icon');
|
|
35
|
-
export const AmplifyIconButton = /*@__PURE__*/createReactComponent<JSX.AmplifyIconButton, HTMLAmplifyIconButtonElement>('amplify-icon-button');
|
|
36
|
-
export const AmplifyInput = /*@__PURE__*/createReactComponent<JSX.AmplifyInput, HTMLAmplifyInputElement>('amplify-input');
|
|
37
|
-
export const AmplifyLabel = /*@__PURE__*/createReactComponent<JSX.AmplifyLabel, HTMLAmplifyLabelElement>('amplify-label');
|
|
38
|
-
export const AmplifyLink = /*@__PURE__*/createReactComponent<JSX.AmplifyLink, HTMLAmplifyLinkElement>('amplify-link');
|
|
39
|
-
export const AmplifyLoadingSpinner = /*@__PURE__*/createReactComponent<JSX.AmplifyLoadingSpinner, HTMLAmplifyLoadingSpinnerElement>('amplify-loading-spinner');
|
|
40
|
-
export const AmplifyNav = /*@__PURE__*/createReactComponent<JSX.AmplifyNav, HTMLAmplifyNavElement>('amplify-nav');
|
|
41
|
-
export const AmplifyOauthButton = /*@__PURE__*/createReactComponent<JSX.AmplifyOauthButton, HTMLAmplifyOauthButtonElement>('amplify-oauth-button');
|
|
42
|
-
export const AmplifyPasswordField = /*@__PURE__*/createReactComponent<JSX.AmplifyPasswordField, HTMLAmplifyPasswordFieldElement>('amplify-password-field');
|
|
43
|
-
export const AmplifyPhoneField = /*@__PURE__*/createReactComponent<JSX.AmplifyPhoneField, HTMLAmplifyPhoneFieldElement>('amplify-phone-field');
|
|
44
|
-
export const AmplifyPhotoPicker = /*@__PURE__*/createReactComponent<JSX.AmplifyPhotoPicker, HTMLAmplifyPhotoPickerElement>('amplify-photo-picker');
|
|
45
|
-
export const AmplifyPicker = /*@__PURE__*/createReactComponent<JSX.AmplifyPicker, HTMLAmplifyPickerElement>('amplify-picker');
|
|
46
|
-
export const AmplifyRadioButton = /*@__PURE__*/createReactComponent<JSX.AmplifyRadioButton, HTMLAmplifyRadioButtonElement>('amplify-radio-button');
|
|
47
|
-
export const AmplifyRequireNewPassword = /*@__PURE__*/createReactComponent<JSX.AmplifyRequireNewPassword, HTMLAmplifyRequireNewPasswordElement>('amplify-require-new-password');
|
|
48
|
-
export const AmplifyS3Album = /*@__PURE__*/createReactComponent<JSX.AmplifyS3Album, HTMLAmplifyS3AlbumElement>('amplify-s3-album');
|
|
49
|
-
export const AmplifyS3Image = /*@__PURE__*/createReactComponent<JSX.AmplifyS3Image, HTMLAmplifyS3ImageElement>('amplify-s3-image');
|
|
50
|
-
export const AmplifyS3ImagePicker = /*@__PURE__*/createReactComponent<JSX.AmplifyS3ImagePicker, HTMLAmplifyS3ImagePickerElement>('amplify-s3-image-picker');
|
|
51
|
-
export const AmplifyS3Text = /*@__PURE__*/createReactComponent<JSX.AmplifyS3Text, HTMLAmplifyS3TextElement>('amplify-s3-text');
|
|
52
|
-
export const AmplifyS3TextPicker = /*@__PURE__*/createReactComponent<JSX.AmplifyS3TextPicker, HTMLAmplifyS3TextPickerElement>('amplify-s3-text-picker');
|
|
53
|
-
export const AmplifySection = /*@__PURE__*/createReactComponent<JSX.AmplifySection, HTMLAmplifySectionElement>('amplify-section');
|
|
54
|
-
export const AmplifySelect = /*@__PURE__*/createReactComponent<JSX.AmplifySelect, HTMLAmplifySelectElement>('amplify-select');
|
|
55
|
-
export const AmplifySelectMfaType = /*@__PURE__*/createReactComponent<JSX.AmplifySelectMfaType, HTMLAmplifySelectMfaTypeElement>('amplify-select-mfa-type');
|
|
56
|
-
export const AmplifySignIn = /*@__PURE__*/createReactComponent<JSX.AmplifySignIn, HTMLAmplifySignInElement>('amplify-sign-in');
|
|
57
|
-
export const AmplifySignInButton = /*@__PURE__*/createReactComponent<JSX.AmplifySignInButton, HTMLAmplifySignInButtonElement>('amplify-sign-in-button');
|
|
58
|
-
export const AmplifySignOut = /*@__PURE__*/createReactComponent<JSX.AmplifySignOut, HTMLAmplifySignOutElement>('amplify-sign-out');
|
|
59
|
-
export const AmplifySignUp = /*@__PURE__*/createReactComponent<JSX.AmplifySignUp, HTMLAmplifySignUpElement>('amplify-sign-up');
|
|
60
|
-
export const AmplifyStrike = /*@__PURE__*/createReactComponent<JSX.AmplifyStrike, HTMLAmplifyStrikeElement>('amplify-strike');
|
|
61
|
-
export const AmplifyToast = /*@__PURE__*/createReactComponent<JSX.AmplifyToast, HTMLAmplifyToastElement>('amplify-toast');
|
|
62
|
-
export const AmplifyTooltip = /*@__PURE__*/createReactComponent<JSX.AmplifyTooltip, HTMLAmplifyTooltipElement>('amplify-tooltip');
|
|
63
|
-
export const AmplifyTotpSetup = /*@__PURE__*/createReactComponent<JSX.AmplifyTotpSetup, HTMLAmplifyTotpSetupElement>('amplify-totp-setup');
|
|
64
|
-
export const AmplifyUsernameField = /*@__PURE__*/createReactComponent<JSX.AmplifyUsernameField, HTMLAmplifyUsernameFieldElement>('amplify-username-field');
|
|
65
|
-
export const AmplifyVerifyContact = /*@__PURE__*/createReactComponent<JSX.AmplifyVerifyContact, HTMLAmplifyVerifyContactElement>('amplify-verify-contact');
|
package/src/index.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
attachEventProps,
|
|
5
|
-
createForwardRef,
|
|
6
|
-
dashToPascalCase,
|
|
7
|
-
isCoveredByReact,
|
|
8
|
-
} from './utils/index';
|
|
9
|
-
|
|
10
|
-
interface IonicReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
|
|
11
|
-
forwardedRef?: React.Ref<ElementType>;
|
|
12
|
-
ref?: React.Ref<any>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const createReactComponent = <PropType, ElementType>(tagName: string) => {
|
|
16
|
-
const displayName = dashToPascalCase(tagName);
|
|
17
|
-
const ReactComponent = class extends React.Component<IonicReactInternalProps<ElementType>> {
|
|
18
|
-
|
|
19
|
-
private ref: React.RefObject<HTMLElement>;
|
|
20
|
-
|
|
21
|
-
constructor(props: IonicReactInternalProps<ElementType>) {
|
|
22
|
-
super(props);
|
|
23
|
-
this.ref = React.createRef<HTMLElement>();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
componentDidMount() {
|
|
27
|
-
this.componentDidUpdate(this.props);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
componentDidUpdate(prevProps: IonicReactInternalProps<ElementType>) {
|
|
31
|
-
const node = this.ref.current;
|
|
32
|
-
attachEventProps(node, this.props, prevProps);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
render() {
|
|
36
|
-
const { children, forwardedRef, style, className, ref, ...cProps } = this.props;
|
|
37
|
-
|
|
38
|
-
const propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
39
|
-
const isEventProp = name.indexOf('on') === 0 && name[2] === name[2].toUpperCase();
|
|
40
|
-
const isDataProp = name.indexOf('data-') === 0;
|
|
41
|
-
const isAriaProp = name.indexOf('aria-') === 0;
|
|
42
|
-
|
|
43
|
-
if (isEventProp) {
|
|
44
|
-
const eventName = name.substring(2).toLowerCase();
|
|
45
|
-
if (typeof document !== "undefined" && isCoveredByReact(eventName)) {
|
|
46
|
-
(acc as any)[name] = (cProps as any)[name];
|
|
47
|
-
}
|
|
48
|
-
} else if (isDataProp || isAriaProp) {
|
|
49
|
-
(acc as any)[name] = (cProps as any)[name];
|
|
50
|
-
}
|
|
51
|
-
return acc;
|
|
52
|
-
}, {});
|
|
53
|
-
|
|
54
|
-
const newProps: any = {
|
|
55
|
-
...propsToPass,
|
|
56
|
-
ref: this.ref,
|
|
57
|
-
style,
|
|
58
|
-
className,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return React.createElement(tagName, newProps, children);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static get displayName() {
|
|
65
|
-
return displayName;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
return createForwardRef<PropType, ElementType>(ReactComponent, displayName);
|
|
69
|
-
};
|