@vaadin/react-components 24.8.0-alpha3 → 24.8.0-alpha8
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/ContextMenu.d.ts +1 -1
- package/ContextMenu.d.ts.map +1 -1
- package/ContextMenu.js +1 -1
- package/ContextMenu.js.map +1 -1
- package/MenuBar.d.ts +1 -1
- package/MenuBar.d.ts.map +1 -1
- package/MenuBar.js +1 -1
- package/MenuBar.js.map +1 -1
- package/css/lumo/mixins/RequiredField.css +2 -12
- package/package.json +60 -60
- package/utils/createComponent.js +1 -1
- package/utils/createComponent.js.map +1 -1
package/ContextMenu.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type ContextMenuItem<TItemData extends object = object> = Omit<_ContextMe
|
|
|
8
8
|
children?: Array<ContextMenuItem<TItemData>>;
|
|
9
9
|
};
|
|
10
10
|
export type ContextMenuItemSelectedEvent<TItem extends ContextMenuItem = ContextMenuItem> = CustomEvent<{
|
|
11
|
-
value: TItem
|
|
11
|
+
value: ContextMenuItem<TItem>;
|
|
12
12
|
}>;
|
|
13
13
|
export type ContextMenuProps<TItem extends ContextMenuItem = ContextMenuItem> = Partial<Omit<_ContextMenuProps, 'opened' | 'renderer' | 'items' | 'onItemSelected'>> & Readonly<{
|
|
14
14
|
renderer?: ComponentType<ContextMenuReactRendererProps> | null;
|
package/ContextMenu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["src/ContextMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiC,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACjH,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACzC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,yBAAyB,EAAsB,MAAM,mCAAmC,CAAC;AAGvG,cAAc,4BAA4B,CAAC;AAE3C,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAEtH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CACnE,gBAAgB,CAAC,SAAS,CAAC,EAC3B,WAAW,GAAG,UAAU,CACzB,GAAG;IACF,SAAS,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAElC,QAAQ,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,4BAA4B,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe,IAAI,WAAW,CAAC;IACtG,KAAK,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["src/ContextMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiC,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACjH,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,IAAI,iBAAiB,EAC1C,KAAK,eAAe,IAAI,gBAAgB,EACzC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,yBAAyB,EAAsB,MAAM,mCAAmC,CAAC;AAGvG,cAAc,4BAA4B,CAAC;AAE3C,MAAM,MAAM,6BAA6B,GAAG,yBAAyB,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAEtH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CACnE,gBAAgB,CAAC,SAAS,CAAC,EAC3B,WAAW,GAAG,UAAU,CACzB,GAAG;IACF,SAAS,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAElC,QAAQ,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,4BAA4B,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe,IAAI,WAAW,CAAC;IACtG,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;CAC/B,CAAC,CAAC;AAKH,MAAM,MAAM,gBAAgB,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe,IAAI,OAAO,CACrF,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,gBAAgB,CAAC,CAC5E,GACC,QAAQ,CAAC;IACP,QAAQ,CAAC,EAAE,aAAa,CAAC,6BAA6B,CAAC,GAAG,IAAI,CAAC;IAE/D,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAErB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,4BAA4B,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACvE,CAAC,CAAC;AAmCL,QAAA,MAAM,oBAAoB,EAA8B,CAAC,KAAK,SAAS,eAAe,GAAG,eAAe,EACtG,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,kBAAkB,CAAC,KAC/D,YAAY,GAAG,IAAI,CAAC;AAEzB,OAAO,EAAE,oBAAoB,IAAI,WAAW,EAAE,CAAC"}
|
package/ContextMenu.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"@vaadin/context-menu/vaadin-context-menu.js";import{forwardRef as s}from"react";import{ContextMenu as C}from"@vaadin/context-menu/vaadin-context-menu.js";import*as u from"react";import{createComponent as d}from"./utils/createComponent.js";var M={onItemSelected:"item-selected",onOpenedChanged:"opened-changed"},o=d({elementClass:C,events:M,react:u,tagName:"vaadin-context-menu"});import{useContextRenderer as l}from"./renderers/useContextRenderer.js";import{getOriginalItem as c,mapItemsWithComponents as I}from"./utils/mapItemsWithComponents.js";import{jsxs as E}from"react/jsx-runtime";function i(e,m){let[r,p]=l(e.renderer),[a
|
|
1
|
+
export*from"@vaadin/context-menu/vaadin-context-menu.js";import{forwardRef as s}from"react";import{ContextMenu as C}from"@vaadin/context-menu/vaadin-context-menu.js";import*as u from"react";import{createComponent as d}from"./utils/createComponent.js";var M={onItemSelected:"item-selected",onOpenedChanged:"opened-changed"},o=d({elementClass:C,events:M,react:u,tagName:"vaadin-context-menu"});import{useContextRenderer as l}from"./renderers/useContextRenderer.js";import{getOriginalItem as c,mapItemsWithComponents as I}from"./utils/mapItemsWithComponents.js";import{jsxs as E}from"react/jsx-runtime";function i(e,m){let[r,p]=l(e.renderer),[x,a]=I(e.items,"vaadin-context-menu-item"),n=e.onItemSelected;return E(o,{...e,ref:m,renderer:p,items:a,onItemSelected:n?t=>{Object.assign(t.detail,{value:c(t.detail.value)}),n(t)}:void 0,children:[e.children,r,x]})}var g=s(i);export{g as ContextMenu,C as ContextMenuElement};
|
|
2
2
|
//# sourceMappingURL=ContextMenu.js.map
|
package/ContextMenu.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/ContextMenu.tsx", "src/generated/ContextMenu.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@vaadin/context-menu/vaadin-context-menu.js\";\nimport { type ComponentType, type ForwardedRef, forwardRef, type ReactElement, type RefAttributes } from 'react';\nimport {\n ContextMenu as _ContextMenu,\n type ContextMenuRendererContext,\n type ContextMenuElement,\n type ContextMenuProps as _ContextMenuProps,\n type ContextMenuItem as _ContextMenuItem,\n} from './generated/ContextMenu.js';\nimport { type ReactContextRendererProps, useContextRenderer } from './renderers/useContextRenderer.js';\nimport { getOriginalItem, mapItemsWithComponents } from './utils/mapItemsWithComponents.js';\n\nexport * from './generated/ContextMenu.js';\n\nexport type ContextMenuReactRendererProps = ReactContextRendererProps<ContextMenuRendererContext, ContextMenuElement>;\n\nexport type ContextMenuItem<TItemData extends object = object> = Omit<\n _ContextMenuItem<TItemData>,\n 'component' | 'children'\n> & {\n component?: ReactElement | string;\n\n children?: Array<ContextMenuItem<TItemData>>;\n};\n\nexport type ContextMenuItemSelectedEvent<TItem extends ContextMenuItem = ContextMenuItem> = CustomEvent<{\n value: TItem
|
|
4
|
+
"sourcesContent": ["export * from \"@vaadin/context-menu/vaadin-context-menu.js\";\nimport { type ComponentType, type ForwardedRef, forwardRef, type ReactElement, type RefAttributes } from 'react';\nimport {\n ContextMenu as _ContextMenu,\n type ContextMenuRendererContext,\n type ContextMenuElement,\n type ContextMenuProps as _ContextMenuProps,\n type ContextMenuItem as _ContextMenuItem,\n} from './generated/ContextMenu.js';\nimport { type ReactContextRendererProps, useContextRenderer } from './renderers/useContextRenderer.js';\nimport { getOriginalItem, mapItemsWithComponents } from './utils/mapItemsWithComponents.js';\n\nexport * from './generated/ContextMenu.js';\n\nexport type ContextMenuReactRendererProps = ReactContextRendererProps<ContextMenuRendererContext, ContextMenuElement>;\n\nexport type ContextMenuItem<TItemData extends object = object> = Omit<\n _ContextMenuItem<TItemData>,\n 'component' | 'children'\n> & {\n component?: ReactElement | string;\n\n children?: Array<ContextMenuItem<TItemData>>;\n};\n\nexport type ContextMenuItemSelectedEvent<TItem extends ContextMenuItem = ContextMenuItem> = CustomEvent<{\n value: ContextMenuItem<TItem>;\n}>;\n\n// The 'opened' property is omitted because it is readonly in the web component.\n// So you cannot set it up manually, only read from the component.\n// For changing the property, use specific methods of the component.\nexport type ContextMenuProps<TItem extends ContextMenuItem = ContextMenuItem> = Partial<\n Omit<_ContextMenuProps, 'opened' | 'renderer' | 'items' | 'onItemSelected'>\n> &\n Readonly<{\n renderer?: ComponentType<ContextMenuReactRendererProps> | null;\n\n items?: Array<TItem>;\n\n onItemSelected?: (event: ContextMenuItemSelectedEvent<TItem>) => void;\n }>;\n\nfunction ContextMenu<TItem extends ContextMenuItem = ContextMenuItem>(\n props: ContextMenuProps<TItem>,\n ref: ForwardedRef<ContextMenuElement>,\n): ReactElement | null {\n const [portals, renderer] = useContextRenderer(props.renderer);\n const [itemPortals, webComponentItems] = mapItemsWithComponents(props.items, 'vaadin-context-menu-item');\n\n const onItemSelected = props.onItemSelected;\n const mappedOnItemSelected = onItemSelected\n ? (event: CustomEvent<{ value: _ContextMenuItem }>) => {\n // Replace the mapped web component item with the original item\n Object.assign(event.detail, {\n value: getOriginalItem(event.detail.value),\n });\n\n onItemSelected(event as ContextMenuItemSelectedEvent<TItem>);\n }\n : undefined;\n return (\n <_ContextMenu\n {...props}\n ref={ref}\n renderer={renderer}\n items={webComponentItems}\n onItemSelected={mappedOnItemSelected}\n >\n {props.children}\n {portals}\n {itemPortals}\n </_ContextMenu>\n );\n}\n\nconst ForwardedContextMenu = forwardRef(ContextMenu) as <TItem extends ContextMenuItem = ContextMenuItem>(\n props: ContextMenuProps<TItem> & RefAttributes<ContextMenuElement>,\n) => ReactElement | null;\n\nexport { ForwardedContextMenu as ContextMenu };\n", "import type { EventName } from \"@lit/react\";\nimport { ContextMenu as ContextMenuElement, type ContextMenuEventMap as _ContextMenuEventMap, } from \"@vaadin/context-menu/vaadin-context-menu.js\";\nimport * as React from \"react\";\nimport { createComponent, type WebComponentProps } from \"../utils/createComponent.js\";\nexport { ContextMenuElement, };\nexport type ContextMenuEventMap = Readonly<{\n onItemSelected: EventName<_ContextMenuEventMap[\"item-selected\"]>;\n onOpenedChanged: EventName<_ContextMenuEventMap[\"opened-changed\"]>;\n}>;\nconst events = { onItemSelected: \"item-selected\", onOpenedChanged: \"opened-changed\" } as ContextMenuEventMap;\nexport type ContextMenuProps = WebComponentProps<ContextMenuElement, ContextMenuEventMap>;\nexport const ContextMenu = createComponent({\n elementClass: ContextMenuElement, events, react: React, tagName: \"vaadin-context-menu\"\n});\n"],
|
|
5
5
|
"mappings": "AAAA,WAAc,8CACd,OAAgD,cAAAA,MAAyD,QCAzG,OAAS,eAAeC,MAA6E,8CACrG,UAAYC,MAAW,QACvB,OAAS,mBAAAC,MAA+C,6BAMxD,IAAMC,EAAS,CAAE,eAAgB,gBAAiB,gBAAiB,gBAAiB,EAEvEC,EAAcC,EAAgB,CACvC,aAAcC,EAAoB,OAAAH,EAAQ,MAAOI,EAAO,QAAS,qBACrE,CAAC,EDJD,OAAyC,sBAAAC,MAA0B,oCACnE,OAAS,mBAAAC,EAAiB,0BAAAC,MAA8B,oCAoDpD,eAAAC,MAAA,oBAnBJ,SAASC,EACPC,EACAC,EACqB,CACrB,GAAM,CAACC,EAASC,CAAQ,EAAIR,EAAmBK,EAAM,QAAQ,EACvD,CAACI,EAAaC,CAAiB,EAAIR,EAAuBG,EAAM,MAAO,0BAA0B,EAEjGM,EAAiBN,EAAM,eAW7B,OACEF,EAACC,EAAA,CACE,GAAGC,EACJ,IAAKC,EACL,SAAUE,EACV,MAAOE,EACP,eAhByBC,EACxBC,GAAoD,CAEnD,OAAO,OAAOA,EAAM,OAAQ,CAC1B,MAAOX,EAAgBW,EAAM,OAAO,KAAK,CAC3C,CAAC,EAEDD,EAAeC,CAA4C,CAC7D,EACA,OASC,UAAAP,EAAM,SACNE,EACAE,GACH,CAEJ,CAEA,IAAMI,EAAuBC,EAAWV,CAAW",
|
|
6
6
|
"names": ["forwardRef", "ContextMenuElement", "React", "createComponent", "events", "ContextMenu", "createComponent", "ContextMenuElement", "React", "useContextRenderer", "getOriginalItem", "mapItemsWithComponents", "jsxs", "ContextMenu", "props", "ref", "portals", "renderer", "itemPortals", "webComponentItems", "onItemSelected", "event", "ForwardedContextMenu", "forwardRef"]
|
|
7
7
|
}
|
package/MenuBar.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type MenuBarItem<TItemData extends object = object> = Omit<_MenuBarItem<T
|
|
|
10
10
|
children?: Array<SubMenuItem<TItemData>>;
|
|
11
11
|
};
|
|
12
12
|
export type MenuBarItemSelectedEvent<TItem extends MenuBarItem = MenuBarItem> = CustomEvent<{
|
|
13
|
-
value: TItem
|
|
13
|
+
value: MenuBarItem<TItem>;
|
|
14
14
|
}>;
|
|
15
15
|
export type MenuBarProps<TItem extends MenuBarItem = MenuBarItem> = Partial<Omit<_MenuBarProps, 'items' | 'onItemSelected'>> & Readonly<{
|
|
16
16
|
items?: Array<TItem>;
|
package/MenuBar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuBar.d.ts","sourceRoot":"","sources":["src/MenuBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,wBAAwB,CAAC;AAGhC,cAAc,wBAAwB,CAAC;AAEvC,MAAM,MAAM,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG;IACrH,SAAS,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAElC,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG;IACrH,SAAS,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAElC,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IAAI,WAAW,CAAC;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuBar.d.ts","sourceRoot":"","sources":["src/MenuBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,wBAAwB,CAAC;AAGhC,cAAc,wBAAwB,CAAC;AAEvC,MAAM,MAAM,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG;IACrH,SAAS,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAElC,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG;IACrH,SAAS,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAElC,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IAAI,WAAW,CAAC;IAAE,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CAAE,CAAC,CAAC;AAE3H,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,GAC1H,QAAQ,CAAC;IACP,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAErB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;CACnE,CAAC,CAAC;AAyBL,QAAA,MAAM,gBAAgB,EAA0B,CAAC,KAAK,SAAS,WAAW,GAAG,WAAW,EACtF,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC,KACvD,YAAY,GAAG,IAAI,CAAC;AAEzB,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
package/MenuBar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"@vaadin/menu-bar/vaadin-menu-bar.js";import{forwardRef as
|
|
1
|
+
export*from"@vaadin/menu-bar/vaadin-menu-bar.js";import{forwardRef as s}from"react";import{MenuBar as u}from"@vaadin/menu-bar/vaadin-menu-bar.js";import*as p from"react";import{createComponent as M}from"./utils/createComponent.js";var I={onItemSelected:"item-selected"},a=M({elementClass:u,events:I,react:p,tagName:"vaadin-menu-bar"});import{getOriginalItem as l,mapItemsWithComponents as c}from"./utils/mapItemsWithComponents.js";import{jsxs as B}from"react/jsx-runtime";function d(e,r){let[m,o]=c(e.items,"vaadin-menu-bar-item"),n=e.onItemSelected;return B(a,{...e,ref:r,items:o,onItemSelected:n?t=>{Object.assign(t.detail,{value:l(t.detail.value)}),n(t)}:void 0,children:[e.children,m]})}var x=s(d);export{x as MenuBar,u as MenuBarElement};
|
|
2
2
|
//# sourceMappingURL=MenuBar.js.map
|
package/MenuBar.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["src/MenuBar.tsx", "src/generated/MenuBar.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@vaadin/menu-bar/vaadin-menu-bar.js\";\nimport { type ForwardedRef, forwardRef, type ReactElement, type RefAttributes } from 'react';\nimport {\n MenuBar as _MenuBar,\n type MenuBarElement,\n type MenuBarProps as _MenuBarProps,\n type MenuBarItem as _MenuBarItem,\n type SubMenuItem as _SubMenuItem,\n} from './generated/MenuBar.js';\nimport { getOriginalItem, mapItemsWithComponents } from './utils/mapItemsWithComponents.js';\n\nexport * from './generated/MenuBar.js';\n\nexport type SubMenuItem<TItemData extends object = object> = Omit<_SubMenuItem<TItemData>, 'component' | 'children'> & {\n component?: ReactElement | string;\n\n children?: Array<SubMenuItem<TItemData>>;\n};\n\nexport type MenuBarItem<TItemData extends object = object> = Omit<_MenuBarItem<TItemData>, 'component' | 'children'> & {\n component?: ReactElement | string;\n\n children?: Array<SubMenuItem<TItemData>>;\n};\n\nexport type MenuBarItemSelectedEvent<TItem extends MenuBarItem = MenuBarItem> = CustomEvent<{ value: TItem }>;\n\nexport type MenuBarProps<TItem extends MenuBarItem = MenuBarItem> = Partial<Omit<_MenuBarProps, 'items' | 'onItemSelected'>> &\n Readonly<{\n items?: Array<TItem>;\n\n onItemSelected?: (event: MenuBarItemSelectedEvent<TItem>) => void;\n }>;\n\nfunction MenuBar<TItem extends MenuBarItem = MenuBarItem>(props: MenuBarProps<TItem>, ref: ForwardedRef<MenuBarElement>): ReactElement | null {\n const [itemPortals, webComponentItems] = mapItemsWithComponents(props.items, 'vaadin-menu-bar-item');\n\n const onItemSelected = props.onItemSelected;\n const mappedOnItemSelected = onItemSelected\n ? (event: CustomEvent<{ value: _MenuBarItem }>) => {\n // Replace the mapped web component item with the original item\n Object.assign(event.detail, {\n value: getOriginalItem(event.detail.value),\n });\n\n onItemSelected(event as MenuBarItemSelectedEvent<TItem>);\n }\n : undefined;\n\n return (\n <_MenuBar {...props} ref={ref} items={webComponentItems} onItemSelected={mappedOnItemSelected}>\n {props.children}\n {itemPortals}\n </_MenuBar>\n );\n}\n\nconst ForwardedMenuBar = forwardRef(MenuBar) as <TItem extends MenuBarItem = MenuBarItem>(\n props: MenuBarProps<TItem> & RefAttributes<MenuBarElement>,\n) => ReactElement | null;\n\nexport { ForwardedMenuBar as MenuBar };\n", "import type { EventName } from \"@lit/react\";\nimport { MenuBar as MenuBarElement, type MenuBarEventMap as _MenuBarEventMap, } from \"@vaadin/menu-bar/vaadin-menu-bar.js\";\nimport * as React from \"react\";\nimport { createComponent, type WebComponentProps } from \"../utils/createComponent.js\";\nexport { MenuBarElement, };\nexport type MenuBarEventMap = Readonly<{\n onItemSelected: EventName<_MenuBarEventMap[\"item-selected\"]>;\n}>;\nconst events = { onItemSelected: \"item-selected\" } as MenuBarEventMap;\nexport type MenuBarProps = WebComponentProps<MenuBarElement, MenuBarEventMap>;\nexport const MenuBar = createComponent({\n elementClass: MenuBarElement, events, react: React, tagName: \"vaadin-menu-bar\"\n});\n"],
|
|
4
|
+
"sourcesContent": ["export * from \"@vaadin/menu-bar/vaadin-menu-bar.js\";\nimport { type ForwardedRef, forwardRef, type ReactElement, type RefAttributes } from 'react';\nimport {\n MenuBar as _MenuBar,\n type MenuBarElement,\n type MenuBarProps as _MenuBarProps,\n type MenuBarItem as _MenuBarItem,\n type SubMenuItem as _SubMenuItem,\n} from './generated/MenuBar.js';\nimport { getOriginalItem, mapItemsWithComponents } from './utils/mapItemsWithComponents.js';\n\nexport * from './generated/MenuBar.js';\n\nexport type SubMenuItem<TItemData extends object = object> = Omit<_SubMenuItem<TItemData>, 'component' | 'children'> & {\n component?: ReactElement | string;\n\n children?: Array<SubMenuItem<TItemData>>;\n};\n\nexport type MenuBarItem<TItemData extends object = object> = Omit<_MenuBarItem<TItemData>, 'component' | 'children'> & {\n component?: ReactElement | string;\n\n children?: Array<SubMenuItem<TItemData>>;\n};\n\nexport type MenuBarItemSelectedEvent<TItem extends MenuBarItem = MenuBarItem> = CustomEvent<{ value: MenuBarItem<TItem> }>;\n\nexport type MenuBarProps<TItem extends MenuBarItem = MenuBarItem> = Partial<Omit<_MenuBarProps, 'items' | 'onItemSelected'>> &\n Readonly<{\n items?: Array<TItem>;\n\n onItemSelected?: (event: MenuBarItemSelectedEvent<TItem>) => void;\n }>;\n\nfunction MenuBar<TItem extends MenuBarItem = MenuBarItem>(props: MenuBarProps<TItem>, ref: ForwardedRef<MenuBarElement>): ReactElement | null {\n const [itemPortals, webComponentItems] = mapItemsWithComponents(props.items, 'vaadin-menu-bar-item');\n\n const onItemSelected = props.onItemSelected;\n const mappedOnItemSelected = onItemSelected\n ? (event: CustomEvent<{ value: _MenuBarItem }>) => {\n // Replace the mapped web component item with the original item\n Object.assign(event.detail, {\n value: getOriginalItem(event.detail.value),\n });\n\n onItemSelected(event as MenuBarItemSelectedEvent<TItem>);\n }\n : undefined;\n\n return (\n <_MenuBar {...props} ref={ref} items={webComponentItems} onItemSelected={mappedOnItemSelected}>\n {props.children}\n {itemPortals}\n </_MenuBar>\n );\n}\n\nconst ForwardedMenuBar = forwardRef(MenuBar) as <TItem extends MenuBarItem = MenuBarItem>(\n props: MenuBarProps<TItem> & RefAttributes<MenuBarElement>,\n) => ReactElement | null;\n\nexport { ForwardedMenuBar as MenuBar };\n", "import type { EventName } from \"@lit/react\";\nimport { MenuBar as MenuBarElement, type MenuBarEventMap as _MenuBarEventMap, } from \"@vaadin/menu-bar/vaadin-menu-bar.js\";\nimport * as React from \"react\";\nimport { createComponent, type WebComponentProps } from \"../utils/createComponent.js\";\nexport { MenuBarElement, };\nexport type MenuBarEventMap = Readonly<{\n onItemSelected: EventName<_MenuBarEventMap[\"item-selected\"]>;\n}>;\nconst events = { onItemSelected: \"item-selected\" } as MenuBarEventMap;\nexport type MenuBarProps = WebComponentProps<MenuBarElement, MenuBarEventMap>;\nexport const MenuBar = createComponent({\n elementClass: MenuBarElement, events, react: React, tagName: \"vaadin-menu-bar\"\n});\n"],
|
|
5
5
|
"mappings": "AAAA,WAAc,sCACd,OAA4B,cAAAA,MAAyD,QCArF,OAAS,WAAWC,MAAiE,sCACrF,UAAYC,MAAW,QACvB,OAAS,mBAAAC,MAA+C,6BAKxD,IAAMC,EAAS,CAAE,eAAgB,eAAgB,EAEpCC,EAAUC,EAAgB,CACnC,aAAcC,EAAgB,OAAAH,EAAQ,MAAOI,EAAO,QAAS,iBACjE,CAAC,EDHD,OAAS,mBAAAC,EAAiB,0BAAAC,MAA8B,oCAyCpD,eAAAC,MAAA,oBAhBJ,SAASC,EAAiDC,EAA4BC,EAAwD,CAC5I,GAAM,CAACC,EAAaC,CAAiB,EAAIN,EAAuBG,EAAM,MAAO,sBAAsB,EAE7FI,EAAiBJ,EAAM,eAY7B,OACEF,EAACC,EAAA,CAAU,GAAGC,EAAO,IAAKC,EAAK,MAAOE,EAAmB,eAZ9BC,EACxBC,GAAgD,CAE/C,OAAO,OAAOA,EAAM,OAAQ,CAC1B,MAAOT,EAAgBS,EAAM,OAAO,KAAK,CAC3C,CAAC,EAEDD,EAAeC,CAAwC,CACzD,EACA,OAIC,UAAAL,EAAM,SACNE,GACH,CAEJ,CAEA,IAAMI,EAAmBC,EAAWR,CAAO",
|
|
6
6
|
"names": ["forwardRef", "MenuBarElement", "React", "createComponent", "events", "MenuBar", "createComponent", "MenuBarElement", "React", "getOriginalItem", "mapItemsWithComponents", "jsxs", "MenuBar", "props", "ref", "itemPortals", "webComponentItems", "onItemSelected", "event", "ForwardedMenuBar", "forwardRef"]
|
|
7
7
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
color: var(--vaadin-input-field-label-color, var(--lumo-secondary-text-color));
|
|
7
7
|
font-weight: var(--vaadin-input-field-label-font-weight, 500);
|
|
8
8
|
font-size: var(--vaadin-input-field-label-font-size, var(--lumo-font-size-s));
|
|
9
|
-
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
10
9
|
transition: color 0.2s;
|
|
11
10
|
line-height: 1;
|
|
12
|
-
padding-
|
|
11
|
+
padding-inline-start: calc(var(--lumo-border-radius-m) / 4);
|
|
12
|
+
padding-inline-end: 1em;
|
|
13
13
|
padding-bottom: 0.5em;
|
|
14
14
|
/* As a workaround for diacritics being cut off, add a top padding and a
|
|
15
15
|
negative margin to compensate */
|
|
@@ -93,16 +93,6 @@
|
|
|
93
93
|
|
|
94
94
|
/* RTL specific styles */
|
|
95
95
|
|
|
96
|
-
:host([dir='rtl']) [part='label'] {
|
|
97
|
-
margin-left: 0;
|
|
98
|
-
margin-right: calc(var(--lumo-border-radius-m) / 4);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
:host([dir='rtl']) [part='label'] {
|
|
102
|
-
padding-left: 1em;
|
|
103
|
-
padding-right: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
96
|
:host([dir='rtl']) [part='required-indicator']::after {
|
|
107
97
|
right: auto;
|
|
108
98
|
left: 0;
|
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-alpha8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -27,65 +27,65 @@
|
|
|
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/menu-bar": "24.8.0-
|
|
63
|
-
"@vaadin/message-input": "24.8.0-
|
|
64
|
-
"@vaadin/message-list": "24.8.0-
|
|
65
|
-
"@vaadin/multi-select-combo-box": "24.8.0-
|
|
66
|
-
"@vaadin/notification": "24.8.0-
|
|
67
|
-
"@vaadin/number-field": "24.8.0-
|
|
68
|
-
"@vaadin/overlay": "24.8.0-
|
|
69
|
-
"@vaadin/password-field": "24.8.0-
|
|
70
|
-
"@vaadin/popover": "24.8.0-
|
|
71
|
-
"@vaadin/progress-bar": "24.8.0-
|
|
72
|
-
"@vaadin/radio-group": "24.8.0-
|
|
73
|
-
"@vaadin/scroller": "24.8.0-
|
|
74
|
-
"@vaadin/select": "24.8.0-
|
|
75
|
-
"@vaadin/side-nav": "24.8.0-
|
|
76
|
-
"@vaadin/split-layout": "24.8.0-
|
|
77
|
-
"@vaadin/tabs": "24.8.0-
|
|
78
|
-
"@vaadin/tabsheet": "24.8.0-
|
|
79
|
-
"@vaadin/text-area": "24.8.0-
|
|
80
|
-
"@vaadin/text-field": "24.8.0-
|
|
81
|
-
"@vaadin/time-picker": "24.8.0-
|
|
82
|
-
"@vaadin/tooltip": "24.8.0-
|
|
83
|
-
"@vaadin/upload": "24.8.0-
|
|
84
|
-
"@vaadin/vaadin-lumo-styles": "24.8.0-
|
|
85
|
-
"@vaadin/vaadin-material-styles": "24.8.0-
|
|
86
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-
|
|
87
|
-
"@vaadin/vertical-layout": "24.8.0-
|
|
88
|
-
"@vaadin/virtual-list": "24.8.0-
|
|
30
|
+
"@vaadin/a11y-base": "24.8.0-alpha8",
|
|
31
|
+
"@vaadin/accordion": "24.8.0-alpha8",
|
|
32
|
+
"@vaadin/app-layout": "24.8.0-alpha8",
|
|
33
|
+
"@vaadin/avatar": "24.8.0-alpha8",
|
|
34
|
+
"@vaadin/avatar-group": "24.8.0-alpha8",
|
|
35
|
+
"@vaadin/button": "24.8.0-alpha8",
|
|
36
|
+
"@vaadin/card": "24.8.0-alpha8",
|
|
37
|
+
"@vaadin/checkbox": "24.8.0-alpha8",
|
|
38
|
+
"@vaadin/checkbox-group": "24.8.0-alpha8",
|
|
39
|
+
"@vaadin/combo-box": "24.8.0-alpha8",
|
|
40
|
+
"@vaadin/component-base": "24.8.0-alpha8",
|
|
41
|
+
"@vaadin/confirm-dialog": "24.8.0-alpha8",
|
|
42
|
+
"@vaadin/context-menu": "24.8.0-alpha8",
|
|
43
|
+
"@vaadin/custom-field": "24.8.0-alpha8",
|
|
44
|
+
"@vaadin/date-picker": "24.8.0-alpha8",
|
|
45
|
+
"@vaadin/date-time-picker": "24.8.0-alpha8",
|
|
46
|
+
"@vaadin/details": "24.8.0-alpha8",
|
|
47
|
+
"@vaadin/dialog": "24.8.0-alpha8",
|
|
48
|
+
"@vaadin/email-field": "24.8.0-alpha8",
|
|
49
|
+
"@vaadin/field-base": "24.8.0-alpha8",
|
|
50
|
+
"@vaadin/field-highlighter": "24.8.0-alpha8",
|
|
51
|
+
"@vaadin/form-layout": "24.8.0-alpha8",
|
|
52
|
+
"@vaadin/grid": "24.8.0-alpha8",
|
|
53
|
+
"@vaadin/horizontal-layout": "24.8.0-alpha8",
|
|
54
|
+
"@vaadin/icon": "24.8.0-alpha8",
|
|
55
|
+
"@vaadin/icons": "24.8.0-alpha8",
|
|
56
|
+
"@vaadin/input-container": "24.8.0-alpha8",
|
|
57
|
+
"@vaadin/integer-field": "24.8.0-alpha8",
|
|
58
|
+
"@vaadin/item": "24.8.0-alpha8",
|
|
59
|
+
"@vaadin/list-box": "24.8.0-alpha8",
|
|
60
|
+
"@vaadin/lit-renderer": "24.8.0-alpha8",
|
|
61
|
+
"@vaadin/login": "24.8.0-alpha8",
|
|
62
|
+
"@vaadin/menu-bar": "24.8.0-alpha8",
|
|
63
|
+
"@vaadin/message-input": "24.8.0-alpha8",
|
|
64
|
+
"@vaadin/message-list": "24.8.0-alpha8",
|
|
65
|
+
"@vaadin/multi-select-combo-box": "24.8.0-alpha8",
|
|
66
|
+
"@vaadin/notification": "24.8.0-alpha8",
|
|
67
|
+
"@vaadin/number-field": "24.8.0-alpha8",
|
|
68
|
+
"@vaadin/overlay": "24.8.0-alpha8",
|
|
69
|
+
"@vaadin/password-field": "24.8.0-alpha8",
|
|
70
|
+
"@vaadin/popover": "24.8.0-alpha8",
|
|
71
|
+
"@vaadin/progress-bar": "24.8.0-alpha8",
|
|
72
|
+
"@vaadin/radio-group": "24.8.0-alpha8",
|
|
73
|
+
"@vaadin/scroller": "24.8.0-alpha8",
|
|
74
|
+
"@vaadin/select": "24.8.0-alpha8",
|
|
75
|
+
"@vaadin/side-nav": "24.8.0-alpha8",
|
|
76
|
+
"@vaadin/split-layout": "24.8.0-alpha8",
|
|
77
|
+
"@vaadin/tabs": "24.8.0-alpha8",
|
|
78
|
+
"@vaadin/tabsheet": "24.8.0-alpha8",
|
|
79
|
+
"@vaadin/text-area": "24.8.0-alpha8",
|
|
80
|
+
"@vaadin/text-field": "24.8.0-alpha8",
|
|
81
|
+
"@vaadin/time-picker": "24.8.0-alpha8",
|
|
82
|
+
"@vaadin/tooltip": "24.8.0-alpha8",
|
|
83
|
+
"@vaadin/upload": "24.8.0-alpha8",
|
|
84
|
+
"@vaadin/vaadin-lumo-styles": "24.8.0-alpha8",
|
|
85
|
+
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
86
|
+
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
87
|
+
"@vaadin/vertical-layout": "24.8.0-alpha8",
|
|
88
|
+
"@vaadin/virtual-list": "24.8.0-alpha8"
|
|
89
89
|
},
|
|
90
90
|
"author": "Vaadin Ltd.",
|
|
91
91
|
"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-alpha8"});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-alpha8',\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,eACnC,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
|
}
|