@itwin/appui-react 5.21.1 → 5.23.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 (56) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/lib/appui-react/cursor/cursormenu/CursorMenu.d.ts.map +1 -1
  3. package/lib/appui-react/cursor/cursormenu/CursorMenu.js +0 -2
  4. package/lib/appui-react/cursor/cursormenu/CursorMenu.js.map +1 -1
  5. package/lib/appui-react/layout/state/NineZoneAction.d.ts +4 -4
  6. package/lib/appui-react/layout/state/NineZoneAction.d.ts.map +1 -1
  7. package/lib/appui-react/layout/state/NineZoneAction.js.map +1 -1
  8. package/lib/appui-react/layout/state/NineZoneStateReducer.d.ts.map +1 -1
  9. package/lib/appui-react/layout/state/NineZoneStateReducer.js +19 -5
  10. package/lib/appui-react/layout/state/NineZoneStateReducer.js.map +1 -1
  11. package/lib/appui-react/layout/widget/Overflow.d.ts.map +1 -1
  12. package/lib/appui-react/layout/widget/Overflow.js +1 -1
  13. package/lib/appui-react/layout/widget/Overflow.js.map +1 -1
  14. package/lib/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.d.ts +115 -0
  15. package/lib/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.d.ts.map +1 -0
  16. package/lib/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.js +82 -0
  17. package/lib/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.js.map +1 -0
  18. package/lib/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.scss +68 -0
  19. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.d.ts +27 -0
  20. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.d.ts.map +1 -0
  21. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.js +38 -0
  22. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.js.map +1 -0
  23. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.scss +44 -0
  24. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.d.ts +12 -0
  25. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.d.ts.map +1 -0
  26. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.js +31 -0
  27. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.js.map +1 -0
  28. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.scss +47 -0
  29. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.d.ts +18 -0
  30. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.d.ts.map +1 -0
  31. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.js +52 -0
  32. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.js.map +1 -0
  33. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.scss +6 -0
  34. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.d.ts +15 -0
  35. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.d.ts.map +1 -0
  36. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.js +35 -0
  37. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.js.map +1 -0
  38. package/lib/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.scss +29 -0
  39. package/lib/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
  40. package/lib/appui-react/widget-panels/Frontstage.js +7 -12
  41. package/lib/appui-react/widget-panels/Frontstage.js.map +1 -1
  42. package/lib/appui-react.d.ts +5 -0
  43. package/lib/appui-react.d.ts.map +1 -1
  44. package/lib/appui-react.js +5 -0
  45. package/lib/appui-react.js.map +1 -1
  46. package/lib/cjs/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.scss +68 -0
  47. package/lib/cjs/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.scss +44 -0
  48. package/lib/cjs/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.scss +47 -0
  49. package/lib/cjs/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.scss +6 -0
  50. package/lib/cjs/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.scss +29 -0
  51. package/lib/esm/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.scss +68 -0
  52. package/lib/esm/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.scss +44 -0
  53. package/lib/esm/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.scss +47 -0
  54. package/lib/esm/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.scss +6 -0
  55. package/lib/esm/appui-react/layout/widget/widget-content-layout/header/HeaderTopBar.scss +29 -0
  56. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/layout/widget/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,UAAU,mBAAmB;IAC3B,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAoCxD;AAED,UAAU,yBAAyB;IACjC,KAAK,IAAI,IAAI,CAAC;CACf;AAED,gBAAgB;AAChB,eAAO,MAAM,qBAAqB,sDAEtB,CAAC"}
1
+ {"version":3,"file":"Overflow.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/layout/widget/Overflow.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,UAAU,mBAAmB;IAC3B,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,qBAqCxD;AAED,UAAU,yBAAyB;IACjC,KAAK,IAAI,IAAI,CAAC;CACf;AAED,gBAAgB;AAChB,eAAO,MAAM,qBAAqB,sDAEtB,CAAC"}
@@ -31,7 +31,7 @@ export function WidgetOverflow(props) {
31
31
  const { translate } = useTranslation();
32
32
  const moreWidgetsTitle = translate("widget.tooltips.moreWidgets");
33
33
  return (React.createElement(WidgetOverflowContext.Provider, { value: overflowContext },
34
- React.createElement(DropdownMenu, { className: "nz-widget-overflow_menu", menuItems: props.items, visible: open, onVisibleChange: setOpen },
34
+ React.createElement(DropdownMenu, { className: "nz-widget-overflow_menu", menuItems: props.items, visible: open, onVisibleChange: setOpen, closeOnItemClick: false },
35
35
  React.createElement(TabBarButton, { label: moreWidgetsTitle, className: classnames("nz-widget-overflow", props.hidden && "nz-hidden"), ref: resizeObserverRef },
36
36
  React.createElement(SvgChevronRightSmall, null)))));
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/appui-react/layout/widget/Overflow.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE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B,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC,aAAa,CAEtD,SAAS,CAAC,CAAC;AACb,qBAAqB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAE/D,SAAS,aAAa,CAAC,OAAmB;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CACpC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAC5C,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Widget\n */\n\nimport \"./Overflow.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { useResizeObserver } from \"@itwin/core-react/internal\";\nimport { PanelSideContext } from \"../widget-panels/Panel.js\";\nimport { useLayout } from \"../base/LayoutStore.js\";\nimport { DropdownMenu } from \"@itwin/itwinui-react\";\nimport { SvgChevronRightSmall } from \"@itwin/itwinui-icons-react\";\nimport { TabBarButton } from \"./Button.js\";\nimport { useTranslation } from \"../../hooks/useTranslation.js\";\n\ninterface WidgetOverflowProps {\n items: React.ReactElement[];\n hidden?: boolean;\n onResize?: (w: number) => void;\n}\n\n/** @internal */\nexport function WidgetOverflow(props: WidgetOverflowProps) {\n const [open, setOpen] = React.useState(false);\n const resizeObserverRef = useResizeObserver<HTMLDivElement>(props.onResize);\n const handleClose = React.useCallback(() => {\n setOpen(false);\n }, []);\n usePanelPopup(handleClose);\n const overflowContext = React.useMemo<WidgetOverflowContextArgs>(() => {\n return {\n close: handleClose,\n };\n }, [handleClose]);\n\n const { translate } = useTranslation();\n const moreWidgetsTitle = translate(\"widget.tooltips.moreWidgets\");\n return (\n <WidgetOverflowContext.Provider value={overflowContext}>\n <DropdownMenu\n className=\"nz-widget-overflow_menu\"\n menuItems={props.items}\n visible={open}\n onVisibleChange={setOpen}\n >\n <TabBarButton\n label={moreWidgetsTitle}\n className={classnames(\n \"nz-widget-overflow\",\n props.hidden && \"nz-hidden\"\n )}\n ref={resizeObserverRef}\n >\n <SvgChevronRightSmall />\n </TabBarButton>\n </DropdownMenu>\n </WidgetOverflowContext.Provider>\n );\n}\n\ninterface WidgetOverflowContextArgs {\n close(): void;\n}\n\n/** @internal */\nexport const WidgetOverflowContext = React.createContext<\n WidgetOverflowContextArgs | undefined\n>(undefined);\nWidgetOverflowContext.displayName = \"nz:WidgetOverflowContext\";\n\nfunction usePanelPopup(onClose: () => void) {\n const side = React.useContext(PanelSideContext);\n const collapsed = useLayout((state) =>\n side ? state.panels[side].collapsed : false\n );\n React.useEffect(() => {\n if (collapsed) {\n onClose();\n }\n }, [collapsed, onClose]);\n}\n"]}
1
+ {"version":3,"file":"Overflow.js","sourceRoot":"","sources":["../../../../src/appui-react/layout/widget/Overflow.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,iBAAiB,CAAC;AACzB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,oBA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AAC;AAMD,gBAAgB;AAChB,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC,aAAa,CAEtD,SAAS,CAAC,CAAC;AACb,qBAAqB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAE/D,SAAS,aAAa,CAAC,OAAmB;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CACpC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAC5C,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Widget\n */\n\nimport \"./Overflow.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { useResizeObserver } from \"@itwin/core-react/internal\";\nimport { PanelSideContext } from \"../widget-panels/Panel.js\";\nimport { useLayout } from \"../base/LayoutStore.js\";\nimport { DropdownMenu } from \"@itwin/itwinui-react\";\nimport { SvgChevronRightSmall } from \"@itwin/itwinui-icons-react\";\nimport { TabBarButton } from \"./Button.js\";\nimport { useTranslation } from \"../../hooks/useTranslation.js\";\n\ninterface WidgetOverflowProps {\n items: React.ReactElement[];\n hidden?: boolean;\n onResize?: (w: number) => void;\n}\n\n/** @internal */\nexport function WidgetOverflow(props: WidgetOverflowProps) {\n const [open, setOpen] = React.useState(false);\n const resizeObserverRef = useResizeObserver<HTMLDivElement>(props.onResize);\n const handleClose = React.useCallback(() => {\n setOpen(false);\n }, []);\n usePanelPopup(handleClose);\n const overflowContext = React.useMemo<WidgetOverflowContextArgs>(() => {\n return {\n close: handleClose,\n };\n }, [handleClose]);\n\n const { translate } = useTranslation();\n const moreWidgetsTitle = translate(\"widget.tooltips.moreWidgets\");\n return (\n <WidgetOverflowContext.Provider value={overflowContext}>\n <DropdownMenu\n className=\"nz-widget-overflow_menu\"\n menuItems={props.items}\n visible={open}\n onVisibleChange={setOpen}\n closeOnItemClick={false}\n >\n <TabBarButton\n label={moreWidgetsTitle}\n className={classnames(\n \"nz-widget-overflow\",\n props.hidden && \"nz-hidden\"\n )}\n ref={resizeObserverRef}\n >\n <SvgChevronRightSmall />\n </TabBarButton>\n </DropdownMenu>\n </WidgetOverflowContext.Provider>\n );\n}\n\ninterface WidgetOverflowContextArgs {\n close(): void;\n}\n\n/** @internal */\nexport const WidgetOverflowContext = React.createContext<\n WidgetOverflowContextArgs | undefined\n>(undefined);\nWidgetOverflowContext.displayName = \"nz:WidgetOverflowContext\";\n\nfunction usePanelPopup(onClose: () => void) {\n const side = React.useContext(PanelSideContext);\n const collapsed = useLayout((state) =>\n side ? state.panels[side].collapsed : false\n );\n React.useEffect(() => {\n if (collapsed) {\n onClose();\n }\n }, [collapsed, onClose]);\n}\n"]}
@@ -0,0 +1,115 @@
1
+ /** @packageDocumentation
2
+ * @module WidgetContentLayout
3
+ */
4
+ import "./WidgetContentLayout.scss";
5
+ import type { ComponentPropsWithRef } from "react";
6
+ import * as React from "react";
7
+ import type { ToggleSwitch } from "@itwin/itwinui-react";
8
+ type IconMenu = IconMenuButton | IconMenuDivider;
9
+ interface IconMenuButton {
10
+ icon: React.ReactNode;
11
+ onClick: () => void;
12
+ label: string;
13
+ type?: "button";
14
+ disabled?: boolean;
15
+ isActive?: boolean;
16
+ }
17
+ interface IconMenuDivider {
18
+ type: "divider";
19
+ key?: string;
20
+ }
21
+ interface WidgetContentLayoutHeaderProps extends ComponentPropsWithRef<"div"> {
22
+ /**
23
+ * Toggle switch in the header.
24
+ */
25
+ toggle?: React.ComponentProps<typeof ToggleSwitch>;
26
+ /**
27
+ * Array of buttons to display in the header.
28
+ */
29
+ buttons?: React.ReactNode[];
30
+ /**
31
+ * Menu in the header.
32
+ */
33
+ menu?: {
34
+ title: string;
35
+ items: {
36
+ label: string;
37
+ onClick: () => void;
38
+ }[];
39
+ };
40
+ /**
41
+ * Title to display in the header.
42
+ */
43
+ title?: string;
44
+ /**
45
+ * Callback function for search functionality.
46
+ */
47
+ onSearch?: (value: string) => void;
48
+ /**
49
+ * Array of icon menu items to display in the header.
50
+ */
51
+ icons?: IconMenu[];
52
+ /**
53
+ * Size of the icons.
54
+ */
55
+ iconSize?: "small" | "large";
56
+ /**
57
+ * Child elements to render within the header.
58
+ */
59
+ children?: React.ReactNode;
60
+ }
61
+ interface WidgetContentLayoutBodyProps extends ComponentPropsWithRef<"div"> {
62
+ /**
63
+ * Whether the body is in a loading state.
64
+ */
65
+ isLoading?: boolean;
66
+ /**
67
+ * Whether to show a non-blocking loading indicator.
68
+ */
69
+ isNonBlockingLoading?: boolean;
70
+ /**
71
+ * Child elements to render within the body.
72
+ */
73
+ children?: React.ReactNode;
74
+ }
75
+ interface WidgetContentLayoutFooterProps extends ComponentPropsWithRef<"div"> {
76
+ /**
77
+ * Child elements to render within the footer.
78
+ */
79
+ children?: React.ReactNode;
80
+ }
81
+ interface WidgetContentLayoutProps extends ComponentPropsWithRef<"div"> {
82
+ /**
83
+ * Whether the entire layout is in a loading state.
84
+ */
85
+ isLoading?: boolean;
86
+ /**
87
+ * Whether to hide dividers between sections.
88
+ */
89
+ hideDividers?: boolean;
90
+ /**
91
+ * Child elements (Header, Body, Footer) to render.
92
+ */
93
+ children?: React.ReactNode;
94
+ }
95
+ /**
96
+ * A layout component for widgets that provides a top section for buttons, a body section and a footer section.
97
+ * @example
98
+ * <WidgetContentLayout>
99
+ * <WidgetContentLayout.Header />
100
+ * <WidgetContentLayout.Body>
101
+ * <ContentComponent />
102
+ * </WidgetContentLayout.Body>
103
+ * <WidgetContentLayout.Footer>
104
+ * <FooterComponent />
105
+ * </WidgetContentLayout.Footer>
106
+ * </WidgetContentLayout>
107
+ * @public
108
+ */
109
+ export declare const WidgetContentLayout: React.ForwardRefExoticComponent<Omit<WidgetContentLayoutProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
110
+ Header: React.ForwardRefExoticComponent<Omit<WidgetContentLayoutHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
111
+ Body: React.ForwardRefExoticComponent<Omit<WidgetContentLayoutBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
112
+ Footer: React.ForwardRefExoticComponent<Omit<WidgetContentLayoutFooterProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
113
+ };
114
+ export {};
115
+ //# sourceMappingURL=WidgetContentLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetContentLayout.d.ts","sourceRoot":"","sources":["../../../../../src/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,KAAK,QAAQ,GAAG,cAAc,GAAG,eAAe,CAAC;AAEjD,UAAU,cAAc;IACtB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,C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AEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AA2CD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB;;;;CAI9B,CAAC"}
@@ -0,0 +1,82 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module WidgetContentLayout
7
+ */
8
+ import "./WidgetContentLayout.scss";
9
+ import classNames from "classnames";
10
+ import * as React from "react";
11
+ import { Divider, ProgressLinear, ProgressRadial } from "@itwin/itwinui-react";
12
+ import { HeaderLayout } from "./header/HeaderLayout.js";
13
+ const Header = React.forwardRef(function Header(props, ref) {
14
+ const { className, children, toggle, buttons, menu, title, onSearch, icons, iconSize, ...rest } = props;
15
+ return (React.createElement("div", { className: classNames("nz-widget-widgetContentLayout-header", className), ...rest, ref: ref },
16
+ React.createElement(HeaderLayout, { toggle: toggle, buttons: buttons, menu: menu, title: title, onSearch: onSearch, icons: icons, iconSize: iconSize }),
17
+ children));
18
+ });
19
+ Header.displayName = "appui:WidgetContentLayout.Header";
20
+ const Body = React.forwardRef(function Body(props, ref) {
21
+ const { isNonBlockingLoading, isLoading, className, children, ...rest } = props;
22
+ return (React.createElement("div", { className: "nz-widget-widgetContentLayout-body_wrapper" },
23
+ isLoading ? (React.createElement(LoadingOverlay, null)) : (isNonBlockingLoading && (React.createElement(ProgressLinear, { className: "nz-widget-widgetContentLayout-progress" }))),
24
+ React.createElement("div", { className: classNames("nz-widget-widgetContentLayout-body", className), ...rest, ref: ref }, children)));
25
+ });
26
+ Body.displayName = "appui:WidgetContentLayout.Body";
27
+ const Footer = React.forwardRef(function Footer(props, ref) {
28
+ const { className, children, ...rest } = props;
29
+ return (React.createElement("div", { className: classNames("nz-widget-widgetContentLayout-footer", className), ...rest, ref: ref }, children));
30
+ });
31
+ Footer.displayName = "appui:WidgetContentLayout.Footer";
32
+ function LoadingOverlay() {
33
+ return (React.createElement("div", { className: "nz-widget-widgetContentLayout-loadingOverlay" },
34
+ React.createElement(ProgressRadial, null)));
35
+ }
36
+ const WidgetContentLayoutInner = React.forwardRef(function WidgetContentLayoutInner(props, ref) {
37
+ const { isLoading, hideDividers, children, className, ...divProps } = props;
38
+ const [headerElement, setHeaderElement] = React.useState();
39
+ const [bodyElement, setBodyElement] = React.useState();
40
+ const [footerElement, setFooterElement] = React.useState();
41
+ React.useEffect(() => {
42
+ React.Children.forEach(children, (child) => {
43
+ if (!React.isValidElement(child))
44
+ return;
45
+ if (child.type === Header)
46
+ setHeaderElement(child);
47
+ else if (child.type === Body)
48
+ setBodyElement(child);
49
+ else if (child.type === Footer)
50
+ setFooterElement(child);
51
+ });
52
+ }, [children]);
53
+ const widgetComponents = [headerElement, bodyElement, footerElement].filter(Boolean);
54
+ return (React.createElement("div", { className: classNames("nz-widget-widgetContentLayout", className), ...divProps, ref: ref },
55
+ isLoading && React.createElement(LoadingOverlay, null),
56
+ widgetComponents.map((component, index) => (React.createElement(React.Fragment, { key: index },
57
+ component,
58
+ index < widgetComponents.length - 1 && !hideDividers && (React.createElement(Divider, { className: "nz-widget-widgetContentLayout-divider" })))))));
59
+ });
60
+ /**
61
+ * A layout component for widgets that provides a top section for buttons, a body section and a footer section.
62
+ * @example
63
+ * <WidgetContentLayout>
64
+ * <WidgetContentLayout.Header />
65
+ * <WidgetContentLayout.Body>
66
+ * <ContentComponent />
67
+ * </WidgetContentLayout.Body>
68
+ * <WidgetContentLayout.Footer>
69
+ * <FooterComponent />
70
+ * </WidgetContentLayout.Footer>
71
+ * </WidgetContentLayout>
72
+ * @public
73
+ */
74
+ export const WidgetContentLayout = Object.assign(WidgetContentLayoutInner, {
75
+ Header,
76
+ Body,
77
+ Footer,
78
+ });
79
+ WidgetContentLayout.Header = Header;
80
+ WidgetContentLayout.Body = Body;
81
+ WidgetContentLayout.Footer = Footer;
82
+ //# sourceMappingURL=WidgetContentLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WidgetContentLayout.js","sourceRoot":"","sources":["../../../../../src/appui-react/layout/widget/widget-content-layout/WidgetContentLayout.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG/E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAwDxD,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAC7B,SAAS,MAAM,CAAC,KAAK,EAAE,GAAG;IACxB,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CACnB,sCAAsC,EACtC,SAAS,CACV,KACG,IAAI,EACR,GAAG,EAAE,GAAG;QAER,oBAAC,YAAY,IACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB;QACD,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,kCAAkC,CAAC;AAiBxD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAC3B,SAAS,IAAI,CAAC,KAAK,EAAE,GAAG;IACtB,MAAM,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,IAA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;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE;IACzE,MAAM;IACN,IAAI;IACJ,MAAM;CACP,CAAC,CAAC;AAEH,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC;AACpC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC;AAChC,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module WidgetContentLayout\n */\n\nimport \"./WidgetContentLayout.scss\";\nimport classNames from \"classnames\";\nimport type { ComponentPropsWithRef } from \"react\";\nimport * as React from \"react\";\n\nimport { Divider, ProgressLinear, ProgressRadial } from \"@itwin/itwinui-react\";\nimport type { ToggleSwitch } from \"@itwin/itwinui-react\";\n\nimport { HeaderLayout } from \"./header/HeaderLayout.js\";\n\ntype IconMenu = IconMenuButton | IconMenuDivider;\n\ninterface IconMenuButton {\n icon: React.ReactNode;\n onClick: () => void;\n label: string;\n type?: \"button\";\n disabled?: boolean;\n isActive?: boolean;\n}\n\ninterface IconMenuDivider {\n type: \"divider\";\n key?: string;\n}\n\ninterface WidgetContentLayoutHeaderProps extends ComponentPropsWithRef<\"div\"> {\n /**\n * Toggle switch in the header.\n */\n toggle?: React.ComponentProps<typeof ToggleSwitch>;\n /**\n * Array of buttons to display in the header.\n */\n buttons?: React.ReactNode[];\n /**\n * Menu in the header.\n */\n menu?: {\n title: string;\n items: { label: string; onClick: () => void }[];\n };\n /**\n * Title to display in the header.\n */\n title?: string;\n /**\n * Callback function for search functionality.\n */\n onSearch?: (value: string) => void;\n /**\n * Array of icon menu items to display in the header.\n */\n icons?: IconMenu[];\n /**\n * Size of the icons.\n */\n iconSize?: \"small\" | \"large\";\n /**\n * Child elements to render within the header.\n */\n children?: React.ReactNode;\n}\n\nconst Header = React.forwardRef<HTMLDivElement, WidgetContentLayoutHeaderProps>(\n function Header(props, ref) {\n const {\n className,\n children,\n toggle,\n buttons,\n menu,\n title,\n onSearch,\n icons,\n iconSize,\n ...rest\n } = props;\n\n return (\n <div\n className={classNames(\n \"nz-widget-widgetContentLayout-header\",\n className\n )}\n {...rest}\n ref={ref}\n >\n <HeaderLayout\n toggle={toggle}\n buttons={buttons}\n menu={menu}\n title={title}\n onSearch={onSearch}\n icons={icons}\n iconSize={iconSize}\n />\n {children}\n </div>\n );\n }\n);\n\nHeader.displayName = \"appui:WidgetContentLayout.Header\";\n\ninterface WidgetContentLayoutBodyProps extends ComponentPropsWithRef<\"div\"> {\n /**\n * Whether the body is in a loading state.\n */\n isLoading?: boolean;\n /**\n * Whether to show a non-blocking loading indicator.\n */\n isNonBlockingLoading?: boolean;\n /**\n * Child elements to render within the body.\n */\n children?: React.ReactNode;\n}\n\nconst Body = React.forwardRef<HTMLDivElement, WidgetContentLayoutBodyProps>(\n function Body(props, ref) {\n const { isNonBlockingLoading, isLoading, className, children, ...rest } =\n props;\n return (\n <div className=\"nz-widget-widgetContentLayout-body_wrapper\">\n {isLoading ? (\n <LoadingOverlay />\n ) : (\n isNonBlockingLoading && (\n <ProgressLinear className=\"nz-widget-widgetContentLayout-progress\" />\n )\n )}\n <div\n className={classNames(\n \"nz-widget-widgetContentLayout-body\",\n className\n )}\n {...rest}\n ref={ref}\n >\n {children}\n </div>\n </div>\n );\n }\n);\nBody.displayName = \"appui:WidgetContentLayout.Body\";\n\ninterface WidgetContentLayoutFooterProps extends ComponentPropsWithRef<\"div\"> {\n /**\n * Child elements to render within the footer.\n */\n children?: React.ReactNode;\n}\n\nconst Footer = React.forwardRef<HTMLDivElement, WidgetContentLayoutFooterProps>(\n function Footer(props, ref) {\n const { className, children, ...rest } = props;\n return (\n <div\n className={classNames(\n \"nz-widget-widgetContentLayout-footer\",\n className\n )}\n {...rest}\n ref={ref}\n >\n {children}\n </div>\n );\n }\n);\nFooter.displayName = \"appui:WidgetContentLayout.Footer\";\n\nfunction LoadingOverlay() {\n return (\n <div className=\"nz-widget-widgetContentLayout-loadingOverlay\">\n <ProgressRadial />\n </div>\n );\n}\n\ninterface WidgetContentLayoutProps extends ComponentPropsWithRef<\"div\"> {\n /**\n * Whether the entire layout is in a loading state.\n */\n isLoading?: boolean;\n /**\n * Whether to hide dividers between sections.\n */\n hideDividers?: boolean;\n /**\n * Child elements (Header, Body, Footer) to render.\n */\n children?: React.ReactNode;\n}\n\nconst WidgetContentLayoutInner = React.forwardRef<\n HTMLDivElement,\n WidgetContentLayoutProps\n>(function WidgetContentLayoutInner(props, ref) {\n const { isLoading, hideDividers, children, className, ...divProps } = props;\n const [headerElement, setHeaderElement] = React.useState<React.ReactNode>();\n const [bodyElement, setBodyElement] = React.useState<React.ReactNode>();\n const [footerElement, setFooterElement] = React.useState<React.ReactNode>();\n\n React.useEffect(() => {\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n if (child.type === Header) setHeaderElement(child);\n else if (child.type === Body) setBodyElement(child);\n else if (child.type === Footer) setFooterElement(child);\n });\n }, [children]);\n\n const widgetComponents = [headerElement, bodyElement, footerElement].filter(\n Boolean\n );\n\n return (\n <div\n className={classNames(\"nz-widget-widgetContentLayout\", className)}\n {...divProps}\n ref={ref}\n >\n {isLoading && <LoadingOverlay />}\n {widgetComponents.map((component, index) => (\n <React.Fragment key={index}>\n {component}\n {index < widgetComponents.length - 1 && !hideDividers && (\n <Divider className=\"nz-widget-widgetContentLayout-divider\" />\n )}\n </React.Fragment>\n ))}\n </div>\n );\n});\n\n/**\n * A layout component for widgets that provides a top section for buttons, a body section and a footer section.\n * @example\n * <WidgetContentLayout>\n * <WidgetContentLayout.Header />\n * <WidgetContentLayout.Body>\n * <ContentComponent />\n * </WidgetContentLayout.Body>\n * <WidgetContentLayout.Footer>\n * <FooterComponent />\n * </WidgetContentLayout.Footer>\n * </WidgetContentLayout>\n * @public\n */\nexport const WidgetContentLayout = Object.assign(WidgetContentLayoutInner, {\n Header,\n Body,\n Footer,\n});\n\nWidgetContentLayout.Header = Header;\nWidgetContentLayout.Body = Body;\nWidgetContentLayout.Footer = Footer;\n"]}
@@ -0,0 +1,68 @@
1
+ @layer appui.component {
2
+ .nz-widget-widgetContentLayout {
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ width: 100%;
7
+ position: relative;
8
+ overflow: hidden;
9
+ }
10
+ .nz-widget-widgetContentLayout-header {
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: var(--iui-size-s);
14
+ padding: var(--iui-size-s);
15
+ }
16
+
17
+ .nz-widget-widgetContentLayout-body_wrapper {
18
+ position: relative;
19
+ flex: 1;
20
+ height: 0px;
21
+ width: 100%;
22
+ display: grid;
23
+ gap: var(--iui-size-s);
24
+
25
+ .nz-widget-widgetContentLayout-progress {
26
+ padding-inline: var(--iui-size-s);
27
+
28
+ /* check if it has sibling with classname .nz-widget-widgetContentLayout-body */
29
+ + .nz-widget-widgetContentLayout-body {
30
+ padding-block-start: 0px;
31
+ }
32
+ }
33
+
34
+ .nz-widget-widgetContentLayout-body {
35
+ display: flex;
36
+ width: 100%;
37
+ flex-direction: column;
38
+ gap: var(--iui-size-s);
39
+ flex: 1;
40
+ overflow: auto;
41
+ padding: var(--iui-size-s);
42
+ }
43
+ }
44
+
45
+ .nz-widget-widgetContentLayout-footer {
46
+ display: flex;
47
+ gap: var(--iui-size-s);
48
+ justify-content: flex-end;
49
+ width: 100%;
50
+ padding: var(--iui-size-s);
51
+ }
52
+
53
+ .nz-widget-widgetContentLayout-loadingOverlay {
54
+ position: absolute;
55
+ top: 0;
56
+ left: 0;
57
+ right: 0;
58
+ bottom: 0;
59
+ display: grid;
60
+ place-items: center;
61
+ z-index: 1000;
62
+ backdrop-filter: blur(5px);
63
+ }
64
+
65
+ .nz-widget-widgetContentLayout-divider {
66
+ margin-inline: var(--iui-size-s);
67
+ }
68
+ }
@@ -0,0 +1,27 @@
1
+ import "./HeaderIconToolbar.scss";
2
+ import * as React from "react";
3
+ import type { WidgetContentLayout } from "../WidgetContentLayout.js";
4
+ type WidgetContentLayoutHeaderProps = React.ComponentProps<typeof WidgetContentLayout.Header>;
5
+ type IconMenu = NonNullable<WidgetContentLayoutHeaderProps["icons"]>[number];
6
+ interface IconMenuSearch {
7
+ type: "search";
8
+ }
9
+ type SearchExpandedState = [
10
+ boolean,
11
+ React.Dispatch<React.SetStateAction<boolean>>
12
+ ];
13
+ interface HeaderIconToolbarProps extends Pick<WidgetContentLayoutHeaderProps, "iconSize" | "onSearch"> {
14
+ /** Array of icon menu items to display, including regular icons, search, and dividers. */
15
+ menuIcons: (IconMenu | IconMenuSearch)[];
16
+ /** State tuple controlling whether the search box is expanded or collapsed. */
17
+ searchExpandedState: SearchExpandedState;
18
+ }
19
+ /**
20
+ * Header toolbar component that displays menu icons with overflow handling.
21
+ * Renders a button group with icons, search functionality, and an overflow menu.
22
+ * Icons that don't fit in the available space are moved into a dropdown menu.
23
+ * @internal
24
+ */
25
+ export declare function HeaderIconToolbar(props: HeaderIconToolbarProps): React.JSX.Element;
26
+ export {};
27
+ //# sourceMappingURL=HeaderIconToolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderIconToolbar.d.ts","sourceRoot":"","sources":["../../../../../../src/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.tsx"],"names":[],"mappings":"AAKA,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,KAAK,8BAA8B,GAAG,KAAK,CAAC,cAAc,CACxD,OAAO,mBAAmB,CAAC,MAAM,CAClC,CAAC;AACF,KAAK,QAAQ,GAAG,WAAW,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,UAAU,cAAc;IACtB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,KAAK,mBAAmB,GAAG;IACzB,OAAO;IACP,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;CAC9C,CAAC;AAEF,UAAU,sBACR,SAAQ,IAAI,CAAC,8BAA8B,EAAE,UAAU,GAAG,UAAU,CAAC;IACrE,0FAA0F;IAC1F,SAAS,EAAE,CAAC,QAAQ,GAAG,cAAc,CAAC,EAAE,CAAC;IACzC,+EAA+E;IAC/E,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAyG9D"}
@@ -0,0 +1,38 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import "./HeaderIconToolbar.scss";
6
+ import * as React from "react";
7
+ import { ButtonGroup, Divider, DropdownMenu, IconButton, MenuDivider, MenuItem, } from "@itwin/itwinui-react";
8
+ import { SvgMore, SvgSearch } from "@itwin/itwinui-icons-react";
9
+ import { HeaderSearch } from "./HeaderSearch.js";
10
+ /**
11
+ * Header toolbar component that displays menu icons with overflow handling.
12
+ * Renders a button group with icons, search functionality, and an overflow menu.
13
+ * Icons that don't fit in the available space are moved into a dropdown menu.
14
+ * @internal
15
+ */
16
+ export function HeaderIconToolbar(props) {
17
+ const [searchIsExpanded, setSearchIsExpanded] = props.searchExpandedState;
18
+ const searchState = React.useState("");
19
+ return (React.createElement("div", { className: "nz-widget-widgetContentLayout-header-headerIconToolbar", "data-_appui-icon-size": props.iconSize, "data-_appui-search-expanded": searchIsExpanded ? "true" : "false", "data-_appui-single-item": props.menuIcons.length === 1 ? "true" : "false" },
20
+ React.createElement(ButtonGroup, { key: String(searchIsExpanded), className: "nz-buttonGroup", overflowPlacement: "end", overflowButton: (overflowStart) => (React.createElement(DropdownMenu, { menuItems: (close) => Array(props.menuIcons.length - overflowStart)
21
+ .fill(null)
22
+ .map((_, _index) => {
23
+ const index = overflowStart + _index;
24
+ const icon = props.menuIcons.at(index);
25
+ if (!icon)
26
+ return React.createElement(React.Fragment, null);
27
+ return icon.type === "divider" ? (_index === 0 || searchIsExpanded ? (React.createElement(React.Fragment, { key: index })) : (React.createElement(MenuDivider, { key: index }))) : icon.type === "search" ? (!searchIsExpanded ? (React.createElement(MenuItem, { key: index, onClick: () => {
28
+ close();
29
+ setSearchIsExpanded(true);
30
+ }, startIcon: React.createElement(SvgSearch, null) }, "Search")) : (React.createElement(React.Fragment, { key: index }))) : (React.createElement(MenuItem, { isSelected: icon.isActive, disabled: icon.disabled, key: index, onClick: () => {
31
+ icon.onClick();
32
+ close();
33
+ }, startIcon: React.createElement(React.Fragment, null, icon.icon) }, icon.label));
34
+ }) },
35
+ React.createElement(IconButton, { size: props.iconSize, styleType: "borderless", "aria-label": "More" },
36
+ React.createElement(SvgMore, null)))) }, props.menuIcons.map((icon, index) => icon.type === "divider" ? (React.createElement(Divider, { orientation: "vertical", key: icon.key ?? `divider-${index}` })) : icon.type === "search" ? (React.createElement(HeaderSearch, { key: "search", searchExpandedState: props.searchExpandedState, searchState: searchState, iconSize: props.iconSize, onSearch: props.onSearch })) : (React.createElement(IconButton, { disabled: icon.disabled, label: icon.label, key: icon.label, size: props.iconSize, styleType: "borderless", onClick: icon.onClick, labelProps: { placement: "bottom" }, isActive: icon.isActive, className: "nz-iconButton" }, icon.icon))))));
37
+ }
38
+ //# sourceMappingURL=HeaderIconToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderIconToolbar.js","sourceRoot":"","sources":["../../../../../../src/appui-react/layout/widget/widget-content-layout/header/HeaderIconToolbar.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OA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AAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CACxB,oBAAC,OAAO,IACN,WAAW,EAAC,UAAU,EACtB,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,WAAW,KAAK,EAAE,GACnC,CACH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC3B,oBAAC,YAAY,IACX,GAAG,EAAC,QAAQ,EACZ,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,UAAU,IACT,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,IAAI,EAAE,KAAK,CAAC,QAAQ,EACpB,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,UAAU,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAC,eAAe,IAExB,IAAI,CAAC,IAAI,CACC,CACd,CACF,CACW,CACV,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./HeaderIconToolbar.scss\";\nimport * as React from \"react\";\nimport {\n ButtonGroup,\n Divider,\n DropdownMenu,\n IconButton,\n MenuDivider,\n MenuItem,\n} from \"@itwin/itwinui-react\";\nimport { SvgMore, SvgSearch } from \"@itwin/itwinui-icons-react\";\nimport { HeaderSearch } from \"./HeaderSearch.js\";\nimport type { WidgetContentLayout } from \"../WidgetContentLayout.js\";\n\ntype WidgetContentLayoutHeaderProps = React.ComponentProps<\n typeof WidgetContentLayout.Header\n>;\ntype IconMenu = NonNullable<WidgetContentLayoutHeaderProps[\"icons\"]>[number];\n\ninterface IconMenuSearch {\n type: \"search\";\n}\n\ntype SearchExpandedState = [\n boolean,\n React.Dispatch<React.SetStateAction<boolean>>\n];\n\ninterface HeaderIconToolbarProps\n extends Pick<WidgetContentLayoutHeaderProps, \"iconSize\" | \"onSearch\"> {\n /** Array of icon menu items to display, including regular icons, search, and dividers. */\n menuIcons: (IconMenu | IconMenuSearch)[];\n /** State tuple controlling whether the search box is expanded or collapsed. */\n searchExpandedState: SearchExpandedState;\n}\n\n/**\n * Header toolbar component that displays menu icons with overflow handling.\n * Renders a button group with icons, search functionality, and an overflow menu.\n * Icons that don't fit in the available space are moved into a dropdown menu.\n * @internal\n */\nexport function HeaderIconToolbar(props: HeaderIconToolbarProps) {\n const [searchIsExpanded, setSearchIsExpanded] = props.searchExpandedState;\n const searchState = React.useState(\"\");\n\n return (\n <div\n className=\"nz-widget-widgetContentLayout-header-headerIconToolbar\"\n data-_appui-icon-size={props.iconSize}\n data-_appui-search-expanded={searchIsExpanded ? \"true\" : \"false\"}\n data-_appui-single-item={props.menuIcons.length === 1 ? \"true\" : \"false\"}\n >\n <ButtonGroup\n key={String(searchIsExpanded)}\n className=\"nz-buttonGroup\"\n overflowPlacement=\"end\"\n overflowButton={(overflowStart) => (\n <DropdownMenu\n menuItems={(close) =>\n Array(props.menuIcons.length - overflowStart)\n .fill(null)\n .map((_, _index) => {\n const index = overflowStart + _index;\n const icon = props.menuIcons.at(index);\n if (!icon) return <></>;\n return icon.type === \"divider\" ? (\n _index === 0 || searchIsExpanded ? (\n <React.Fragment key={index}></React.Fragment>\n ) : (\n <MenuDivider key={index} />\n )\n ) : icon.type === \"search\" ? (\n !searchIsExpanded ? (\n <MenuItem\n key={index}\n onClick={() => {\n close();\n setSearchIsExpanded(true);\n }}\n startIcon={<SvgSearch />}\n >\n Search\n </MenuItem>\n ) : (\n <React.Fragment key={index}></React.Fragment>\n )\n ) : (\n <MenuItem\n isSelected={icon.isActive}\n disabled={icon.disabled}\n key={index}\n onClick={() => {\n icon.onClick();\n close();\n }}\n startIcon={<>{icon.icon}</>}\n >\n {icon.label}\n </MenuItem>\n );\n })\n }\n >\n <IconButton\n size={props.iconSize}\n styleType=\"borderless\"\n aria-label=\"More\"\n >\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n )}\n >\n {props.menuIcons.map((icon, index) =>\n icon.type === \"divider\" ? (\n <Divider\n orientation=\"vertical\"\n key={icon.key ?? `divider-${index}`}\n />\n ) : icon.type === \"search\" ? (\n <HeaderSearch\n key=\"search\"\n searchExpandedState={props.searchExpandedState}\n searchState={searchState}\n iconSize={props.iconSize}\n onSearch={props.onSearch}\n />\n ) : (\n <IconButton\n disabled={icon.disabled}\n label={icon.label}\n key={icon.label}\n size={props.iconSize}\n styleType=\"borderless\"\n onClick={icon.onClick}\n labelProps={{ placement: \"bottom\" }}\n isActive={icon.isActive}\n className=\"nz-iconButton\"\n >\n {icon.icon}\n </IconButton>\n )\n )}\n </ButtonGroup>\n </div>\n );\n}\n"]}
@@ -0,0 +1,44 @@
1
+ @layer appui.component {
2
+ .nz-widget-widgetContentLayout-header-headerIconToolbar {
3
+ --_appui-icon-size: var(--iui-component-height);
4
+ --_appui-max-search-width: 200px;
5
+ min-width: var(--_appui-icon-size);
6
+ min-height: var(--_appui-icon-size);
7
+
8
+ &[data-_appui-icon-size="small"] {
9
+ --icon-size: var(--iui-component-height-small);
10
+ }
11
+
12
+ &[data-_appui-icon-size="large"] {
13
+ --icon-size: var(--iui-component-height-large);
14
+ }
15
+
16
+ &[data-_appui-search-expanded="true"] {
17
+ &[data-_appui-single-item="true"] {
18
+ min-width: var(--_appui-max-search-width);
19
+ }
20
+ &[data-_appui-single-item="false"] {
21
+ min-width: calc(
22
+ var(--_appui-max-search-width) + var(--_appui-icon-size) +
23
+ var(--iui-size-s)
24
+ );
25
+ }
26
+ }
27
+
28
+ .nz-buttonGroup {
29
+ gap: var(--iui-size-s);
30
+ &:before {
31
+ content: "";
32
+ flex: 1;
33
+ }
34
+
35
+ > :first-child {
36
+ margin-inline-start: calc(-1 * var(--iui-size-s));
37
+ }
38
+
39
+ .nz-iconButton[data-iui-active="true"]:after {
40
+ inset-block: unset;
41
+ }
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,12 @@
1
+ import "./HeaderLayout.scss";
2
+ import * as React from "react";
3
+ import type { WidgetContentLayout } from "../WidgetContentLayout.js";
4
+ type WidgetContentLayoutHeaderProps = React.ComponentProps<typeof WidgetContentLayout.Header>;
5
+ type HeaderLayoutProps = Pick<WidgetContentLayoutHeaderProps, "toggle" | "buttons" | "menu" | "title" | "onSearch" | "icons" | "iconSize">;
6
+ /**
7
+ * A layout component for the header, including optional search, icons, buttons, title, and a menu.
8
+ * @internal
9
+ */
10
+ export declare function HeaderLayout(props: HeaderLayoutProps): React.JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=HeaderLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.tsx"],"names":[],"mappings":"AAKA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,KAAK,8BAA8B,GAAG,KAAK,CAAC,cAAc,CACxD,OAAO,mBAAmB,CAAC,MAAM,CAClC,CAAC;AAEF,KAAK,iBAAiB,GAAG,IAAI,CAC3B,8BAA8B,EAC9B,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAC5E,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAiDpD"}
@@ -0,0 +1,31 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import "./HeaderLayout.scss";
6
+ import * as React from "react";
7
+ import { DropdownButton, MenuItem, Text, ToggleSwitch, } from "@itwin/itwinui-react";
8
+ import { HeaderTopBar } from "./HeaderTopBar.js";
9
+ /**
10
+ * A layout component for the header, including optional search, icons, buttons, title, and a menu.
11
+ * @internal
12
+ */
13
+ export function HeaderLayout(props) {
14
+ const buttons = props.buttons || [];
15
+ const icons = props.icons || [];
16
+ const leftItems = [
17
+ props.toggle ? React.createElement(ToggleSwitch, { key: "toggle", ...props.toggle }) : undefined,
18
+ props.menu ? (React.createElement(DropdownButton, { key: "menu", className: "nz-menu", menuItems: props.menu.items.map((i) => (React.createElement(MenuItem, { key: i.label, onClick: i.onClick }, i.label))) }, props.menu.title)) : undefined,
19
+ buttons.length > 0 ? (React.createElement("div", { key: "buttons", className: "nz-buttons" }, buttons)) : undefined,
20
+ ].filter((item) => !!item);
21
+ const topBarLeftItems = props.title
22
+ ? [
23
+ React.createElement(Text, { key: "title", className: "nz-title" }, props.title),
24
+ ]
25
+ : leftItems.slice(0, 1);
26
+ const remainingLeftItems = props.title ? leftItems : leftItems.slice(1);
27
+ return (React.createElement("div", { className: "nz-widget-widgetContentLayout-header-headerLayout" },
28
+ (props.onSearch || topBarLeftItems.length > 0 || icons.length > 0) && (React.createElement(HeaderTopBar, { primaryContent: topBarLeftItems, onSearch: props.onSearch, icons: icons, iconSize: props.iconSize })),
29
+ remainingLeftItems.map((item) => (React.createElement("div", { className: "nz-remainingItems", key: item.key }, item)))));
30
+ }
31
+ //# sourceMappingURL=HeaderLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderLayout.js","sourceRoot":"","sources":["../../../../../../src/appui-react/layout/widget/widget-content-layout/header/HeaderLayout.tsx"],"names":[],"mapp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K,CAAC,KAAK;QACjC,CAAC,CAAC;YACE,oBAAC,IAAI,IAAC,GAAG,EAAC,OAAO,EAAC,SAAS,EAAC,UAAU,IACnC,KAAK,CAAC,KAAK,CACP;SACR;QACH,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,MAAM,kBAAkB,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,CACL,6BAAK,SAAS,EAAC,mDAAmD;QAC/D,CAAC,KAAK,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACrE,oBAAC,YAAY,IACX,cAAc,EAAE,eAAe,EAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,CAAC,QAAQ,GACxB,CACH;QACA,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAChC,6BAAK,SAAS,EAAC,mBAAmB,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,IAC7C,IAAI,CACD,CACP,CAAC,CACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./HeaderLayout.scss\";\nimport * as React from \"react\";\nimport {\n DropdownButton,\n MenuItem,\n Text,\n ToggleSwitch,\n} from \"@itwin/itwinui-react\";\nimport { HeaderTopBar } from \"./HeaderTopBar.js\";\nimport type { WidgetContentLayout } from \"../WidgetContentLayout.js\";\n\ntype WidgetContentLayoutHeaderProps = React.ComponentProps<\n typeof WidgetContentLayout.Header\n>;\n\ntype HeaderLayoutProps = Pick<\n WidgetContentLayoutHeaderProps,\n \"toggle\" | \"buttons\" | \"menu\" | \"title\" | \"onSearch\" | \"icons\" | \"iconSize\"\n>;\n\n/**\n * A layout component for the header, including optional search, icons, buttons, title, and a menu.\n * @internal\n */\nexport function HeaderLayout(props: HeaderLayoutProps) {\n const buttons = props.buttons || [];\n const icons = props.icons || [];\n const leftItems = [\n props.toggle ? <ToggleSwitch key=\"toggle\" {...props.toggle} /> : undefined,\n props.menu ? (\n <DropdownButton\n key=\"menu\"\n className=\"nz-menu\"\n menuItems={props.menu.items.map((i) => (\n <MenuItem key={i.label} onClick={i.onClick}>\n {i.label}\n </MenuItem>\n ))}\n >\n {props.menu.title}\n </DropdownButton>\n ) : undefined,\n buttons.length > 0 ? (\n <div key=\"buttons\" className=\"nz-buttons\">\n {buttons}\n </div>\n ) : undefined,\n ].filter((item) => !!item);\n const topBarLeftItems = props.title\n ? [\n <Text key=\"title\" className=\"nz-title\">\n {props.title}\n </Text>,\n ]\n : leftItems.slice(0, 1);\n const remainingLeftItems = props.title ? leftItems : leftItems.slice(1);\n return (\n <div className=\"nz-widget-widgetContentLayout-header-headerLayout\">\n {(props.onSearch || topBarLeftItems.length > 0 || icons.length > 0) && (\n <HeaderTopBar\n primaryContent={topBarLeftItems}\n onSearch={props.onSearch}\n icons={icons}\n iconSize={props.iconSize}\n />\n )}\n {remainingLeftItems.map((item) => (\n <div className=\"nz-remainingItems\" key={item.key}>\n {item}\n </div>\n ))}\n </div>\n );\n}\n"]}
@@ -0,0 +1,47 @@
1
+ @layer appui.component {
2
+ .nz-widget-widgetContentLayout-header-headerLayout {
3
+ width: 100%;
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: var(--iui-size-s);
7
+ container-type: inline-size;
8
+
9
+ .nz-menu {
10
+ width: 100%;
11
+ max-width: 560px;
12
+ }
13
+
14
+ .nz-buttons {
15
+ display: flex;
16
+ gap: var(--iui-size-s);
17
+ align-items: center;
18
+
19
+ width: 100%;
20
+ max-width: 560px;
21
+ > button {
22
+ overflow: auto;
23
+ min-width: fit-content;
24
+ }
25
+ }
26
+
27
+ .nz-title {
28
+ font-weight: bolder;
29
+ text-overflow: ellipsis;
30
+ overflow: hidden;
31
+ }
32
+
33
+ .nz-remainingItems {
34
+ overflow-x: auto;
35
+
36
+ .nz-buttons {
37
+ flex-wrap: wrap;
38
+ }
39
+ }
40
+
41
+ .nz-headerTopBarWrapper {
42
+ display: flex;
43
+ gap: var(--iui-size-s);
44
+ width: 100%;
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,18 @@
1
+ import "./HeaderSearch.scss";
2
+ import * as React from "react";
3
+ import type { WidgetContentLayout } from "../WidgetContentLayout.js";
4
+ import type { HeaderIconToolbar } from "./HeaderIconToolbar.js";
5
+ type WidgetContentLayoutHeaderProps = React.ComponentProps<typeof WidgetContentLayout.Header>;
6
+ type HeaderIconToolbarProps = React.ComponentProps<typeof HeaderIconToolbar>;
7
+ interface HeaderSearchProps extends Pick<WidgetContentLayoutHeaderProps, "iconSize" | "onSearch">, Pick<HeaderIconToolbarProps, "searchExpandedState"> {
8
+ /** State tuple for the search text value and its setter function. */
9
+ searchState: [string, React.Dispatch<React.SetStateAction<string>>];
10
+ }
11
+ /**
12
+ * A collapsible search box component for widget headers.
13
+ * Provides an expandable search input with icons that automatically focuses when expanded.
14
+ * @internal
15
+ */
16
+ export declare function HeaderSearch(props: HeaderSearchProps): React.JSX.Element;
17
+ export {};
18
+ //# sourceMappingURL=HeaderSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderSearch.d.ts","sourceRoot":"","sources":["../../../../../../src/appui-react/layout/widget/widget-content-layout/header/HeaderSearch.tsx"],"names":[],"mappings":"AAKA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,KAAK,8BAA8B,GAAG,KAAK,CAAC,cAAc,CACxD,OAAO,mBAAmB,CAAC,MAAM,CAClC,CAAC;AACF,KAAK,sBAAsB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7E,UAAU,iBACR,SAAQ,IAAI,CAAC,8BAA8B,EAAE,UAAU,GAAG,UAAU,CAAC,EACnE,IAAI,CAAC,sBAAsB,EAAE,qBAAqB,CAAC;IACrD,qEAAqE;IACrE,WAAW,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACrE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBA+DpD"}