@torq-north/react-tools 1.4.0 → 1.4.1

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/dist/index.cjs CHANGED
@@ -610,9 +610,9 @@ function buildCheckboxOption(option, values) {
610
610
  }
611
611
  function render(option, showCheckbox, isSelected) {
612
612
  if (typeof option === "string") {
613
- return (jsxRuntime.jsx(material.MenuItem, { value: option, sx: { display: "block" }, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsxRuntime.jsx(material.Checkbox, { checked: isSelected }), jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
613
+ return (jsxRuntime.jsx(material.MenuItem, { value: option, sx: { display: "block" }, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsxRuntime.jsx(material.Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
614
614
  }
615
- return (jsxRuntime.jsx(material.MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsxRuntime.jsx(material.Checkbox, { checked: isSelected }), jsxRuntime.jsxs(material.Box, { children: [jsxRuntime.jsx(material.Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
615
+ return (jsxRuntime.jsx(material.MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxRuntime.jsxs(material.Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsxRuntime.jsx(material.Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsxRuntime.jsxs(material.Box, { children: [jsxRuntime.jsx(material.Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
616
616
  }
617
617
 
618
618
  function SelectFormField(_a) {
package/dist/index.es.js CHANGED
@@ -608,9 +608,9 @@ function buildCheckboxOption(option, values) {
608
608
  }
609
609
  function render(option, showCheckbox, isSelected) {
610
610
  if (typeof option === "string") {
611
- return (jsx(MenuItem, { value: option, sx: { display: "block" }, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsx(Checkbox, { checked: isSelected }), jsx(Box, { children: jsx(Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
611
+ return (jsx(MenuItem, { value: option, sx: { display: "block" }, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsx(Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsx(Box, { children: jsx(Typography, { sx: { textWrap: "wrap" }, children: option }) })] }) }, option));
612
612
  }
613
- return (jsx(MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && jsx(Checkbox, { checked: isSelected }), jsxs(Box, { children: [jsx(Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsx(Box, { children: jsx(Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
613
+ return (jsx(MenuItem, { value: option.value, sx: { display: "block" }, disabled: option.disabled, children: jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [showCheckbox && (jsx(Checkbox, { checked: isSelected, sx: { padding: 0, marginX: 1 } })), jsxs(Box, { children: [jsx(Typography, { fontWeight: option.subText ? "bold" : undefined, sx: { textWrap: "wrap" }, children: option.text }), option.subText && (jsx(Box, { children: jsx(Typography, { variant: "body2", sx: { textWrap: "wrap" }, children: option.subText }) }))] })] }) }, option.value));
614
614
  }
615
615
 
616
616
  function SelectFormField(_a) {
@@ -0,0 +1,5 @@
1
+ import { IrcAddress } from "../Types/IrcPerson";
2
+ export interface IrcAddressDisplayProps {
3
+ address: IrcAddress;
4
+ }
5
+ export declare function IrcAddressDisplay({ address }: IrcAddressDisplayProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { IrcPerson } from "../Types/IrcPerson";
3
+ export type IrcProfileSections = "personal" | "address" | "contact";
4
+ export interface IrcPersonDetailsProps {
5
+ person?: IrcPerson;
6
+ isLoading?: boolean;
7
+ sections?: (IrcProfileSections | (() => React.ReactNode))[];
8
+ }
9
+ export declare function IrcPersonDetails({ person, isLoading, sections, }: IrcPersonDetailsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { IrcPerson } from "../Types/IrcPerson";
2
+ export interface IrcPersonHeaderProps {
3
+ person?: IrcPerson;
4
+ isLoading?: boolean;
5
+ editMode?: boolean;
6
+ onEditClicked?: () => void;
7
+ readonly?: boolean;
8
+ }
9
+ export declare function IrcPersonHeader({ person, isLoading, editMode, onEditClicked, readonly, }: IrcPersonHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { TabbedLayoutTab } from "../../MUI/Components/TabbedLayout/TabbedLayout";
2
+ import { IrcPersonDetailsProps } from "./IrcPersonDetails";
3
+ import { IrcPerson } from "../Types/IrcPerson";
4
+ import { type ReactNode } from "react";
5
+ export interface IrcProfileTabFunctionProps {
6
+ /** Whether the profile is in edit mode */
7
+ editMode: boolean;
8
+ /** Called when the edit mode is toggled */
9
+ setEditMode: (editMode: boolean) => void;
10
+ }
11
+ export interface IrcProfileTab extends Omit<TabbedLayoutTab, "content"> {
12
+ /** Whether the tab is readonly. If true, the edit button is hidden on the profile header */
13
+ readonly?: boolean;
14
+ /** The content to display for the tab */
15
+ content: ReactNode | ((props: IrcProfileTabFunctionProps) => ReactNode);
16
+ }
17
+ export interface IrcProfileProps {
18
+ /** The person to display in the profile tab and header */
19
+ person?: IrcPerson;
20
+ /** Whether the profile is loading */
21
+ isLoading?: boolean;
22
+ /** The sections to display in the profile tab */
23
+ profileSections?: IrcPersonDetailsProps["sections"];
24
+ /** The tabs to display in the profile (in addition to the profile tab) */
25
+ tabs?: IrcProfileTab[];
26
+ }
27
+ export declare function IrcProfile({ person, isLoading, tabs: customTabs, profileSections, }: IrcProfileProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ export interface ProfileSectionProps {
3
+ /** The title to display for the section */
4
+ title: string;
5
+ /** The icon to display for the section */
6
+ icon?: React.ReactNode;
7
+ /** The content to display for the section */
8
+ children: React.ReactNode;
9
+ }
10
+ export declare function ProfileSection({ title, icon, children }: ProfileSectionProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ export interface IrcAddress {
2
+ line1: string;
3
+ line2?: string;
4
+ city: string;
5
+ province: string;
6
+ postalCode: string;
7
+ country: string;
8
+ }
9
+ export interface IrcPerson {
10
+ firstName: string;
11
+ lastName: string;
12
+ preferredName?: string;
13
+ dateOfBirth: string;
14
+ ancestry?: string;
15
+ enrolmentStatus: string;
16
+ applicationStatus: string;
17
+ gender?: string;
18
+ fileNumber: string;
19
+ trustNumber?: string;
20
+ slgbtqiaplus?: boolean;
21
+ healthCardNumber?: string;
22
+ nihbNumber?: string;
23
+ residentOfBeaufortDeltaRegion?: boolean;
24
+ community?: string;
25
+ mailingAddress?: IrcAddress;
26
+ physicalAddress?: IrcAddress;
27
+ email?: string;
28
+ phoneNumber?: string;
29
+ eftOnFile?: boolean;
30
+ }
@@ -0,0 +1,5 @@
1
+ export { IrcProfile } from "./Components/IrcProfile";
2
+ export { ProfileSection } from "./Components/ProfileSection";
3
+ export type { IrcProfileTab, IrcProfileTabFunctionProps, } from "./Components/IrcProfile";
4
+ export type { ProfileSectionProps } from "./Components/ProfileSection";
5
+ export type { IrcPerson, IrcAddress } from "./Types/IrcPerson";
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ export interface TabbedLayoutTab {
3
+ /** The label to display for the tab button */
4
+ label: string;
5
+ /** The unique key for the tab */
6
+ key: string;
7
+ /** The icon to display for the tab button */
8
+ icon?: React.ReactNode;
9
+ /** The content to display for the tab */
10
+ content: React.ReactNode;
11
+ }
12
+ export interface TabbedLayoutProps {
13
+ /** A list of tabs to display */
14
+ tabs: TabbedLayoutTab[];
15
+ /** A shared header that is displayed above all tabs */
16
+ header?: React.ReactNode;
17
+ /** The tab to select when the component is first rendered (uncontrolled mode only) */
18
+ defaultTab?: string;
19
+ /** The currently selected tab key (controlled mode) */
20
+ selectedTab?: string;
21
+ /** Called when the selected tab changes */
22
+ onChange?: (tab: string) => void;
23
+ }
24
+ export declare function TabbedLayout({ tabs, defaultTab, header, selectedTab: selectedTabProp, onChange, }: TabbedLayoutProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { TabbedLayout } from "./TabbedLayout";
2
+ export type { TabbedLayoutProps, TabbedLayoutTab } from "./TabbedLayout";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@torq-north/react-tools",
3
3
  "type": "module",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "description": "A collection of commonly used utilities",
6
6
  "author": "@torq-north",
7
7
  "license": "SEE LICENCE.md",