diff --git a/documentation/docs/api/components/LinkWithStatePassthrough.mdx b/documentation/docs/api/01-Components/LinkWithStatePassthrough.mdx similarity index 100% rename from documentation/docs/api/components/LinkWithStatePassthrough.mdx rename to documentation/docs/api/01-Components/LinkWithStatePassthrough.mdx diff --git a/documentation/docs/api/components/NavLinkWithStatePassthrough.mdx b/documentation/docs/api/01-Components/NavLinkWithStatePassthrough.mdx similarity index 100% rename from documentation/docs/api/components/NavLinkWithStatePassthrough.mdx rename to documentation/docs/api/01-Components/NavLinkWithStatePassthrough.mdx diff --git a/documentation/docs/api/components/Navigation.mdx b/documentation/docs/api/01-Components/Navigation.mdx similarity index 100% rename from documentation/docs/api/components/Navigation.mdx rename to documentation/docs/api/01-Components/Navigation.mdx diff --git a/documentation/docs/api/components/RedirectWithStatePassthrough.mdx b/documentation/docs/api/01-Components/RedirectWithStatePassthrough.mdx similarity index 100% rename from documentation/docs/api/components/RedirectWithStatePassthrough.mdx rename to documentation/docs/api/01-Components/RedirectWithStatePassthrough.mdx diff --git a/documentation/docs/api/components/Toolbox.mdx b/documentation/docs/api/01-Components/Toolbox.mdx similarity index 100% rename from documentation/docs/api/components/Toolbox.mdx rename to documentation/docs/api/01-Components/Toolbox.mdx diff --git a/documentation/docs/api/components/TopBar.mdx b/documentation/docs/api/01-Components/TopBar.mdx similarity index 100% rename from documentation/docs/api/components/TopBar.mdx rename to documentation/docs/api/01-Components/TopBar.mdx diff --git a/documentation/docs/api/hooks/useAuthentication.mdx b/documentation/docs/api/02-Hooks/useAuthentication.mdx similarity index 100% rename from documentation/docs/api/hooks/useAuthentication.mdx rename to documentation/docs/api/02-Hooks/useAuthentication.mdx diff --git a/documentation/docs/api/hooks/useData.md b/documentation/docs/api/02-Hooks/useData.md similarity index 100% rename from documentation/docs/api/hooks/useData.md rename to documentation/docs/api/02-Hooks/useData.md diff --git a/documentation/docs/api/hooks/useDataPagination.md b/documentation/docs/api/02-Hooks/useDataPagination.md similarity index 100% rename from documentation/docs/api/hooks/useDataPagination.md rename to documentation/docs/api/02-Hooks/useDataPagination.md diff --git a/documentation/docs/api/hooks/useDeferredValue.md b/documentation/docs/api/02-Hooks/useDeferredValue.md similarity index 100% rename from documentation/docs/api/hooks/useDeferredValue.md rename to documentation/docs/api/02-Hooks/useDeferredValue.md diff --git a/documentation/docs/api/hooks/useOrfiumProducts.mdx b/documentation/docs/api/02-Hooks/useOrfiumProducts.mdx similarity index 100% rename from documentation/docs/api/hooks/useOrfiumProducts.mdx rename to documentation/docs/api/02-Hooks/useOrfiumProducts.mdx diff --git a/documentation/docs/api/hooks/useOrganizations.mdx b/documentation/docs/api/02-Hooks/useOrganizations.mdx similarity index 100% rename from documentation/docs/api/hooks/useOrganizations.mdx rename to documentation/docs/api/02-Hooks/useOrganizations.mdx diff --git a/documentation/docs/api/hooks/useSafeContext.md b/documentation/docs/api/02-Hooks/useSafeContext.md similarity index 100% rename from documentation/docs/api/hooks/useSafeContext.md rename to documentation/docs/api/02-Hooks/useSafeContext.md diff --git a/documentation/docs/api/hooks/useSafeDispatch.md b/documentation/docs/api/02-Hooks/useSafeDispatch.md similarity index 100% rename from documentation/docs/api/hooks/useSafeDispatch.md rename to documentation/docs/api/02-Hooks/useSafeDispatch.md diff --git a/documentation/docs/api/hooks/useTopBarUtilitySection.mdx b/documentation/docs/api/02-Hooks/useTopBarUtilitySection.mdx similarity index 100% rename from documentation/docs/api/hooks/useTopBarUtilitySection.mdx rename to documentation/docs/api/02-Hooks/useTopBarUtilitySection.mdx diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToAUD.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToAUD.mdx new file mode 100644 index 00000000..4f608a3e --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToAUD.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToAUD' +title: 'formatToAUD' +sidebar_label: 'formatToAUD' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToAUD } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to AUD. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCAD.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCAD.mdx new file mode 100644 index 00000000..fe56ede5 --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCAD.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToCAD' +title: 'formatToCAD' +sidebar_label: 'formatToCAD' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToCAD } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to CAD. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCNY.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCNY.mdx new file mode 100644 index 00000000..dee7d028 --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCNY.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToCNY' +title: 'formatToCNY' +sidebar_label: 'formatToCNY' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToCNY } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to CNY. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCurrency.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCurrency.mdx new file mode 100644 index 00000000..185c784e --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToCurrency.mdx @@ -0,0 +1,23 @@ +--- +id: 'formatToCurrency' +title: 'formatToCurrency' +sidebar_label: 'formatToCurrency' +sidebar_position: -1 +custom_edit_url: null +--- + +`import { formatToCurrency } from '@orfium/toolbox';` + +### Description + +A generic function for formatting a number or number-formatted string to any valid currency. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `currency: string` - Must be a valid ISO 4217 currency code as specified [here](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToEUR.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToEUR.mdx new file mode 100644 index 00000000..1321268f --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToEUR.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToEUR' +title: 'formatToEUR' +sidebar_label: 'formatToEUR' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToEUR } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to EUR. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToGBP.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToGBP.mdx new file mode 100644 index 00000000..805e3a3d --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToGBP.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToGBP' +title: 'formatToGBP' +sidebar_label: 'formatToGBP' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToGBP } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to GBP. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToJPY.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToJPY.mdx new file mode 100644 index 00000000..f713e3ae --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToJPY.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToJPY' +title: 'formatToJPY' +sidebar_label: 'formatToJPY' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToJPY } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to JPY. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToUSD.mdx b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToUSD.mdx new file mode 100644 index 00000000..ea70e808 --- /dev/null +++ b/documentation/docs/api/03-Utilities/01-Functions/00-Currencies/formatToUSD.mdx @@ -0,0 +1,22 @@ +--- +id: 'formatToUSD' +title: 'formatToUSD' +sidebar_label: 'formatToUSD' +sidebar_position: 0 +custom_edit_url: null +--- + +`import { formatToUSD } from '@orfium/toolbox';` + +### Description + +A function for formatting a number or number-formatted string specifically to USD. + +### Parameters + +- `value: string | number` - If it's a string it must be expressing a number, otherwise you will get a runtime error +- `options?: Omit` - An [`options`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) compliant object, excluding the properties `currency` and `style` + +### Return value + +Ƭ `string` diff --git a/documentation/docs/api/utilities/01-Functions/generateRoutes.mdx b/documentation/docs/api/03-Utilities/01-Functions/generateRoutes.mdx similarity index 100% rename from documentation/docs/api/utilities/01-Functions/generateRoutes.mdx rename to documentation/docs/api/03-Utilities/01-Functions/generateRoutes.mdx diff --git a/documentation/docs/api/utilities/02-Types/Optional.mdx b/documentation/docs/api/03-Utilities/02-Types/Optional.mdx similarity index 73% rename from documentation/docs/api/utilities/02-Types/Optional.mdx rename to documentation/docs/api/03-Utilities/02-Types/Optional.mdx index 298f2b38..60f21370 100644 --- a/documentation/docs/api/utilities/02-Types/Optional.mdx +++ b/documentation/docs/api/03-Utilities/02-Types/Optional.mdx @@ -5,7 +5,7 @@ sidebar_label: 'Optional' sidebar_position: 1 custom_edit_url: null --- -import Optional from '../../Types/Optional.mdx'; +import Optional from '../../04-Types/Optional.mdx'; diff --git a/documentation/docs/api/utilities/03-Singletons/orfiumIdBaseInstance.md b/documentation/docs/api/03-Utilities/03-Singletons/orfiumIdBaseInstance.md similarity index 100% rename from documentation/docs/api/utilities/03-Singletons/orfiumIdBaseInstance.md rename to documentation/docs/api/03-Utilities/03-Singletons/orfiumIdBaseInstance.md diff --git a/documentation/docs/api/utilities/04-Constants/DEFAULT_NAVBAR_HEIGHT.md b/documentation/docs/api/03-Utilities/04-Constants/DEFAULT_NAVBAR_HEIGHT.md similarity index 100% rename from documentation/docs/api/utilities/04-Constants/DEFAULT_NAVBAR_HEIGHT.md rename to documentation/docs/api/03-Utilities/04-Constants/DEFAULT_NAVBAR_HEIGHT.md diff --git a/documentation/docs/api/Types/AuthenticationContextValue.mdx b/documentation/docs/api/04-Types/AuthenticationContextValue.mdx similarity index 100% rename from documentation/docs/api/Types/AuthenticationContextValue.mdx rename to documentation/docs/api/04-Types/AuthenticationContextValue.mdx diff --git a/documentation/docs/api/Types/Authorization.mdx b/documentation/docs/api/04-Types/Authorization.mdx similarity index 100% rename from documentation/docs/api/Types/Authorization.mdx rename to documentation/docs/api/04-Types/Authorization.mdx diff --git a/documentation/docs/api/Types/DecodedTokenResponse.mdx b/documentation/docs/api/04-Types/DecodedTokenResponse.mdx similarity index 100% rename from documentation/docs/api/Types/DecodedTokenResponse.mdx rename to documentation/docs/api/04-Types/DecodedTokenResponse.mdx diff --git a/documentation/docs/api/Types/FallbackPath.mdx b/documentation/docs/api/04-Types/FallbackPath.mdx similarity index 100% rename from documentation/docs/api/Types/FallbackPath.mdx rename to documentation/docs/api/04-Types/FallbackPath.mdx diff --git a/documentation/docs/api/Types/MenuItem.mdx b/documentation/docs/api/04-Types/MenuItem.mdx similarity index 100% rename from documentation/docs/api/Types/MenuItem.mdx rename to documentation/docs/api/04-Types/MenuItem.mdx diff --git a/documentation/docs/api/Types/NavigationProps.mdx b/documentation/docs/api/04-Types/NavigationProps.mdx similarity index 100% rename from documentation/docs/api/Types/NavigationProps.mdx rename to documentation/docs/api/04-Types/NavigationProps.mdx diff --git a/documentation/docs/api/Types/Optional.mdx b/documentation/docs/api/04-Types/Optional.mdx similarity index 100% rename from documentation/docs/api/Types/Optional.mdx rename to documentation/docs/api/04-Types/Optional.mdx diff --git a/documentation/docs/api/Types/OrfiumProductsContextValue.mdx b/documentation/docs/api/04-Types/OrfiumProductsContextValue.mdx similarity index 100% rename from documentation/docs/api/Types/OrfiumProductsContextValue.mdx rename to documentation/docs/api/04-Types/OrfiumProductsContextValue.mdx diff --git a/documentation/docs/api/Types/Organization.mdx b/documentation/docs/api/04-Types/Organization.mdx similarity index 100% rename from documentation/docs/api/Types/Organization.mdx rename to documentation/docs/api/04-Types/Organization.mdx diff --git a/documentation/docs/api/Types/OrganizationsContextValue.mdx b/documentation/docs/api/04-Types/OrganizationsContextValue.mdx similarity index 100% rename from documentation/docs/api/Types/OrganizationsContextValue.mdx rename to documentation/docs/api/04-Types/OrganizationsContextValue.mdx diff --git a/documentation/docs/api/Types/Product.mdx b/documentation/docs/api/04-Types/Product.mdx similarity index 100% rename from documentation/docs/api/Types/Product.mdx rename to documentation/docs/api/04-Types/Product.mdx diff --git a/documentation/docs/api/Types/RouteComponentProps.mdx b/documentation/docs/api/04-Types/RouteComponentProps.mdx similarity index 100% rename from documentation/docs/api/Types/RouteComponentProps.mdx rename to documentation/docs/api/04-Types/RouteComponentProps.mdx diff --git a/documentation/docs/api/Types/RouteItem.mdx b/documentation/docs/api/04-Types/RouteItem.mdx similarity index 100% rename from documentation/docs/api/Types/RouteItem.mdx rename to documentation/docs/api/04-Types/RouteItem.mdx diff --git a/documentation/docs/api/Types/RoutingStructure.mdx b/documentation/docs/api/04-Types/RoutingStructure.mdx similarity index 100% rename from documentation/docs/api/Types/RoutingStructure.mdx rename to documentation/docs/api/04-Types/RoutingStructure.mdx diff --git a/documentation/docs/api/Types/ToolboxProps.mdx b/documentation/docs/api/04-Types/ToolboxProps.mdx similarity index 100% rename from documentation/docs/api/Types/ToolboxProps.mdx rename to documentation/docs/api/04-Types/ToolboxProps.mdx diff --git a/documentation/docs/api/Types/TopBarProps.mdx b/documentation/docs/api/04-Types/TopBarProps.mdx similarity index 100% rename from documentation/docs/api/Types/TopBarProps.mdx rename to documentation/docs/api/04-Types/TopBarProps.mdx diff --git a/documentation/docs/api/Types/TopBarUtilitySectionContextValue.mdx b/documentation/docs/api/04-Types/TopBarUtilitySectionContextValue.mdx similarity index 100% rename from documentation/docs/api/Types/TopBarUtilitySectionContextValue.mdx rename to documentation/docs/api/04-Types/TopBarUtilitySectionContextValue.mdx diff --git a/documentation/docs/api/Types/User.mdx b/documentation/docs/api/04-Types/User.mdx similarity index 100% rename from documentation/docs/api/Types/User.mdx rename to documentation/docs/api/04-Types/User.mdx diff --git a/documentation/docs/api/_type-definitions/AuthenticationContextValue.md b/documentation/docs/api/_type-definitions/AuthenticationContextValue.md index 5cd36c66..df17a793 100644 --- a/documentation/docs/api/_type-definitions/AuthenticationContextValue.md +++ b/documentation/docs/api/_type-definitions/AuthenticationContextValue.md @@ -2,7 +2,7 @@ | :----------------------- |:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `isAuthenticated` | `boolean` | | `isLoading` | `boolean` | -| `user` | [User](../Types/User) | undefined | -| `getAccessTokenSilently` |
(opts?: GetTokenSilentlyOptions) => Promise<
void |
{
decodedToken: [DecodedTokenResponse](../Types/DecodedTokenResponse) | Record ;
token: string;
}
\>
| +| `user` | [User](../04-Types/User) | undefined | +| `getAccessTokenSilently` |
(opts?: GetTokenSilentlyOptions) => Promise<
void |
{
decodedToken: [DecodedTokenResponse](../04-Types/DecodedTokenResponse) | Record ;
token: string;
}
\>
| | `loginWithRedirect` | (o?: RedirectLoginOptions) => Promise | | `logout` | `() => void` | diff --git a/documentation/docs/api/_type-definitions/MenuItem.md b/documentation/docs/api/_type-definitions/MenuItem.md index cd80c228..42d02d6f 100644 --- a/documentation/docs/api/_type-definitions/MenuItem.md +++ b/documentation/docs/api/_type-definitions/MenuItem.md @@ -3,4 +3,4 @@ | `text` | `string` | | `url` | `string` | | `iconName` | `AcceptedIconNames` | -| `children?` | [Optional](../utilities/Types/Optional)<[MenuItem](../Types/MenuItem), 'iconName'\>[] | +| `children?` | [Optional](../03-Utilities/Types/Optional)<[MenuItem](../04-Types/MenuItem), 'iconName'\>[] | diff --git a/documentation/docs/api/_type-definitions/NavigationProps.md b/documentation/docs/api/_type-definitions/NavigationProps.md index fca92939..c32912aa 100644 --- a/documentation/docs/api/_type-definitions/NavigationProps.md +++ b/documentation/docs/api/_type-definitions/NavigationProps.md @@ -1,11 +1,11 @@ | Name | Type | | :--------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `regularNavigation` | [MenuItem](../Types/MenuItem)[] | +| `regularNavigation` | [MenuItem](../04-Types/MenuItem)[] | | `navigationHeader` | `string` | | `userIsAdmin?` | `boolean` _(default: `false`)_ | | `hideOrgSwitcher?` | `boolean` _(default: `false`)_ | -| `adminNavigation?` | [MenuItem](../Types/MenuItem)[] | +| `adminNavigation?` | [MenuItem](../04-Types/MenuItem)[] | | `adminNavigationHeader?` | `string` | | `adminNavigationURLSegment?` | `string` | | `adminButtonTooltipText?` | `string` | -| `extras?` | { title: string; menuItems: ([Omit](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)<[MenuItem](../Types/MenuItem), 'children'\>)[] }[] | +| `extras?` | { title: string; menuItems: ([Omit](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)<[MenuItem](../04-Types/MenuItem), 'children'\>)[] }[] | diff --git a/documentation/docs/api/_type-definitions/OrfiumProductsContextValue.md b/documentation/docs/api/_type-definitions/OrfiumProductsContextValue.md index 11f6fca5..856662b2 100644 --- a/documentation/docs/api/_type-definitions/OrfiumProductsContextValue.md +++ b/documentation/docs/api/_type-definitions/OrfiumProductsContextValue.md @@ -1 +1 @@ -[`Product`](../Types/Product)`[] | null` \ No newline at end of file +[`Product`](../04-Types/Product)`[] | null` \ No newline at end of file diff --git a/documentation/docs/api/_type-definitions/OrganizationsContextValue.md b/documentation/docs/api/_type-definitions/OrganizationsContextValue.md index ce0ba440..caaa62d7 100644 --- a/documentation/docs/api/_type-definitions/OrganizationsContextValue.md +++ b/documentation/docs/api/_type-definitions/OrganizationsContextValue.md @@ -1,5 +1,5 @@ | Name | Type | | :--------------------- | :--------------------------------------------------------------- | -| `organizations` | [Organization](../Types/Organization)[] | -| `selectedOrganization` | [Organization](../Types/Organization)[] | null | +| `organizations` | [Organization](../04-Types/Organization)[] | +| `selectedOrganization` | [Organization](../04-Types/Organization)[] | null | | `switchOrganization` | `(organisation: string) => void` | diff --git a/documentation/docs/api/_type-definitions/RouteItem.md b/documentation/docs/api/_type-definitions/RouteItem.md index 0e5c8f26..bfd18829 100644 --- a/documentation/docs/api/_type-definitions/RouteItem.md +++ b/documentation/docs/api/_type-definitions/RouteItem.md @@ -1,6 +1,6 @@ | Name | Type | | :--------------- | :----------------------------------------------------------------------------------------- | | `path` | string | string[] | -| `authorization?` | [`Authorization`](../Types/Authorization) | +| `authorization?` | [`Authorization`](../04-Types/Authorization) | | `extraProps?` | `unknown` | -| `component?` | React.FunctionComponent<[RouteComponentProps](../Types/RouteComponentProps)\> | +| `component?` | React.FunctionComponent<[RouteComponentProps](../04-Types/RouteComponentProps)\> | diff --git a/documentation/docs/api/_type-definitions/RoutingStructure.md b/documentation/docs/api/_type-definitions/RoutingStructure.md index 4471a479..6694d1ed 100644 --- a/documentation/docs/api/_type-definitions/RoutingStructure.md +++ b/documentation/docs/api/_type-definitions/RoutingStructure.md @@ -1,4 +1,4 @@ | Name | Type | | :-------------- | :---------------------------------------------------------------------------- | -| `fallbackPaths` | Partial\> | -| `routes` | [RouteItem](../Types/RouteItem)[] | +| `fallbackPaths` | Partial\> | +| `routes` | [RouteItem](../04-Types/RouteItem)[] | diff --git a/documentation/docs/api/components/index.md b/documentation/docs/api/components/index.md deleted file mode 100644 index 9f062a72..00000000 --- a/documentation/docs/api/components/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: "index" -title: "Components" -sidebar_label: "Components" -sidebar_position: 1 -custom_edit_url: null ---- - -- [Authentication](./Authentication) -- [Navigation](./Navigation.mdx) -- [TopBar](./TopBar.mdx) diff --git a/documentation/docs/api/hooks/index.md b/documentation/docs/api/hooks/index.md deleted file mode 100644 index d0336abd..00000000 --- a/documentation/docs/api/hooks/index.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: "index" -title: "Hooks" -sidebar_label: "Hooks" -sidebar_position: 1 -custom_edit_url: null ---- - -- [useAuthentication](./useAuthentication.mdx) -- [useData](./useData.md) -- [useDataPagination](./useDataPagination.md) -- [useDeferredValue](./useDeferredValue.md) -- [useSafeContext](./useSafeContext.md) -- [useSafeDispatch](./useSafeDispatch.md) \ No newline at end of file diff --git a/documentation/docs/api/utilities/index.md b/documentation/docs/api/utilities/index.md deleted file mode 100644 index 498b3dfa..00000000 --- a/documentation/docs/api/utilities/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -id: "index" -title: "Utilities" -sidebar_label: "Utilities" -sidebar_position: 1 -custom_edit_url: null ---- - -- [generateRoutes](./generateRoutes.mdx) -- [orfiumIdBaseInstance](./orfiumIdBaseInstance.md) -- [DEFAULT_NAVBAR_HEIGHT](./DEFAULT_NAVBAR_HEIGHT.md) \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 738d310c..0f05996a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,13 @@ export * from './routing'; export type { Organization } from './store/organizations'; export * from './ui'; export { + formatToAUD, + formatToCAD, + formatToCurrency, + formatToEUR, + formatToGBP, + formatToJPY, + formatToUSD, LinkWithStatePassthrough, NavLinkWithStatePassthrough, RedirectWithStatePassthrough, diff --git a/src/utils/currencies.ts b/src/utils/currencies.ts new file mode 100644 index 00000000..f7ed3471 --- /dev/null +++ b/src/utils/currencies.ts @@ -0,0 +1,60 @@ +export function formatToCurrency( + value: number | string, + currency = 'USD', + options?: Omit +) { + if (typeof value === 'string' && isNaN(Number(value))) { + throw 'A string value must be expressing a proper numeric value'; + } + + return new Intl.NumberFormat('en-US', { + ...options, + style: 'currency', + currency: currency, + // Per spec, Intl.NumberFormat.prototype.format can accept a string value, however TS is not allowing it. + // Read this issue thread for more information: https://github.com/microsoft/TypeScript/issues/52124 + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + }).format(value); +} +export function formatToUSD( + value: number | string, + options?: Omit +) { + return formatToCurrency(value, 'USD', options); +} + +export function formatToEUR( + value: number | string, + options?: Omit +) { + return formatToCurrency(value, 'EUR', options); +} + +export function formatToGBP( + value: number | string, + options?: Omit +) { + return formatToCurrency(value, 'GBP', options); +} + +export function formatToAUD( + value: number | string, + options?: Omit +) { + return formatToCurrency(value, 'AUD', options); +} + +export function formatToCAD( + value: number | string, + options?: Omit +) { + return formatToCurrency(value, 'CAD', options); +} + +export function formatToJPY( + value: number | string, + options?: Omit +) { + return formatToCurrency(value, 'JPY', options); +} diff --git a/src/utils/index.ts b/src/utils/index.ts index f1081100..54b3f90e 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,3 +1,4 @@ +export * from './currencies'; export * from './LinkWithStatePassthrough'; export * from './NavLinkWithStatePassthrough'; export * from './reactQuery';