@public-ui/react 1.1.7-rc.10
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/LICENSE +287 -0
- package/README.md +7 -0
- package/cjs/index.d.ts +46 -0
- package/cjs/index.js +49 -0
- package/cjs/index.js.map +1 -0
- package/cjs/react-component-lib/createComponent.d.ts +10 -0
- package/cjs/react-component-lib/createComponent.js +92 -0
- package/cjs/react-component-lib/createComponent.js.map +1 -0
- package/cjs/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/cjs/react-component-lib/createOverlayComponent.js +105 -0
- package/cjs/react-component-lib/createOverlayComponent.js.map +1 -0
- package/cjs/react-component-lib/index.d.ts +2 -0
- package/cjs/react-component-lib/index.js +8 -0
- package/cjs/react-component-lib/index.js.map +1 -0
- package/cjs/react-component-lib/interfaces.d.ts +29 -0
- package/cjs/react-component-lib/interfaces.js +3 -0
- package/cjs/react-component-lib/interfaces.js.map +1 -0
- package/cjs/react-component-lib/utils/attachProps.d.ts +8 -0
- package/cjs/react-component-lib/utils/attachProps.js +92 -0
- package/cjs/react-component-lib/utils/attachProps.js.map +1 -0
- package/cjs/react-component-lib/utils/case.d.ts +2 -0
- package/cjs/react-component-lib/utils/case.js +12 -0
- package/cjs/react-component-lib/utils/case.js.map +1 -0
- package/cjs/react-component-lib/utils/dev.d.ts +2 -0
- package/cjs/react-component-lib/utils/dev.js +18 -0
- package/cjs/react-component-lib/utils/dev.js.map +1 -0
- package/cjs/react-component-lib/utils/index.d.ts +10 -0
- package/cjs/react-component-lib/utils/index.js +57 -0
- package/cjs/react-component-lib/utils/index.js.map +1 -0
- package/esm/index.d.ts +46 -0
- package/esm/index.js +46 -0
- package/esm/index.js.map +1 -0
- package/esm/react-component-lib/createComponent.d.ts +10 -0
- package/esm/react-component-lib/createComponent.js +65 -0
- package/esm/react-component-lib/createComponent.js.map +1 -0
- package/esm/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/esm/react-component-lib/createOverlayComponent.js +98 -0
- package/esm/react-component-lib/createOverlayComponent.js.map +1 -0
- package/esm/react-component-lib/index.d.ts +2 -0
- package/esm/react-component-lib/index.js +3 -0
- package/esm/react-component-lib/index.js.map +1 -0
- package/esm/react-component-lib/interfaces.d.ts +29 -0
- package/esm/react-component-lib/interfaces.js +2 -0
- package/esm/react-component-lib/interfaces.js.map +1 -0
- package/esm/react-component-lib/utils/attachProps.d.ts +8 -0
- package/esm/react-component-lib/utils/attachProps.js +85 -0
- package/esm/react-component-lib/utils/attachProps.js.map +1 -0
- package/esm/react-component-lib/utils/case.d.ts +2 -0
- package/esm/react-component-lib/utils/case.js +7 -0
- package/esm/react-component-lib/utils/case.js.map +1 -0
- package/esm/react-component-lib/utils/dev.d.ts +2 -0
- package/esm/react-component-lib/utils/dev.js +13 -0
- package/esm/react-component-lib/utils/dev.js.map +1 -0
- package/esm/react-component-lib/utils/index.d.ts +10 -0
- package/esm/react-component-lib/utils/index.js +33 -0
- package/esm/react-component-lib/utils/index.js.map +1 -0
- package/package.json +73 -0
- package/types/index.d.ts +46 -0
- package/types/react-component-lib/createComponent.d.ts +10 -0
- package/types/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/types/react-component-lib/index.d.ts +2 -0
- package/types/react-component-lib/interfaces.d.ts +29 -0
- package/types/react-component-lib/utils/attachProps.d.ts +8 -0
- package/types/react-component-lib/utils/attachProps.js +85 -0
- package/types/react-component-lib/utils/attachProps.js.map +1 -0
- package/types/react-component-lib/utils/case.d.ts +2 -0
- package/types/react-component-lib/utils/case.js +7 -0
- package/types/react-component-lib/utils/case.js.map +1 -0
- package/types/react-component-lib/utils/dev.d.ts +2 -0
- package/types/react-component-lib/utils/dev.js +13 -0
- package/types/react-component-lib/utils/dev.js.map +1 -0
- package/types/react-component-lib/utils/index.d.ts +10 -0
- package/types/react-component-lib/utils/index.js +33 -0
- package/types/react-component-lib/utils/index.js.map +1 -0
- package/umd/index.d.ts +46 -0
- package/umd/index.js +59 -0
- package/umd/index.js.map +1 -0
- package/umd/react-component-lib/createComponent.d.ts +10 -0
- package/umd/react-component-lib/createComponent.js +102 -0
- package/umd/react-component-lib/createComponent.js.map +1 -0
- package/umd/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/umd/react-component-lib/createOverlayComponent.js +115 -0
- package/umd/react-component-lib/createOverlayComponent.js.map +1 -0
- package/umd/react-component-lib/index.d.ts +2 -0
- package/umd/react-component-lib/index.js +18 -0
- package/umd/react-component-lib/index.js.map +1 -0
- package/umd/react-component-lib/interfaces.d.ts +29 -0
- package/umd/react-component-lib/interfaces.js +13 -0
- package/umd/react-component-lib/interfaces.js.map +1 -0
- package/umd/react-component-lib/utils/attachProps.d.ts +8 -0
- package/umd/react-component-lib/utils/attachProps.js +102 -0
- package/umd/react-component-lib/utils/attachProps.js.map +1 -0
- package/umd/react-component-lib/utils/case.d.ts +2 -0
- package/umd/react-component-lib/utils/case.js +22 -0
- package/umd/react-component-lib/utils/case.js.map +1 -0
- package/umd/react-component-lib/utils/dev.d.ts +2 -0
- package/umd/react-component-lib/utils/dev.js +28 -0
- package/umd/react-component-lib/utils/dev.js.map +1 -0
- package/umd/react-component-lib/utils/index.d.ts +10 -0
- package/umd/react-component-lib/utils/index.js +67 -0
- package/umd/react-component-lib/utils/index.js.map +1 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createOverlayComponent = void 0;
|
|
27
|
+
const react_1 = __importDefault(require("react"));
|
|
28
|
+
const react_dom_1 = __importDefault(require("react-dom"));
|
|
29
|
+
const utils_1 = require("./utils");
|
|
30
|
+
const createOverlayComponent = (tagName, controller, customElement) => {
|
|
31
|
+
(0, utils_1.defineCustomElement)(tagName, customElement);
|
|
32
|
+
const displayName = (0, utils_1.dashToPascalCase)(tagName);
|
|
33
|
+
const didDismissEventName = `on${displayName}DidDismiss`;
|
|
34
|
+
const didPresentEventName = `on${displayName}DidPresent`;
|
|
35
|
+
const willDismissEventName = `on${displayName}WillDismiss`;
|
|
36
|
+
const willPresentEventName = `on${displayName}WillPresent`;
|
|
37
|
+
let isDismissing = false;
|
|
38
|
+
class Overlay extends react_1.default.Component {
|
|
39
|
+
constructor(props) {
|
|
40
|
+
super(props);
|
|
41
|
+
if (typeof document !== 'undefined') {
|
|
42
|
+
this.el = document.createElement('div');
|
|
43
|
+
}
|
|
44
|
+
this.handleDismiss = this.handleDismiss.bind(this);
|
|
45
|
+
}
|
|
46
|
+
static get displayName() {
|
|
47
|
+
return displayName;
|
|
48
|
+
}
|
|
49
|
+
componentDidMount() {
|
|
50
|
+
if (this.props.isOpen) {
|
|
51
|
+
this.present();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
componentWillUnmount() {
|
|
55
|
+
if (this.overlay) {
|
|
56
|
+
this.overlay.dismiss();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
handleDismiss(event) {
|
|
60
|
+
if (this.props.onDidDismiss) {
|
|
61
|
+
this.props.onDidDismiss(event);
|
|
62
|
+
}
|
|
63
|
+
(0, utils_1.setRef)(this.props.forwardedRef, null);
|
|
64
|
+
}
|
|
65
|
+
shouldComponentUpdate(nextProps) {
|
|
66
|
+
if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
|
|
67
|
+
isDismissing = true;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
componentDidUpdate(prevProps) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
if (this.overlay) {
|
|
74
|
+
(0, utils_1.attachProps)(this.overlay, this.props, prevProps);
|
|
75
|
+
}
|
|
76
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
77
|
+
this.present(prevProps);
|
|
78
|
+
}
|
|
79
|
+
if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
|
|
80
|
+
yield this.overlay.dismiss();
|
|
81
|
+
isDismissing = false;
|
|
82
|
+
this.forceUpdate();
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
present(prevProps) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const _a = this.props, { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent } = _a, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss", "onDidPresent", "onWillDismiss", "onWillPresent"]);
|
|
89
|
+
const elementProps = Object.assign(Object.assign({}, cProps), { ref: this.props.forwardedRef, [didDismissEventName]: this.handleDismiss, [didPresentEventName]: (e) => this.props.onDidPresent && this.props.onDidPresent(e), [willDismissEventName]: (e) => this.props.onWillDismiss && this.props.onWillDismiss(e), [willPresentEventName]: (e) => this.props.onWillPresent && this.props.onWillPresent(e) });
|
|
90
|
+
this.overlay = yield controller.create(Object.assign(Object.assign({}, elementProps), { component: this.el, componentProps: {} }));
|
|
91
|
+
(0, utils_1.setRef)(this.props.forwardedRef, this.overlay);
|
|
92
|
+
(0, utils_1.attachProps)(this.overlay, elementProps, prevProps);
|
|
93
|
+
yield this.overlay.present();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return react_dom_1.default.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return react_1.default.forwardRef((props, ref) => {
|
|
101
|
+
return react_1.default.createElement(Overlay, Object.assign({}, props, { forwardedRef: ref }));
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
exports.createOverlayComponent = createOverlayComponent;
|
|
105
|
+
//# sourceMappingURL=createOverlayComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createOverlayComponent.js","sourceRoot":"","sources":["../../src/react-component-lib/createOverlayComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,0DAAiC;AAGjC,mCAMiB;AAgBV,MAAM,sBAAsB,GAAG,CAIpC,OAAe,EACf,UAA8D,EAC9D,aAAmB,EACnB,EAAE;IACF,IAAA,2BAAmB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAE5C,MAAM,WAAW,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,mBAAmB,GAAG,KAAK,WAAW,YAAY,CAAC;IACzD,MAAM,mBAAmB,GAAG,KAAK,WAAW,YAAY,CAAC;IAC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oB,CAAC,EAAE,CAAC,CAAc,EAAE,EAAE,CACzC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,GAC1D,CAAC;gBAEF,IAAI,CAAC,OAAO,GAAG,MAAM,UAAU,CAAC,MAAM,iCACjC,YAAY,KACf,SAAS,EAAE,IAAI,CAAC,EAAE,EAClB,cAAc,EAAE,EAAE,IAClB,CAAC;gBAEH,IAAA,cAAM,EAAC,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC9C,IAAA,mBAAW,EAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;gBAEnD,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC/B,CAAC;SAAA;QAED,MAAM;YAMJ,OAAO,mBAAQ,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;KACF;IAED,OAAO,eAAK,CAAC,UAAU,CAAqB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACzD,OAAO,8BAAC,OAAO,oBAAK,KAAK,IAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAvIW,QAAA,sBAAsB,0BAuIjC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOverlayComponent = exports.createReactComponent = void 0;
|
|
4
|
+
var createComponent_1 = require("./createComponent");
|
|
5
|
+
Object.defineProperty(exports, "createReactComponent", { enumerable: true, get: function () { return createComponent_1.createReactComponent; } });
|
|
6
|
+
var createOverlayComponent_1 = require("./createOverlayComponent");
|
|
7
|
+
Object.defineProperty(exports, "createOverlayComponent", { enumerable: true, get: function () { return createOverlayComponent_1.createOverlayComponent; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-component-lib/index.ts"],"names":[],"mappings":";;;AAAA,qDAAyD;AAAhD,uHAAA,oBAAoB,OAAA;AAC7B,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA"}
|
|
@@ -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 const attachProps: (node: HTMLElement, newProps: any, oldProps?: any) => void;
|
|
2
|
+
export declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: any) => string;
|
|
3
|
+
export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
|
|
4
|
+
export declare const syncEvent: (node: Element & {
|
|
5
|
+
__events?: {
|
|
6
|
+
[key: string]: ((e: Event) => any) | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
}, eventName: string, newEventHandler?: ((e: Event) => any) | undefined) => void;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncEvent = exports.isCoveredByReact = exports.getClassName = exports.attachProps = void 0;
|
|
4
|
+
const case_1 = require("./case");
|
|
5
|
+
const attachProps = (node, newProps, oldProps = {}) => {
|
|
6
|
+
if (node instanceof Element) {
|
|
7
|
+
const className = (0, exports.getClassName)(node.classList, newProps, oldProps);
|
|
8
|
+
if (className !== '') {
|
|
9
|
+
node.className = className;
|
|
10
|
+
}
|
|
11
|
+
Object.keys(newProps).forEach((name) => {
|
|
12
|
+
if (name === 'children' ||
|
|
13
|
+
name === 'style' ||
|
|
14
|
+
name === 'ref' ||
|
|
15
|
+
name === 'class' ||
|
|
16
|
+
name === 'className' ||
|
|
17
|
+
name === 'forwardedRef') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
21
|
+
const eventName = name.substring(2);
|
|
22
|
+
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
23
|
+
if (!(0, exports.isCoveredByReact)(eventNameLc)) {
|
|
24
|
+
(0, exports.syncEvent)(node, eventNameLc, newProps[name]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
node[name] = newProps[name];
|
|
29
|
+
const propType = typeof newProps[name];
|
|
30
|
+
if (propType === 'string') {
|
|
31
|
+
node.setAttribute((0, case_1.camelToDashCase)(name), newProps[name]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.attachProps = attachProps;
|
|
38
|
+
const getClassName = (classList, newProps, oldProps) => {
|
|
39
|
+
const newClassProp = newProps.className || newProps.class;
|
|
40
|
+
const oldClassProp = oldProps.className || oldProps.class;
|
|
41
|
+
const currentClasses = arrayToMap(classList);
|
|
42
|
+
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
43
|
+
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
44
|
+
const finalClassNames = [];
|
|
45
|
+
currentClasses.forEach((currentClass) => {
|
|
46
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
47
|
+
finalClassNames.push(currentClass);
|
|
48
|
+
incomingPropClasses.delete(currentClass);
|
|
49
|
+
}
|
|
50
|
+
else if (!oldPropClasses.has(currentClass)) {
|
|
51
|
+
finalClassNames.push(currentClass);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
55
|
+
return finalClassNames.join(' ');
|
|
56
|
+
};
|
|
57
|
+
exports.getClassName = getClassName;
|
|
58
|
+
const isCoveredByReact = (eventNameSuffix) => {
|
|
59
|
+
if (typeof document === 'undefined') {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const eventName = 'on' + eventNameSuffix;
|
|
64
|
+
let isSupported = eventName in document;
|
|
65
|
+
if (!isSupported) {
|
|
66
|
+
const element = document.createElement('div');
|
|
67
|
+
element.setAttribute(eventName, 'return;');
|
|
68
|
+
isSupported = typeof element[eventName] === 'function';
|
|
69
|
+
}
|
|
70
|
+
return isSupported;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.isCoveredByReact = isCoveredByReact;
|
|
74
|
+
const syncEvent = (node, eventName, newEventHandler) => {
|
|
75
|
+
const eventStore = node.__events || (node.__events = {});
|
|
76
|
+
const oldEventHandler = eventStore[eventName];
|
|
77
|
+
if (oldEventHandler) {
|
|
78
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
79
|
+
}
|
|
80
|
+
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
81
|
+
if (newEventHandler) {
|
|
82
|
+
newEventHandler.call(this, e);
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
};
|
|
86
|
+
exports.syncEvent = syncEvent;
|
|
87
|
+
const arrayToMap = (arr) => {
|
|
88
|
+
const map = new Map();
|
|
89
|
+
arr.forEach((s) => map.set(s, s));
|
|
90
|
+
return map;
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=attachProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachProps.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/attachProps.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAElC,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAE,QAAa,EAAE,WAAgB,EAAE,EAAE,EAAE;IAElF,IAAI,IAAI,YAAY,OAAO,EAAE;QAE3B,MAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,SAAS,KAAK,EAAE,EAAE;YACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;SAC5B;QAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrC,IACE,IAAI,KAAK,UAAU;gBACnB,IAAI,KAAK,OAAO;gBAChB,IAAI,KAAK,KAAK;gBACd,IAAI,KAAK,OAAO;gBAChB,IAAI,KAAK,WAAW;gBACpB,IAAI,KAAK,cAAc,EACvB;gBACA,OAAO;aACR;YACD,IAAI,IAAI,CAAC,OAA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KACpB;AACH,CAAC,CAAC;AAfW,QAAA,gBAAgB,oBAe3B;AAEK,MAAM,SAAS,GAAG,CACvB,IAAiF,EACjF,SAAiB,EACjB,eAAmC,EACnC,EAAE;IACF,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAG9C,IAAI,eAAe,EAAE;QACnB,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;KACtD;IAGD,IAAI,CAAC,gBAAgB,CACnB,SAAS,EACT,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS,OAAO,CAAC,CAAQ;QAChD,IAAI,eAAe,EAAE;YACnB,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SAC/B;IACH,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAtBW,QAAA,SAAS,aAsBpB;AAEF,MAAM,UAAU,GAAG,CAAC,GAA4B,EAAE,EAAE;IAClD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACrC,GAAgB,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.camelToDashCase = exports.dashToPascalCase = void 0;
|
|
4
|
+
const dashToPascalCase = (str) => str
|
|
5
|
+
.toLowerCase()
|
|
6
|
+
.split('-')
|
|
7
|
+
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
8
|
+
.join('');
|
|
9
|
+
exports.dashToPascalCase = dashToPascalCase;
|
|
10
|
+
const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
|
|
11
|
+
exports.camelToDashCase = camelToDashCase;
|
|
12
|
+
//# sourceMappingURL=case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/case.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,EAAE,CAC9C,GAAG;KACA,WAAW,EAAE;KACb,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACpE,IAAI,CAAC,EAAE,CAAC,CAAC;AALD,QAAA,gBAAgB,oBAKf;AACP,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7C,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AADtD,QAAA,eAAe,mBACuC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deprecationWarning = exports.isDevMode = void 0;
|
|
4
|
+
const isDevMode = () => {
|
|
5
|
+
return process && process.env && process.env.NODE_ENV === 'development';
|
|
6
|
+
};
|
|
7
|
+
exports.isDevMode = isDevMode;
|
|
8
|
+
const warnings = {};
|
|
9
|
+
const deprecationWarning = (key, message) => {
|
|
10
|
+
if ((0, exports.isDevMode)()) {
|
|
11
|
+
if (!warnings[key]) {
|
|
12
|
+
console.warn(message);
|
|
13
|
+
warnings[key] = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.deprecationWarning = deprecationWarning;
|
|
18
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/dev.ts"],"names":[],"mappings":";;;AAAO,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;AAC1E,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEF,MAAM,QAAQ,GAA+B,EAAE,CAAC;AAEzC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,OAAe,EAAE,EAAE;IACjE,IAAI,IAAA,iBAAS,GAAE,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;AAPW,QAAA,kBAAkB,sBAO7B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleReactProps } from '../interfaces';
|
|
3
|
+
export declare type StencilReactExternalProps<PropType, ElementType> = PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps;
|
|
4
|
+
export declare type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
|
|
5
|
+
export declare const setRef: (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => void;
|
|
6
|
+
export declare const mergeRefs: (...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]) => React.RefCallback<any>;
|
|
7
|
+
export declare const createForwardRef: <PropType, ElementType>(ReactComponent: any, displayName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
8
|
+
export declare const defineCustomElement: (tagName: string, customElement: any) => void;
|
|
9
|
+
export * from './attachProps';
|
|
10
|
+
export * from './case';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.defineCustomElement = exports.createForwardRef = exports.mergeRefs = exports.setRef = void 0;
|
|
21
|
+
const react_1 = __importDefault(require("react"));
|
|
22
|
+
const setRef = (ref, value) => {
|
|
23
|
+
if (typeof ref === 'function') {
|
|
24
|
+
ref(value);
|
|
25
|
+
}
|
|
26
|
+
else if (ref != null) {
|
|
27
|
+
ref.current = value;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.setRef = setRef;
|
|
31
|
+
const mergeRefs = (...refs) => {
|
|
32
|
+
return (value) => {
|
|
33
|
+
refs.forEach(ref => {
|
|
34
|
+
(0, exports.setRef)(ref, value);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
exports.mergeRefs = mergeRefs;
|
|
39
|
+
const createForwardRef = (ReactComponent, displayName) => {
|
|
40
|
+
const forwardRef = (props, ref) => {
|
|
41
|
+
return react_1.default.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
42
|
+
};
|
|
43
|
+
forwardRef.displayName = displayName;
|
|
44
|
+
return react_1.default.forwardRef(forwardRef);
|
|
45
|
+
};
|
|
46
|
+
exports.createForwardRef = createForwardRef;
|
|
47
|
+
const defineCustomElement = (tagName, customElement) => {
|
|
48
|
+
if (customElement !== undefined &&
|
|
49
|
+
typeof customElements !== 'undefined' &&
|
|
50
|
+
!customElements.get(tagName)) {
|
|
51
|
+
customElements.define(tagName, customElement);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.defineCustomElement = defineCustomElement;
|
|
55
|
+
__exportStar(require("./attachProps"), exports);
|
|
56
|
+
__exportStar(require("./case"), exports);
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAWnB,MAAM,MAAM,GAAG,CAAC,GAA+D,EAAE,KAAU,EAAE,EAAE;IACpG,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;QAC7B,GAAG,CAAC,KAAK,CAAC,CAAA;KACX;SAAM,IAAI,GAAG,IAAI,IAAI,EAAE;QAErB,GAAmC,CAAC,OAAO,GAAG,KAAK,CAAA;KACrD;AACH,CAAC,CAAC;AAPW,QAAA,MAAM,UAOjB;AAEK,MAAM,SAAS,GAAG,CACvB,GAAG,IAAoE,EAC/C,EAAE;IAC1B,OAAO,CAAC,KAAU,EAAE,EAAE;QACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACjB,IAAA,cAAM,EAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACpB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC,CAAC;AARW,QAAA,SAAS,aAQpB;AAEK,MAAM,gBAAgB,GAAG,CAC9B,cAAmB,EACnB,WAAmB,EACnB,EAAE;IACF,MAAM,UAAU,GAAG,CACjB,KAAuD,EACvD,GAA0C,EAC1C,EAAE;QACF,OAAO,8BAAC,cAAc,oBAAK,KAAK,IAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC1D,CAAC,CAAC;IACF,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;IAErC,OAAO,eAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B;AAEK,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,aAAkB,EAAE,EAAE;IACzE,IACE,aAAa,KAAK,SAAS;QAC3B,OAAO,cAAc,KAAK,WAAW;QACrC,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAC5B;QACA,cAAc,CAAC,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;KAC/C;AACH,CAAC,CAAA;AARY,QAAA,mBAAmB,uBAQ/B;AAED,gDAA8B;AAC9B,yCAAuB"}
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { JSX } from '@public-ui/components';
|
|
3
|
+
export declare const KolAbbr: import("react").ForwardRefExoticComponent<JSX.KolAbbr & Omit<import("react").HTMLAttributes<HTMLKolAbbrElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolAbbrElement>>;
|
|
4
|
+
export declare const KolAccordion: import("react").ForwardRefExoticComponent<JSX.KolAccordion & Omit<import("react").HTMLAttributes<HTMLKolAccordionElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolAccordionElement>>;
|
|
5
|
+
export declare const KolAlert: import("react").ForwardRefExoticComponent<JSX.KolAlert & Omit<import("react").HTMLAttributes<HTMLKolAlertElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolAlertElement>>;
|
|
6
|
+
export declare const KolBadge: import("react").ForwardRefExoticComponent<JSX.KolBadge & Omit<import("react").HTMLAttributes<HTMLKolBadgeElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolBadgeElement>>;
|
|
7
|
+
export declare const KolBreadcrumb: import("react").ForwardRefExoticComponent<JSX.KolBreadcrumb & Omit<import("react").HTMLAttributes<HTMLKolBreadcrumbElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolBreadcrumbElement>>;
|
|
8
|
+
export declare const KolButton: import("react").ForwardRefExoticComponent<JSX.KolButton & Omit<import("react").HTMLAttributes<HTMLKolButtonElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolButtonElement>>;
|
|
9
|
+
export declare const KolButtonGroup: import("react").ForwardRefExoticComponent<JSX.KolButtonGroup & Omit<import("react").HTMLAttributes<HTMLKolButtonGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolButtonGroupElement>>;
|
|
10
|
+
export declare const KolCard: import("react").ForwardRefExoticComponent<JSX.KolCard & Omit<import("react").HTMLAttributes<HTMLKolCardElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolCardElement>>;
|
|
11
|
+
export declare const KolDetails: import("react").ForwardRefExoticComponent<JSX.KolDetails & Omit<import("react").HTMLAttributes<HTMLKolDetailsElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolDetailsElement>>;
|
|
12
|
+
export declare const KolForm: import("react").ForwardRefExoticComponent<JSX.KolForm & Omit<import("react").HTMLAttributes<HTMLKolFormElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolFormElement>>;
|
|
13
|
+
export declare const KolHeading: import("react").ForwardRefExoticComponent<JSX.KolHeading & Omit<import("react").HTMLAttributes<HTMLKolHeadingElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolHeadingElement>>;
|
|
14
|
+
export declare const KolHeadingWc: import("react").ForwardRefExoticComponent<JSX.KolHeadingWc & Omit<import("react").HTMLAttributes<HTMLKolHeadingWcElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolHeadingWcElement>>;
|
|
15
|
+
export declare const KolIcon: import("react").ForwardRefExoticComponent<JSX.KolIcon & Omit<import("react").HTMLAttributes<HTMLKolIconElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolIconElement>>;
|
|
16
|
+
export declare const KolIconFontAwesome: import("react").ForwardRefExoticComponent<JSX.KolIconFontAwesome & Omit<import("react").HTMLAttributes<HTMLKolIconFontAwesomeElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolIconFontAwesomeElement>>;
|
|
17
|
+
export declare const KolIconIcofont: import("react").ForwardRefExoticComponent<JSX.KolIconIcofont & Omit<import("react").HTMLAttributes<HTMLKolIconIcofontElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolIconIcofontElement>>;
|
|
18
|
+
export declare const KolIndentedText: import("react").ForwardRefExoticComponent<JSX.KolIndentedText & Omit<import("react").HTMLAttributes<HTMLKolIndentedTextElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolIndentedTextElement>>;
|
|
19
|
+
export declare const KolInputAdapterLeanup: import("react").ForwardRefExoticComponent<JSX.KolInputAdapterLeanup & Omit<import("react").HTMLAttributes<HTMLKolInputAdapterLeanupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputAdapterLeanupElement>>;
|
|
20
|
+
export declare const KolInputCheckbox: import("react").ForwardRefExoticComponent<JSX.KolInputCheckbox & Omit<import("react").HTMLAttributes<HTMLKolInputCheckboxElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputCheckboxElement>>;
|
|
21
|
+
export declare const KolInputColor: import("react").ForwardRefExoticComponent<JSX.KolInputColor & Omit<import("react").HTMLAttributes<HTMLKolInputColorElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputColorElement>>;
|
|
22
|
+
export declare const KolInputEmail: import("react").ForwardRefExoticComponent<JSX.KolInputEmail & Omit<import("react").HTMLAttributes<HTMLKolInputEmailElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputEmailElement>>;
|
|
23
|
+
export declare const KolInputFile: import("react").ForwardRefExoticComponent<JSX.KolInputFile & Omit<import("react").HTMLAttributes<HTMLKolInputFileElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputFileElement>>;
|
|
24
|
+
export declare const KolInputNumber: import("react").ForwardRefExoticComponent<JSX.KolInputNumber & Omit<import("react").HTMLAttributes<HTMLKolInputNumberElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputNumberElement>>;
|
|
25
|
+
export declare const KolInputPassword: import("react").ForwardRefExoticComponent<JSX.KolInputPassword & Omit<import("react").HTMLAttributes<HTMLKolInputPasswordElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputPasswordElement>>;
|
|
26
|
+
export declare const KolInputRadio: import("react").ForwardRefExoticComponent<JSX.KolInputRadio & Omit<import("react").HTMLAttributes<HTMLKolInputRadioElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputRadioElement>>;
|
|
27
|
+
export declare const KolInputRange: import("react").ForwardRefExoticComponent<JSX.KolInputRange & Omit<import("react").HTMLAttributes<HTMLKolInputRangeElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputRangeElement>>;
|
|
28
|
+
export declare const KolInputText: import("react").ForwardRefExoticComponent<JSX.KolInputText & Omit<import("react").HTMLAttributes<HTMLKolInputTextElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolInputTextElement>>;
|
|
29
|
+
export declare const KolKolibri: import("react").ForwardRefExoticComponent<JSX.KolKolibri & Omit<import("react").HTMLAttributes<HTMLKolKolibriElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolKolibriElement>>;
|
|
30
|
+
export declare const KolLink: import("react").ForwardRefExoticComponent<JSX.KolLink & Omit<import("react").HTMLAttributes<HTMLKolLinkElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolLinkElement>>;
|
|
31
|
+
export declare const KolLinkGroup: import("react").ForwardRefExoticComponent<JSX.KolLinkGroup & Omit<import("react").HTMLAttributes<HTMLKolLinkGroupElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolLinkGroupElement>>;
|
|
32
|
+
export declare const KolLogo: import("react").ForwardRefExoticComponent<JSX.KolLogo & Omit<import("react").HTMLAttributes<HTMLKolLogoElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolLogoElement>>;
|
|
33
|
+
export declare const KolModal: import("react").ForwardRefExoticComponent<JSX.KolModal & Omit<import("react").HTMLAttributes<HTMLKolModalElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolModalElement>>;
|
|
34
|
+
export declare const KolNav: import("react").ForwardRefExoticComponent<JSX.KolNav & Omit<import("react").HTMLAttributes<HTMLKolNavElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolNavElement>>;
|
|
35
|
+
export declare const KolPagination: import("react").ForwardRefExoticComponent<JSX.KolPagination & Omit<import("react").HTMLAttributes<HTMLKolPaginationElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolPaginationElement>>;
|
|
36
|
+
export declare const KolProgress: import("react").ForwardRefExoticComponent<JSX.KolProgress & Omit<import("react").HTMLAttributes<HTMLKolProgressElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolProgressElement>>;
|
|
37
|
+
export declare const KolSelect: import("react").ForwardRefExoticComponent<JSX.KolSelect & Omit<import("react").HTMLAttributes<HTMLKolSelectElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolSelectElement>>;
|
|
38
|
+
export declare const KolSkipNav: import("react").ForwardRefExoticComponent<JSX.KolSkipNav & Omit<import("react").HTMLAttributes<HTMLKolSkipNavElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolSkipNavElement>>;
|
|
39
|
+
export declare const KolSpin: import("react").ForwardRefExoticComponent<JSX.KolSpin & Omit<import("react").HTMLAttributes<HTMLKolSpinElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolSpinElement>>;
|
|
40
|
+
export declare const KolSymbol: import("react").ForwardRefExoticComponent<JSX.KolSymbol & Omit<import("react").HTMLAttributes<HTMLKolSymbolElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolSymbolElement>>;
|
|
41
|
+
export declare const KolTable: import("react").ForwardRefExoticComponent<JSX.KolTable & Omit<import("react").HTMLAttributes<HTMLKolTableElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolTableElement>>;
|
|
42
|
+
export declare const KolTabs: import("react").ForwardRefExoticComponent<JSX.KolTabs & Omit<import("react").HTMLAttributes<HTMLKolTabsElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolTabsElement>>;
|
|
43
|
+
export declare const KolTextarea: import("react").ForwardRefExoticComponent<JSX.KolTextarea & Omit<import("react").HTMLAttributes<HTMLKolTextareaElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolTextareaElement>>;
|
|
44
|
+
export declare const KolToast: import("react").ForwardRefExoticComponent<JSX.KolToast & Omit<import("react").HTMLAttributes<HTMLKolToastElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolToastElement>>;
|
|
45
|
+
export declare const KolTooltip: import("react").ForwardRefExoticComponent<JSX.KolTooltip & Omit<import("react").HTMLAttributes<HTMLKolTooltipElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolTooltipElement>>;
|
|
46
|
+
export declare const KolVersion: import("react").ForwardRefExoticComponent<JSX.KolVersion & Omit<import("react").HTMLAttributes<HTMLKolVersionElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLKolVersionElement>>;
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createReactComponent } from './react-component-lib';
|
|
2
|
+
export const KolAbbr = createReactComponent('kol-abbr');
|
|
3
|
+
export const KolAccordion = createReactComponent('kol-accordion');
|
|
4
|
+
export const KolAlert = createReactComponent('kol-alert');
|
|
5
|
+
export const KolBadge = createReactComponent('kol-badge');
|
|
6
|
+
export const KolBreadcrumb = createReactComponent('kol-breadcrumb');
|
|
7
|
+
export const KolButton = createReactComponent('kol-button');
|
|
8
|
+
export const KolButtonGroup = createReactComponent('kol-button-group');
|
|
9
|
+
export const KolCard = createReactComponent('kol-card');
|
|
10
|
+
export const KolDetails = createReactComponent('kol-details');
|
|
11
|
+
export const KolForm = createReactComponent('kol-form');
|
|
12
|
+
export const KolHeading = createReactComponent('kol-heading');
|
|
13
|
+
export const KolHeadingWc = createReactComponent('kol-heading-wc');
|
|
14
|
+
export const KolIcon = createReactComponent('kol-icon');
|
|
15
|
+
export const KolIconFontAwesome = createReactComponent('kol-icon-font-awesome');
|
|
16
|
+
export const KolIconIcofont = createReactComponent('kol-icon-icofont');
|
|
17
|
+
export const KolIndentedText = createReactComponent('kol-indented-text');
|
|
18
|
+
export const KolInputAdapterLeanup = createReactComponent('kol-input-adapter-leanup');
|
|
19
|
+
export const KolInputCheckbox = createReactComponent('kol-input-checkbox');
|
|
20
|
+
export const KolInputColor = createReactComponent('kol-input-color');
|
|
21
|
+
export const KolInputEmail = createReactComponent('kol-input-email');
|
|
22
|
+
export const KolInputFile = createReactComponent('kol-input-file');
|
|
23
|
+
export const KolInputNumber = createReactComponent('kol-input-number');
|
|
24
|
+
export const KolInputPassword = createReactComponent('kol-input-password');
|
|
25
|
+
export const KolInputRadio = createReactComponent('kol-input-radio');
|
|
26
|
+
export const KolInputRange = createReactComponent('kol-input-range');
|
|
27
|
+
export const KolInputText = createReactComponent('kol-input-text');
|
|
28
|
+
export const KolKolibri = createReactComponent('kol-kolibri');
|
|
29
|
+
export const KolLink = createReactComponent('kol-link');
|
|
30
|
+
export const KolLinkGroup = createReactComponent('kol-link-group');
|
|
31
|
+
export const KolLogo = createReactComponent('kol-logo');
|
|
32
|
+
export const KolModal = createReactComponent('kol-modal');
|
|
33
|
+
export const KolNav = createReactComponent('kol-nav');
|
|
34
|
+
export const KolPagination = createReactComponent('kol-pagination');
|
|
35
|
+
export const KolProgress = createReactComponent('kol-progress');
|
|
36
|
+
export const KolSelect = createReactComponent('kol-select');
|
|
37
|
+
export const KolSkipNav = createReactComponent('kol-skip-nav');
|
|
38
|
+
export const KolSpin = createReactComponent('kol-spin');
|
|
39
|
+
export const KolSymbol = createReactComponent('kol-symbol');
|
|
40
|
+
export const KolTable = createReactComponent('kol-table');
|
|
41
|
+
export const KolTabs = createReactComponent('kol-tabs');
|
|
42
|
+
export const KolTextarea = createReactComponent('kol-textarea');
|
|
43
|
+
export const KolToast = createReactComponent('kol-toast');
|
|
44
|
+
export const KolTooltip = createReactComponent('kol-tooltip');
|
|
45
|
+
export const KolVersion = createReactComponent('kol-version');
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAM7D,MAAM,CAAC,MAAM,OAAO,GAAgB,oBAAoB,CAAkC,UAAU,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,YAAY,GAAgB,oBAAoB,CAA4C,eAAe,CAAC,CAAC;AAC1H,MAAM,CAAC,MAAM,QAAQ,GAAgB,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,QAAQ,GAAgB,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,aAAa,GAAgB,oBAAoB,CAA8C,gBAAgB,CAAC,CAAC;AAC9H,MAAM,CAAC,MAAM,SAAS,GAAgB,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,cAAc,GAAgB,oBAAoB,CAAgD,kBAAkB,CAAC,CAAC;AACnI,MAAM,CAAC,MAAM,OAAO,GAAgB,oBAAoB,CAAkC,UAAU,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,UAAU,GAAgB,oBAAoB,CAAwC,aAAa,CAAC,CAAC;AAClH,MAAM,CAAC,MAAM,OAAO,GAAgB,oBAAoB,CAAkC,UAAU,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,UAAU,GAAgB,oBAAoB,CAAwC,aAAa,CAAC,CAAC;AAClH,MAAM,CAAC,MAAM,YAAY,GAAgB,oBAAoB,CAA4C,gBAAgB,CAAC,CAAC;AAC3H,MAAM,CAAC,MAAM,OAAO,GAAgB,oBAAoB,CAAkC,UAAU,CAAC,CAAC;A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oB,CAAkC,UAAU,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,QAAQ,GAAgB,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,MAAM,GAAgB,oBAAoB,CAAgC,SAAS,CAAC,CAAC;AAClG,MAAM,CAAC,MAAM,aAAa,GAAgB,oBAAoB,CAA8C,gBAAgB,CAAC,CAAC;AAC9H,MAAM,CAAC,MAAM,WAAW,GAAgB,oBAAoB,CAA0C,cAAc,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,SAAS,GAAgB,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,UAAU,GAAgB,oBAAoB,CAAwC,cAAc,CAAC,CAAC;AACnH,MAAM,CAAC,MAAM,OAAO,GAAgB,oBAAoB,CAAkC,UAAU,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,SAAS,GAAgB,oBAAoB,CAAsC,YAAY,CAAC,CAAC;AAC9G,MAAM,CAAC,MAAM,QAAQ,GAAgB,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,OAAO,GAAgB,oBAAoB,CAAkC,UAAU,CAAC,CAAC;AACtG,MAAM,CAAC,MAAM,WAAW,GAAgB,oBAAoB,CAA0C,cAAc,CAAC,CAAC;AACtH,MAAM,CAAC,MAAM,QAAQ,GAAgB,oBAAoB,CAAoC,WAAW,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,UAAU,GAAgB,oBAAoB,CAAwC,aAAa,CAAC,CAAC;AAClH,MAAM,CAAC,MAAM,UAAU,GAAgB,oBAAoB,CAAwC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface HTMLStencilElement extends HTMLElement {
|
|
3
|
+
componentOnReady(): Promise<this>;
|
|
4
|
+
}
|
|
5
|
+
interface StencilReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
|
|
6
|
+
forwardedRef: React.RefObject<ElementType>;
|
|
7
|
+
ref?: React.Ref<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare const createReactComponent: <PropType, ElementType extends HTMLStencilElement, ContextStateType = {}, ExpandedPropsTypes = {}>(tagName: string, ReactComponentContext?: React.Context<ContextStateType> | undefined, manipulatePropsFunction?: ((originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes) | undefined, defineCustomElement?: () => void) => React.ForwardRefExoticComponent<React.PropsWithoutRef<import("./utils").StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { createElement } from 'react';
|
|
13
|
+
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
|
|
14
|
+
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
|
|
15
|
+
if (defineCustomElement !== undefined) {
|
|
16
|
+
defineCustomElement();
|
|
17
|
+
}
|
|
18
|
+
const displayName = dashToPascalCase(tagName);
|
|
19
|
+
const ReactComponent = class extends React.Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.setComponentElRef = (element) => {
|
|
23
|
+
this.componentEl = element;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
componentDidMount() {
|
|
27
|
+
this.componentDidUpdate(this.props);
|
|
28
|
+
}
|
|
29
|
+
componentDidUpdate(prevProps) {
|
|
30
|
+
attachProps(this.componentEl, this.props, prevProps);
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
const _a = this.props, { children, forwardedRef, style, className, ref } = _a, cProps = __rest(_a, ["children", "forwardedRef", "style", "className", "ref"]);
|
|
34
|
+
let propsToPass = Object.keys(cProps).reduce((acc, name) => {
|
|
35
|
+
const value = cProps[name];
|
|
36
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
37
|
+
const eventName = name.substring(2).toLowerCase();
|
|
38
|
+
if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
|
|
39
|
+
acc[name] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const type = typeof value;
|
|
44
|
+
if (type === 'string' || type === 'boolean' || type === 'number') {
|
|
45
|
+
acc[camelToDashCase(name)] = value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return acc;
|
|
49
|
+
}, {});
|
|
50
|
+
if (manipulatePropsFunction) {
|
|
51
|
+
propsToPass = manipulatePropsFunction(this.props, propsToPass);
|
|
52
|
+
}
|
|
53
|
+
const newProps = Object.assign(Object.assign({}, propsToPass), { ref: mergeRefs(forwardedRef, this.setComponentElRef), style });
|
|
54
|
+
return createElement(tagName, newProps, children);
|
|
55
|
+
}
|
|
56
|
+
static get displayName() {
|
|
57
|
+
return displayName;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (ReactComponentContext) {
|
|
61
|
+
ReactComponent.contextType = ReactComponentContext;
|
|
62
|
+
}
|
|
63
|
+
return createForwardRef(ReactComponent, displayName);
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=createComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createComponent.js","s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