@diwacopilot/components-react 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +19 -0
  2. package/dist/components.d.ts +58 -0
  3. package/dist/components.d.ts.map +1 -0
  4. package/dist/components.js +63 -0
  5. package/dist/index.d.ts +6 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +8 -0
  8. package/dist/react-component-lib/createComponent.d.ts +11 -0
  9. package/dist/react-component-lib/createComponent.d.ts.map +1 -0
  10. package/dist/react-component-lib/createComponent.js +67 -0
  11. package/dist/react-component-lib/createOverlayComponent.d.ts +22 -0
  12. package/dist/react-component-lib/createOverlayComponent.d.ts.map +1 -0
  13. package/dist/react-component-lib/createOverlayComponent.js +97 -0
  14. package/dist/react-component-lib/index.d.ts +3 -0
  15. package/dist/react-component-lib/index.d.ts.map +1 -0
  16. package/dist/react-component-lib/index.js +2 -0
  17. package/dist/react-component-lib/interfaces.d.ts +30 -0
  18. package/dist/react-component-lib/interfaces.d.ts.map +1 -0
  19. package/dist/react-component-lib/interfaces.js +1 -0
  20. package/dist/react-component-lib/utils/attachProps.d.ts +17 -0
  21. package/dist/react-component-lib/utils/attachProps.d.ts.map +1 -0
  22. package/dist/react-component-lib/utils/attachProps.js +107 -0
  23. package/dist/react-component-lib/utils/case.d.ts +3 -0
  24. package/dist/react-component-lib/utils/case.d.ts.map +1 -0
  25. package/dist/react-component-lib/utils/case.js +6 -0
  26. package/dist/react-component-lib/utils/dev.d.ts +3 -0
  27. package/dist/react-component-lib/utils/dev.d.ts.map +1 -0
  28. package/dist/react-component-lib/utils/dev.js +12 -0
  29. package/dist/react-component-lib/utils/index.d.ts +11 -0
  30. package/dist/react-component-lib/utils/index.d.ts.map +1 -0
  31. package/dist/react-component-lib/utils/index.js +33 -0
  32. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @diwacopilot/components-react
2
+
3
+ React wrappers for `@diwacopilot/components`.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @diwacopilot/components @diwacopilot/components-react
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { DButton } from "@diwacopilot/components-react";
15
+
16
+ export function App() {
17
+ return <DButton label="Continue" />;
18
+ }
19
+ ```
@@ -0,0 +1,58 @@
1
+ export declare const DiwaAccordion: import("react").ForwardRefExoticComponent<any>;
2
+ export declare const DiwaBadge: import("react").ForwardRefExoticComponent<any>;
3
+ export declare const DiwaButton: import("react").ForwardRefExoticComponent<any>;
4
+ export declare const DiwaButtonPure: import("react").ForwardRefExoticComponent<any>;
5
+ export declare const DiwaCheckbox: import("react").ForwardRefExoticComponent<any>;
6
+ export declare const DiwaDivider: import("react").ForwardRefExoticComponent<any>;
7
+ export declare const DiwaFlyout: import("react").ForwardRefExoticComponent<any>;
8
+ export declare const DiwaIcon: import("react").ForwardRefExoticComponent<any>;
9
+ export declare const DiwaInlineNotification: import("react").ForwardRefExoticComponent<any>;
10
+ export declare const DiwaInput: import("react").ForwardRefExoticComponent<any>;
11
+ export declare const DiwaInputDate: import("react").ForwardRefExoticComponent<any>;
12
+ export declare const DiwaInputEmail: import("react").ForwardRefExoticComponent<any>;
13
+ export declare const DiwaInputMonth: import("react").ForwardRefExoticComponent<any>;
14
+ export declare const DiwaInputNumber: import("react").ForwardRefExoticComponent<any>;
15
+ export declare const DiwaInputPassword: import("react").ForwardRefExoticComponent<any>;
16
+ export declare const DiwaInputSearch: import("react").ForwardRefExoticComponent<any>;
17
+ export declare const DiwaInputTel: import("react").ForwardRefExoticComponent<any>;
18
+ export declare const DiwaInputText: import("react").ForwardRefExoticComponent<any>;
19
+ export declare const DiwaInputTime: import("react").ForwardRefExoticComponent<any>;
20
+ export declare const DiwaInputUrl: import("react").ForwardRefExoticComponent<any>;
21
+ export declare const DiwaInputWeek: import("react").ForwardRefExoticComponent<any>;
22
+ export declare const DiwaLink: import("react").ForwardRefExoticComponent<any>;
23
+ export declare const DiwaLinkPure: import("react").ForwardRefExoticComponent<any>;
24
+ export declare const DiwaModal: import("react").ForwardRefExoticComponent<any>;
25
+ export declare const DiwaMultiSelect: import("react").ForwardRefExoticComponent<any>;
26
+ export declare const DiwaMultiSelectOption: import("react").ForwardRefExoticComponent<any>;
27
+ export declare const DiwaPagination: import("react").ForwardRefExoticComponent<any>;
28
+ export declare const DiwaPinCode: import("react").ForwardRefExoticComponent<any>;
29
+ export declare const DiwaPopover: import("react").ForwardRefExoticComponent<any>;
30
+ export declare const DiwaRadioGroup: import("react").ForwardRefExoticComponent<any>;
31
+ export declare const DiwaRadioGroupItem: import("react").ForwardRefExoticComponent<any>;
32
+ export declare const DiwaScroller: import("react").ForwardRefExoticComponent<any>;
33
+ export declare const DiwaSegmentedControl: import("react").ForwardRefExoticComponent<any>;
34
+ export declare const DiwaSegmentedControlItem: import("react").ForwardRefExoticComponent<any>;
35
+ export declare const DiwaSelect: import("react").ForwardRefExoticComponent<any>;
36
+ export declare const DiwaSelectOption: import("react").ForwardRefExoticComponent<any>;
37
+ export declare const DiwaSpinner: import("react").ForwardRefExoticComponent<any>;
38
+ export declare const DiwaStepperHorizontal: import("react").ForwardRefExoticComponent<any>;
39
+ export declare const DiwaStepperHorizontalItem: import("react").ForwardRefExoticComponent<any>;
40
+ export declare const DiwaSwitch: import("react").ForwardRefExoticComponent<any>;
41
+ export declare const DiwaTable: import("react").ForwardRefExoticComponent<any>;
42
+ export declare const DiwaTableBody: import("react").ForwardRefExoticComponent<any>;
43
+ export declare const DiwaTableCell: import("react").ForwardRefExoticComponent<any>;
44
+ export declare const DiwaTableHead: import("react").ForwardRefExoticComponent<any>;
45
+ export declare const DiwaTableHeadCell: import("react").ForwardRefExoticComponent<any>;
46
+ export declare const DiwaTableRow: import("react").ForwardRefExoticComponent<any>;
47
+ export declare const DiwaTabs: import("react").ForwardRefExoticComponent<any>;
48
+ export declare const DiwaTabsBar: import("react").ForwardRefExoticComponent<any>;
49
+ export declare const DiwaTabsItem: import("react").ForwardRefExoticComponent<any>;
50
+ export declare const DiwaTag: import("react").ForwardRefExoticComponent<any>;
51
+ export declare const DiwaTagDismissible: import("react").ForwardRefExoticComponent<any>;
52
+ export declare const DiwaText: import("react").ForwardRefExoticComponent<any>;
53
+ export declare const DiwaTextList: import("react").ForwardRefExoticComponent<any>;
54
+ export declare const DiwaTextListItem: import("react").ForwardRefExoticComponent<any>;
55
+ export declare const DiwaTextarea: import("react").ForwardRefExoticComponent<any>;
56
+ export declare const DiwaToast: import("react").ForwardRefExoticComponent<any>;
57
+ export declare const DiwaToastItem: import("react").ForwardRefExoticComponent<any>;
58
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa,gDAAmG,CAAC;AAC9H,eAAO,MAAM,SAAS,gDAAuF,CAAC;AAC9G,eAAO,MAAM,UAAU,gDAA0F,CAAC;AAClH,eAAO,MAAM,cAAc,gDAAuG,CAAC;AACnI,eAAO,MAAM,YAAY,gDAAgG,CAAC;AAC1H,eAAO,MAAM,WAAW,gDAA6F,CAAC;AACtH,eAAO,MAAM,UAAU,gDAA0F,CAAC;AAClH,eAAO,MAAM,QAAQ,gDAAoF,CAAC;AAC1G,eAAO,MAAM,sBAAsB,gDAA+H,CAAC;AACnK,eAAO,MAAM,SAAS,gDAAuF,CAAC;AAC9G,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,cAAc,gDAAuG,CAAC;AACnI,eAAO,MAAM,cAAc,gDAAuG,CAAC;AACnI,eAAO,MAAM,eAAe,gDAA0G,CAAC;AACvI,eAAO,MAAM,iBAAiB,gDAAgH,CAAC;AAC/I,eAAO,MAAM,eAAe,gDAA0G,CAAC;AACvI,eAAO,MAAM,YAAY,gDAAiG,CAAC;AAC3H,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,YAAY,gDAAiG,CAAC;AAC3H,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,QAAQ,gDAAoF,CAAC;AAC1G,eAAO,MAAM,YAAY,gDAAiG,CAAC;AAC3H,eAAO,MAAM,SAAS,gDAAuF,CAAC;AAC9G,eAAO,MAAM,eAAe,gDAA0G,CAAC;AACvI,eAAO,MAAM,qBAAqB,gDAA6H,CAAC;AAChK,eAAO,MAAM,cAAc,gDAAsG,CAAC;AAClI,eAAO,MAAM,WAAW,gDAA8F,CAAC;AACvH,eAAO,MAAM,WAAW,gDAA6F,CAAC;AACtH,eAAO,MAAM,cAAc,gDAAuG,CAAC;AACnI,eAAO,MAAM,kBAAkB,gDAAoH,CAAC;AACpJ,eAAO,MAAM,YAAY,gDAAgG,CAAC;AAC1H,eAAO,MAAM,oBAAoB,gDAAyH,CAAC;AAC3J,eAAO,MAAM,wBAAwB,gDAAsI,CAAC;AAC5K,eAAO,MAAM,UAAU,gDAA0F,CAAC;AAClH,eAAO,MAAM,gBAAgB,gDAA6G,CAAC;AAC3I,eAAO,MAAM,WAAW,gDAA6F,CAAC;AACtH,eAAO,MAAM,qBAAqB,gDAA4H,CAAC;AAC/J,eAAO,MAAM,yBAAyB,gDAAyI,CAAC;AAChL,eAAO,MAAM,UAAU,gDAA0F,CAAC;AAClH,eAAO,MAAM,SAAS,gDAAuF,CAAC;AAC9G,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,aAAa,gDAAoG,CAAC;AAC/H,eAAO,MAAM,iBAAiB,gDAAiH,CAAC;AAChJ,eAAO,MAAM,YAAY,gDAAiG,CAAC;AAC3H,eAAO,MAAM,QAAQ,gDAAoF,CAAC;AAC1G,eAAO,MAAM,WAAW,gDAA8F,CAAC;AACvH,eAAO,MAAM,YAAY,gDAAiG,CAAC;AAC3H,eAAO,MAAM,OAAO,gDAAiF,CAAC;AACtG,eAAO,MAAM,kBAAkB,gDAAmH,CAAC;AACnJ,eAAO,MAAM,QAAQ,gDAAoF,CAAC;AAC1G,eAAO,MAAM,YAAY,gDAAiG,CAAC;AAC3H,eAAO,MAAM,gBAAgB,gDAA8G,CAAC;AAC5I,eAAO,MAAM,YAAY,gDAAgG,CAAC;AAC1H,eAAO,MAAM,SAAS,gDAAuF,CAAC;AAC9G,eAAO,MAAM,aAAa,gDAAoG,CAAC"}
@@ -0,0 +1,63 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ /* auto-generated react proxies */
4
+ import { createReactComponent } from './react-component-lib';
5
+ import { defineCustomElements } from '@diwacopilot/components/loader';
6
+ defineCustomElements();
7
+ export const DiwaAccordion = /*@__PURE__*/ createReactComponent('diwa-accordion');
8
+ export const DiwaBadge = /*@__PURE__*/ createReactComponent('diwa-badge');
9
+ export const DiwaButton = /*@__PURE__*/ createReactComponent('diwa-button');
10
+ export const DiwaButtonPure = /*@__PURE__*/ createReactComponent('diwa-button-pure');
11
+ export const DiwaCheckbox = /*@__PURE__*/ createReactComponent('diwa-checkbox');
12
+ export const DiwaDivider = /*@__PURE__*/ createReactComponent('diwa-divider');
13
+ export const DiwaFlyout = /*@__PURE__*/ createReactComponent('diwa-flyout');
14
+ export const DiwaIcon = /*@__PURE__*/ createReactComponent('diwa-icon');
15
+ export const DiwaInlineNotification = /*@__PURE__*/ createReactComponent('diwa-inline-notification');
16
+ export const DiwaInput = /*@__PURE__*/ createReactComponent('diwa-input');
17
+ export const DiwaInputDate = /*@__PURE__*/ createReactComponent('diwa-input-date');
18
+ export const DiwaInputEmail = /*@__PURE__*/ createReactComponent('diwa-input-email');
19
+ export const DiwaInputMonth = /*@__PURE__*/ createReactComponent('diwa-input-month');
20
+ export const DiwaInputNumber = /*@__PURE__*/ createReactComponent('diwa-input-number');
21
+ export const DiwaInputPassword = /*@__PURE__*/ createReactComponent('diwa-input-password');
22
+ export const DiwaInputSearch = /*@__PURE__*/ createReactComponent('diwa-input-search');
23
+ export const DiwaInputTel = /*@__PURE__*/ createReactComponent('diwa-input-tel');
24
+ export const DiwaInputText = /*@__PURE__*/ createReactComponent('diwa-input-text');
25
+ export const DiwaInputTime = /*@__PURE__*/ createReactComponent('diwa-input-time');
26
+ export const DiwaInputUrl = /*@__PURE__*/ createReactComponent('diwa-input-url');
27
+ export const DiwaInputWeek = /*@__PURE__*/ createReactComponent('diwa-input-week');
28
+ export const DiwaLink = /*@__PURE__*/ createReactComponent('diwa-link');
29
+ export const DiwaLinkPure = /*@__PURE__*/ createReactComponent('diwa-link-pure');
30
+ export const DiwaModal = /*@__PURE__*/ createReactComponent('diwa-modal');
31
+ export const DiwaMultiSelect = /*@__PURE__*/ createReactComponent('diwa-multi-select');
32
+ export const DiwaMultiSelectOption = /*@__PURE__*/ createReactComponent('diwa-multi-select-option');
33
+ export const DiwaPagination = /*@__PURE__*/ createReactComponent('diwa-pagination');
34
+ export const DiwaPinCode = /*@__PURE__*/ createReactComponent('diwa-pin-code');
35
+ export const DiwaPopover = /*@__PURE__*/ createReactComponent('diwa-popover');
36
+ export const DiwaRadioGroup = /*@__PURE__*/ createReactComponent('diwa-radio-group');
37
+ export const DiwaRadioGroupItem = /*@__PURE__*/ createReactComponent('diwa-radio-group-item');
38
+ export const DiwaScroller = /*@__PURE__*/ createReactComponent('diwa-scroller');
39
+ export const DiwaSegmentedControl = /*@__PURE__*/ createReactComponent('diwa-segmented-control');
40
+ export const DiwaSegmentedControlItem = /*@__PURE__*/ createReactComponent('diwa-segmented-control-item');
41
+ export const DiwaSelect = /*@__PURE__*/ createReactComponent('diwa-select');
42
+ export const DiwaSelectOption = /*@__PURE__*/ createReactComponent('diwa-select-option');
43
+ export const DiwaSpinner = /*@__PURE__*/ createReactComponent('diwa-spinner');
44
+ export const DiwaStepperHorizontal = /*@__PURE__*/ createReactComponent('diwa-stepper-horizontal');
45
+ export const DiwaStepperHorizontalItem = /*@__PURE__*/ createReactComponent('diwa-stepper-horizontal-item');
46
+ export const DiwaSwitch = /*@__PURE__*/ createReactComponent('diwa-switch');
47
+ export const DiwaTable = /*@__PURE__*/ createReactComponent('diwa-table');
48
+ export const DiwaTableBody = /*@__PURE__*/ createReactComponent('diwa-table-body');
49
+ export const DiwaTableCell = /*@__PURE__*/ createReactComponent('diwa-table-cell');
50
+ export const DiwaTableHead = /*@__PURE__*/ createReactComponent('diwa-table-head');
51
+ export const DiwaTableHeadCell = /*@__PURE__*/ createReactComponent('diwa-table-head-cell');
52
+ export const DiwaTableRow = /*@__PURE__*/ createReactComponent('diwa-table-row');
53
+ export const DiwaTabs = /*@__PURE__*/ createReactComponent('diwa-tabs');
54
+ export const DiwaTabsBar = /*@__PURE__*/ createReactComponent('diwa-tabs-bar');
55
+ export const DiwaTabsItem = /*@__PURE__*/ createReactComponent('diwa-tabs-item');
56
+ export const DiwaTag = /*@__PURE__*/ createReactComponent('diwa-tag');
57
+ export const DiwaTagDismissible = /*@__PURE__*/ createReactComponent('diwa-tag-dismissible');
58
+ export const DiwaText = /*@__PURE__*/ createReactComponent('diwa-text');
59
+ export const DiwaTextList = /*@__PURE__*/ createReactComponent('diwa-text-list');
60
+ export const DiwaTextListItem = /*@__PURE__*/ createReactComponent('diwa-text-list-item');
61
+ export const DiwaTextarea = /*@__PURE__*/ createReactComponent('diwa-textarea');
62
+ export const DiwaToast = /*@__PURE__*/ createReactComponent('diwa-toast');
63
+ export const DiwaToastItem = /*@__PURE__*/ createReactComponent('diwa-toast-item');
@@ -0,0 +1,6 @@
1
+ export * from './components';
2
+ export { DiwaBadge as DBadge } from './components';
3
+ export { DiwaButton as DButton } from './components';
4
+ export { DiwaInput as DInput } from './components';
5
+ export { DiwaSpinner as DSpinner } from './components';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAI7B,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,WAAW,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // Re-export everything from the Stencil-generated proxies.
2
+ export * from './components';
3
+ // D* aliases — the public API name consumers should use.
4
+ // The Diwa* variants remain available for backwards compatibility.
5
+ export { DiwaBadge as DBadge } from './components';
6
+ export { DiwaButton as DButton } from './components';
7
+ export { DiwaInput as DInput } from './components';
8
+ export { DiwaSpinner as DSpinner } from './components';
@@ -0,0 +1,11 @@
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 {};
11
+ //# sourceMappingURL=createComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createComponent.d.ts","sourceRoot":"","sources":["../../src/react-component-lib/createComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAI7C,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,UAAU,yBAAyB,CAAC,WAAW,CAAE,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACxF,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,EACR,WAAW,SAAS,kBAAkB,EACtC,gBAAgB,GAAG,EAAE,EACrB,kBAAkB,GAAG,EAAE,EAEvB,SAAS,MAAM,EACf,wBAAwB,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,EACvD,0BAA0B,CACxB,aAAa,EAAE,yBAAyB,CAAC,WAAW,CAAC,EACrD,WAAW,EAAE,GAAG,KACb,kBAAkB,EACvB,sBAAsB,MAAM,IAAI,kKAgFjC,CAAC"}
@@ -0,0 +1,67 @@
1
+ import React, { createElement } from 'react';
2
+ import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils';
3
+ export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
4
+ if (defineCustomElement !== undefined) {
5
+ defineCustomElement();
6
+ }
7
+ const displayName = dashToPascalCase(tagName);
8
+ const ReactComponent = class extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this.setComponentElRef = (element) => {
12
+ this.componentEl = element;
13
+ };
14
+ }
15
+ componentDidMount() {
16
+ this.componentDidUpdate(this.props);
17
+ }
18
+ componentDidUpdate(prevProps) {
19
+ attachProps(this.componentEl, this.props, prevProps);
20
+ }
21
+ render() {
22
+ const { children, forwardedRef, style, className, ref, ...cProps } = this.props;
23
+ let propsToPass = Object.keys(cProps).reduce((acc, name) => {
24
+ const value = cProps[name];
25
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
26
+ const eventName = name.substring(2).toLowerCase();
27
+ if (typeof document !== 'undefined' && isCoveredByReact(eventName)) {
28
+ acc[name] = value;
29
+ }
30
+ }
31
+ else {
32
+ // we should only render strings, booleans, and numbers as attrs in html.
33
+ // objects, functions, arrays etc get synced via properties on mount.
34
+ const type = typeof value;
35
+ if (type === 'string' || type === 'boolean' || type === 'number') {
36
+ acc[camelToDashCase(name)] = value;
37
+ }
38
+ }
39
+ return acc;
40
+ }, {});
41
+ if (manipulatePropsFunction) {
42
+ propsToPass = manipulatePropsFunction(this.props, propsToPass);
43
+ }
44
+ const newProps = {
45
+ ...propsToPass,
46
+ ref: mergeRefs(forwardedRef, this.setComponentElRef),
47
+ style,
48
+ };
49
+ /**
50
+ * We use createElement here instead of
51
+ * React.createElement to work around a
52
+ * bug in Vite (https://github.com/vitejs/vite/issues/6104).
53
+ * React.createElement causes all elements to be rendered
54
+ * as <tagname> instead of the actual Web Component.
55
+ */
56
+ return createElement(tagName, newProps, children);
57
+ }
58
+ static get displayName() {
59
+ return displayName;
60
+ }
61
+ };
62
+ // If context was passed to createReactComponent then conditionally add it to the Component Class
63
+ if (ReactComponentContext) {
64
+ ReactComponent.contextType = ReactComponentContext;
65
+ }
66
+ return createForwardRef(ReactComponent, displayName);
67
+ };
@@ -0,0 +1,22 @@
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 {};
22
+ //# sourceMappingURL=createOverlayComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createOverlayComponent.d.ts","sourceRoot":"","sources":["../../src/react-component-lib/createOverlayComponent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAA8D,MAAM,SAAS,CAAC;AAE/G,UAAU,cAAe,SAAQ,WAAW;IAC1C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAChE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IACjE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;CAClE;AAED,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,SAAS,MAAM,EAAE,WAAW,SAAS,cAAc,EACxG,SAAS,MAAM,EACf,YAAY;IAAE,MAAM,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,WAAW,CAAC,CAAA;CAAE,EAC9D,gBAAgB,GAAG;mBAYA,wBAAwB,CAAC,WAAW,CAAC;sCA0GzD,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // @ts-nocheck
3
+ import React from 'react';
4
+ import ReactDOM from 'react-dom';
5
+ import { attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
6
+ export const createOverlayComponent = (tagName, controller, customElement) => {
7
+ defineCustomElement(tagName, customElement);
8
+ const displayName = dashToPascalCase(tagName);
9
+ const didDismissEventName = `on${displayName}DidDismiss`;
10
+ const didPresentEventName = `on${displayName}DidPresent`;
11
+ const willDismissEventName = `on${displayName}WillDismiss`;
12
+ const willPresentEventName = `on${displayName}WillPresent`;
13
+ let isDismissing = false;
14
+ class Overlay extends React.Component {
15
+ constructor(props) {
16
+ super(props);
17
+ if (typeof document !== 'undefined') {
18
+ this.el = document.createElement('div');
19
+ }
20
+ this.handleDismiss = this.handleDismiss.bind(this);
21
+ }
22
+ static get displayName() {
23
+ return displayName;
24
+ }
25
+ componentDidMount() {
26
+ if (this.props.isOpen) {
27
+ this.present();
28
+ }
29
+ }
30
+ componentWillUnmount() {
31
+ if (this.overlay) {
32
+ this.overlay.dismiss();
33
+ }
34
+ }
35
+ handleDismiss(event) {
36
+ if (this.props.onDidDismiss) {
37
+ this.props.onDidDismiss(event);
38
+ }
39
+ setRef(this.props.forwardedRef, null);
40
+ }
41
+ shouldComponentUpdate(nextProps) {
42
+ // Check if the overlay component is about to dismiss
43
+ if (this.overlay && nextProps.isOpen !== this.props.isOpen && nextProps.isOpen === false) {
44
+ isDismissing = true;
45
+ }
46
+ return true;
47
+ }
48
+ async componentDidUpdate(prevProps) {
49
+ if (this.overlay) {
50
+ attachProps(this.overlay, this.props, prevProps);
51
+ }
52
+ if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen === true) {
53
+ this.present(prevProps);
54
+ }
55
+ if (this.overlay && prevProps.isOpen !== this.props.isOpen && this.props.isOpen === false) {
56
+ await this.overlay.dismiss();
57
+ isDismissing = false;
58
+ /**
59
+ * Now that the overlay is dismissed
60
+ * we need to render again so that any
61
+ * inner components will be unmounted
62
+ */
63
+ this.forceUpdate();
64
+ }
65
+ }
66
+ async present(prevProps) {
67
+ const { children, isOpen, onDidDismiss, onDidPresent, onWillDismiss, onWillPresent, ...cProps } = this.props;
68
+ const elementProps = {
69
+ ...cProps,
70
+ ref: this.props.forwardedRef,
71
+ [didDismissEventName]: this.handleDismiss,
72
+ [didPresentEventName]: (e) => this.props.onDidPresent && this.props.onDidPresent(e),
73
+ [willDismissEventName]: (e) => this.props.onWillDismiss && this.props.onWillDismiss(e),
74
+ [willPresentEventName]: (e) => this.props.onWillPresent && this.props.onWillPresent(e),
75
+ };
76
+ this.overlay = await controller.create({
77
+ ...elementProps,
78
+ component: this.el,
79
+ componentProps: {},
80
+ });
81
+ setRef(this.props.forwardedRef, this.overlay);
82
+ attachProps(this.overlay, elementProps, prevProps);
83
+ await this.overlay.present();
84
+ }
85
+ render() {
86
+ /**
87
+ * Continue to render the component even when
88
+ * overlay is dismissing otherwise component
89
+ * will be hidden before animation is done.
90
+ */
91
+ return ReactDOM.createPortal(this.props.isOpen || isDismissing ? this.props.children : null, this.el);
92
+ }
93
+ }
94
+ return React.forwardRef((props, ref) => {
95
+ return _jsx(Overlay, { ...props, forwardedRef: ref });
96
+ });
97
+ };
@@ -0,0 +1,3 @@
1
+ export { createReactComponent } from './createComponent';
2
+ export { createOverlayComponent } from './createOverlayComponent';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react-component-lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createReactComponent } from './createComponent';
2
+ export { createOverlayComponent } from './createOverlayComponent';
@@ -0,0 +1,30 @@
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
+ }
30
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/react-component-lib/interfaces.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,GAAG;IACnC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG;IACzC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,WAAW,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IAEnB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,cAAc,CAAC,EAAE,GAAG,CAAC;IAErB,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/B,WAAW,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,WAAW,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAC9C,UAAU,EAAE,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAE7C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ export declare const attachProps: (node: HTMLElement, newProps: any, oldProps?: any) => void;
2
+ export declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: any) => string;
3
+ /**
4
+ * Transforms a React event name to a browser event name.
5
+ */
6
+ export declare const transformReactEventName: (eventNameSuffix: string) => string;
7
+ /**
8
+ * Checks if an event is supported in the current execution environment.
9
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
10
+ */
11
+ export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
12
+ export declare const syncEvent: (node: Element & {
13
+ __events?: {
14
+ [key: string]: ((e: Event) => any) | undefined;
15
+ };
16
+ }, eventName: string, newEventHandler?: (e: Event) => any) => void;
17
+ //# sourceMappingURL=attachProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachProps.d.ts","sourceRoot":"","sources":["../../../src/react-component-lib/utils/attachProps.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,MAAM,WAAW,EAAE,UAAU,GAAG,EAAE,WAAU,GAAQ,SAoC/E,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,WAAW,YAAY,EAAE,UAAU,GAAG,EAAE,UAAU,GAAG,WAsBjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,MAAM,WAM9D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,iBAAiB,MAAM,YAevD,CAAC;AAEF,eAAO,MAAM,SAAS,GACpB,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,EACjF,WAAW,MAAM,EACjB,kBAAkB,CAAC,CAAC,EAAE,KAAK,KAAK,GAAG,SAmBpC,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { camelToDashCase } from './case';
2
+ export const attachProps = (node, newProps, oldProps = {}) => {
3
+ // some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
4
+ if (node instanceof Element) {
5
+ // add any classes in className to the class list
6
+ const className = getClassName(node.classList, newProps, oldProps);
7
+ if (className !== '') {
8
+ node.className = className;
9
+ }
10
+ Object.keys(newProps).forEach((name) => {
11
+ if (name === 'children' ||
12
+ name === 'style' ||
13
+ name === 'ref' ||
14
+ name === 'class' ||
15
+ name === 'className' ||
16
+ name === 'forwardedRef') {
17
+ return;
18
+ }
19
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
20
+ const eventName = name.substring(2);
21
+ const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
22
+ if (!isCoveredByReact(eventNameLc)) {
23
+ syncEvent(node, eventNameLc, newProps[name]);
24
+ }
25
+ }
26
+ else {
27
+ node[name] = newProps[name];
28
+ const propType = typeof newProps[name];
29
+ if (propType === 'string') {
30
+ node.setAttribute(camelToDashCase(name), newProps[name]);
31
+ }
32
+ }
33
+ });
34
+ }
35
+ };
36
+ export const getClassName = (classList, newProps, oldProps) => {
37
+ const newClassProp = newProps.className || newProps.class;
38
+ const oldClassProp = oldProps.className || oldProps.class;
39
+ // map the classes to Maps for performance
40
+ const currentClasses = arrayToMap(classList);
41
+ const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
42
+ const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
43
+ const finalClassNames = [];
44
+ // loop through each of the current classes on the component
45
+ // to see if it should be a part of the classNames added
46
+ currentClasses.forEach((currentClass) => {
47
+ if (incomingPropClasses.has(currentClass)) {
48
+ // add it as its already included in classnames coming in from newProps
49
+ finalClassNames.push(currentClass);
50
+ incomingPropClasses.delete(currentClass);
51
+ }
52
+ else if (!oldPropClasses.has(currentClass)) {
53
+ // add it as it has NOT been removed by user
54
+ finalClassNames.push(currentClass);
55
+ }
56
+ });
57
+ incomingPropClasses.forEach((s) => finalClassNames.push(s));
58
+ return finalClassNames.join(' ');
59
+ };
60
+ /**
61
+ * Transforms a React event name to a browser event name.
62
+ */
63
+ export const transformReactEventName = (eventNameSuffix) => {
64
+ switch (eventNameSuffix) {
65
+ case 'doubleclick':
66
+ return 'dblclick';
67
+ }
68
+ return eventNameSuffix;
69
+ };
70
+ /**
71
+ * Checks if an event is supported in the current execution environment.
72
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
73
+ */
74
+ export const isCoveredByReact = (eventNameSuffix) => {
75
+ if (typeof document === 'undefined') {
76
+ return true;
77
+ }
78
+ else {
79
+ const eventName = 'on' + transformReactEventName(eventNameSuffix);
80
+ let isSupported = eventName in document;
81
+ if (!isSupported) {
82
+ const element = document.createElement('div');
83
+ element.setAttribute(eventName, 'return;');
84
+ isSupported = typeof element[eventName] === 'function';
85
+ }
86
+ return isSupported;
87
+ }
88
+ };
89
+ export const syncEvent = (node, eventName, newEventHandler) => {
90
+ const eventStore = node.__events || (node.__events = {});
91
+ const oldEventHandler = eventStore[eventName];
92
+ // Remove old listener so they don't double up.
93
+ if (oldEventHandler) {
94
+ node.removeEventListener(eventName, oldEventHandler);
95
+ }
96
+ // Bind new listener.
97
+ node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
98
+ if (newEventHandler) {
99
+ newEventHandler.call(this, e);
100
+ }
101
+ }));
102
+ };
103
+ const arrayToMap = (arr) => {
104
+ const map = new Map();
105
+ arr.forEach((s) => map.set(s, s));
106
+ return map;
107
+ };
@@ -0,0 +1,3 @@
1
+ export declare const dashToPascalCase: (str: string) => string;
2
+ export declare const camelToDashCase: (str: string) => string;
3
+ //# sourceMappingURL=case.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../../../src/react-component-lib/utils/case.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,WAK/B,CAAC;AACd,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,WAAqE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const dashToPascalCase = (str) => str
2
+ .toLowerCase()
3
+ .split('-')
4
+ .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
5
+ .join('');
6
+ export const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
@@ -0,0 +1,3 @@
1
+ export declare const isDevMode: () => boolean;
2
+ export declare const deprecationWarning: (key: string, message: string) => void;
3
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/react-component-lib/utils/dev.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAErB,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,SAO9D,CAAC"}
@@ -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,11 @@
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';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react-component-lib/utils/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,MAAM,yBAAyB,CAAC,QAAQ,EAAE,WAAW,IAAI,QAAQ,GACrE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,GAChD,eAAe,CAAC;AAGlB,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;AAEnH,eAAO,MAAM,MAAM,GAAI,KAAK,wBAAwB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,EAAE,OAAO,GAAG,SAOjG,CAAC;AAEF,eAAO,MAAM,SAAS,GACpB,GAAG,MAAM,CAAC,wBAAwB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,EAAE,KACtE,KAAK,CAAC,WAAW,CAAC,GAAG,CAMvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,EAAE,WAAW,EAAE,gBAAgB,GAAG,EAAE,aAAa,MAAM,gJAU/F,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,EAAE,eAAe,GAAG,SAItE,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // @ts-nocheck
3
+ import React from 'react';
4
+ export const setRef = (ref, value) => {
5
+ if (typeof ref === 'function') {
6
+ ref(value);
7
+ }
8
+ else if (ref != null) {
9
+ // Cast as a MutableRef so we can assign current
10
+ ref.current = value;
11
+ }
12
+ };
13
+ export const mergeRefs = (...refs) => {
14
+ return (value) => {
15
+ refs.forEach((ref) => {
16
+ setRef(ref, value);
17
+ });
18
+ };
19
+ };
20
+ export const createForwardRef = (ReactComponent, displayName) => {
21
+ const forwardRef = (props, ref) => {
22
+ return _jsx(ReactComponent, { ...props, forwardedRef: ref });
23
+ };
24
+ forwardRef.displayName = displayName;
25
+ return React.forwardRef(forwardRef);
26
+ };
27
+ export const defineCustomElement = (tagName, customElement) => {
28
+ if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
29
+ customElements.define(tagName, customElement);
30
+ }
31
+ };
32
+ export * from './attachProps';
33
+ export * from './case';
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@diwacopilot/components-react",
3
+ "version": "1.0.0",
4
+ "description": "React wrapper package for Diwa Web Components.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "build": "node scripts/patch-generated-react-lib.cjs && tsc -p tsconfig.json",
21
+ "prepack": "npm run build"
22
+ },
23
+ "peerDependencies": {
24
+ "@diwacopilot/components": "^1.0.0",
25
+ "react": ">=18.0.0",
26
+ "react-dom": ">=18.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@diwacopilot/components": "file:../diwa-components",
30
+ "@types/react": "^19.2.2",
31
+ "@types/react-dom": "^19.2.2",
32
+ "react": "^19.2.0",
33
+ "react-dom": "^19.2.0",
34
+ "typescript": "^5.7.2"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/jortega0033/diwa-design-system.git",
42
+ "directory": "diwa-components-react"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/jortega0033/diwa-design-system/issues"
46
+ },
47
+ "homepage": "https://github.com/jortega0033/diwa-design-system#readme"
48
+ }