@vaadin/react-components 24.8.0-alpha15 → 24.8.0-alpha16
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/MasterDetailLayout.d.ts +24 -7
- package/MasterDetailLayout.d.ts.map +1 -1
- package/MasterDetailLayout.js +1 -1
- package/MasterDetailLayout.js.map +3 -3
- package/generated/MasterDetailLayout.d.ts +10 -3
- package/generated/MasterDetailLayout.d.ts.map +1 -1
- package/package.json +61 -61
- package/utils/createComponent.js +1 -1
- package/utils/createComponent.js.map +1 -1
package/MasterDetailLayout.d.ts
CHANGED
|
@@ -3,16 +3,33 @@ import React from 'react';
|
|
|
3
3
|
export * from './generated/MasterDetailLayout.js';
|
|
4
4
|
type MasterProps = React.PropsWithChildren<{}>;
|
|
5
5
|
type DetailProps = React.PropsWithChildren<{}>;
|
|
6
|
+
declare const MasterDetailLayoutWithValidation: React.FC<React.ComponentProps<typeof _MasterDetailLayout>>;
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* `MasterDetailLayout` is a React component for building UIs with a master
|
|
9
|
+
* (or primary) area and a detail (or secondary) area that is displayed next to, or
|
|
10
|
+
* overlaid on top of, the master area, depending on configuration and viewport size.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
12
|
+
* Content for each area should be wrapped into to the respective
|
|
13
|
+
* `MasterDetailLayout.Master` and `MasterDetailLayout.Detail` wrapper components.
|
|
14
|
+
* Using any other component as a child will throw an error. To ensure that view
|
|
15
|
+
* transitions are run properly, details content should be rendered conditionally
|
|
16
|
+
* into the `MasterDetailLayout.Detail` component.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const selectedProduct = useSignal<Product | null>(null);
|
|
21
|
+
*
|
|
22
|
+
* <MasterDetailLayout>
|
|
23
|
+
* <MasterDetailLayout.Master>
|
|
24
|
+
* <ProductList onSelect={(product) => { selectedProduct.value = product }} />
|
|
25
|
+
* </MasterDetailLayout.Master>
|
|
26
|
+
* <MasterDetailLayout.Detail>
|
|
27
|
+
* { selectedProduct.value && <ProductDetail product={selectedProduct.value} /> }
|
|
28
|
+
* </MasterDetailLayout.Detail>
|
|
29
|
+
* </MasterDetailLayout>
|
|
30
|
+
* ```
|
|
13
31
|
*/
|
|
14
|
-
|
|
15
|
-
declare const MasterDetailLayout: React.ComponentType<React.ComponentProps<typeof _MasterDetailLayout>> & {
|
|
32
|
+
declare const MasterDetailLayout: typeof MasterDetailLayoutWithValidation & {
|
|
16
33
|
Master: React.FC<MasterProps>;
|
|
17
34
|
Detail: React.FC<DetailProps>;
|
|
18
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterDetailLayout.d.ts","sourceRoot":"","sources":["src/MasterDetailLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,mBAAmB,EAE1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E,cAAc,mCAAmC,CAAC;AAElD,KAAK,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAC/C,KAAK,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"MasterDetailLayout.d.ts","sourceRoot":"","sources":["src/MasterDetailLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,mBAAmB,EAE1C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E,cAAc,mCAAmC,CAAC;AAElD,KAAK,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAC/C,KAAK,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAoI/C,QAAA,MAAM,gCAAgC,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,CAIhG,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,kBAAkB,EAAuC,OAAO,gCAAgC,GAAG;IACvG,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;IAC9B,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC;AAKF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/MasterDetailLayout.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"@vaadin/master-detail-layout/vaadin-master-detail-layout.js";import{MasterDetailLayout as
|
|
1
|
+
export*from"@vaadin/master-detail-layout/vaadin-master-detail-layout.js";import{MasterDetailLayout as v}from"@vaadin/master-detail-layout/vaadin-master-detail-layout.js";import*as L from"react";import{createComponent as R}from"./utils/createComponent.js";var P={onBackdropClick:"backdrop-click",onDetailEscapePress:"detail-escape-press"},m=R({elementClass:v,events:P,react:L,tagName:"vaadin-master-detail-layout"});import s,{useEffect as k,useLayoutEffect as x,useRef as p,useState as f}from"react";import{Fragment as A,jsx as d,jsxs as N}from"react/jsx-runtime";function D({children:t}){return t}function b(t,e){let n=s.Children.toArray(t).filter(a=>s.isValidElement(a)),l=s.Children.toArray(e).filter(a=>s.isValidElement(a));if(n.length!==l.length)return!0;for(let a=0;a<n.length;a++){let r=n[a],i=l[a];if(r.type!==i.type||r.key!==i.key)return!0}return!1}function M({children:t}){let e=p(null),n=p(0),l=p(null),a=n.current+1,[r,i]=f("idle"),[c,y]=f(t);return x(()=>{let u=e.current?.closest("vaadin-master-detail-layout");if(u){if(r==="idle"){let o=e.current.childElementCount>0;e.current.setAttribute("slot",o?"detail":"detail-hidden")}else if(r==="starting"){let o=e.current.childElementCount>0,E=l.current.childElementCount>0,C=o&&E?"replace":o?"remove":"add";u._startTransition(C,()=>{i("ready"),y(t),n.current=a})}else if(r==="ready"){let o=e.current.childElementCount>0;e.current.setAttribute("slot",o?"detail":"detail-hidden"),u._finishTransition().then(()=>{i("idle")})}}},[r,c]),k(()=>{r==="idle"&&(b(c,t)?i("starting"):y(t))},[r,t]),N(A,{children:[d("div",{ref:e,style:{display:"contents"},children:c},n.current),r==="starting"&&d("div",{ref:l,style:{display:"none"},children:t},a)]})}function _(t){s.Children.forEach(t,e=>{if(s.isValidElement(e)&&e.type!==D&&e.type!==M)throw new Error("Invalid child in MasterDetailLayout. Only <MasterDetailLayout.Master> and <MasterDetailLayout.Detail> components are allowed. Check the component docs for proper usage.")})}var g=t=>(_(t.children),d(m,{...t})),h=g;h.Master=D;h.Detail=M;export{h as MasterDetailLayout,v as MasterDetailLayoutElement};
|
|
2
2
|
//# sourceMappingURL=MasterDetailLayout.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/MasterDetailLayout.tsx", "src/generated/MasterDetailLayout.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@vaadin/master-detail-layout/vaadin-master-detail-layout.js\";\nimport {\n MasterDetailLayout as _MasterDetailLayout,\n MasterDetailLayoutElement,\n} from './generated/MasterDetailLayout.js';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nexport * from './generated/MasterDetailLayout.js';\n\ntype MasterProps = React.PropsWithChildren<{}>;\ntype DetailProps = React.PropsWithChildren<{}>;\n\ntype MasterDetailLayoutElementWithInternalAPI = MasterDetailLayoutElement & {\n _startTransition: (transitionType: 'add' | 'remove' | 'replace', callback: () => void) => void;\n _finishTransition: () => Promise<void>;\n};\n\nfunction Master({ children }: MasterProps) {\n return children;\n}\n\n/**\n * Compares two sets of React children to detect meaningful changes, ignoring text nodes.\n * Compares by component type and key.\n *\n * @param prevChildren Previous children\n * @param nextChildren Current children\n * @returns True if the non-text children are meaningfully different, false otherwise\n */\
|
|
5
|
-
"mappings": "AAAA,WAAc,8DCCd,OAAS,sBAAsBA,
|
|
6
|
-
"names": ["MasterDetailLayoutElement", "React", "createComponent", "events", "MasterDetailLayout", "createComponent", "MasterDetailLayoutElement", "React", "React", "useEffect", "useLayoutEffect", "useRef", "useState", "Fragment", "jsx", "jsxs", "Master", "children", "areChildrenDifferent", "prevChildren", "nextChildren", "prevArray", "child", "nextArray", "i", "prevChild", "nextChild", "Detail", "currentDetailsRef", "currentDetailsKey", "nextDetailsRef", "nextDetailsKey", "state", "setState", "currentChildren", "setCurrentChildren", "layout", "hasChildren", "hasCurrentDetails", "hasNextDetails", "transitionType", "MasterDetailLayout"]
|
|
4
|
+
"sourcesContent": ["export * from \"@vaadin/master-detail-layout/vaadin-master-detail-layout.js\";\nimport {\n MasterDetailLayout as _MasterDetailLayout,\n MasterDetailLayoutElement,\n} from './generated/MasterDetailLayout.js';\nimport React, { useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nexport * from './generated/MasterDetailLayout.js';\n\ntype MasterProps = React.PropsWithChildren<{}>;\ntype DetailProps = React.PropsWithChildren<{}>;\n\ntype MasterDetailLayoutElementWithInternalAPI = MasterDetailLayoutElement & {\n _startTransition: (transitionType: 'add' | 'remove' | 'replace', callback: () => void) => void;\n _finishTransition: () => Promise<void>;\n};\n\nfunction Master({ children }: MasterProps) {\n return children;\n}\n\n/**\n * Compares two sets of React children to detect meaningful changes, ignoring text nodes.\n * Compares by component type and key.\n *\n * @param prevChildren Previous children\n * @param nextChildren Current children\n * @returns True if the non-text children are meaningfully different, false otherwise\n */\nfunction areChildrenDifferent(prevChildren: React.ReactNode, nextChildren: React.ReactNode): boolean {\n // Convert to arrays and filter out text nodes\n const prevArray = React.Children.toArray(prevChildren).filter((child) => React.isValidElement(child));\n const nextArray = React.Children.toArray(nextChildren).filter((child) => React.isValidElement(child));\n\n // If lengths are different, children have changed\n if (prevArray.length !== nextArray.length) {\n return true;\n }\n\n // Compare each element by type and key\n for (let i = 0; i < prevArray.length; i++) {\n const prevChild = prevArray[i] as React.ReactElement;\n const nextChild = nextArray[i] as React.ReactElement;\n\n // Compare by type\n if (prevChild.type !== nextChild.type) {\n return true;\n }\n\n // Compare by key (React.Children.toArray adds keys if missing)\n if (prevChild.key !== nextChild.key) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction Detail({ children }: DetailProps) {\n const currentDetailsRef = useRef<HTMLDivElement>(null);\n const currentDetailsKey = useRef<number>(0);\n const nextDetailsRef = useRef<HTMLDivElement>(null);\n const nextDetailsKey = currentDetailsKey.current + 1;\n const [state, setState] = useState('idle');\n const [currentChildren, setCurrentChildren] = useState(children);\n\n useLayoutEffect(() => {\n const layout = currentDetailsRef.current?.closest(\n 'vaadin-master-detail-layout',\n ) as MasterDetailLayoutElementWithInternalAPI;\n if (!layout) {\n return;\n }\n\n if (state === 'idle') {\n // No transition in progress\n // Just update slot name\n const hasChildren = currentDetailsRef.current!.childElementCount > 0;\n currentDetailsRef.current!.setAttribute('slot', hasChildren ? 'detail' : 'detail-hidden');\n } else if (state === 'starting') {\n // Transition is starting and old and (invisible) new details are rendered\n // Determine the transition type based on old and new detail contents\n const hasCurrentDetails = currentDetailsRef.current!.childElementCount > 0;\n const hasNextDetails = nextDetailsRef.current!.childElementCount > 0;\n const transitionType = hasCurrentDetails && hasNextDetails ? 'replace' : hasCurrentDetails ? 'remove' : 'add';\n // Start transition to capture old DOM state\n layout._startTransition(transitionType, () => {\n // Once old DOM state is captured, render with new details only\n setState('ready');\n setCurrentChildren(children);\n currentDetailsKey.current = nextDetailsKey;\n });\n } else if (state === 'ready') {\n // Transition is ready and new details are rendered\n // Update slot name to either show or hide the new details\n const hasChildren = currentDetailsRef.current!.childElementCount > 0;\n currentDetailsRef.current!.setAttribute('slot', hasChildren ? 'detail' : 'detail-hidden');\n // Finish transition to animate to new DOM state\n layout._finishTransition().then(() => {\n // Transition is finished, reset state\n setState('idle');\n });\n }\n }, [state, currentChildren]);\n\n useEffect(() => {\n if (state !== 'idle') {\n return;\n }\n if (areChildrenDifferent(currentChildren, children)) {\n setState('starting');\n } else {\n setCurrentChildren(children);\n }\n }, [state, children]);\n\n return (\n <>\n <div ref={currentDetailsRef} key={currentDetailsKey.current} style={{ display: 'contents' }}>\n {currentChildren}\n </div>\n {state === 'starting' && (\n <div ref={nextDetailsRef} key={nextDetailsKey} style={{ display: 'none' }}>\n {children}\n </div>\n )}\n </>\n );\n}\n\nfunction validateChildren(children: React.ReactNode) {\n React.Children.forEach(children, (child) => {\n // Ignore non-React elements\n // We especially want to ignore text nodes to allow for whitespace resulting from formatting\n if (React.isValidElement(child) && child.type !== Master && child.type !== Detail) {\n throw new Error(\n 'Invalid child in MasterDetailLayout. Only <MasterDetailLayout.Master> and <MasterDetailLayout.Detail> components are allowed. Check the component docs for proper usage.',\n );\n }\n });\n}\n\nconst MasterDetailLayoutWithValidation: React.FC<React.ComponentProps<typeof _MasterDetailLayout>> = (props) => {\n validateChildren(props.children);\n\n return <_MasterDetailLayout {...props} />;\n};\n\n/**\n * `MasterDetailLayout` is a React component for building UIs with a master\n * (or primary) area and a detail (or secondary) area that is displayed next to, or\n * overlaid on top of, the master area, depending on configuration and viewport size.\n *\n * Content for each area should be wrapped into to the respective\n * `MasterDetailLayout.Master` and `MasterDetailLayout.Detail` wrapper components.\n * Using any other component as a child will throw an error. To ensure that view\n * transitions are run properly, details content should be rendered conditionally\n * into the `MasterDetailLayout.Detail` component.\n *\n * @example\n * ```tsx\n * const selectedProduct = useSignal<Product | null>(null);\n *\n * <MasterDetailLayout>\n * <MasterDetailLayout.Master>\n * <ProductList onSelect={(product) => { selectedProduct.value = product }} />\n * </MasterDetailLayout.Master>\n * <MasterDetailLayout.Detail>\n * { selectedProduct.value && <ProductDetail product={selectedProduct.value} /> }\n * </MasterDetailLayout.Detail>\n * </MasterDetailLayout>\n * ```\n */\nconst MasterDetailLayout = MasterDetailLayoutWithValidation as typeof MasterDetailLayoutWithValidation & {\n Master: React.FC<MasterProps>;\n Detail: React.FC<DetailProps>;\n};\n\nMasterDetailLayout.Master = Master;\nMasterDetailLayout.Detail = Detail;\n\nexport { MasterDetailLayout };\n", "import type { EventName } from \"@lit/react\";\nimport { MasterDetailLayout as MasterDetailLayoutElement, type MasterDetailLayoutEventMap as _MasterDetailLayoutEventMap, } from \"@vaadin/master-detail-layout/vaadin-master-detail-layout.js\";\nimport * as React from \"react\";\nimport { createComponent, type WebComponentProps } from \"../utils/createComponent.js\";\nexport { MasterDetailLayoutElement, };\nexport type MasterDetailLayoutEventMap = Readonly<{\n onBackdropClick: EventName<_MasterDetailLayoutEventMap[\"backdrop-click\"]>;\n onDetailEscapePress: EventName<_MasterDetailLayoutEventMap[\"detail-escape-press\"]>;\n}>;\nconst events = { onBackdropClick: \"backdrop-click\", onDetailEscapePress: \"detail-escape-press\" } as MasterDetailLayoutEventMap;\nexport type MasterDetailLayoutProps = WebComponentProps<MasterDetailLayoutElement, MasterDetailLayoutEventMap>;\nexport const MasterDetailLayout = createComponent({\n elementClass: MasterDetailLayoutElement, events, react: React, tagName: \"vaadin-master-detail-layout\"\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["MasterDetailLayoutElement", "React", "createComponent", "events", "MasterDetailLayout", "createComponent", "MasterDetailLayoutElement", "React", "React", "useEffect", "useLayoutEffect", "useRef", "useState", "Fragment", "jsx", "jsxs", "Master", "children", "areChildrenDifferent", "prevChildren", "nextChildren", "prevArray", "child", "nextArray", "i", "prevChild", "nextChild", "Detail", "currentDetailsRef", "currentDetailsKey", "nextDetailsRef", "nextDetailsKey", "state", "setState", "currentChildren", "setCurrentChildren", "layout", "hasChildren", "hasCurrentDetails", "hasNextDetails", "transitionType", "validateChildren", "MasterDetailLayoutWithValidation", "props", "MasterDetailLayout"]
|
|
7
7
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { EventName } from "@lit/react";
|
|
2
|
+
import { MasterDetailLayout as MasterDetailLayoutElement, type MasterDetailLayoutEventMap as _MasterDetailLayoutEventMap } from "@vaadin/master-detail-layout/vaadin-master-detail-layout.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { type WebComponentProps } from "../utils/createComponent.js";
|
|
4
5
|
export * from "@vaadin/master-detail-layout/vaadin-master-detail-layout.js";
|
|
5
6
|
export { MasterDetailLayoutElement, };
|
|
6
|
-
export type MasterDetailLayoutEventMap = Readonly<{
|
|
7
|
+
export type MasterDetailLayoutEventMap = Readonly<{
|
|
8
|
+
onBackdropClick: EventName<_MasterDetailLayoutEventMap["backdrop-click"]>;
|
|
9
|
+
onDetailEscapePress: EventName<_MasterDetailLayoutEventMap["detail-escape-press"]>;
|
|
10
|
+
}>;
|
|
7
11
|
export type MasterDetailLayoutProps = WebComponentProps<MasterDetailLayoutElement, MasterDetailLayoutEventMap>;
|
|
8
|
-
export declare const MasterDetailLayout: (props: Partial<import("../utils/createComponent.js").ThemedWebComponentProps<MasterDetailLayoutElement, Readonly<{
|
|
12
|
+
export declare const MasterDetailLayout: (props: Partial<import("../utils/createComponent.js").ThemedWebComponentProps<MasterDetailLayoutElement, Readonly<{
|
|
13
|
+
onBackdropClick: EventName<_MasterDetailLayoutEventMap["backdrop-click"]>;
|
|
14
|
+
onDetailEscapePress: EventName<_MasterDetailLayoutEventMap["detail-escape-press"]>;
|
|
15
|
+
}>>> & React.RefAttributes<MasterDetailLayoutElement>) => React.ReactElement | null;
|
|
9
16
|
//# sourceMappingURL=MasterDetailLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterDetailLayout.d.ts","sourceRoot":"","sources":["../src/generated/MasterDetailLayout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MasterDetailLayout.d.ts","sourceRoot":"","sources":["../src/generated/MasterDetailLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,kBAAkB,IAAI,yBAAyB,EAAE,KAAK,0BAA0B,IAAI,2BAA2B,EAAG,MAAM,6DAA6D,CAAC;AAC/L,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACtF,cAAc,6DAA6D,CAAC;AAC5E,OAAO,EAAE,yBAAyB,GAAG,CAAC;AACtC,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAC9C,eAAe,EAAE,SAAS,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1E,mBAAmB,EAAE,SAAS,CAAC,2BAA2B,CAAC,qBAAqB,CAAC,CAAC,CAAC;CACtF,CAAC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,CAAC;AAC/G,eAAO,MAAM,kBAAkB;qBALV,SAAS,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,CAAC;yBACpD,SAAS,CAAC,2BAA2B,CAAC,qBAAqB,CAAC,CAAC;mFAMpF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/react-components",
|
|
3
|
-
"version": "24.8.0-
|
|
3
|
+
"version": "24.8.0-alpha16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -27,66 +27,66 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@lit/react": "^1.0.7",
|
|
30
|
-
"@vaadin/a11y-base": "24.8.0-
|
|
31
|
-
"@vaadin/accordion": "24.8.0-
|
|
32
|
-
"@vaadin/app-layout": "24.8.0-
|
|
33
|
-
"@vaadin/avatar": "24.8.0-
|
|
34
|
-
"@vaadin/avatar-group": "24.8.0-
|
|
35
|
-
"@vaadin/button": "24.8.0-
|
|
36
|
-
"@vaadin/card": "24.8.0-
|
|
37
|
-
"@vaadin/checkbox": "24.8.0-
|
|
38
|
-
"@vaadin/checkbox-group": "24.8.0-
|
|
39
|
-
"@vaadin/combo-box": "24.8.0-
|
|
40
|
-
"@vaadin/component-base": "24.8.0-
|
|
41
|
-
"@vaadin/confirm-dialog": "24.8.0-
|
|
42
|
-
"@vaadin/context-menu": "24.8.0-
|
|
43
|
-
"@vaadin/custom-field": "24.8.0-
|
|
44
|
-
"@vaadin/date-picker": "24.8.0-
|
|
45
|
-
"@vaadin/date-time-picker": "24.8.0-
|
|
46
|
-
"@vaadin/details": "24.8.0-
|
|
47
|
-
"@vaadin/dialog": "24.8.0-
|
|
48
|
-
"@vaadin/email-field": "24.8.0-
|
|
49
|
-
"@vaadin/field-base": "24.8.0-
|
|
50
|
-
"@vaadin/field-highlighter": "24.8.0-
|
|
51
|
-
"@vaadin/form-layout": "24.8.0-
|
|
52
|
-
"@vaadin/grid": "24.8.0-
|
|
53
|
-
"@vaadin/horizontal-layout": "24.8.0-
|
|
54
|
-
"@vaadin/icon": "24.8.0-
|
|
55
|
-
"@vaadin/icons": "24.8.0-
|
|
56
|
-
"@vaadin/input-container": "24.8.0-
|
|
57
|
-
"@vaadin/integer-field": "24.8.0-
|
|
58
|
-
"@vaadin/item": "24.8.0-
|
|
59
|
-
"@vaadin/list-box": "24.8.0-
|
|
60
|
-
"@vaadin/lit-renderer": "24.8.0-
|
|
61
|
-
"@vaadin/login": "24.8.0-
|
|
62
|
-
"@vaadin/master-detail-layout": "24.8.0-
|
|
63
|
-
"@vaadin/menu-bar": "24.8.0-
|
|
64
|
-
"@vaadin/message-input": "24.8.0-
|
|
65
|
-
"@vaadin/message-list": "24.8.0-
|
|
66
|
-
"@vaadin/multi-select-combo-box": "24.8.0-
|
|
67
|
-
"@vaadin/notification": "24.8.0-
|
|
68
|
-
"@vaadin/number-field": "24.8.0-
|
|
69
|
-
"@vaadin/overlay": "24.8.0-
|
|
70
|
-
"@vaadin/password-field": "24.8.0-
|
|
71
|
-
"@vaadin/popover": "24.8.0-
|
|
72
|
-
"@vaadin/progress-bar": "24.8.0-
|
|
73
|
-
"@vaadin/radio-group": "24.8.0-
|
|
74
|
-
"@vaadin/scroller": "24.8.0-
|
|
75
|
-
"@vaadin/select": "24.8.0-
|
|
76
|
-
"@vaadin/side-nav": "24.8.0-
|
|
77
|
-
"@vaadin/split-layout": "24.8.0-
|
|
78
|
-
"@vaadin/tabs": "24.8.0-
|
|
79
|
-
"@vaadin/tabsheet": "24.8.0-
|
|
80
|
-
"@vaadin/text-area": "24.8.0-
|
|
81
|
-
"@vaadin/text-field": "24.8.0-
|
|
82
|
-
"@vaadin/time-picker": "24.8.0-
|
|
83
|
-
"@vaadin/tooltip": "24.8.0-
|
|
84
|
-
"@vaadin/upload": "24.8.0-
|
|
85
|
-
"@vaadin/vaadin-lumo-styles": "24.8.0-
|
|
86
|
-
"@vaadin/vaadin-material-styles": "24.8.0-
|
|
87
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-
|
|
88
|
-
"@vaadin/vertical-layout": "24.8.0-
|
|
89
|
-
"@vaadin/virtual-list": "24.8.0-
|
|
30
|
+
"@vaadin/a11y-base": "24.8.0-alpha16",
|
|
31
|
+
"@vaadin/accordion": "24.8.0-alpha16",
|
|
32
|
+
"@vaadin/app-layout": "24.8.0-alpha16",
|
|
33
|
+
"@vaadin/avatar": "24.8.0-alpha16",
|
|
34
|
+
"@vaadin/avatar-group": "24.8.0-alpha16",
|
|
35
|
+
"@vaadin/button": "24.8.0-alpha16",
|
|
36
|
+
"@vaadin/card": "24.8.0-alpha16",
|
|
37
|
+
"@vaadin/checkbox": "24.8.0-alpha16",
|
|
38
|
+
"@vaadin/checkbox-group": "24.8.0-alpha16",
|
|
39
|
+
"@vaadin/combo-box": "24.8.0-alpha16",
|
|
40
|
+
"@vaadin/component-base": "24.8.0-alpha16",
|
|
41
|
+
"@vaadin/confirm-dialog": "24.8.0-alpha16",
|
|
42
|
+
"@vaadin/context-menu": "24.8.0-alpha16",
|
|
43
|
+
"@vaadin/custom-field": "24.8.0-alpha16",
|
|
44
|
+
"@vaadin/date-picker": "24.8.0-alpha16",
|
|
45
|
+
"@vaadin/date-time-picker": "24.8.0-alpha16",
|
|
46
|
+
"@vaadin/details": "24.8.0-alpha16",
|
|
47
|
+
"@vaadin/dialog": "24.8.0-alpha16",
|
|
48
|
+
"@vaadin/email-field": "24.8.0-alpha16",
|
|
49
|
+
"@vaadin/field-base": "24.8.0-alpha16",
|
|
50
|
+
"@vaadin/field-highlighter": "24.8.0-alpha16",
|
|
51
|
+
"@vaadin/form-layout": "24.8.0-alpha16",
|
|
52
|
+
"@vaadin/grid": "24.8.0-alpha16",
|
|
53
|
+
"@vaadin/horizontal-layout": "24.8.0-alpha16",
|
|
54
|
+
"@vaadin/icon": "24.8.0-alpha16",
|
|
55
|
+
"@vaadin/icons": "24.8.0-alpha16",
|
|
56
|
+
"@vaadin/input-container": "24.8.0-alpha16",
|
|
57
|
+
"@vaadin/integer-field": "24.8.0-alpha16",
|
|
58
|
+
"@vaadin/item": "24.8.0-alpha16",
|
|
59
|
+
"@vaadin/list-box": "24.8.0-alpha16",
|
|
60
|
+
"@vaadin/lit-renderer": "24.8.0-alpha16",
|
|
61
|
+
"@vaadin/login": "24.8.0-alpha16",
|
|
62
|
+
"@vaadin/master-detail-layout": "24.8.0-alpha16",
|
|
63
|
+
"@vaadin/menu-bar": "24.8.0-alpha16",
|
|
64
|
+
"@vaadin/message-input": "24.8.0-alpha16",
|
|
65
|
+
"@vaadin/message-list": "24.8.0-alpha16",
|
|
66
|
+
"@vaadin/multi-select-combo-box": "24.8.0-alpha16",
|
|
67
|
+
"@vaadin/notification": "24.8.0-alpha16",
|
|
68
|
+
"@vaadin/number-field": "24.8.0-alpha16",
|
|
69
|
+
"@vaadin/overlay": "24.8.0-alpha16",
|
|
70
|
+
"@vaadin/password-field": "24.8.0-alpha16",
|
|
71
|
+
"@vaadin/popover": "24.8.0-alpha16",
|
|
72
|
+
"@vaadin/progress-bar": "24.8.0-alpha16",
|
|
73
|
+
"@vaadin/radio-group": "24.8.0-alpha16",
|
|
74
|
+
"@vaadin/scroller": "24.8.0-alpha16",
|
|
75
|
+
"@vaadin/select": "24.8.0-alpha16",
|
|
76
|
+
"@vaadin/side-nav": "24.8.0-alpha16",
|
|
77
|
+
"@vaadin/split-layout": "24.8.0-alpha16",
|
|
78
|
+
"@vaadin/tabs": "24.8.0-alpha16",
|
|
79
|
+
"@vaadin/tabsheet": "24.8.0-alpha16",
|
|
80
|
+
"@vaadin/text-area": "24.8.0-alpha16",
|
|
81
|
+
"@vaadin/text-field": "24.8.0-alpha16",
|
|
82
|
+
"@vaadin/time-picker": "24.8.0-alpha16",
|
|
83
|
+
"@vaadin/tooltip": "24.8.0-alpha16",
|
|
84
|
+
"@vaadin/upload": "24.8.0-alpha16",
|
|
85
|
+
"@vaadin/vaadin-lumo-styles": "24.8.0-alpha16",
|
|
86
|
+
"@vaadin/vaadin-material-styles": "24.8.0-alpha16",
|
|
87
|
+
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha16",
|
|
88
|
+
"@vaadin/vertical-layout": "24.8.0-alpha16",
|
|
89
|
+
"@vaadin/virtual-list": "24.8.0-alpha16"
|
|
90
90
|
},
|
|
91
91
|
"author": "Vaadin Ltd.",
|
|
92
92
|
"license": "Apache-2.0",
|
package/utils/createComponent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createComponent as n}from"@lit/react";window.Vaadin??={},window.Vaadin.registrations??=[],window.Vaadin.registrations.push({is:"@vaadin/react-components",version:"24.8.0-
|
|
1
|
+
import{createComponent as n}from"@lit/react";window.Vaadin??={},window.Vaadin.registrations??=[],window.Vaadin.registrations.push({is:"@vaadin/react-components",version:"24.8.0-alpha16"});function s(e){const{elementClass:t}=e;return n("_properties"in t?{...e,elementClass:{name:t.name,prototype:{...t._properties,hidden:Boolean}}}:e)}export{s as createComponent};
|
|
2
2
|
//# sourceMappingURL=createComponent.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/utils/createComponent.ts"],
|
|
4
|
-
"sourcesContent": ["import { createComponent as _createComponent, type EventName } from '@lit/react';\nimport type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';\nimport type React from 'react';\nimport type { RefAttributes } from 'react';\n\ndeclare const __VERSION__: string;\n\ndeclare global {\n interface VaadinRegistration {\n is: string;\n version: string;\n }\n\n interface Vaadin {\n registrations?: VaadinRegistration[];\n }\n\n interface Window {\n // @ts-expect-error: Different declaration from one of the dependencies.\n Vaadin?: Vaadin;\n }\n}\n\nwindow.Vaadin ??= {};\nwindow.Vaadin.registrations ??= [];\nwindow.Vaadin.registrations.push({\n is: '@vaadin/react-components',\n version: /* updated-by-script */ '24.8.0-
|
|
4
|
+
"sourcesContent": ["import { createComponent as _createComponent, type EventName } from '@lit/react';\nimport type { ThemePropertyMixinClass } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';\nimport type React from 'react';\nimport type { RefAttributes } from 'react';\n\ndeclare const __VERSION__: string;\n\ndeclare global {\n interface VaadinRegistration {\n is: string;\n version: string;\n }\n\n interface Vaadin {\n registrations?: VaadinRegistration[];\n }\n\n interface Window {\n // @ts-expect-error: Different declaration from one of the dependencies.\n Vaadin?: Vaadin;\n }\n}\n\nwindow.Vaadin ??= {};\nwindow.Vaadin.registrations ??= [];\nwindow.Vaadin.registrations.push({\n is: '@vaadin/react-components',\n version: /* updated-by-script */ '24.8.0-alpha16',\n});\n\n// TODO: Remove when types from @lit-labs/react are exported\nexport type EventNames = Record<string, EventName | string>;\ntype Constructor<T> = { new (): T; name: string };\ntype PolymerConstructor<T> = Constructor<T> & { _properties: Record<string, unknown> };\ntype Options<I extends HTMLElement, E extends EventNames = {}> = Readonly<{\n displayName?: string;\n elementClass: Constructor<I> | PolymerConstructor<I>;\n events?: E;\n react: typeof window.React;\n tagName: string;\n}>;\n\n// A map of expected event listener types based on EventNames.\ntype EventListeners<R extends EventNames> = {\n [K in keyof R]?: R[K] extends EventName ? (e: R[K]['__eventType']) => void : (e: Event) => void;\n};\n\n// Props derived from custom element class. Currently has limitations of making\n// all properties optional and also surfaces life cycle methods in autocomplete.\n// TODO: LoginOverlay has \"autofocus\" property, so we add it back manually.\ntype ElementProps<I> = Partial<Omit<I, keyof HTMLElement>> & { autofocus?: boolean };\n\n// Acceptable props to the React component.\ntype ComponentProps<I, E extends EventNames = {}> = Omit<\n React.HTMLAttributes<I>,\n // Prefer type of provided event handler props or those on element over\n // built-in HTMLAttributes\n keyof E | keyof ElementProps<I>\n> &\n EventListeners<E> &\n ElementProps<I>;\n\nexport type ThemedWebComponentProps<\n I extends ThemePropertyMixinClass & HTMLElement,\n E extends EventNames = {},\n> = ComponentProps<I, E> & {\n /**\n * Attribute that can be used by the component to apply built-in style variants,\n * or to propagate its value to the sub-components in Shadow DOM.\n *\n * @see ThemePropertyMixinClass#_theme\n */\n theme?: string;\n};\n\ntype AllWebComponentProps<I extends HTMLElement, E extends EventNames = {}> = I extends ThemePropertyMixinClass\n ? ThemedWebComponentProps<I, E>\n : ComponentProps<I, E>;\n\nexport type WebComponentProps<I extends HTMLElement, E extends EventNames = {}> = Partial<AllWebComponentProps<I, E>>;\n\n// We need a separate declaration here; otherwise, the TypeScript fails into the\n// endless loop trying to resolve the typings.\nexport function createComponent<I extends HTMLElement, E extends EventNames = {}>(\n options: Options<I, E>,\n): (props: WebComponentProps<I, E> & RefAttributes<I>) => React.ReactElement | null;\n\nexport function createComponent<I extends HTMLElement, E extends EventNames = {}>(options: Options<I, E>): any {\n const { elementClass } = options;\n\n return _createComponent(\n '_properties' in elementClass\n ? {\n ...options,\n // TODO: improve or remove the Polymer workaround\n // 'createComponent' relies on key presence on the custom element class,\n // but Polymer defines properties on the prototype when the first element\n // is created. Workaround: pass a mock object with properties in\n // the prototype.\n elementClass: {\n // @ts-expect-error: it is a specific workaround for Polymer classes.\n name: elementClass.name,\n prototype: { ...elementClass._properties, hidden: Boolean },\n },\n }\n : options,\n );\n}\n"],
|
|
5
5
|
"mappings": "AAAA,OAAS,mBAAmBA,MAAwC,aAuBpE,OAAO,SAAW,CAAC,EACnB,OAAO,OAAO,gBAAkB,CAAC,EACjC,OAAO,OAAO,cAAc,KAAK,CAC/B,GAAI,2BACJ,QAAiC,gBACnC,CAAC,EA2DM,SAASC,EAAkEC,EAA6B,CAC7G,KAAM,CAAE,aAAAC,CAAa,EAAID,EAEzB,OAAOF,EACL,gBAAiBG,EACb,CACE,GAAGD,EAMH,aAAc,CAEZ,KAAMC,EAAa,KACnB,UAAW,CAAE,GAAGA,EAAa,YAAa,OAAQ,OAAQ,CAC5D,CACF,EACAD,CACN,CACF",
|
|
6
6
|
"names": ["_createComponent", "createComponent", "options", "elementClass"]
|
|
7
7
|
}
|