@siemens/ix-react 3.0.0-alpha.0 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +1006 -0
- package/dist/components.js.map +1 -0
- package/dist/components.server.js +1283 -0
- package/dist/components.server.js.map +1 -0
- package/dist/context/application-context.js +22 -0
- package/dist/context/application-context.js.map +1 -0
- package/dist/context/context.js +14 -0
- package/dist/context/context.js.map +1 -0
- package/dist/delegate.js +77 -0
- package/dist/delegate.js.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/internal-components.js +13 -0
- package/dist/internal-components.js.map +1 -0
- package/dist/ix-icon.js +15 -0
- package/dist/ix-icon.js.map +1 -0
- package/dist/modal/index.js +17 -0
- package/dist/modal/index.js.map +1 -0
- package/dist/modal/modal.js +21 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/modal/portal.js +64 -0
- package/dist/modal/portal.js.map +1 -0
- package/dist/toast/toast.js +30 -0
- package/dist/toast/toast.js.map +1 -0
- package/dist/tree/internal-tree.js +21 -0
- package/dist/tree/internal-tree.js.map +1 -0
- package/dist/tree/tree.js +38 -0
- package/dist/tree/tree.js.map +1 -0
- package/dist/types/components/IxApplicationHeader.d.ts +12 -0
- package/dist/types/components/IxDateInput.d.ts +13 -0
- package/dist/types/components/IxFlipTile.d.ts +11 -0
- package/dist/types/components/IxMenu.d.ts +15 -0
- package/dist/types/components/IxMenuAbout.d.ts +13 -0
- package/dist/types/components/IxMenuSettings.d.ts +13 -0
- package/dist/types/components/IxMessageBar.d.ts +12 -0
- package/dist/types/components.d.ts +464 -0
- package/dist/types/components.server.d.ts +469 -0
- package/dist/types/context/application-context.d.ts +7 -0
- package/dist/types/context/context.d.ts +5 -0
- package/dist/types/context.d.ts +1 -0
- package/dist/types/delegate.d.ts +14 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/internal-components.d.ts +1 -0
- package/dist/types/ix-icon.d.ts +3 -0
- package/dist/types/modal/index.d.ts +6 -0
- package/dist/types/modal/modal.d.ts +9 -0
- package/dist/types/modal/portal.d.ts +5 -0
- package/dist/types/toast/index.d.ts +1 -0
- package/dist/types/toast/toast.d.ts +5 -0
- package/dist/types/tree/index.d.ts +1 -0
- package/dist/types/tree/internal-tree.d.ts +14 -0
- package/dist/types/tree/tree.d.ts +8 -0
- package/package.json +18 -12
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineCustomElement as defineCustomElement$1 } from '@siemens/ix/components/ix-toast-container.js';
|
|
3
|
+
import { defineCustomElement } from '@siemens/ix/components/ix-toast.js';
|
|
4
|
+
import { toast } from '@siemens/ix';
|
|
5
|
+
import ReactDOMClient from 'react-dom/client';
|
|
6
|
+
|
|
7
|
+
async function showToast(config) {
|
|
8
|
+
// Define custom element, otherwise dynamic creation of toast container will fail
|
|
9
|
+
defineCustomElement();
|
|
10
|
+
defineCustomElement$1();
|
|
11
|
+
if (typeof config.message === 'string') {
|
|
12
|
+
const toastInstance = await toast(config);
|
|
13
|
+
return toastInstance;
|
|
14
|
+
}
|
|
15
|
+
const node = config.message;
|
|
16
|
+
const toastContainer = document.createElement('DIV');
|
|
17
|
+
const root = ReactDOMClient.createRoot(toastContainer);
|
|
18
|
+
root.render(node);
|
|
19
|
+
const toastInstance = await toast({
|
|
20
|
+
...config,
|
|
21
|
+
message: toastContainer,
|
|
22
|
+
});
|
|
23
|
+
toastInstance.onClose.once(() => {
|
|
24
|
+
root.unmount();
|
|
25
|
+
});
|
|
26
|
+
return toastInstance;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { showToast };
|
|
30
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sources":["../../src/toast/toast.ts"],"sourcesContent":["'use client';\n/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { defineCustomElement as defineToastContainer } from '@siemens/ix/components/ix-toast-container.js';\nimport { defineCustomElement as defineToast } from '@siemens/ix/components/ix-toast.js';\n\nimport { toast, ToastConfig as IxToastConfig } from '@siemens/ix';\nimport ReactDOMClient from 'react-dom/client';\n\nexport type ToastConfig = {\n message: string | React.ReactNode;\n};\n\nexport async function showToast(\n config: Omit<IxToastConfig, 'message'> & ToastConfig\n) {\n // Define custom element, otherwise dynamic creation of toast container will fail\n defineToast();\n defineToastContainer();\n\n if (typeof config.message === 'string') {\n const toastInstance = await toast(config as IxToastConfig);\n return toastInstance;\n }\n\n const node = config.message as React.ReactNode;\n const toastContainer = document.createElement('DIV');\n const root = ReactDOMClient.createRoot(toastContainer);\n root.render(node);\n\n const toastInstance = await toast({\n ...config,\n message: toastContainer,\n });\n\n toastInstance.onClose.once(() => {\n root.unmount();\n });\n\n return toastInstance;\n}\n"],"names":[],"mappings":";;;;;;AAmBO;;AAIL;AACA;AAEA;AACE;AACA;;AAGF;;;AAGA;AAEA;AACE;AACA;AACD;AAED;;AAEA;AAEA;AACF;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { IxTree, defineCustomElement } from '@siemens/ix/components/ix-tree.js';
|
|
3
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
const InternalIxTree =
|
|
7
|
+
/*@__PURE__*/ createComponent({
|
|
8
|
+
tagName: 'ix-tree',
|
|
9
|
+
elementClass: IxTree,
|
|
10
|
+
react: React,
|
|
11
|
+
events: {
|
|
12
|
+
onContextChange: 'contextChange',
|
|
13
|
+
onNodeToggled: 'nodeToggled',
|
|
14
|
+
onNodeClicked: 'nodeClicked',
|
|
15
|
+
onNodeRemoved: 'nodeRemoved',
|
|
16
|
+
},
|
|
17
|
+
defineCustomElement: defineCustomElement,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export { InternalIxTree as default };
|
|
21
|
+
//# sourceMappingURL=internal-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-tree.js","sources":["../../src/tree/internal-tree.tsx"],"sourcesContent":["'use client';\n/* eslint-disable */\n\n/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { type IxTreeCustomEvent, type TreeContext } from '@siemens/ix';\nimport {\n IxTree as IxTreeElement,\n defineCustomElement as defineIxTree,\n} from '@siemens/ix/components/ix-tree.js';\nimport {\n createComponent,\n type EventName,\n type StencilReactComponent,\n} from '@stencil/react-output-target/runtime';\nimport React from 'react';\n\ntype IxTreeEvents = {\n onContextChange: EventName<IxTreeCustomEvent<TreeContext>>;\n onNodeToggled: EventName<CustomEvent<{ id: string; isExpaned: boolean }>>;\n onNodeClicked: EventName<CustomEvent<string>>;\n onNodeRemoved: EventName<CustomEvent<any>>;\n};\n\nconst InternalIxTree: StencilReactComponent<IxTreeElement, IxTreeEvents> =\n /*@__PURE__*/ createComponent<IxTreeElement, IxTreeEvents>({\n tagName: 'ix-tree',\n elementClass: IxTreeElement,\n react: React,\n events: {\n onContextChange: 'contextChange',\n onNodeToggled: 'nodeToggled',\n onNodeClicked: 'nodeClicked',\n onNodeRemoved: 'nodeRemoved',\n } as IxTreeEvents,\n defineCustomElement: defineIxTree,\n });\n\nexport default InternalIxTree;\n"],"names":[],"mappings":";;;;;AA+BA;AACE;AACE;AACA;AACA;AACA;AACE;AACA;AACA;AACA;AACe;AACjB;AACD;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useCallback } from 'react';
|
|
4
|
+
import ReactDOMClient from 'react-dom/client';
|
|
5
|
+
import InternalIxTree from './internal-tree.js';
|
|
6
|
+
|
|
7
|
+
const IxTree = (props) => {
|
|
8
|
+
const cachedRootNodes = useRef(new Map());
|
|
9
|
+
const renderItem = useCallback((_, data, __, context, update) => {
|
|
10
|
+
const treeItem = document.createElement('ix-tree-item');
|
|
11
|
+
treeItem.hasChildren = data.hasChildren;
|
|
12
|
+
treeItem.context = context[data.id];
|
|
13
|
+
update((itemData, context) => {
|
|
14
|
+
treeItem.context = context[itemData.id];
|
|
15
|
+
treeItem.hasChildren = itemData.hasChildren;
|
|
16
|
+
});
|
|
17
|
+
const container = document.createElement('DIV');
|
|
18
|
+
const rootNode = ReactDOMClient.createRoot(container);
|
|
19
|
+
if (props.renderItem) {
|
|
20
|
+
rootNode.render(props.renderItem(data.data));
|
|
21
|
+
}
|
|
22
|
+
treeItem.appendChild(container);
|
|
23
|
+
cachedRootNodes.current.set(treeItem, rootNode);
|
|
24
|
+
return treeItem;
|
|
25
|
+
}, []);
|
|
26
|
+
return (jsx(InternalIxTree, { ...props, renderItem: props.renderItem ? renderItem : undefined, onNodeRemoved: (removed) => {
|
|
27
|
+
const { detail } = removed;
|
|
28
|
+
detail.forEach((removedItemElement) => {
|
|
29
|
+
if (cachedRootNodes.current.has(removedItemElement)) {
|
|
30
|
+
cachedRootNodes.current.get(removedItemElement)?.unmount();
|
|
31
|
+
cachedRootNodes.current.delete(removedItemElement);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
} }));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { IxTree, IxTree as default };
|
|
38
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sources":["../../src/tree/tree.tsx"],"sourcesContent":["'use client';\n/*\n * SPDX-FileCopyrightText: 2024 Siemens AG\n *\n * SPDX-License-Identifier: MIT\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { type TreeContext, UpdateCallback } from '@siemens/ix';\nimport React, { useCallback, useRef } from 'react';\nimport ReactDOM, { Root } from 'react-dom/client';\nimport InternalIxTree from './internal-tree';\n\ntype ExtractProps<TComponentOrTProps> =\n TComponentOrTProps extends React.ComponentType<infer TProps>\n ? TProps\n : TComponentOrTProps;\n\ntype IxTreeProps = ExtractProps<typeof InternalIxTree> & {\n renderItem?: (data: any) => React.ReactNode;\n};\n\nexport const IxTree = (props: IxTreeProps) => {\n const cachedRootNodes = useRef<Map<HTMLElement, Root>>(new Map());\n\n const renderItem = useCallback(\n (\n _: number,\n data: any,\n __: any[],\n context: TreeContext,\n update: (callback: UpdateCallback) => void\n ) => {\n const treeItem = document.createElement('ix-tree-item');\n treeItem.hasChildren = data.hasChildren;\n treeItem.context = context[data.id];\n\n update((itemData, context) => {\n treeItem.context = context[itemData.id];\n treeItem.hasChildren = itemData.hasChildren;\n });\n\n const container = document.createElement('DIV');\n const rootNode = ReactDOM.createRoot(container);\n if (props.renderItem) {\n rootNode.render(props.renderItem(data.data));\n }\n\n treeItem.appendChild(container);\n cachedRootNodes.current.set(treeItem, rootNode);\n\n return treeItem;\n },\n []\n );\n\n return (\n <InternalIxTree\n {...props}\n renderItem={props.renderItem ? renderItem : undefined}\n onNodeRemoved={(removed: CustomEvent<any[]>) => {\n const { detail } = removed;\n\n detail.forEach((removedItemElement) => {\n if (cachedRootNodes.current.has(removedItemElement)) {\n cachedRootNodes.current.get(removedItemElement)?.unmount();\n cachedRootNodes.current.delete(removedItemElement);\n }\n });\n }}\n ></InternalIxTree>\n );\n};\n\nexport default IxTree;\n"],"names":[],"mappings":";;;;;;AAwBa;;AAGX;;AASI;;AAGA;;AAEE;AACF;;;AAIA;AACE;;AAGF;;AAGA;;;AAUE;AAEA;;;AAGI;;AAEJ;;AAIR;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { IxApplicationHeader as IxApplicationHeaderElement } from "@siemens/ix/components/ix-application-header.js";
|
|
6
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
7
|
+
type IxApplicationHeaderEvents = {
|
|
8
|
+
onMenuToggle: EventName<CustomEvent<boolean>>;
|
|
9
|
+
onOpenAppSwitch: EventName<CustomEvent<void>>;
|
|
10
|
+
};
|
|
11
|
+
declare const IxApplicationHeader: StencilReactComponent<IxApplicationHeaderElement, IxApplicationHeaderEvents>;
|
|
12
|
+
export default IxApplicationHeader;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { type DateInputValidityState, type IxDateInputCustomEvent } from "@siemens/ix";
|
|
6
|
+
import { IxDateInput as IxDateInputElement } from "@siemens/ix/components/ix-date-input.js";
|
|
7
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
8
|
+
type IxDateInputEvents = {
|
|
9
|
+
onValueChange: EventName<CustomEvent<string | undefined>>;
|
|
10
|
+
onValidityStateChange: EventName<IxDateInputCustomEvent<DateInputValidityState>>;
|
|
11
|
+
};
|
|
12
|
+
declare const IxDateInput: StencilReactComponent<IxDateInputElement, IxDateInputEvents>;
|
|
13
|
+
export default IxDateInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { IxFlipTile as IxFlipTileElement } from "@siemens/ix/components/ix-flip-tile.js";
|
|
6
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
7
|
+
type IxFlipTileEvents = {
|
|
8
|
+
onToggle: EventName<CustomEvent<number>>;
|
|
9
|
+
};
|
|
10
|
+
declare const IxFlipTile: StencilReactComponent<IxFlipTileElement, IxFlipTileEvents>;
|
|
11
|
+
export default IxFlipTile;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { IxMenu as IxMenuElement } from "@siemens/ix/components/ix-menu.js";
|
|
6
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
7
|
+
type IxMenuEvents = {
|
|
8
|
+
onExpandChange: EventName<CustomEvent<boolean>>;
|
|
9
|
+
onMapExpandChange: EventName<CustomEvent<boolean>>;
|
|
10
|
+
onOpenAppSwitch: EventName<CustomEvent<void>>;
|
|
11
|
+
onOpenSettings: EventName<CustomEvent<void>>;
|
|
12
|
+
onOpenAbout: EventName<CustomEvent<void>>;
|
|
13
|
+
};
|
|
14
|
+
declare const IxMenu: StencilReactComponent<IxMenuElement, IxMenuEvents>;
|
|
15
|
+
export default IxMenu;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { type CustomCloseEvent, type IxMenuAboutCustomEvent } from "@siemens/ix";
|
|
6
|
+
import { IxMenuAbout as IxMenuAboutElement } from "@siemens/ix/components/ix-menu-about.js";
|
|
7
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
8
|
+
type IxMenuAboutEvents = {
|
|
9
|
+
onTabChange: EventName<CustomEvent<string>>;
|
|
10
|
+
onClose: EventName<IxMenuAboutCustomEvent<CustomCloseEvent>>;
|
|
11
|
+
};
|
|
12
|
+
declare const IxMenuAbout: StencilReactComponent<IxMenuAboutElement, IxMenuAboutEvents>;
|
|
13
|
+
export default IxMenuAbout;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { type CustomCloseEvent, type IxMenuSettingsCustomEvent } from "@siemens/ix";
|
|
6
|
+
import { IxMenuSettings as IxMenuSettingsElement } from "@siemens/ix/components/ix-menu-settings.js";
|
|
7
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
8
|
+
type IxMenuSettingsEvents = {
|
|
9
|
+
onTabChange: EventName<CustomEvent<string>>;
|
|
10
|
+
onClose: EventName<IxMenuSettingsCustomEvent<CustomCloseEvent>>;
|
|
11
|
+
};
|
|
12
|
+
declare const IxMenuSettings: StencilReactComponent<IxMenuSettingsElement, IxMenuSettingsEvents>;
|
|
13
|
+
export default IxMenuSettings;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by the Stencil React Output Target.
|
|
3
|
+
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4
|
+
*/
|
|
5
|
+
import { IxMessageBar as IxMessageBarElement } from "@siemens/ix/components/ix-message-bar.js";
|
|
6
|
+
import type { EventName, StencilReactComponent } from '@stencil/react-output-target/runtime';
|
|
7
|
+
type IxMessageBarEvents = {
|
|
8
|
+
onClosedChange: EventName<CustomEvent<any>>;
|
|
9
|
+
onCloseAnimationCompleted: EventName<CustomEvent<any>>;
|
|
10
|
+
};
|
|
11
|
+
declare const IxMessageBar: StencilReactComponent<IxMessageBarElement, IxMessageBarEvents>;
|
|
12
|
+
export default IxMessageBar;
|