@abgov/react-components 6.10.0-dev.1 → 6.10.0-dev.11
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 +2 -0
- package/experimental/work-side-menu/work-side-menu.d.ts +34 -0
- package/experimental/work-side-menu-item/work-side-menu-item.d.ts +32 -0
- package/experimental.js +61 -1
- package/experimental.js.map +1 -1
- package/experimental.mjs +62 -2
- package/experimental.mjs.map +1 -1
- package/{icon-CK55b563.js → icon-B3p90m2x.js} +21 -26
- package/icon-B3p90m2x.js.map +1 -0
- package/{icon-CoYGOp1V.mjs → icon-CCNDGfBO.mjs} +22 -27
- package/icon-CCNDGfBO.mjs.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +382 -718
- package/index.js.map +1 -1
- package/index.mjs +381 -716
- package/index.mjs.map +1 -1
- package/lib/accordion/accordion.d.ts +6 -5
- package/lib/app-header/app-header.d.ts +6 -4
- package/lib/app-header-menu/app-header-menu.d.ts +3 -3
- package/lib/badge/badge.d.ts +3 -3
- package/lib/block/block.d.ts +9 -3
- package/lib/button/button.d.ts +6 -5
- package/lib/button-group/button-group.d.ts +3 -3
- package/lib/calendar/calendar.d.ts +6 -5
- package/lib/callout/callout.d.ts +3 -3
- package/lib/card/card-actions.d.ts +3 -2
- package/lib/card/card-content.d.ts +3 -2
- package/lib/card/card-group.d.ts +3 -2
- package/lib/card/card-image.d.ts +3 -2
- package/lib/card/card.d.ts +3 -3
- package/lib/checkbox/checkbox.d.ts +6 -5
- package/lib/chip/chip.d.ts +6 -5
- package/lib/common/extract-props.d.ts +32 -0
- package/lib/container/container.d.ts +7 -3
- package/lib/data-grid/data-grid.d.ts +21 -0
- package/lib/date-picker/date-picker.d.ts +6 -5
- package/lib/details/details.d.ts +3 -3
- package/lib/dropdown/dropdown.d.ts +6 -5
- package/lib/file-upload-card/file-upload-card.d.ts +6 -5
- package/lib/file-upload-input/file-upload-input.d.ts +6 -5
- package/lib/filter-chip/filter-chip.d.ts +6 -5
- package/lib/footer/footer.d.ts +3 -2
- package/lib/footer-meta-section/footer-meta-section.d.ts +3 -2
- package/lib/footer-nav-section/footer-nav-section.d.ts +3 -2
- package/lib/form/fieldset.d.ts +7 -6
- package/lib/form/public-form-page.d.ts +6 -5
- package/lib/form/public-form-summary.d.ts +3 -3
- package/lib/form/public-form.d.ts +6 -5
- package/lib/form/public-subform-index.d.ts +3 -4
- package/lib/form/public-subform.d.ts +6 -5
- package/lib/form/task-list.d.ts +3 -3
- package/lib/form/task.d.ts +4 -4
- package/lib/form-item/form-item.d.ts +3 -3
- package/lib/icon/icon.d.ts +3 -14
- package/lib/icon-button/icon-button.d.ts +6 -5
- package/lib/input/input.d.ts +6 -5
- package/lib/linear-progress/linear-progress.d.ts +23 -0
- package/lib/link/link.d.ts +3 -3
- package/lib/link-button/link-button.d.ts +3 -3
- package/lib/menu-button/menu-action.d.ts +3 -3
- package/lib/menu-button/menu-button.d.ts +9 -3
- package/lib/popover/popover.d.ts +3 -3
- package/lib/radio-group/radio-group.d.ts +6 -5
- package/lib/table/table-sort-header.d.ts +3 -3
- package/lib/temporary-notification-ctrl/temporary-notification-ctrl.d.ts +6 -5
- package/lib/text/text.d.ts +5 -3
- package/lib/textarea/textarea.d.ts +6 -5
- package/lib/tooltip/tooltip.d.ts +3 -3
- package/package.json +1 -1
- package/icon-CK55b563.js.map +0 -1
- package/icon-CoYGOp1V.mjs.map +0 -1
package/experimental/index.d.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode, JSX } from 'react';
|
|
2
|
+
interface WCProps {
|
|
3
|
+
heading: string;
|
|
4
|
+
url: string;
|
|
5
|
+
"user-name"?: string;
|
|
6
|
+
"user-secondary-text"?: string;
|
|
7
|
+
testid?: string;
|
|
8
|
+
primaryContent?: ReactNode;
|
|
9
|
+
secondaryContent?: ReactNode;
|
|
10
|
+
accountContent?: ReactNode;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
ref: React.RefObject<HTMLElement | null>;
|
|
13
|
+
}
|
|
14
|
+
declare module "react" {
|
|
15
|
+
namespace JSX {
|
|
16
|
+
interface IntrinsicElements {
|
|
17
|
+
"goa-work-side-menu": WCProps & React.HTMLAttributes<HTMLElement>;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export interface GoabWorkSideMenuProps {
|
|
22
|
+
heading: string;
|
|
23
|
+
url: string;
|
|
24
|
+
userName?: string;
|
|
25
|
+
userSecondaryText?: string;
|
|
26
|
+
testId?: string;
|
|
27
|
+
primaryContent?: ReactNode;
|
|
28
|
+
secondaryContent?: ReactNode;
|
|
29
|
+
accountContent?: ReactNode;
|
|
30
|
+
open?: boolean;
|
|
31
|
+
onToggle?: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function GoabxWorkSideMenu({ heading, url, userName, userSecondaryText, testId, primaryContent, secondaryContent, accountContent, open, onToggle, }: GoabWorkSideMenuProps): JSX.Element;
|
|
34
|
+
export default GoabxWorkSideMenu;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { GoabWorkSideMenuItemType } from '@abgov/ui-components-common';
|
|
3
|
+
interface WCProps {
|
|
4
|
+
label: string;
|
|
5
|
+
url: string;
|
|
6
|
+
badge?: string;
|
|
7
|
+
current?: string;
|
|
8
|
+
divider?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
testid?: string;
|
|
11
|
+
type?: GoabWorkSideMenuItemType;
|
|
12
|
+
}
|
|
13
|
+
declare module "react" {
|
|
14
|
+
namespace JSX {
|
|
15
|
+
interface IntrinsicElements {
|
|
16
|
+
"goa-work-side-menu-item": WCProps & React.HTMLAttributes<HTMLElement>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export interface GoabWorkSideMenuItemProps {
|
|
21
|
+
label: string;
|
|
22
|
+
url: string;
|
|
23
|
+
badge?: string;
|
|
24
|
+
current?: boolean;
|
|
25
|
+
divider?: boolean;
|
|
26
|
+
icon?: string;
|
|
27
|
+
testId?: string;
|
|
28
|
+
type?: GoabWorkSideMenuItemType;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export declare function GoabxWorkSideMenuItem(props: GoabWorkSideMenuItemProps): JSX.Element;
|
|
32
|
+
export default GoabxWorkSideMenuItem;
|
package/experimental.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const react = require("react");
|
|
5
|
-
const icon = require("./icon-
|
|
5
|
+
const icon = require("./icon-B3p90m2x.js");
|
|
6
6
|
const panel = "_panel_m3z4m_1";
|
|
7
7
|
const panelBackground = "_panelBackground_m3z4m_8";
|
|
8
8
|
const children = "_children_m3z4m_12";
|
|
@@ -84,6 +84,66 @@ function ResizablePanel(props) {
|
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
|
+
function GoabxWorkSideMenu({
|
|
88
|
+
heading,
|
|
89
|
+
url,
|
|
90
|
+
userName,
|
|
91
|
+
userSecondaryText,
|
|
92
|
+
testId,
|
|
93
|
+
primaryContent,
|
|
94
|
+
secondaryContent,
|
|
95
|
+
accountContent,
|
|
96
|
+
open,
|
|
97
|
+
onToggle
|
|
98
|
+
}) {
|
|
99
|
+
const el = react.useRef(null);
|
|
100
|
+
react.useEffect(() => {
|
|
101
|
+
var _a;
|
|
102
|
+
if (!(el == null ? void 0 : el.current) || !onToggle) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
(_a = el.current) == null ? void 0 : _a.addEventListener("_toggle", onToggle);
|
|
106
|
+
return () => {
|
|
107
|
+
var _a2;
|
|
108
|
+
(_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_toggle", onToggle);
|
|
109
|
+
};
|
|
110
|
+
}, [el, onToggle]);
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
112
|
+
"goa-work-side-menu",
|
|
113
|
+
{
|
|
114
|
+
ref: el,
|
|
115
|
+
heading,
|
|
116
|
+
url,
|
|
117
|
+
"user-name": userName,
|
|
118
|
+
"user-secondary-text": userSecondaryText,
|
|
119
|
+
open: open ? true : false,
|
|
120
|
+
testid: testId,
|
|
121
|
+
children: [
|
|
122
|
+
primaryContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "primary", children: primaryContent }),
|
|
123
|
+
secondaryContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "secondary", children: secondaryContent }),
|
|
124
|
+
accountContent && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "account", children: accountContent })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function GoabxWorkSideMenuItem(props) {
|
|
130
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
+
"goa-work-side-menu-item",
|
|
132
|
+
{
|
|
133
|
+
label: props.label,
|
|
134
|
+
url: props.url,
|
|
135
|
+
badge: props.badge,
|
|
136
|
+
current: props.current ? "true" : void 0,
|
|
137
|
+
divider: props.divider ? "true" : void 0,
|
|
138
|
+
icon: props.icon,
|
|
139
|
+
testid: props.testId,
|
|
140
|
+
type: props.type,
|
|
141
|
+
children: props.children
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}
|
|
87
145
|
exports.GoabDrawer = icon.GoabDrawer;
|
|
146
|
+
exports.GoabxWorkSideMenu = GoabxWorkSideMenu;
|
|
147
|
+
exports.GoabxWorkSideMenuItem = GoabxWorkSideMenuItem;
|
|
88
148
|
exports.ResizablePanel = ResizablePanel;
|
|
89
149
|
//# 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"],"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"],"names":["useRef","width","useState","useEffect","jsxs","jsx","GoabIcon"],"mappings":";;;;;;;;;;;;;;;;;AAWO,SAAS,eAAe,OAAoC;AAEjE,QAAM,QAAQA,MAAAA,OAA8B,IAAI;AAChD,QAAM,aAAaA,MAAAA,OAA2B,IAAI;AAClD,QAAM,WAAWA,MAAAA,OAA8B,IAAI;AACnD,QAAM,YAAYA,MAAAA,OAA8B,IAAI;AAGpD,QAAM,WAAWA,MAAAA,OAAe,CAAC;AACjC,QAAM,iBAAiBA,MAAAA,OAAmB,QAAQ;AAGlD,QAAM,CAACC,QAAO,QAAQ,IAAIC,eAAA;AAE1BC,QAAAA,UAAU,MAAM;;AACd,aAAS,YAAU,WAAM,YAAN,mBAAe,wBAAwB,UAAS;AAAA,EACrE,GAAG,CAAA,CAAE;AAEL,WAAS,kBAAkB;AACzB,mBAAe,UAAU;AAAA,EAC3B;AAEA,WAAS,YAAY,GAAqB;AACxC,mBAAe,UAAU;AACzB,WAAO,iBAAiB,WAAW,eAAe;AAAA,EACpD;AAEA,WAAS,UAAU,GAAqB;AACtC,mBAAe,UAAU;AACzB,WAAO,oBAAoB,WAAW,eAAe;AAAA,EACvD;AAEA,WAAS,YAAY,GAAqB;;AACxC,QAAI,eAAe,YAAY,UAAU;AACvC;AAAA,IACF;AAEA,UAAM,YAAY,WAAW;AAC7B,UAAM,WAAU,uCAAW,wBAAwB,MAAK;AACxD,UAAM,SAAS,EAAE;AACjB,UAAM,WAAW,MAAM,YAAY;AAEnC,QAAI,UAAU,GAAG;AACf;AAAA,IACF;AAGA,UAAM,YAAU,eAAU,YAAV,mBAAmB,wBAAwB,MAAK;AAGhE,UAAM,YAAY,KAAK;AAAA,MACrB,UAAU;AAAA,MACV,KAAK,IAAI,SAAS,SAAS,SAAS,OAAO;AAAA,IAAA;AAE7C,UAAM,eAAe,KAAK,IAAI,UAAU,YAAY,EAAE;AAGtD,QAAI,gBAAgB,UAAU;AAC5B;AAAA,IACF;AAGA,2CAAW,aAAa,SAAS,UAAU,SAAS;AAEpD,mBAAS,YAAT,mBAAkB;AAAA,MAChB;AAAA,MACA,UAAU,SAAS,UAAU,YAAY,EAAE;AAAA;AAE7C,aAAS,GAAG,KAAK,MAAM,YAAY,CAAC,IAAI;AAAA,EAC1C;AAEA,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,WAAW,IAAI;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MAEA,UAAA;AAAA,QAAAA,gCAAC,WAAA,EAAQ,KAAK,YAAY,WAAW,IAAI,OACvC,UAAA;AAAA,UAAAC,+BAAC,OAAA,EAAI,WAAW,IAAI,UAAW,gBAAM,UAAS;AAAA,UAC9CA,2BAAAA,IAAC,OAAA,EAAI,KAAK,WAAW,WAAW,IAAI,QAClC,UAAAA,2BAAAA,IAACC,KAAAA,UAAA,EAAS,MAAK,cAAA,CAAc,EAAA,CAC/B;AAAA,QAAA,GACF;AAAA,uCACC,OAAA,EAAI,KAAK,UAAU,WAAW,IAAI,OAChC,UAAAL,OAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN
|
|
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","width","useState","useEffect","jsxs","jsx","GoabIcon","_a"],"mappings":";;;;;;;;;;;;;;;;;AAWO,SAAS,eAAe,OAAoC;AAEjE,QAAM,QAAQA,MAAAA,OAA8B,IAAI;AAChD,QAAM,aAAaA,MAAAA,OAA2B,IAAI;AAClD,QAAM,WAAWA,MAAAA,OAA8B,IAAI;AACnD,QAAM,YAAYA,MAAAA,OAA8B,IAAI;AAGpD,QAAM,WAAWA,MAAAA,OAAe,CAAC;AACjC,QAAM,iBAAiBA,MAAAA,OAAmB,QAAQ;AAGlD,QAAM,CAACC,QAAO,QAAQ,IAAIC,eAAA;AAE1BC,QAAAA,UA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+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;;;;;"}
|
package/experimental.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState, useEffect } from "react";
|
|
3
|
-
import { a as GoabIcon } from "./icon-
|
|
4
|
-
import { G } from "./icon-
|
|
3
|
+
import { a as GoabIcon } from "./icon-CCNDGfBO.mjs";
|
|
4
|
+
import { G } from "./icon-CCNDGfBO.mjs";
|
|
5
5
|
const panel = "_panel_m3z4m_1";
|
|
6
6
|
const panelBackground = "_panelBackground_m3z4m_8";
|
|
7
7
|
const children = "_children_m3z4m_12";
|
|
@@ -83,8 +83,68 @@ function ResizablePanel(props) {
|
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
|
+
function GoabxWorkSideMenu({
|
|
87
|
+
heading,
|
|
88
|
+
url,
|
|
89
|
+
userName,
|
|
90
|
+
userSecondaryText,
|
|
91
|
+
testId,
|
|
92
|
+
primaryContent,
|
|
93
|
+
secondaryContent,
|
|
94
|
+
accountContent,
|
|
95
|
+
open,
|
|
96
|
+
onToggle
|
|
97
|
+
}) {
|
|
98
|
+
const el = useRef(null);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
var _a;
|
|
101
|
+
if (!(el == null ? void 0 : el.current) || !onToggle) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
(_a = el.current) == null ? void 0 : _a.addEventListener("_toggle", onToggle);
|
|
105
|
+
return () => {
|
|
106
|
+
var _a2;
|
|
107
|
+
(_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_toggle", onToggle);
|
|
108
|
+
};
|
|
109
|
+
}, [el, onToggle]);
|
|
110
|
+
return /* @__PURE__ */ jsxs(
|
|
111
|
+
"goa-work-side-menu",
|
|
112
|
+
{
|
|
113
|
+
ref: el,
|
|
114
|
+
heading,
|
|
115
|
+
url,
|
|
116
|
+
"user-name": userName,
|
|
117
|
+
"user-secondary-text": userSecondaryText,
|
|
118
|
+
open: open ? true : false,
|
|
119
|
+
testid: testId,
|
|
120
|
+
children: [
|
|
121
|
+
primaryContent && /* @__PURE__ */ jsx("div", { slot: "primary", children: primaryContent }),
|
|
122
|
+
secondaryContent && /* @__PURE__ */ jsx("div", { slot: "secondary", children: secondaryContent }),
|
|
123
|
+
accountContent && /* @__PURE__ */ jsx("div", { slot: "account", children: accountContent })
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function GoabxWorkSideMenuItem(props) {
|
|
129
|
+
return /* @__PURE__ */ jsx(
|
|
130
|
+
"goa-work-side-menu-item",
|
|
131
|
+
{
|
|
132
|
+
label: props.label,
|
|
133
|
+
url: props.url,
|
|
134
|
+
badge: props.badge,
|
|
135
|
+
current: props.current ? "true" : void 0,
|
|
136
|
+
divider: props.divider ? "true" : void 0,
|
|
137
|
+
icon: props.icon,
|
|
138
|
+
testid: props.testId,
|
|
139
|
+
type: props.type,
|
|
140
|
+
children: props.children
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
86
144
|
export {
|
|
87
145
|
G as GoabDrawer,
|
|
146
|
+
GoabxWorkSideMenu,
|
|
147
|
+
GoabxWorkSideMenuItem,
|
|
88
148
|
ResizablePanel
|
|
89
149
|
};
|
|
90
150
|
//# sourceMappingURL=experimental.mjs.map
|
package/experimental.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.mjs","sources":["../../../libs/react-components/src/experimental/resizable-panel/ResizablePanel.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"],"names":["width"],"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;AAEA,WAAS,YAAY,GAAqB;AACxC,mBAAe,UAAU;AACzB,WAAO,iBAAiB,WAAW,eAAe;AAAA,EACpD;AAEA,WAAS,UAAU,GAAqB;AACtC,mBAAe,UAAU;AACzB,WAAO,oBAAoB,WAAW,eAAe;AAAA,EACvD;AAEA,WAAS,YAAY,GAAqB;;AACxC,QAAI,eAAe,YAAY,UAAU;AACvC;AAAA,IACF;AAEA,UAAM,YAAY,WAAW;AAC7B,UAAM,WAAU,uCAAW,wBAAwB,MAAK;AACxD,UAAM,SAAS,EAAE;AACjB,UAAM,WAAW,MAAM,YAAY;AAEnC,QAAI,UAAU,GAAG;AACf;AAAA,IACF;AAGA,UAAM,YAAU,eAAU,YAAV,mBAAmB,wBAAwB,MAAK;AAGhE,UAAM,YAAY,KAAK;AAAA,MACrB,UAAU;AAAA,MACV,KAAK,IAAI,SAAS,SAAS,SAAS,OAAO;AAAA,IAAA;AAE7C,UAAM,eAAe,KAAK,IAAI,UAAU,YAAY,EAAE;AAGtD,QAAI,gBAAgB,UAAU;AAC5B;AAAA,IACF;AAGA,2CAAW,aAAa,SAAS,UAAU,SAAS;AAEpD,mBAAS,YAAT,mBAAkB;AAAA,MAChB;AAAA,MACA,UAAU,SAAS,UAAU,YAAY,EAAE;AAAA;AAE7C,aAAS,GAAG,KAAK,MAAM,YAAY,CAAC,IAAI;AAAA,EAC1C;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL,WAAW,IAAI;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MAEA,UAAA;AAAA,QAAA,qBAAC,WAAA,EAAQ,KAAK,YAAY,WAAW,IAAI,OACvC,UAAA;AAAA,UAAA,oBAAC,OAAA,EAAI,WAAW,IAAI,UAAW,gBAAM,UAAS;AAAA,UAC9C,oBAAC,OAAA,EAAI,KAAK,WAAW,WAAW,IAAI,QAClC,UAAA,oBAAC,UAAA,EAAS,MAAK,cAAA,CAAc,EAAA,CAC/B;AAAA,QAAA,GACF;AAAA,4BACC,OAAA,EAAI,KAAK,UAAU,WAAW,IAAI,OAChC,UAAAA,OAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
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,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;AAEA,WAAS,YAAY,GAAqB;AAC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UAAA,MAAM;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const react = require("react");
|
|
4
|
+
const lowercase = (input) => input.toLowerCase();
|
|
5
|
+
const kebab = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
|
+
function transformProps(props, transform = lowercase) {
|
|
7
|
+
const result = {};
|
|
8
|
+
for (const [key, value] of Object.entries(props)) {
|
|
9
|
+
if (value === void 0) continue;
|
|
10
|
+
if (key.startsWith("data-")) {
|
|
11
|
+
result[key] = value;
|
|
12
|
+
} else {
|
|
13
|
+
result[transform(key)] = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
4
18
|
function GoabDrawer({
|
|
5
19
|
position,
|
|
6
20
|
open,
|
|
@@ -41,40 +55,21 @@ function GoabDrawer({
|
|
|
41
55
|
);
|
|
42
56
|
}
|
|
43
57
|
function GoabIcon({
|
|
44
|
-
type,
|
|
45
|
-
theme,
|
|
46
|
-
size,
|
|
47
58
|
inverted,
|
|
48
|
-
|
|
49
|
-
fillColor,
|
|
50
|
-
opacity,
|
|
51
|
-
title,
|
|
52
|
-
ariaLabel,
|
|
53
|
-
mt,
|
|
54
|
-
mr,
|
|
55
|
-
mb,
|
|
56
|
-
ml,
|
|
57
|
-
testId
|
|
59
|
+
...rest
|
|
58
60
|
}) {
|
|
61
|
+
const _props = transformProps(rest, lowercase);
|
|
59
62
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
63
|
"goa-icon",
|
|
61
64
|
{
|
|
62
|
-
type,
|
|
63
|
-
theme,
|
|
64
|
-
size,
|
|
65
65
|
inverted: typeof inverted === "boolean" ? inverted ? "true" : void 0 : inverted,
|
|
66
|
-
|
|
67
|
-
opacity,
|
|
68
|
-
title,
|
|
69
|
-
arialabel: ariaLabel,
|
|
70
|
-
mt,
|
|
71
|
-
mr,
|
|
72
|
-
mb,
|
|
73
|
-
ml,
|
|
74
|
-
testid: testId
|
|
66
|
+
..._props
|
|
75
67
|
}
|
|
76
68
|
);
|
|
77
69
|
}
|
|
78
70
|
exports.GoabDrawer = GoabDrawer;
|
|
79
71
|
exports.GoabIcon = GoabIcon;
|
|
80
|
-
|
|
72
|
+
exports.kebab = kebab;
|
|
73
|
+
exports.lowercase = lowercase;
|
|
74
|
+
exports.transformProps = transformProps;
|
|
75
|
+
//# sourceMappingURL=icon-B3p90m2x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-B3p90m2x.js","sources":["../../../libs/react-components/src/lib/common/extract-props.ts","../../../libs/react-components/src/lib/drawer/drawer.tsx","../../../libs/react-components/src/lib/icon/icon.tsx"],"sourcesContent":["/**\n * Transform function type for converting prop names to attribute names.\n */\nexport type TransformFn = (input: string) => string;\n\n/**\n * Converts a camelCase string to lowercase (e.g., \"headingSize\" -> \"headingsize\")\n */\nexport const lowercase: TransformFn = (input) => input.toLowerCase();\n\n/**\n * Converts a camelCase string to kebab-case (e.g., \"verticalPosition\" -> \"vertical-position\")\n */\nexport const kebab: TransformFn = (input) =>\n input.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n\n/**\n * Transforms React props to web component attributes.\n * Use object destructuring to extract props that need special handling,\n * then pass the rest through this function.\n *\n * @param props - The remaining props after destructuring\n * @param transform - Transform function (lowercase or kebab), defaults to lowercase\n * @returns Converted props ready to spread on the web component\n *\n * @example\n * export function GoabAccordion({open, onChange, headingContent, children, ...rest}: GoabAccordionProps) {\n * const _props = transformProps<WCProps>(rest, lowercase);\n * return (\n * <goa-accordion open={open ? \"true\" : undefined} {..._props}>\n * {children}\n * </goa-accordion>\n * );\n * }\n */\nexport function transformProps<WC = Record<string, unknown>>(\n props: object,\n transform: TransformFn = lowercase\n): WC {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n // Skip undefined values - they shouldn't be passed to web components\n if (value === undefined) continue;\n\n // Data attributes pass through unchanged\n if (key.startsWith(\"data-\")) {\n result[key] = value;\n } else {\n result[transform(key)] = value;\n }\n }\n\n return result as WC;\n}\n","import { ReactNode, useEffect, useRef, type JSX } from \"react\";\nimport { GoabDrawerPosition, GoabDrawerSize } from \"@abgov/ui-components-common\";\n\ninterface WCProps {\n position: GoabDrawerPosition;\n open?: boolean;\n heading?: string;\n maxsize?: GoabDrawerSize;\n testid?: string;\n ref: React.RefObject<HTMLElement | null>;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-drawer\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabDrawerProps {\n position: GoabDrawerPosition;\n open?: boolean;\n heading?: string | ReactNode;\n maxSize?: GoabDrawerSize;\n testId?: string;\n actions?: ReactNode;\n children: ReactNode;\n onClose: () => void;\n}\n\nexport function GoabDrawer({\n position,\n open,\n heading,\n maxSize,\n testId,\n actions,\n children,\n onClose,\n}: GoabDrawerProps): JSX.Element {\n const el = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (!el?.current || !onClose) {\n return;\n }\n el.current?.addEventListener(\"_close\", onClose);\n return () => {\n el.current?.removeEventListener(\"_close\", onClose);\n };\n }, [el, onClose]);\n\n return (\n <goa-drawer\n ref={el}\n position={position}\n open={open ? true : undefined}\n heading={typeof heading === \"string\" ? heading : undefined}\n maxsize={maxSize}\n testid={testId}\n >\n {heading && typeof heading !== \"string\" && <div slot=\"heading\">{heading}</div>}\n {actions && <div slot=\"actions\">{actions}</div>}\n {children}\n </goa-drawer>\n );\n}\n\nexport default GoabDrawer;\n","import {\n GoabIconOverridesType,\n GoabIconSize,\n GoabIconTheme,\n GoabIconType,\n Margins, DataAttributes,\n} from \"@abgov/ui-components-common\";\n\nimport type { JSX } from \"react\";\nimport { transformProps, lowercase } from \"../common/extract-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface IonIconElement extends HTMLElement {}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-icon\": WCProps & React.HTMLAttributes<IonIconElement>;\n }\n }\n}\n\nexport interface GoabIconProps extends Margins, DataAttributes {\n type: GoabIconType | GoabIconOverridesType;\n size?: GoabIconSize;\n theme?: GoabIconTheme;\n inverted?: string | boolean; // TODO: Change type to only boolean\n fillColor?: string;\n opacity?: number;\n title?: string;\n ariaLabel?: string;\n testId?: string;\n}\n\ninterface WCProps extends Margins {\n type: GoabIconType | GoabIconOverridesType;\n theme?: GoabIconTheme;\n size?: GoabIconSize;\n inverted?: string;\n fillcolor?: string;\n opacity?: number;\n title?: string;\n arialabel?: string;\n testid?: string;\n}\n\nexport function GoabIcon({\n inverted,\n ...rest\n}: GoabIconProps): JSX.Element {\n const _props = transformProps<WCProps>(rest, lowercase);\n\n return (\n <goa-icon\n inverted={\n typeof inverted === \"boolean\" ? (inverted ? \"true\" : undefined) : inverted\n }\n {..._props}\n />\n );\n}\n"],"names":["useRef","useEffect","_a","jsxs","jsx"],"mappings":";;;AAQO,MAAM,YAAyB,CAAC,UAAU,MAAM,YAAA;AAKhD,MAAM,QAAqB,CAAC,UACjC,MAAM,QAAQ,mBAAmB,OAAO,EAAE,YAAA;AAqBrC,SAAS,eACd,OACA,YAAyB,WACrB;AACJ,QAAM,SAAkC,CAAA;AAExC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAEhD,QAAI,UAAU,OAAW;AAGzB,QAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,aAAO,GAAG,IAAI;AAAA,IAChB,OAAO;AACL,aAAO,UAAU,GAAG,CAAC,IAAI;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO;AACT;ACtBO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAiC;AAC/B,QAAM,KAAKA,MAAAA,OAAoB,IAAI;AAEnCC,QAAAA,UAAU,MAAM;;AACd,QAAI,EAAC,yBAAI,YAAW,CAAC,SAAS;AAC5B;AAAA,IACF;AACA,aAAG,YAAH,mBAAY,iBAAiB,UAAU;AACvC,WAAO,MAAM;;AACX,OAAAC,MAAA,GAAG,YAAH,gBAAAA,IAAY,oBAAoB,UAAU;AAAA,IAC5C;AAAA,EACF,GAAG,CAAC,IAAI,OAAO,CAAC;AAEhB,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,MAAM,OAAO,OAAO;AAAA,MACpB,SAAS,OAAO,YAAY,WAAW,UAAU;AAAA,MACjD,SAAS;AAAA,MACT,QAAQ;AAAA,MAEP,UAAA;AAAA,QAAA,WAAW,OAAO,YAAY,2CAAa,OAAA,EAAI,MAAK,WAAW,UAAA,SAAQ;AAAA,QACvE,WAAWC,2BAAAA,IAAC,OAAA,EAAI,MAAK,WAAW,UAAA,SAAQ;AAAA,QACxC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;ACrBO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA,GAAG;AACL,GAA+B;AAC7B,QAAM,SAAS,eAAwB,MAAM,SAAS;AAEtD,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,UACE,OAAO,aAAa,YAAa,WAAW,SAAS,SAAa;AAAA,MAEnE,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;;;;"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
|
+
const lowercase = (input) => input.toLowerCase();
|
|
4
|
+
const kebab = (input) => input.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
5
|
+
function transformProps(props, transform = lowercase) {
|
|
6
|
+
const result = {};
|
|
7
|
+
for (const [key, value] of Object.entries(props)) {
|
|
8
|
+
if (value === void 0) continue;
|
|
9
|
+
if (key.startsWith("data-")) {
|
|
10
|
+
result[key] = value;
|
|
11
|
+
} else {
|
|
12
|
+
result[transform(key)] = value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
3
17
|
function GoabDrawer({
|
|
4
18
|
position,
|
|
5
19
|
open,
|
|
@@ -40,42 +54,23 @@ function GoabDrawer({
|
|
|
40
54
|
);
|
|
41
55
|
}
|
|
42
56
|
function GoabIcon({
|
|
43
|
-
type,
|
|
44
|
-
theme,
|
|
45
|
-
size,
|
|
46
57
|
inverted,
|
|
47
|
-
|
|
48
|
-
fillColor,
|
|
49
|
-
opacity,
|
|
50
|
-
title,
|
|
51
|
-
ariaLabel,
|
|
52
|
-
mt,
|
|
53
|
-
mr,
|
|
54
|
-
mb,
|
|
55
|
-
ml,
|
|
56
|
-
testId
|
|
58
|
+
...rest
|
|
57
59
|
}) {
|
|
60
|
+
const _props = transformProps(rest, lowercase);
|
|
58
61
|
return /* @__PURE__ */ jsx(
|
|
59
62
|
"goa-icon",
|
|
60
63
|
{
|
|
61
|
-
type,
|
|
62
|
-
theme,
|
|
63
|
-
size,
|
|
64
64
|
inverted: typeof inverted === "boolean" ? inverted ? "true" : void 0 : inverted,
|
|
65
|
-
|
|
66
|
-
opacity,
|
|
67
|
-
title,
|
|
68
|
-
arialabel: ariaLabel,
|
|
69
|
-
mt,
|
|
70
|
-
mr,
|
|
71
|
-
mb,
|
|
72
|
-
ml,
|
|
73
|
-
testid: testId
|
|
65
|
+
..._props
|
|
74
66
|
}
|
|
75
67
|
);
|
|
76
68
|
}
|
|
77
69
|
export {
|
|
78
70
|
GoabDrawer as G,
|
|
79
|
-
GoabIcon as a
|
|
71
|
+
GoabIcon as a,
|
|
72
|
+
kebab as k,
|
|
73
|
+
lowercase as l,
|
|
74
|
+
transformProps as t
|
|
80
75
|
};
|
|
81
|
-
//# sourceMappingURL=icon-
|
|
76
|
+
//# sourceMappingURL=icon-CCNDGfBO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-CCNDGfBO.mjs","sources":["../../../libs/react-components/src/lib/common/extract-props.ts","../../../libs/react-components/src/lib/drawer/drawer.tsx","../../../libs/react-components/src/lib/icon/icon.tsx"],"sourcesContent":["/**\n * Transform function type for converting prop names to attribute names.\n */\nexport type TransformFn = (input: string) => string;\n\n/**\n * Converts a camelCase string to lowercase (e.g., \"headingSize\" -> \"headingsize\")\n */\nexport const lowercase: TransformFn = (input) => input.toLowerCase();\n\n/**\n * Converts a camelCase string to kebab-case (e.g., \"verticalPosition\" -> \"vertical-position\")\n */\nexport const kebab: TransformFn = (input) =>\n input.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n\n/**\n * Transforms React props to web component attributes.\n * Use object destructuring to extract props that need special handling,\n * then pass the rest through this function.\n *\n * @param props - The remaining props after destructuring\n * @param transform - Transform function (lowercase or kebab), defaults to lowercase\n * @returns Converted props ready to spread on the web component\n *\n * @example\n * export function GoabAccordion({open, onChange, headingContent, children, ...rest}: GoabAccordionProps) {\n * const _props = transformProps<WCProps>(rest, lowercase);\n * return (\n * <goa-accordion open={open ? \"true\" : undefined} {..._props}>\n * {children}\n * </goa-accordion>\n * );\n * }\n */\nexport function transformProps<WC = Record<string, unknown>>(\n props: object,\n transform: TransformFn = lowercase\n): WC {\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(props)) {\n // Skip undefined values - they shouldn't be passed to web components\n if (value === undefined) continue;\n\n // Data attributes pass through unchanged\n if (key.startsWith(\"data-\")) {\n result[key] = value;\n } else {\n result[transform(key)] = value;\n }\n }\n\n return result as WC;\n}\n","import { ReactNode, useEffect, useRef, type JSX } from \"react\";\nimport { GoabDrawerPosition, GoabDrawerSize } from \"@abgov/ui-components-common\";\n\ninterface WCProps {\n position: GoabDrawerPosition;\n open?: boolean;\n heading?: string;\n maxsize?: GoabDrawerSize;\n testid?: string;\n ref: React.RefObject<HTMLElement | null>;\n}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-drawer\": WCProps & React.HTMLAttributes<HTMLElement>;\n }\n }\n}\n\nexport interface GoabDrawerProps {\n position: GoabDrawerPosition;\n open?: boolean;\n heading?: string | ReactNode;\n maxSize?: GoabDrawerSize;\n testId?: string;\n actions?: ReactNode;\n children: ReactNode;\n onClose: () => void;\n}\n\nexport function GoabDrawer({\n position,\n open,\n heading,\n maxSize,\n testId,\n actions,\n children,\n onClose,\n}: GoabDrawerProps): JSX.Element {\n const el = useRef<HTMLElement>(null);\n\n useEffect(() => {\n if (!el?.current || !onClose) {\n return;\n }\n el.current?.addEventListener(\"_close\", onClose);\n return () => {\n el.current?.removeEventListener(\"_close\", onClose);\n };\n }, [el, onClose]);\n\n return (\n <goa-drawer\n ref={el}\n position={position}\n open={open ? true : undefined}\n heading={typeof heading === \"string\" ? heading : undefined}\n maxsize={maxSize}\n testid={testId}\n >\n {heading && typeof heading !== \"string\" && <div slot=\"heading\">{heading}</div>}\n {actions && <div slot=\"actions\">{actions}</div>}\n {children}\n </goa-drawer>\n );\n}\n\nexport default GoabDrawer;\n","import {\n GoabIconOverridesType,\n GoabIconSize,\n GoabIconTheme,\n GoabIconType,\n Margins, DataAttributes,\n} from \"@abgov/ui-components-common\";\n\nimport type { JSX } from \"react\";\nimport { transformProps, lowercase } from \"../common/extract-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface IonIconElement extends HTMLElement {}\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n \"goa-icon\": WCProps & React.HTMLAttributes<IonIconElement>;\n }\n }\n}\n\nexport interface GoabIconProps extends Margins, DataAttributes {\n type: GoabIconType | GoabIconOverridesType;\n size?: GoabIconSize;\n theme?: GoabIconTheme;\n inverted?: string | boolean; // TODO: Change type to only boolean\n fillColor?: string;\n opacity?: number;\n title?: string;\n ariaLabel?: string;\n testId?: string;\n}\n\ninterface WCProps extends Margins {\n type: GoabIconType | GoabIconOverridesType;\n theme?: GoabIconTheme;\n size?: GoabIconSize;\n inverted?: string;\n fillcolor?: string;\n opacity?: number;\n title?: string;\n arialabel?: string;\n testid?: string;\n}\n\nexport function GoabIcon({\n inverted,\n ...rest\n}: GoabIconProps): JSX.Element {\n const _props = transformProps<WCProps>(rest, lowercase);\n\n return (\n <goa-icon\n inverted={\n typeof inverted === \"boolean\" ? (inverted ? \"true\" : undefined) : inverted\n }\n {..._props}\n />\n );\n}\n"],"names":["_a"],"mappings":";;AAQO,MAAM,YAAyB,CAAC,UAAU,MAAM,YAAA;AAKhD,MAAM,QAAqB,CAAC,UACjC,MAAM,QAAQ,mBAAmB,OAAO,EAAE,YAAA;AAqBrC,SAAS,eACd,OACA,YAAyB,WACrB;AACJ,QAAM,SAAkC,CAAA;AAExC,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAEhD,QAAI,UAAU,OAAW;AAGzB,QAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,aAAO,GAAG,IAAI;AAAA,IAChB,OAAO;AACL,aAAO,UAAU,GAAG,CAAC,IAAI;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO;AACT;ACtBO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAiC;AAC/B,QAAM,KAAK,OAAoB,IAAI;AAEnC,YAAU,MAAM;;AACd,QAAI,EAAC,yBAAI,YAAW,CAAC,SAAS;AAC5B;AAAA,IACF;AACA,aAAG,YAAH,mBAAY,iBAAiB,UAAU;AACvC,WAAO,MAAM;;AACX,OAAAA,MAAA,GAAG,YAAH,gBAAAA,IAAY,oBAAoB,UAAU;AAAA,IAC5C;AAAA,EACF,GAAG,CAAC,IAAI,OAAO,CAAC;AAEhB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,MAAM,OAAO,OAAO;AAAA,MACpB,SAAS,OAAO,YAAY,WAAW,UAAU;AAAA,MACjD,SAAS;AAAA,MACT,QAAQ;AAAA,MAEP,UAAA;AAAA,QAAA,WAAW,OAAO,YAAY,gCAAa,OAAA,EAAI,MAAK,WAAW,UAAA,SAAQ;AAAA,QACvE,WAAW,oBAAC,OAAA,EAAI,MAAK,WAAW,UAAA,SAAQ;AAAA,QACxC;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;ACrBO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA,GAAG;AACL,GAA+B;AAC7B,QAAM,SAAS,eAAwB,MAAM,SAAS;AAEtD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UACE,OAAO,aAAa,YAAa,WAAW,SAAS,SAAa;AAAA,MAEnE,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
package/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './lib/checkbox-list/checkbox-list';
|
|
|
12
12
|
export * from './lib/chip/chip';
|
|
13
13
|
export * from './lib/circular-progress/circular-progress';
|
|
14
14
|
export * from './lib/container/container';
|
|
15
|
+
export * from './lib/data-grid/data-grid';
|
|
15
16
|
export * from './lib/date-picker/date-picker';
|
|
16
17
|
export * from './lib/details/details';
|
|
17
18
|
export * from './lib/divider/divider';
|
|
@@ -40,6 +41,7 @@ export * from './lib/hero-banner/hero-banner-actions';
|
|
|
40
41
|
export * from './lib/icon-button/icon-button';
|
|
41
42
|
export * from './lib/icon/icon';
|
|
42
43
|
export * from './lib/input/input';
|
|
44
|
+
export * from './lib/linear-progress/linear-progress';
|
|
43
45
|
export * from './lib/link/link';
|
|
44
46
|
export * from './lib/link-button/link-button';
|
|
45
47
|
export * from './lib/menu-button/menu-button';
|