@abgov/react-components 6.10.0-dev.2 → 6.10.0-dev.4

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.
@@ -1,2 +1,4 @@
1
1
  export * from './resizable-panel/ResizablePanel';
2
2
  export * from '../lib/drawer/drawer';
3
+ export * from './work-side-menu/work-side-menu';
4
+ export * from './work-side-menu-item/work-side-menu-item';
@@ -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
@@ -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
@@ -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;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I,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,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,I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AQ,CAAC;AACjB,SACEH,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,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;;;;;"}
package/experimental.mjs CHANGED
@@ -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
@@ -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":";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AS,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;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,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AAO,MAAM;;AACX,OAAAC,MAAA,GAAG,YAAH,gBAAAA,IAAY,oBAAoB,WAAW;AAAA,IAC7C;AAAA,EACF,GAAG,CAAC,IAAI,QAAQ,CAAC;AACjB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,aAAW;AAAA,MACX,uBAAqB;AAAA,MACrB,MAAM,OAAO,OAAO;AAAA,MACpB,QAAQ;AAAA,MAEP,UAAA;AAAA,QAAA,kBAAkB,oBAAC,OAAA,EAAI,MAAK,WAAW,UAAA,gBAAe;AAAA,QACtD,oBAAoB,oBAAC,OAAA,EAAI,MAAK,aAAa,UAAA,kBAAiB;AAAA,QAC5D,kBAAkB,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;"}
package/index.js CHANGED
@@ -2109,12 +2109,15 @@ const formatters = {
2109
2109
  G: function(date, token, localize2) {
2110
2110
  const era = date.getFullYear() > 0 ? 1 : 0;
2111
2111
  switch (token) {
2112
+ // AD, BC
2112
2113
  case "G":
2113
2114
  case "GG":
2114
2115
  case "GGG":
2115
2116
  return localize2.era(era, { width: "abbreviated" });
2117
+ // A, B
2116
2118
  case "GGGGG":
2117
2119
  return localize2.era(era, { width: "narrow" });
2120
+ // Anno Domini, Before Christ
2118
2121
  case "GGGG":
2119
2122
  default:
2120
2123
  return localize2.era(era, { width: "wide" });
@@ -2164,22 +2167,28 @@ const formatters = {
2164
2167
  Q: function(date, token, localize2) {
2165
2168
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
2166
2169
  switch (token) {
2170
+ // 1, 2, 3, 4
2167
2171
  case "Q":
2168
2172
  return String(quarter);
2173
+ // 01, 02, 03, 04
2169
2174
  case "QQ":
2170
2175
  return addLeadingZeros(quarter, 2);
2176
+ // 1st, 2nd, 3rd, 4th
2171
2177
  case "Qo":
2172
2178
  return localize2.ordinalNumber(quarter, { unit: "quarter" });
2179
+ // Q1, Q2, Q3, Q4
2173
2180
  case "QQQ":
2174
2181
  return localize2.quarter(quarter, {
2175
2182
  width: "abbreviated",
2176
2183
  context: "formatting"
2177
2184
  });
2185
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2178
2186
  case "QQQQQ":
2179
2187
  return localize2.quarter(quarter, {
2180
2188
  width: "narrow",
2181
2189
  context: "formatting"
2182
2190
  });
2191
+ // 1st quarter, 2nd quarter, ...
2183
2192
  case "QQQQ":
2184
2193
  default:
2185
2194
  return localize2.quarter(quarter, {
@@ -2192,22 +2201,28 @@ const formatters = {
2192
2201
  q: function(date, token, localize2) {
2193
2202
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
2194
2203
  switch (token) {
2204
+ // 1, 2, 3, 4
2195
2205
  case "q":
2196
2206
  return String(quarter);
2207
+ // 01, 02, 03, 04
2197
2208
  case "qq":
2198
2209
  return addLeadingZeros(quarter, 2);
2210
+ // 1st, 2nd, 3rd, 4th
2199
2211
  case "qo":
2200
2212
  return localize2.ordinalNumber(quarter, { unit: "quarter" });
2213
+ // Q1, Q2, Q3, Q4
2201
2214
  case "qqq":
2202
2215
  return localize2.quarter(quarter, {
2203
2216
  width: "abbreviated",
2204
2217
  context: "standalone"
2205
2218
  });
2219
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2206
2220
  case "qqqqq":
2207
2221
  return localize2.quarter(quarter, {
2208
2222
  width: "narrow",
2209
2223
  context: "standalone"
2210
2224
  });
2225
+ // 1st quarter, 2nd quarter, ...
2211
2226
  case "qqqq":
2212
2227
  default:
2213
2228
  return localize2.quarter(quarter, {
@@ -2223,18 +2238,22 @@ const formatters = {
2223
2238
  case "M":
2224
2239
  case "MM":
2225
2240
  return lightFormatters.M(date, token);
2241
+ // 1st, 2nd, ..., 12th
2226
2242
  case "Mo":
2227
2243
  return localize2.ordinalNumber(month + 1, { unit: "month" });
2244
+ // Jan, Feb, ..., Dec
2228
2245
  case "MMM":
2229
2246
  return localize2.month(month, {
2230
2247
  width: "abbreviated",
2231
2248
  context: "formatting"
2232
2249
  });
2250
+ // J, F, ..., D
2233
2251
  case "MMMMM":
2234
2252
  return localize2.month(month, {
2235
2253
  width: "narrow",
2236
2254
  context: "formatting"
2237
2255
  });
2256
+ // January, February, ..., December
2238
2257
  case "MMMM":
2239
2258
  default:
2240
2259
  return localize2.month(month, { width: "wide", context: "formatting" });
@@ -2244,22 +2263,28 @@ const formatters = {
2244
2263
  L: function(date, token, localize2) {
2245
2264
  const month = date.getMonth();
2246
2265
  switch (token) {
2266
+ // 1, 2, ..., 12
2247
2267
  case "L":
2248
2268
  return String(month + 1);
2269
+ // 01, 02, ..., 12
2249
2270
  case "LL":
2250
2271
  return addLeadingZeros(month + 1, 2);
2272
+ // 1st, 2nd, ..., 12th
2251
2273
  case "Lo":
2252
2274
  return localize2.ordinalNumber(month + 1, { unit: "month" });
2275
+ // Jan, Feb, ..., Dec
2253
2276
  case "LLL":
2254
2277
  return localize2.month(month, {
2255
2278
  width: "abbreviated",
2256
2279
  context: "standalone"
2257
2280
  });
2281
+ // J, F, ..., D
2258
2282
  case "LLLLL":
2259
2283
  return localize2.month(month, {
2260
2284
  width: "narrow",
2261
2285
  context: "standalone"
2262
2286
  });
2287
+ // January, February, ..., December
2263
2288
  case "LLLL":
2264
2289
  default:
2265
2290
  return localize2.month(month, { width: "wide", context: "standalone" });
@@ -2300,6 +2325,7 @@ const formatters = {
2300
2325
  E: function(date, token, localize2) {
2301
2326
  const dayOfWeek = date.getDay();
2302
2327
  switch (token) {
2328
+ // Tue
2303
2329
  case "E":
2304
2330
  case "EE":
2305
2331
  case "EEE":
@@ -2307,16 +2333,19 @@ const formatters = {
2307
2333
  width: "abbreviated",
2308
2334
  context: "formatting"
2309
2335
  });
2336
+ // T
2310
2337
  case "EEEEE":
2311
2338
  return localize2.day(dayOfWeek, {
2312
2339
  width: "narrow",
2313
2340
  context: "formatting"
2314
2341
  });
2342
+ // Tu
2315
2343
  case "EEEEEE":
2316
2344
  return localize2.day(dayOfWeek, {
2317
2345
  width: "short",
2318
2346
  context: "formatting"
2319
2347
  });
2348
+ // Tuesday
2320
2349
  case "EEEE":
2321
2350
  default:
2322
2351
  return localize2.day(dayOfWeek, {
@@ -2330,10 +2359,13 @@ const formatters = {
2330
2359
  const dayOfWeek = date.getDay();
2331
2360
  const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2332
2361
  switch (token) {
2362
+ // Numerical value (Nth day of week with current locale or weekStartsOn)
2333
2363
  case "e":
2334
2364
  return String(localDayOfWeek);
2365
+ // Padded numerical value
2335
2366
  case "ee":
2336
2367
  return addLeadingZeros(localDayOfWeek, 2);
2368
+ // 1st, 2nd, ..., 7th
2337
2369
  case "eo":
2338
2370
  return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
2339
2371
  case "eee":
@@ -2341,16 +2373,19 @@ const formatters = {
2341
2373
  width: "abbreviated",
2342
2374
  context: "formatting"
2343
2375
  });
2376
+ // T
2344
2377
  case "eeeee":
2345
2378
  return localize2.day(dayOfWeek, {
2346
2379
  width: "narrow",
2347
2380
  context: "formatting"
2348
2381
  });
2382
+ // Tu
2349
2383
  case "eeeeee":
2350
2384
  return localize2.day(dayOfWeek, {
2351
2385
  width: "short",
2352
2386
  context: "formatting"
2353
2387
  });
2388
+ // Tuesday
2354
2389
  case "eeee":
2355
2390
  default:
2356
2391
  return localize2.day(dayOfWeek, {
@@ -2364,10 +2399,13 @@ const formatters = {
2364
2399
  const dayOfWeek = date.getDay();
2365
2400
  const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
2366
2401
  switch (token) {
2402
+ // Numerical value (same as in `e`)
2367
2403
  case "c":
2368
2404
  return String(localDayOfWeek);
2405
+ // Padded numerical value
2369
2406
  case "cc":
2370
2407
  return addLeadingZeros(localDayOfWeek, token.length);
2408
+ // 1st, 2nd, ..., 7th
2371
2409
  case "co":
2372
2410
  return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
2373
2411
  case "ccc":
@@ -2375,16 +2413,19 @@ const formatters = {
2375
2413
  width: "abbreviated",
2376
2414
  context: "standalone"
2377
2415
  });
2416
+ // T
2378
2417
  case "ccccc":
2379
2418
  return localize2.day(dayOfWeek, {
2380
2419
  width: "narrow",
2381
2420
  context: "standalone"
2382
2421
  });
2422
+ // Tu
2383
2423
  case "cccccc":
2384
2424
  return localize2.day(dayOfWeek, {
2385
2425
  width: "short",
2386
2426
  context: "standalone"
2387
2427
  });
2428
+ // Tuesday
2388
2429
  case "cccc":
2389
2430
  default:
2390
2431
  return localize2.day(dayOfWeek, {
@@ -2398,27 +2439,34 @@ const formatters = {
2398
2439
  const dayOfWeek = date.getDay();
2399
2440
  const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
2400
2441
  switch (token) {
2442
+ // 2
2401
2443
  case "i":
2402
2444
  return String(isoDayOfWeek);
2445
+ // 02
2403
2446
  case "ii":
2404
2447
  return addLeadingZeros(isoDayOfWeek, token.length);
2448
+ // 2nd
2405
2449
  case "io":
2406
2450
  return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
2451
+ // Tue
2407
2452
  case "iii":
2408
2453
  return localize2.day(dayOfWeek, {
2409
2454
  width: "abbreviated",
2410
2455
  context: "formatting"
2411
2456
  });
2457
+ // T
2412
2458
  case "iiiii":
2413
2459
  return localize2.day(dayOfWeek, {
2414
2460
  width: "narrow",
2415
2461
  context: "formatting"
2416
2462
  });
2463
+ // Tu
2417
2464
  case "iiiiii":
2418
2465
  return localize2.day(dayOfWeek, {
2419
2466
  width: "short",
2420
2467
  context: "formatting"
2421
2468
  });
2469
+ // Tuesday
2422
2470
  case "iiii":
2423
2471
  default:
2424
2472
  return localize2.day(dayOfWeek, {
@@ -2584,13 +2632,21 @@ const formatters = {
2584
2632
  return "Z";
2585
2633
  }
2586
2634
  switch (token) {
2635
+ // Hours and optional minutes
2587
2636
  case "X":
2588
2637
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
2638
+ // Hours, minutes and optional seconds without `:` delimiter
2639
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2640
+ // so this token always has the same output as `XX`
2589
2641
  case "XXXX":
2590
2642
  case "XX":
2591
2643
  return formatTimezone(timezoneOffset);
2644
+ // Hours, minutes and optional seconds with `:` delimiter
2645
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2646
+ // so this token always has the same output as `XXX`
2592
2647
  case "XXXXX":
2593
2648
  case "XXX":
2649
+ // Hours and minutes with `:` delimiter
2594
2650
  default:
2595
2651
  return formatTimezone(timezoneOffset, ":");
2596
2652
  }
@@ -2599,13 +2655,21 @@ const formatters = {
2599
2655
  x: function(date, token, _localize) {
2600
2656
  const timezoneOffset = date.getTimezoneOffset();
2601
2657
  switch (token) {
2658
+ // Hours and optional minutes
2602
2659
  case "x":
2603
2660
  return formatTimezoneWithOptionalMinutes(timezoneOffset);
2661
+ // Hours, minutes and optional seconds without `:` delimiter
2662
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2663
+ // so this token always has the same output as `xx`
2604
2664
  case "xxxx":
2605
2665
  case "xx":
2606
2666
  return formatTimezone(timezoneOffset);
2667
+ // Hours, minutes and optional seconds with `:` delimiter
2668
+ // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
2669
+ // so this token always has the same output as `xxx`
2607
2670
  case "xxxxx":
2608
2671
  case "xxx":
2672
+ // Hours and minutes with `:` delimiter
2609
2673
  default:
2610
2674
  return formatTimezone(timezoneOffset, ":");
2611
2675
  }
@@ -2614,10 +2678,12 @@ const formatters = {
2614
2678
  O: function(date, token, _localize) {
2615
2679
  const timezoneOffset = date.getTimezoneOffset();
2616
2680
  switch (token) {
2681
+ // Short
2617
2682
  case "O":
2618
2683
  case "OO":
2619
2684
  case "OOO":
2620
2685
  return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2686
+ // Long
2621
2687
  case "OOOO":
2622
2688
  default:
2623
2689
  return "GMT" + formatTimezone(timezoneOffset, ":");
@@ -2627,10 +2693,12 @@ const formatters = {
2627
2693
  z: function(date, token, _localize) {
2628
2694
  const timezoneOffset = date.getTimezoneOffset();
2629
2695
  switch (token) {
2696
+ // Short
2630
2697
  case "z":
2631
2698
  case "zz":
2632
2699
  case "zzz":
2633
2700
  return "GMT" + formatTimezoneShort(timezoneOffset, ":");
2701
+ // Long
2634
2702
  case "zzzz":
2635
2703
  default:
2636
2704
  return "GMT" + formatTimezone(timezoneOffset, ":");
@@ -3804,6 +3872,7 @@ function GoabText(props) {
3804
3872
  size: props.size,
3805
3873
  maxwidth: props.maxWidth,
3806
3874
  color: props.color,
3875
+ id: props.id,
3807
3876
  mt: props.mt,
3808
3877
  mb: props.mb,
3809
3878
  ml: props.ml,