@ai12z/react 3.12.1-alpha.3 → 3.12.1-alpha.5
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/components/stencil-generated/index.js +18 -0
- package/dist/components/stencil-generated/react-component-lib/createComponent.js +64 -0
- package/dist/components/stencil-generated/react-component-lib/createOverlayComponent.js +97 -0
- package/dist/components/stencil-generated/react-component-lib/index.js +2 -0
- package/dist/components/stencil-generated/react-component-lib/interfaces.js +1 -0
- package/dist/components/stencil-generated/react-component-lib/utils/attachProps.js +91 -0
- package/dist/components/stencil-generated/react-component-lib/utils/case.js +6 -0
- package/dist/components/stencil-generated/react-component-lib/utils/dev.js +12 -0
- package/dist/components/stencil-generated/react-component-lib/utils/index.js +30 -0
- package/dist/index.js +1 -1
- package/dist/types/components/stencil-generated/index.d.ts +16 -0
- package/dist/types/components/stencil-generated/react-component-lib/createComponent.d.ts +10 -0
- package/dist/types/components/stencil-generated/react-component-lib/createOverlayComponent.d.ts +21 -0
- package/dist/types/components/stencil-generated/react-component-lib/index.d.ts +2 -0
- package/dist/types/components/stencil-generated/react-component-lib/interfaces.d.ts +29 -0
- package/dist/types/components/stencil-generated/react-component-lib/utils/attachProps.d.ts +9 -0
- package/dist/types/components/stencil-generated/react-component-lib/utils/case.d.ts +2 -0
- package/dist/types/components/stencil-generated/react-component-lib/utils/dev.d.ts +2 -0
- package/dist/types/components/stencil-generated/react-component-lib/utils/index.d.ts +10 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createReactComponent } from './react-component-lib';
|
|
2
|
+
import { defineCustomElements } from 'ai12z/loader';
|
|
3
|
+
defineCustomElements();
|
|
4
|
+
export const Ai12zBot = createReactComponent('ai12z-bot');
|
|
5
|
+
export const Ai12zCarousel = createReactComponent('ai12z-carousel');
|
|
6
|
+
export const Ai12zCategory = createReactComponent('ai12z-category');
|
|
7
|
+
export const Ai12zChat = createReactComponent('ai12z-chat');
|
|
8
|
+
export const Ai12zChatMessage = createReactComponent('ai12z-chat-message');
|
|
9
|
+
export const Ai12zContainer = createReactComponent('ai12z-container');
|
|
10
|
+
export const Ai12zCta = createReactComponent('ai12z-cta');
|
|
11
|
+
export const Ai12zForm = createReactComponent('ai12z-form');
|
|
12
|
+
export const Ai12zInlineSearch = createReactComponent('ai12z-inline-search');
|
|
13
|
+
export const Ai12zInputForm = createReactComponent('ai12z-input-form');
|
|
14
|
+
export const Ai12zKnowledgeBox = createReactComponent('ai12z-knowledge-box');
|
|
15
|
+
export const Ai12zMic = createReactComponent('ai12z-mic');
|
|
16
|
+
export const Ai12zSearchPanel = createReactComponent('ai12z-search-panel');
|
|
17
|
+
export const Ai12zSpinner = createReactComponent('ai12z-spinner');
|
|
18
|
+
export const SearchResultsPage = createReactComponent('search-results-page');
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import ReactDOM from 'react-dom';
|
|
23
|
+
import { attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
|
|
24
|
+
export const createOverlayComponent = (tagName, controller, customElement) => {
|
|
25
|
+
defineCustomElement(tagName, customElement);
|
|
26
|
+
const displayName = dashToPascalCase(tagName);
|
|
27
|
+
const didDismissEventName = `on${displayName}DidDismiss`;
|
|
28
|
+
const didPresentEventName = `on${displayName}DidPresent`;
|
|
29
|
+
const willDismissEventName = `on${displayName}WillDismiss`;
|
|
30
|
+
const willPresentEventName = `on${displayName}WillPresent`;
|
|
31
|
+
let isDismissing = false;
|
|
32
|
+
class Overlay extends React.Component {
|
|
33
|
+
constructor(props) {
|
|
34
|
+
super(props);
|
|
35
|
+
if (typeof document !== 'undefined') {
|
|
36
|
+
this.el = document.createElement('div');
|
|
37
|
+
}
|
|
38
|
+
this.handleDismiss = this.handleDismiss.bind(this);
|
|
39
|
+
}
|
|
40
|
+
static get displayName() {
|
|
41
|
+
return displayName;
|
|
42
|
+
}
|
|
43
|
+
componentDidMount() {
|
|
44
|
+
if (this.props.isOpen) {
|
|
45
|
+
this.present();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
componentWillUnmount() {
|
|
49
|
+
if (this.overlay) {
|
|
50
|
+
this.overlay.dismiss();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleDismiss(event) {
|
|
54
|
+
if (this.props.onDidDismiss) {
|
|
55
|
+
this.props.onDidDismiss(event);
|
|
56
|
+
}
|
|
57
|
+
setRef(this.props.forwardedRef, null);
|
|
58
|
+
}
|
|
59
|
+
shouldComponentUpdate(nextProps) {
|
|
60
|
+
if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
|
|
61
|
+
isDismissing = true;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
componentDidUpdate(prevProps) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
if (this.overlay) {
|
|
68
|
+
attachProps(this.overlay, this.props, prevProps);
|
|
69
|
+
}
|
|
70
|
+
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
|
|
71
|
+
this.present(prevProps);
|
|
72
|
+
}
|
|
73
|
+
if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
|
|
74
|
+
yield this.overlay.dismiss();
|
|
75
|
+
isDismissing = false;
|
|
76
|
+
this.forceUpdate();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
present(prevProps) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const _a = this.props, { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent } = _a, cProps = __rest(_a, ["children", "isOpen", "onDidDismiss", "onDidPresent", "onWillDismiss", "onWillPresent"]);
|
|
83
|
+
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) });
|
|
84
|
+
this.overlay = yield controller.create(Object.assign(Object.assign({}, elementProps), { component: this.el, componentProps: {} }));
|
|
85
|
+
setRef(this.props.forwardedRef, this.overlay);
|
|
86
|
+
attachProps(this.overlay, elementProps, prevProps);
|
|
87
|
+
yield this.overlay.present();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return React.forwardRef((props, ref) => {
|
|
95
|
+
return React.createElement(Overlay, Object.assign({}, props, { forwardedRef: ref }));
|
|
96
|
+
});
|
|
97
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { camelToDashCase } from './case';
|
|
2
|
+
export const attachProps = (node, newProps, oldProps = {}) => {
|
|
3
|
+
if (node instanceof Element) {
|
|
4
|
+
const className = getClassName(node.classList, newProps, oldProps);
|
|
5
|
+
if (className !== '') {
|
|
6
|
+
node.className = className;
|
|
7
|
+
}
|
|
8
|
+
Object.keys(newProps).forEach((name) => {
|
|
9
|
+
if (name === 'children' ||
|
|
10
|
+
name === 'style' ||
|
|
11
|
+
name === 'ref' ||
|
|
12
|
+
name === 'class' ||
|
|
13
|
+
name === 'className' ||
|
|
14
|
+
name === 'forwardedRef') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
|
|
18
|
+
const eventName = name.substring(2);
|
|
19
|
+
const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
|
|
20
|
+
if (!isCoveredByReact(eventNameLc)) {
|
|
21
|
+
syncEvent(node, eventNameLc, newProps[name]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
node[name] = newProps[name];
|
|
26
|
+
const propType = typeof newProps[name];
|
|
27
|
+
if (propType === 'string') {
|
|
28
|
+
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export const getClassName = (classList, newProps, oldProps) => {
|
|
35
|
+
const newClassProp = newProps.className || newProps.class;
|
|
36
|
+
const oldClassProp = oldProps.className || oldProps.class;
|
|
37
|
+
const currentClasses = arrayToMap(classList);
|
|
38
|
+
const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
|
|
39
|
+
const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
|
|
40
|
+
const finalClassNames = [];
|
|
41
|
+
currentClasses.forEach((currentClass) => {
|
|
42
|
+
if (incomingPropClasses.has(currentClass)) {
|
|
43
|
+
finalClassNames.push(currentClass);
|
|
44
|
+
incomingPropClasses.delete(currentClass);
|
|
45
|
+
}
|
|
46
|
+
else if (!oldPropClasses.has(currentClass)) {
|
|
47
|
+
finalClassNames.push(currentClass);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
incomingPropClasses.forEach((s) => finalClassNames.push(s));
|
|
51
|
+
return finalClassNames.join(' ');
|
|
52
|
+
};
|
|
53
|
+
export const transformReactEventName = (eventNameSuffix) => {
|
|
54
|
+
switch (eventNameSuffix) {
|
|
55
|
+
case 'doubleclick':
|
|
56
|
+
return 'dblclick';
|
|
57
|
+
}
|
|
58
|
+
return eventNameSuffix;
|
|
59
|
+
};
|
|
60
|
+
export const isCoveredByReact = (eventNameSuffix) => {
|
|
61
|
+
if (typeof document === 'undefined') {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const eventName = 'on' + transformReactEventName(eventNameSuffix);
|
|
66
|
+
let isSupported = eventName in document;
|
|
67
|
+
if (!isSupported) {
|
|
68
|
+
const element = document.createElement('div');
|
|
69
|
+
element.setAttribute(eventName, 'return;');
|
|
70
|
+
isSupported = typeof element[eventName] === 'function';
|
|
71
|
+
}
|
|
72
|
+
return isSupported;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export const syncEvent = (node, eventName, newEventHandler) => {
|
|
76
|
+
const eventStore = node.__events || (node.__events = {});
|
|
77
|
+
const oldEventHandler = eventStore[eventName];
|
|
78
|
+
if (oldEventHandler) {
|
|
79
|
+
node.removeEventListener(eventName, oldEventHandler);
|
|
80
|
+
}
|
|
81
|
+
node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
|
|
82
|
+
if (newEventHandler) {
|
|
83
|
+
newEventHandler.call(this, e);
|
|
84
|
+
}
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
const arrayToMap = (arr) => {
|
|
88
|
+
const map = new Map();
|
|
89
|
+
arr.forEach((s) => map.set(s, s));
|
|
90
|
+
return map;
|
|
91
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const isDevMode = () => {
|
|
2
|
+
return process && process.env && process.env.NODE_ENV === 'development';
|
|
3
|
+
};
|
|
4
|
+
const warnings = {};
|
|
5
|
+
export const deprecationWarning = (key, message) => {
|
|
6
|
+
if (isDevMode()) {
|
|
7
|
+
if (!warnings[key]) {
|
|
8
|
+
console.warn(message);
|
|
9
|
+
warnings[key] = true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const setRef = (ref, value) => {
|
|
3
|
+
if (typeof ref === 'function') {
|
|
4
|
+
ref(value);
|
|
5
|
+
}
|
|
6
|
+
else if (ref != null) {
|
|
7
|
+
ref.current = value;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
export const mergeRefs = (...refs) => {
|
|
11
|
+
return (value) => {
|
|
12
|
+
refs.forEach((ref) => {
|
|
13
|
+
setRef(ref, value);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export const createForwardRef = (ReactComponent, displayName) => {
|
|
18
|
+
const forwardRef = (props, ref) => {
|
|
19
|
+
return React.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
|
|
20
|
+
};
|
|
21
|
+
forwardRef.displayName = displayName;
|
|
22
|
+
return React.forwardRef(forwardRef);
|
|
23
|
+
};
|
|
24
|
+
export const defineCustomElement = (tagName, customElement) => {
|
|
25
|
+
if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
|
|
26
|
+
customElements.define(tagName, customElement);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export * from './attachProps';
|
|
30
|
+
export * from './case';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { defineCustomElements } from "ai12z/loader";
|
|
2
|
-
import { Ai12zBot, Ai12zCta, Ai12zKnowledgeBox, Ai12zInlineSearch, Ai12zSearchPanel, SearchResultsPage, Ai12zContainer, Ai12zForm } from "./components/stencil-generated
|
|
2
|
+
import { Ai12zBot, Ai12zCta, Ai12zKnowledgeBox, Ai12zInlineSearch, Ai12zSearchPanel, SearchResultsPage, Ai12zContainer, Ai12zForm } from "./components/stencil-generated";
|
|
3
3
|
export { Ai12zBot, Ai12zCta, Ai12zKnowledgeBox, Ai12zInlineSearch, Ai12zSearchPanel, SearchResultsPage, Ai12zContainer, Ai12zForm };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JSX } from 'ai12z';
|
|
2
|
+
export declare const Ai12zBot: import("react").ForwardRefExoticComponent<JSX.Ai12zBot & Omit<import("react").HTMLAttributes<HTMLAi12zBotElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zBotElement>>;
|
|
3
|
+
export declare const Ai12zCarousel: import("react").ForwardRefExoticComponent<JSX.Ai12zCarousel & Omit<import("react").HTMLAttributes<HTMLAi12zCarouselElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zCarouselElement>>;
|
|
4
|
+
export declare const Ai12zCategory: import("react").ForwardRefExoticComponent<JSX.Ai12zCategory & Omit<import("react").HTMLAttributes<HTMLAi12zCategoryElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zCategoryElement>>;
|
|
5
|
+
export declare const Ai12zChat: import("react").ForwardRefExoticComponent<JSX.Ai12zChat & Omit<import("react").HTMLAttributes<HTMLAi12zChatElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zChatElement>>;
|
|
6
|
+
export declare const Ai12zChatMessage: import("react").ForwardRefExoticComponent<JSX.Ai12zChatMessage & Omit<import("react").HTMLAttributes<HTMLAi12zChatMessageElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zChatMessageElement>>;
|
|
7
|
+
export declare const Ai12zContainer: import("react").ForwardRefExoticComponent<JSX.Ai12zContainer & Omit<import("react").HTMLAttributes<HTMLAi12zContainerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zContainerElement>>;
|
|
8
|
+
export declare const Ai12zCta: import("react").ForwardRefExoticComponent<JSX.Ai12zCta & Omit<import("react").HTMLAttributes<HTMLAi12zCtaElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zCtaElement>>;
|
|
9
|
+
export declare const Ai12zForm: import("react").ForwardRefExoticComponent<JSX.Ai12zForm & Omit<import("react").HTMLAttributes<HTMLAi12zFormElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zFormElement>>;
|
|
10
|
+
export declare const Ai12zInlineSearch: import("react").ForwardRefExoticComponent<JSX.Ai12zInlineSearch & Omit<import("react").HTMLAttributes<HTMLAi12zInlineSearchElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zInlineSearchElement>>;
|
|
11
|
+
export declare const Ai12zInputForm: import("react").ForwardRefExoticComponent<JSX.Ai12zInputForm & Omit<import("react").HTMLAttributes<HTMLAi12zInputFormElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zInputFormElement>>;
|
|
12
|
+
export declare const Ai12zKnowledgeBox: import("react").ForwardRefExoticComponent<JSX.Ai12zKnowledgeBox & Omit<import("react").HTMLAttributes<HTMLAi12zKnowledgeBoxElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zKnowledgeBoxElement>>;
|
|
13
|
+
export declare const Ai12zMic: import("react").ForwardRefExoticComponent<JSX.Ai12zMic & Omit<import("react").HTMLAttributes<HTMLAi12zMicElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zMicElement>>;
|
|
14
|
+
export declare const Ai12zSearchPanel: import("react").ForwardRefExoticComponent<JSX.Ai12zSearchPanel & Omit<import("react").HTMLAttributes<HTMLAi12zSearchPanelElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zSearchPanelElement>>;
|
|
15
|
+
export declare const Ai12zSpinner: import("react").ForwardRefExoticComponent<JSX.Ai12zSpinner & Omit<import("react").HTMLAttributes<HTMLAi12zSpinnerElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLAi12zSpinnerElement>>;
|
|
16
|
+
export declare const SearchResultsPage: import("react").ForwardRefExoticComponent<JSX.SearchResultsPage & Omit<import("react").HTMLAttributes<HTMLSearchResultsPageElement>, "style"> & import("./react-component-lib/interfaces").StyleReactProps & import("react").RefAttributes<HTMLSearchResultsPageElement>>;
|
|
@@ -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>, manipulatePropsFunction?: (originalProps: StencilReactInternalProps<ElementType>, propsToPass: any) => ExpandedPropsTypes, defineCustomElement?: () => void) => React.ForwardRefExoticComponent<React.PropsWithoutRef<import("./utils").StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
|
|
10
|
+
export {};
|
package/dist/types/components/stencil-generated/react-component-lib/createOverlayComponent.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { OverlayEventDetail } from './interfaces';
|
|
3
|
+
import { StencilReactForwardedRef } from './utils';
|
|
4
|
+
interface OverlayElement extends HTMLElement {
|
|
5
|
+
present: () => Promise<void>;
|
|
6
|
+
dismiss: (data?: any, role?: string | undefined) => Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export interface ReactOverlayProps {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
onDidDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
12
|
+
onDidPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
13
|
+
onWillDismiss?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
14
|
+
onWillPresent?: (event: CustomEvent<OverlayEventDetail>) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const createOverlayComponent: <OverlayComponent extends object, OverlayType extends OverlayElement>(tagName: string, controller: {
|
|
17
|
+
create: (options: any) => Promise<OverlayType>;
|
|
18
|
+
}, customElement?: any) => React.ForwardRefExoticComponent<React.PropsWithoutRef<OverlayComponent & ReactOverlayProps & {
|
|
19
|
+
forwardedRef?: StencilReactForwardedRef<OverlayType>;
|
|
20
|
+
}> & React.RefAttributes<OverlayType>>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,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,9 @@
|
|
|
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 transformReactEventName: (eventNameSuffix: string) => string;
|
|
4
|
+
export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
|
|
5
|
+
export declare const syncEvent: (node: Element & {
|
|
6
|
+
__events?: {
|
|
7
|
+
[key: string]: ((e: Event) => any) | undefined;
|
|
8
|
+
};
|
|
9
|
+
}, eventName: string, newEventHandler?: (e: Event) => any) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleReactProps } from '../interfaces';
|
|
3
|
+
export type StencilReactExternalProps<PropType, ElementType> = PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps;
|
|
4
|
+
export 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';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { defineCustomElements } from "ai12z/loader";
|
|
2
|
-
import { Ai12zBot, Ai12zCta, Ai12zKnowledgeBox, Ai12zInlineSearch, Ai12zSearchPanel, SearchResultsPage, Ai12zContainer, Ai12zForm } from "./components/stencil-generated
|
|
2
|
+
import { Ai12zBot, Ai12zCta, Ai12zKnowledgeBox, Ai12zInlineSearch, Ai12zSearchPanel, SearchResultsPage, Ai12zContainer, Ai12zForm } from "./components/stencil-generated";
|
|
3
3
|
export { Ai12zBot, Ai12zCta, Ai12zKnowledgeBox, Ai12zInlineSearch, Ai12zSearchPanel, SearchResultsPage, Ai12zContainer, Ai12zForm };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai12z/react",
|
|
3
|
-
"version": "3.12.1-alpha.
|
|
3
|
+
"version": "3.12.1-alpha.5",
|
|
4
4
|
"description": "ai12z React Library",
|
|
5
5
|
"author": "Alpesh Patel <alpesh@ai12z.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@stencil/react-output-target": "1.2.0",
|
|
24
|
-
"ai12z": "^3.12.1-alpha.
|
|
24
|
+
"ai12z": "^3.12.1-alpha.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/react": "^18.3.0",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "23d5a843aed11fec2079b260385300ce18a63223"
|
|
37
37
|
}
|