@abgov/react-components 6.10.0-dev.13 → 6.10.0-dev.15
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/experimental/index.d.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { GoabIconType } from '@abgov/ui-components-common';
|
|
3
|
+
interface WCProps {
|
|
4
|
+
heading: string;
|
|
5
|
+
icon: GoabIconType;
|
|
6
|
+
testid?: string;
|
|
7
|
+
}
|
|
8
|
+
declare module "react" {
|
|
9
|
+
namespace JSX {
|
|
10
|
+
interface IntrinsicElements {
|
|
11
|
+
"goa-work-side-menu-group": WCProps & React.HTMLAttributes<HTMLElement>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export interface GoabWorkSideMenuGroupProps {
|
|
16
|
+
heading: string;
|
|
17
|
+
icon: GoabIconType;
|
|
18
|
+
testId?: string;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare function GoabxWorkSideMenuGroup(props: GoabWorkSideMenuGroupProps): JSX.Element;
|
|
22
|
+
export default GoabxWorkSideMenuGroup;
|
package/experimental.js
CHANGED
|
@@ -142,8 +142,20 @@ function GoabxWorkSideMenuItem(props) {
|
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
|
+
function GoabxWorkSideMenuGroup(props) {
|
|
146
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
|
+
"goa-work-side-menu-group",
|
|
148
|
+
{
|
|
149
|
+
heading: props.heading,
|
|
150
|
+
icon: props.icon,
|
|
151
|
+
testid: props.testId,
|
|
152
|
+
children: props.children
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
145
156
|
exports.GoabDrawer = icon.GoabDrawer;
|
|
146
157
|
exports.GoabxWorkSideMenu = GoabxWorkSideMenu;
|
|
158
|
+
exports.GoabxWorkSideMenuGroup = GoabxWorkSideMenuGroup;
|
|
147
159
|
exports.GoabxWorkSideMenuItem = GoabxWorkSideMenuItem;
|
|
148
160
|
exports.ResizablePanel = ResizablePanel;
|
|
149
161
|
//# sourceMappingURL=experimental.js.map
|
package/experimental.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","sources":["../../../libs/react-components/src/experimental/resizable-panel/ResizablePanel.tsx","../../../libs/react-components/src/experimental/work-side-menu/work-side-menu.tsx","../../../libs/react-components/src/experimental/work-side-menu-item/work-side-menu-item.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState, type JSX } from \"react\";\nimport Css from \"./ResizablePanel.module.css\";\nimport { GoabIcon } from \"../../lib/icon/icon\";\n\nexport type ResizableProps = {\n minWidth?: number;\n children: ReactNode;\n};\n\ntype MouseState = \"static\" | \"active\";\n\nexport function ResizablePanel(props: ResizableProps): JSX.Element {\n // element refs\n const bgRef = useRef<HTMLDivElement | null>(null);\n const sectionRef = useRef<HTMLElement | null>(null);\n const widthRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useRef<HTMLDivElement | null>(null);\n\n // value refs\n const maxWidth = useRef<number>(0);\n const resizeBarState = useRef<MouseState>(\"static\");\n\n // state\n const [width, setWidth] = useState<string>();\n\n useEffect(() => {\n maxWidth.current = bgRef.current?.getBoundingClientRect().width ?? 0;\n }, []);\n\n function resetMouseState() {\n resizeBarState.current = \"static\";\n }\n\n function onMouseDown(_: React.MouseEvent) {\n resizeBarState.current = \"active\";\n window.addEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseUp(_: React.MouseEvent) {\n resizeBarState.current = \"static\";\n window.removeEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseMove(e: React.MouseEvent) {\n if (resizeBarState.current === \"static\") {\n return;\n }\n\n const sectionEl = sectionRef.current;\n const xOffset = sectionEl?.getBoundingClientRect().x || 0;\n const mouseX = e.clientX;\n const minWidth = props.minWidth || 0;\n\n if (mouseX <= 0) {\n return;\n }\n\n // mouse direction\n const newXPos = handleRef.current?.getBoundingClientRect().x ?? 0;\n\n // set width of preview area\n const calcWidth = Math.max(\n newXPos - xOffset,\n Math.min(mouseX - xOffset, maxWidth.current),\n );\n const elementWidth = Math.max(minWidth, calcWidth - 64); // 4rem padding\n\n // prevent dragging bar more than allowed\n if (elementWidth <= minWidth) {\n return;\n }\n\n // set resizable area width\n sectionEl?.setAttribute(\"style\", `width: ${calcWidth}px;`);\n // set displayed px width\n widthRef.current?.setAttribute(\n \"style\",\n `right: ${maxWidth.current - calcWidth + 32}px`,\n );\n setWidth(`${Math.round(elementWidth)}px`);\n }\n\n return (\n <div\n ref={bgRef}\n className={Css.panelBackground}\n onMouseDown={onMouseDown}\n onMouseMove={onMouseMove}\n onMouseUp={onMouseUp}\n >\n <section ref={sectionRef} className={Css.panel}>\n <div className={Css.children}>{props.children}</div>\n <div ref={handleRef} className={Css.handle}>\n <GoabIcon type=\"reorder-two\" />\n </div>\n </section>\n <div ref={widthRef} className={Css.width}>\n {width}\n </div>\n </div>\n );\n}\n\nexport default ResizablePanel;\n","import { ReactNode, useEffect, useRef, type JSX } from \"react\";\n\ninterface WCProps {\n heading: string;\n url: string;\n \"user-name\"?: string;\n \"user-secondary-text\"?: string;\n testid?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n ref: React.RefObject<HTMLElement | null>;\n}\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\n/* eslint-disable-next-line */\nexport interface GoabWorkSideMenuProps {\n heading: string;\n url: string;\n userName?: string;\n userSecondaryText?: string;\n testId?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n onToggle?: () => void;\n}\n\nexport function GoabxWorkSideMenu({\n heading,\n url,\n userName,\n userSecondaryText,\n testId,\n primaryContent,\n secondaryContent,\n accountContent,\n open,\n onToggle,\n}: GoabWorkSideMenuProps): JSX.Element {\n const el = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (!el?.current || !onToggle) {\n return;\n }\n el.current?.addEventListener(\"_toggle\", onToggle);\n return () => {\n el.current?.removeEventListener(\"_toggle\", onToggle);\n };\n }, [el, onToggle]);\n return (\n <goa-work-side-menu\n ref={el}\n heading={heading}\n url={url}\n user-name={userName}\n user-secondary-text={userSecondaryText}\n open={open ? true : false}\n testid={testId}\n >\n {primaryContent && <div slot=\"primary\">{primaryContent}</div>}\n {secondaryContent && <div slot=\"secondary\">{secondaryContent}</div>}\n {accountContent && <div slot=\"account\">{accountContent}</div>}\n </goa-work-side-menu>\n );\n}\n\nexport default GoabxWorkSideMenu;\n","import { type JSX } from \"react\";\nimport { GoabWorkSideMenuItemType } from \"@abgov/ui-components-common\";\ninterface WCProps {\n label: string;\n url: string;\n badge?: string;\n current?: string;\n divider?: string;\n icon?: string;\n testid?: string;\n type?: GoabWorkSideMenuItemType;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu-item\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabWorkSideMenuItemProps {\n label: string;\n url: string;\n badge?: string;\n current?: boolean;\n divider?: boolean;\n icon?: string;\n testId?: string;\n type?: GoabWorkSideMenuItemType;\n children?: React.ReactNode;\n}\n\nexport function GoabxWorkSideMenuItem(props: GoabWorkSideMenuItemProps): JSX.Element {\n return (\n <goa-work-side-menu-item\n label={props.label}\n url={props.url}\n badge={props.badge}\n current={props.current ? \"true\" : undefined}\n divider={props.divider ? \"true\" : undefined}\n icon={props.icon}\n testid={props.testId}\n type={props.type}\n >\n {props.children}\n </goa-work-side-menu-item>\n );\n}\n\nexport default GoabxWorkSideMenuItem;\n"],"names":["useRef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A,MACA,aAAW;AAAA,MACX,uBAAqB;AAAA,MACrB,MAAM,OAAO,OAAO;AAAA,MACpB,QAAQ;AAAA,MAEP,UAAA;AAAA,QAAA,kBAAkBC,2BAAAA,IAAC,OAAA,EAAI,MAAK,WAAW,UAAA,gBAAe;AAAA,QACtD,oBAAoBA,2BAAAA,IAAC,OAAA,EAAI,MAAK,aAAa,UAAA,kBAAiB;AAAA,QAC5D,kBAAkBA,2BAAAA,IAAC,OAAA,EAAI,MAAK,WAAW,UAAA,eAAA,CAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG7D;ACzCO,SAAS,sBAAsB,OAA+C;AACnF,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,KAAK,MAAM;AAAA,MACX,OAAO,MAAM;AAAA,MACb,SAAS,MAAM,UAAU,SAAS;AAAA,MAClC,SAAS,MAAM,UAAU,SAAS;AAAA,MAClC,MAAM,MAAM;AAAA,MACZ,QAAQ,MAAM;AAAA,MACd,MAAM,MAAM;AAAA,MAEX,UAAA,MAAM;AAAA,IAAA;AAAA,EAAA;AAGb;;;;;"}
|
|
1
|
+
{"version":3,"file":"experimental.js","sources":["../../../libs/react-components/src/experimental/resizable-panel/ResizablePanel.tsx","../../../libs/react-components/src/experimental/work-side-menu/work-side-menu.tsx","../../../libs/react-components/src/experimental/work-side-menu-item/work-side-menu-item.tsx","../../../libs/react-components/src/experimental/work-side-menu-group/work-side-menu-group.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState, type JSX } from \"react\";\nimport Css from \"./ResizablePanel.module.css\";\nimport { GoabIcon } from \"../../lib/icon/icon\";\n\nexport type ResizableProps = {\n minWidth?: number;\n children: ReactNode;\n};\n\ntype MouseState = \"static\" | \"active\";\n\nexport function ResizablePanel(props: ResizableProps): JSX.Element {\n // element refs\n const bgRef = useRef<HTMLDivElement | null>(null);\n const sectionRef = useRef<HTMLElement | null>(null);\n const widthRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useRef<HTMLDivElement | null>(null);\n\n // value refs\n const maxWidth = useRef<number>(0);\n const resizeBarState = useRef<MouseState>(\"static\");\n\n // state\n const [width, setWidth] = useState<string>();\n\n useEffect(() => {\n maxWidth.current = bgRef.current?.getBoundingClientRect().width ?? 0;\n }, []);\n\n function resetMouseState() {\n resizeBarState.current = \"static\";\n }\n\n function onMouseDown(_: React.MouseEvent) {\n resizeBarState.current = \"active\";\n window.addEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseUp(_: React.MouseEvent) {\n resizeBarState.current = \"static\";\n window.removeEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseMove(e: React.MouseEvent) {\n if (resizeBarState.current === \"static\") {\n return;\n }\n\n const sectionEl = sectionRef.current;\n const xOffset = sectionEl?.getBoundingClientRect().x || 0;\n const mouseX = e.clientX;\n const minWidth = props.minWidth || 0;\n\n if (mouseX <= 0) {\n return;\n }\n\n // mouse direction\n const newXPos = handleRef.current?.getBoundingClientRect().x ?? 0;\n\n // set width of preview area\n const calcWidth = Math.max(\n newXPos - xOffset,\n Math.min(mouseX - xOffset, maxWidth.current),\n );\n const elementWidth = Math.max(minWidth, calcWidth - 64); // 4rem padding\n\n // prevent dragging bar more than allowed\n if (elementWidth <= minWidth) {\n return;\n }\n\n // set resizable area width\n sectionEl?.setAttribute(\"style\", `width: ${calcWidth}px;`);\n // set displayed px width\n widthRef.current?.setAttribute(\n \"style\",\n `right: ${maxWidth.current - calcWidth + 32}px`,\n );\n setWidth(`${Math.round(elementWidth)}px`);\n }\n\n return (\n <div\n ref={bgRef}\n className={Css.panelBackground}\n onMouseDown={onMouseDown}\n onMouseMove={onMouseMove}\n onMouseUp={onMouseUp}\n >\n <section ref={sectionRef} className={Css.panel}>\n <div className={Css.children}>{props.children}</div>\n <div ref={handleRef} className={Css.handle}>\n <GoabIcon type=\"reorder-two\" />\n </div>\n </section>\n <div ref={widthRef} className={Css.width}>\n {width}\n </div>\n </div>\n );\n}\n\nexport default ResizablePanel;\n","import { ReactNode, useEffect, useRef, type JSX } from \"react\";\n\ninterface WCProps {\n heading: string;\n url: string;\n \"user-name\"?: string;\n \"user-secondary-text\"?: string;\n testid?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n ref: React.RefObject<HTMLElement | null>;\n}\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\n/* eslint-disable-next-line */\nexport interface GoabWorkSideMenuProps {\n heading: string;\n url: string;\n userName?: string;\n userSecondaryText?: string;\n testId?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n onToggle?: () => void;\n}\n\nexport function GoabxWorkSideMenu({\n heading,\n url,\n userName,\n userSecondaryText,\n testId,\n primaryContent,\n secondaryContent,\n accountContent,\n open,\n onToggle,\n}: GoabWorkSideMenuProps): JSX.Element {\n const el = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (!el?.current || !onToggle) {\n return;\n }\n el.current?.addEventListener(\"_toggle\", onToggle);\n return () => {\n el.current?.removeEventListener(\"_toggle\", onToggle);\n };\n }, [el, onToggle]);\n return (\n <goa-work-side-menu\n ref={el}\n heading={heading}\n url={url}\n user-name={userName}\n user-secondary-text={userSecondaryText}\n open={open ? true : false}\n testid={testId}\n >\n {primaryContent && <div slot=\"primary\">{primaryContent}</div>}\n {secondaryContent && <div slot=\"secondary\">{secondaryContent}</div>}\n {accountContent && <div slot=\"account\">{accountContent}</div>}\n </goa-work-side-menu>\n );\n}\n\nexport default GoabxWorkSideMenu;\n","import { type JSX } from \"react\";\nimport { GoabWorkSideMenuItemType } from \"@abgov/ui-components-common\";\ninterface WCProps {\n label: string;\n url: string;\n badge?: string;\n current?: string;\n divider?: string;\n icon?: string;\n testid?: string;\n type?: GoabWorkSideMenuItemType;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu-item\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabWorkSideMenuItemProps {\n label: string;\n url: string;\n badge?: string;\n current?: boolean;\n divider?: boolean;\n icon?: string;\n testId?: string;\n type?: GoabWorkSideMenuItemType;\n children?: React.ReactNode;\n}\n\nexport function GoabxWorkSideMenuItem(props: GoabWorkSideMenuItemProps): JSX.Element {\n return (\n <goa-work-side-menu-item\n label={props.label}\n url={props.url}\n badge={props.badge}\n current={props.current ? \"true\" : undefined}\n divider={props.divider ? \"true\" : undefined}\n icon={props.icon}\n testid={props.testId}\n type={props.type}\n >\n {props.children}\n </goa-work-side-menu-item>\n );\n}\n\nexport default GoabxWorkSideMenuItem;\n","import { type JSX } from \"react\";\nimport { GoabIconType } from \"@abgov/ui-components-common\";\n\ninterface WCProps {\n heading: string;\n icon: GoabIconType;\n testid?: string;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu-group\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabWorkSideMenuGroupProps {\n heading: string;\n icon: GoabIconType;\n testId?: string;\n children?: React.ReactNode;\n}\n\nexport function GoabxWorkSideMenuGroup(props: GoabWorkSideMenuGroupProps): JSX.Element {\n return (\n <goa-work-side-menu-group\n heading={props.heading}\n icon={props.icon}\n testid={props.testId}\n >\n {props.children}\n </goa-work-side-menu-group>\n );\n}\n\nexport default GoabxWorkSideMenuGroup;\n"],"names":["useRef","width","useState","useEffect","jsxs","jsx","GoabIcon","_a"],"mappings":";;;;;;;;;;;;;;;;;AAWO,SAAS,eAAe,OAAoC;AAEjE,QAAM,QAAQA,MAAAA,OAA8B,IAAI;AAChD,QAAM,aAAaA,MAAAA,OA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,UAAA,gBAAe;AAAA,QACtD,oBAAoBA,2BAAAA,IAAC,OAAA,EAAI,MAAK,aAAa,UAAA,kBAAiB;AAAA,QAC5D,kBAAkBA,2BAAAA,IAAC,OAAA,EAAI,MAAK,WAAW,UAAA,eAAA,CAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG7D;ACzCO,SAAS,sBAAsB,OAA+C;AACnF,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,KAAK,MAAM;AAAA,MACX,OAAO,MAAM;AAAA,MACb,SAAS,MAAM,UAAU,SAAS;AAAA,MAClC,SAAS,MAAM,UAAU,SAAS;AAAA,MAClC,MAAM,MAAM;AAAA,MACZ,QAAQ,MAAM;AAAA,MACd,MAAM,MAAM;AAAA,MAEX,UAAA,MAAM;AAAA,IAAA;AAAA,EAAA;AAGb;ACxBO,SAAS,uBAAuB,OAAgD;AACrF,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,MAAM;AAAA,MACf,MAAM,MAAM;AAAA,MACZ,QAAQ,MAAM;AAAA,MAEb,UAAA,MAAM;AAAA,IAAA;AAAA,EAAA;AAGb;;;;;;"}
|
package/experimental.mjs
CHANGED
|
@@ -141,9 +141,21 @@ function GoabxWorkSideMenuItem(props) {
|
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
|
+
function GoabxWorkSideMenuGroup(props) {
|
|
145
|
+
return /* @__PURE__ */ jsx(
|
|
146
|
+
"goa-work-side-menu-group",
|
|
147
|
+
{
|
|
148
|
+
heading: props.heading,
|
|
149
|
+
icon: props.icon,
|
|
150
|
+
testid: props.testId,
|
|
151
|
+
children: props.children
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
144
155
|
export {
|
|
145
156
|
G as GoabDrawer,
|
|
146
157
|
GoabxWorkSideMenu,
|
|
158
|
+
GoabxWorkSideMenuGroup,
|
|
147
159
|
GoabxWorkSideMenuItem,
|
|
148
160
|
ResizablePanel
|
|
149
161
|
};
|
package/experimental.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.mjs","sources":["../../../libs/react-components/src/experimental/resizable-panel/ResizablePanel.tsx","../../../libs/react-components/src/experimental/work-side-menu/work-side-menu.tsx","../../../libs/react-components/src/experimental/work-side-menu-item/work-side-menu-item.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState, type JSX } from \"react\";\nimport Css from \"./ResizablePanel.module.css\";\nimport { GoabIcon } from \"../../lib/icon/icon\";\n\nexport type ResizableProps = {\n minWidth?: number;\n children: ReactNode;\n};\n\ntype MouseState = \"static\" | \"active\";\n\nexport function ResizablePanel(props: ResizableProps): JSX.Element {\n // element refs\n const bgRef = useRef<HTMLDivElement | null>(null);\n const sectionRef = useRef<HTMLElement | null>(null);\n const widthRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useRef<HTMLDivElement | null>(null);\n\n // value refs\n const maxWidth = useRef<number>(0);\n const resizeBarState = useRef<MouseState>(\"static\");\n\n // state\n const [width, setWidth] = useState<string>();\n\n useEffect(() => {\n maxWidth.current = bgRef.current?.getBoundingClientRect().width ?? 0;\n }, []);\n\n function resetMouseState() {\n resizeBarState.current = \"static\";\n }\n\n function onMouseDown(_: React.MouseEvent) {\n resizeBarState.current = \"active\";\n window.addEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseUp(_: React.MouseEvent) {\n resizeBarState.current = \"static\";\n window.removeEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseMove(e: React.MouseEvent) {\n if (resizeBarState.current === \"static\") {\n return;\n }\n\n const sectionEl = sectionRef.current;\n const xOffset = sectionEl?.getBoundingClientRect().x || 0;\n const mouseX = e.clientX;\n const minWidth = props.minWidth || 0;\n\n if (mouseX <= 0) {\n return;\n }\n\n // mouse direction\n const newXPos = handleRef.current?.getBoundingClientRect().x ?? 0;\n\n // set width of preview area\n const calcWidth = Math.max(\n newXPos - xOffset,\n Math.min(mouseX - xOffset, maxWidth.current),\n );\n const elementWidth = Math.max(minWidth, calcWidth - 64); // 4rem padding\n\n // prevent dragging bar more than allowed\n if (elementWidth <= minWidth) {\n return;\n }\n\n // set resizable area width\n sectionEl?.setAttribute(\"style\", `width: ${calcWidth}px;`);\n // set displayed px width\n widthRef.current?.setAttribute(\n \"style\",\n `right: ${maxWidth.current - calcWidth + 32}px`,\n );\n setWidth(`${Math.round(elementWidth)}px`);\n }\n\n return (\n <div\n ref={bgRef}\n className={Css.panelBackground}\n onMouseDown={onMouseDown}\n onMouseMove={onMouseMove}\n onMouseUp={onMouseUp}\n >\n <section ref={sectionRef} className={Css.panel}>\n <div className={Css.children}>{props.children}</div>\n <div ref={handleRef} className={Css.handle}>\n <GoabIcon type=\"reorder-two\" />\n </div>\n </section>\n <div ref={widthRef} className={Css.width}>\n {width}\n </div>\n </div>\n );\n}\n\nexport default ResizablePanel;\n","import { ReactNode, useEffect, useRef, type JSX } from \"react\";\n\ninterface WCProps {\n heading: string;\n url: string;\n \"user-name\"?: string;\n \"user-secondary-text\"?: string;\n testid?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n ref: React.RefObject<HTMLElement | null>;\n}\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\n/* eslint-disable-next-line */\nexport interface GoabWorkSideMenuProps {\n heading: string;\n url: string;\n userName?: string;\n userSecondaryText?: string;\n testId?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n onToggle?: () => void;\n}\n\nexport function GoabxWorkSideMenu({\n heading,\n url,\n userName,\n userSecondaryText,\n testId,\n primaryContent,\n secondaryContent,\n accountContent,\n open,\n onToggle,\n}: GoabWorkSideMenuProps): JSX.Element {\n const el = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (!el?.current || !onToggle) {\n return;\n }\n el.current?.addEventListener(\"_toggle\", onToggle);\n return () => {\n el.current?.removeEventListener(\"_toggle\", onToggle);\n };\n }, [el, onToggle]);\n return (\n <goa-work-side-menu\n ref={el}\n heading={heading}\n url={url}\n user-name={userName}\n user-secondary-text={userSecondaryText}\n open={open ? true : false}\n testid={testId}\n >\n {primaryContent && <div slot=\"primary\">{primaryContent}</div>}\n {secondaryContent && <div slot=\"secondary\">{secondaryContent}</div>}\n {accountContent && <div slot=\"account\">{accountContent}</div>}\n </goa-work-side-menu>\n );\n}\n\nexport default GoabxWorkSideMenu;\n","import { type JSX } from \"react\";\nimport { GoabWorkSideMenuItemType } from \"@abgov/ui-components-common\";\ninterface WCProps {\n label: string;\n url: string;\n badge?: string;\n current?: string;\n divider?: string;\n icon?: string;\n testid?: string;\n type?: GoabWorkSideMenuItemType;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu-item\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabWorkSideMenuItemProps {\n label: string;\n url: string;\n badge?: string;\n current?: boolean;\n divider?: boolean;\n icon?: string;\n testId?: string;\n type?: GoabWorkSideMenuItemType;\n children?: React.ReactNode;\n}\n\nexport function GoabxWorkSideMenuItem(props: GoabWorkSideMenuItemProps): JSX.Element {\n return (\n <goa-work-side-menu-item\n label={props.label}\n url={props.url}\n badge={props.badge}\n current={props.current ? \"true\" : undefined}\n divider={props.divider ? \"true\" : undefined}\n icon={props.icon}\n testid={props.testId}\n type={props.type}\n >\n {props.children}\n </goa-work-side-menu-item>\n );\n}\n\nexport default GoabxWorkSideMenuItem;\n"],"names":["width","_a"],"mappings":";;;;;;;;;;;;;;;;AAWO,SAAS,eAAe,OAAoC;AAEjE,QAAM,QAAQ,OAA8B,IAAI;AAChD,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oBAAC,OAAA,EAAI,MAAK,WAAW,UAAA,eAAA,CAAe;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAG7D;ACzCO,SAAS,sBAAsB,OAA+C;AACnF,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO,MAAM;AAAA,MACb,KAAK,MAAM;AAAA,MACX,OAAO,MAAM;AAAA,MACb,SAAS,MAAM,UAAU,SAAS;AAAA,MAClC,SAAS,MAAM,UAAU,SAAS;AAAA,MAClC,MAAM,MAAM;AAAA,MACZ,QAAQ,MAAM;AAAA,MACd,MAAM,MAAM;AAAA,MAEX,UAAA,MAAM;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
1
|
+
{"version":3,"file":"experimental.mjs","sources":["../../../libs/react-components/src/experimental/resizable-panel/ResizablePanel.tsx","../../../libs/react-components/src/experimental/work-side-menu/work-side-menu.tsx","../../../libs/react-components/src/experimental/work-side-menu-item/work-side-menu-item.tsx","../../../libs/react-components/src/experimental/work-side-menu-group/work-side-menu-group.tsx"],"sourcesContent":["import { ReactNode, useEffect, useRef, useState, type JSX } from \"react\";\nimport Css from \"./ResizablePanel.module.css\";\nimport { GoabIcon } from \"../../lib/icon/icon\";\n\nexport type ResizableProps = {\n minWidth?: number;\n children: ReactNode;\n};\n\ntype MouseState = \"static\" | \"active\";\n\nexport function ResizablePanel(props: ResizableProps): JSX.Element {\n // element refs\n const bgRef = useRef<HTMLDivElement | null>(null);\n const sectionRef = useRef<HTMLElement | null>(null);\n const widthRef = useRef<HTMLDivElement | null>(null);\n const handleRef = useRef<HTMLDivElement | null>(null);\n\n // value refs\n const maxWidth = useRef<number>(0);\n const resizeBarState = useRef<MouseState>(\"static\");\n\n // state\n const [width, setWidth] = useState<string>();\n\n useEffect(() => {\n maxWidth.current = bgRef.current?.getBoundingClientRect().width ?? 0;\n }, []);\n\n function resetMouseState() {\n resizeBarState.current = \"static\";\n }\n\n function onMouseDown(_: React.MouseEvent) {\n resizeBarState.current = \"active\";\n window.addEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseUp(_: React.MouseEvent) {\n resizeBarState.current = \"static\";\n window.removeEventListener(\"mouseup\", resetMouseState);\n }\n\n function onMouseMove(e: React.MouseEvent) {\n if (resizeBarState.current === \"static\") {\n return;\n }\n\n const sectionEl = sectionRef.current;\n const xOffset = sectionEl?.getBoundingClientRect().x || 0;\n const mouseX = e.clientX;\n const minWidth = props.minWidth || 0;\n\n if (mouseX <= 0) {\n return;\n }\n\n // mouse direction\n const newXPos = handleRef.current?.getBoundingClientRect().x ?? 0;\n\n // set width of preview area\n const calcWidth = Math.max(\n newXPos - xOffset,\n Math.min(mouseX - xOffset, maxWidth.current),\n );\n const elementWidth = Math.max(minWidth, calcWidth - 64); // 4rem padding\n\n // prevent dragging bar more than allowed\n if (elementWidth <= minWidth) {\n return;\n }\n\n // set resizable area width\n sectionEl?.setAttribute(\"style\", `width: ${calcWidth}px;`);\n // set displayed px width\n widthRef.current?.setAttribute(\n \"style\",\n `right: ${maxWidth.current - calcWidth + 32}px`,\n );\n setWidth(`${Math.round(elementWidth)}px`);\n }\n\n return (\n <div\n ref={bgRef}\n className={Css.panelBackground}\n onMouseDown={onMouseDown}\n onMouseMove={onMouseMove}\n onMouseUp={onMouseUp}\n >\n <section ref={sectionRef} className={Css.panel}>\n <div className={Css.children}>{props.children}</div>\n <div ref={handleRef} className={Css.handle}>\n <GoabIcon type=\"reorder-two\" />\n </div>\n </section>\n <div ref={widthRef} className={Css.width}>\n {width}\n </div>\n </div>\n );\n}\n\nexport default ResizablePanel;\n","import { ReactNode, useEffect, useRef, type JSX } from \"react\";\n\ninterface WCProps {\n heading: string;\n url: string;\n \"user-name\"?: string;\n \"user-secondary-text\"?: string;\n testid?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n ref: React.RefObject<HTMLElement | null>;\n}\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\n/* eslint-disable-next-line */\nexport interface GoabWorkSideMenuProps {\n heading: string;\n url: string;\n userName?: string;\n userSecondaryText?: string;\n testId?: string;\n primaryContent?: ReactNode;\n secondaryContent?: ReactNode;\n accountContent?: ReactNode;\n open?: boolean;\n onToggle?: () => void;\n}\n\nexport function GoabxWorkSideMenu({\n heading,\n url,\n userName,\n userSecondaryText,\n testId,\n primaryContent,\n secondaryContent,\n accountContent,\n open,\n onToggle,\n}: GoabWorkSideMenuProps): JSX.Element {\n const el = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (!el?.current || !onToggle) {\n return;\n }\n el.current?.addEventListener(\"_toggle\", onToggle);\n return () => {\n el.current?.removeEventListener(\"_toggle\", onToggle);\n };\n }, [el, onToggle]);\n return (\n <goa-work-side-menu\n ref={el}\n heading={heading}\n url={url}\n user-name={userName}\n user-secondary-text={userSecondaryText}\n open={open ? true : false}\n testid={testId}\n >\n {primaryContent && <div slot=\"primary\">{primaryContent}</div>}\n {secondaryContent && <div slot=\"secondary\">{secondaryContent}</div>}\n {accountContent && <div slot=\"account\">{accountContent}</div>}\n </goa-work-side-menu>\n );\n}\n\nexport default GoabxWorkSideMenu;\n","import { type JSX } from \"react\";\nimport { GoabWorkSideMenuItemType } from \"@abgov/ui-components-common\";\ninterface WCProps {\n label: string;\n url: string;\n badge?: string;\n current?: string;\n divider?: string;\n icon?: string;\n testid?: string;\n type?: GoabWorkSideMenuItemType;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu-item\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabWorkSideMenuItemProps {\n label: string;\n url: string;\n badge?: string;\n current?: boolean;\n divider?: boolean;\n icon?: string;\n testId?: string;\n type?: GoabWorkSideMenuItemType;\n children?: React.ReactNode;\n}\n\nexport function GoabxWorkSideMenuItem(props: GoabWorkSideMenuItemProps): JSX.Element {\n return (\n <goa-work-side-menu-item\n label={props.label}\n url={props.url}\n badge={props.badge}\n current={props.current ? \"true\" : undefined}\n divider={props.divider ? \"true\" : undefined}\n icon={props.icon}\n testid={props.testId}\n type={props.type}\n >\n {props.children}\n </goa-work-side-menu-item>\n );\n}\n\nexport default GoabxWorkSideMenuItem;\n","import { type JSX } from \"react\";\nimport { GoabIconType } from \"@abgov/ui-components-common\";\n\ninterface WCProps {\n heading: string;\n icon: GoabIconType;\n testid?: string;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-work-side-menu-group\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabWorkSideMenuGroupProps {\n heading: string;\n icon: GoabIconType;\n testId?: string;\n children?: React.ReactNode;\n}\n\nexport function GoabxWorkSideMenuGroup(props: GoabWorkSideMenuGroupProps): JSX.Element {\n return (\n <goa-work-side-menu-group\n heading={props.heading}\n icon={props.icon}\n testid={props.testId}\n >\n {props.children}\n </goa-work-side-menu-group>\n );\n}\n\nexport default GoabxWorkSideMenuGroup;\n"],"names":["width","_a"],"mappings":";;;;;;;;;;;;;;;;AAWO,SAAS,eAAe,OAAoC;AAEjE,QAAM,QAAQ,OAA8B,IAAI;AAChD,QAAM,aAAa,OAA2B,IAAI;AAClD,QAAM,WAAW,OAA8B,IAAI;AACnD,QAAM,YAAY,OAA8B,IAAI;AAGpD,QAAM,WAAW,OAAe,CAAC;AACjC,QAAM,iBAAiB,OAAmB,QAAQ;AAGlD,QAAM,CAACA,QAAO,QAAQ,IAAI,SAAA;AAE1B,YAAU,MAAM;;AACd,aAAS,YAAU,WAAM,YAAN,mBAAe,wBAAwB,UAAS;AAAA,EACrE,GAAG,CAAA,CAAE;AAEL,WAAS,kBAAkB;AACzB,mBAAe,UAAU;AAAA,EAC3B;AAE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