@flipdish/portal-library 1.0.74 → 1.0.76
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/7cb5b036a5bc98d2.gif +0 -0
- package/dist/assets/images/fd-loader.gif.cjs.js +2 -0
- package/dist/assets/images/fd-loader.gif.cjs.js.map +1 -0
- package/dist/assets/images/fd-loader.gif.js +2 -0
- package/dist/assets/images/fd-loader.gif.js.map +1 -0
- package/dist/components/custom-hooks/useMicroFrontendAttributes.cjs.js +1 -1
- package/dist/components/custom-hooks/useMicroFrontendAttributes.cjs.js.map +1 -1
- package/dist/components/custom-hooks/useMicroFrontendAttributes.d.ts +2 -1
- package/dist/components/custom-hooks/useMicroFrontendAttributes.js +1 -1
- package/dist/components/custom-hooks/useMicroFrontendAttributes.js.map +1 -1
- package/dist/components/custom-hooks/useRenderValidText.cjs.js +1 -1
- package/dist/components/custom-hooks/useRenderValidText.cjs.js.map +1 -1
- package/dist/components/custom-hooks/useRenderValidText.d.ts +5 -4
- package/dist/components/custom-hooks/useRenderValidText.js +1 -1
- package/dist/components/custom-hooks/useRenderValidText.js.map +1 -1
- package/dist/components/index.cjs.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/renderUtilities/renderUtilities.cjs.js +1 -1
- package/dist/components/renderUtilities/renderUtilities.cjs.js.map +1 -1
- package/dist/components/renderUtilities/renderUtilities.js +1 -1
- package/dist/components/renderUtilities/renderUtilities.js.map +1 -1
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.cjs.js +1 -1
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.cjs.js.map +1 -1
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.js +1 -1
- package/dist/components/ui/FDErrorBoundary/FDErrorBoundary.js.map +1 -1
- package/dist/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.cjs.js +2 -0
- package/dist/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.cjs.js.map +1 -0
- package/dist/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.d.ts +10 -0
- package/dist/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.js +2 -0
- package/dist/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.js.map +1 -0
- package/dist/components/ui/Form/FormItemLayout.cjs.js.map +1 -1
- package/dist/components/ui/Form/FormItemLayout.js.map +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.cjs.js +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.cjs.js.map +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.js +1 -1
- package/dist/components/ui/Form/GenericAutocompleteField.js.map +1 -1
- package/dist/components/ui/Form/GenericFormContainer.cjs.js +1 -1
- package/dist/components/ui/Form/GenericFormContainer.cjs.js.map +1 -1
- package/dist/components/ui/Form/GenericFormContainer.js +1 -1
- package/dist/components/ui/Form/GenericFormContainer.js.map +1 -1
- package/dist/components/ui/Form/GenericTextField.cjs.js +1 -1
- package/dist/components/ui/Form/GenericTextField.cjs.js.map +1 -1
- package/dist/components/ui/Form/GenericTextField.js +1 -1
- package/dist/components/ui/Form/GenericTextField.js.map +1 -1
- package/dist/components/ui/Form/utilities/formValidation.cjs.js.map +1 -1
- package/dist/components/ui/Form/utilities/formValidation.js.map +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDateFieldBase.cjs.js +2 -0
- package/dist/components/ui/GenericDatePickerField/GenericDateFieldBase.cjs.js.map +1 -0
- package/dist/components/ui/GenericDatePickerField/GenericDateFieldBase.d.ts +22 -0
- package/dist/components/ui/GenericDatePickerField/GenericDateFieldBase.js +2 -0
- package/dist/components/ui/GenericDatePickerField/GenericDateFieldBase.js.map +1 -0
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.cjs.js +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.cjs.js.map +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.d.ts +3 -17
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.js +1 -1
- package/dist/components/ui/GenericDatePickerField/GenericDatePickerField.js.map +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js.map +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.d.ts +3 -17
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.js +1 -1
- package/dist/components/ui/GenericDateTimePickerField/GenericDateTimePickerField.js.map +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.cjs.js +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.cjs.js.map +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.js +1 -1
- package/dist/components/ui/GenericRadioButtons/GenericRadioButtons.js.map +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js +1 -1
- package/dist/components/ui/GenericTableBody/GenericTableBody.js.map +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js.map +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.js +1 -1
- package/dist/components/ui/GenericTableBodyRow/GenericTableBodyRow.js.map +1 -1
- package/dist/components/ui/PageLayout/PageLayout.cjs.js +1 -1
- package/dist/components/ui/PageLayout/PageLayout.cjs.js.map +1 -1
- package/dist/components/ui/PageLayout/PageLayout.js +1 -1
- package/dist/components/ui/PageLayout/PageLayout.js.map +1 -1
- package/dist/components/ui/Spacer/Spacer.cjs.js.map +1 -1
- package/dist/components/ui/Spacer/Spacer.js.map +1 -1
- package/dist/providers/TranslationProvider.cjs.js.map +1 -1
- package/dist/providers/TranslationProvider.js.map +1 -1
- package/package.json +2 -1
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fd-loader.gif.cjs.js","sources":["../../../src/assets/images/fd-loader.gif"],"sourcesContent":["export default \"7cb5b036a5bc98d2.gif\""],"names":[],"mappings":"4BAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fd-loader.gif.js","sources":["../../../src/assets/images/fd-loader.gif"],"sourcesContent":["export default \"7cb5b036a5bc98d2.gif\""],"names":["FdLoader"],"mappings":"AAAA,IAAeA,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("react");const e=["orgId","appId",{key:"isFlipdishStaff",type:"boolean"}]
|
|
1
|
+
"use strict";var t=require("react");const e=["orgId","appId",{key:"isFlipdishStaff",type:"boolean"}],n=(t,e)=>t||"boolean"===e?"boolean"===e?"true"===t:"number"===e?Number(t):t:null,o=t=>[...e.map((t=>"string"==typeof t?t:t.key)),...t.map((t=>"string"==typeof t?t:t.key))];module.exports=(r=[])=>{const[s,i]=t.useState((()=>(t=>{const e=o(t),n={};return e.forEach((t=>{const e="string"==typeof t?t:t.key;n[e]=null})),n})(r)));return t.useEffect((()=>{const t=document.getElementById("flipdish-micro-frontend");if(!t)return void console.warn("Micro-frontend div not found");const s=o(r),u=[...e,...r],c=()=>{i((e=>{const o={...e};let r=!1;return s.forEach((e=>{const{value:s,key:i}=((t,e,o)=>{const r=((t,e)=>e.find((e=>"string"==typeof e?e===t:e.key===t)))(t,o),s=(t=>t&&"string"!=typeof t&&"type"in t?t.type:"string")(r),i="string"==typeof t?t:t.key,u=(void 0)[`VITE_${i.toUpperCase()}_OVERRIDE`],c=`data-${i}`,a=e.getAttribute(c);return{value:n(u?u.toString():a,s),key:i}})(e,t,u);o[i]!==s&&(o[i]=s,r=!0)})),r?o:e}))};c();const a=new MutationObserver(c);return a.observe(t,{attributes:!0}),()=>a.disconnect()}),[r]),s};
|
|
2
2
|
//# sourceMappingURL=useMicroFrontendAttributes.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMicroFrontendAttributes.cjs.js","sources":["../../../src/components/custom-hooks/useMicroFrontendAttributes.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\ntype KeyType = 'string' | 'boolean' | 'number';\n\ninterface KeyConfig {\n key: string;\n type?: KeyType; // type is optional, defaults to 'string'\n}\n\nconst ALWAYS_RETURN_KEYS: (string | KeyConfig)[] = ['orgId', 'appId', { key: 'isFlipdishStaff', type: 'boolean' }] as const;\n\ntype AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig\n ? (typeof ALWAYS_RETURN_KEYS)[number]['key']\n : (typeof ALWAYS_RETURN_KEYS)[number];\n\ntype ExtractKey<T> = T extends KeyConfig ? T['key'] : T;\n\
|
|
1
|
+
{"version":3,"file":"useMicroFrontendAttributes.cjs.js","sources":["../../../src/components/custom-hooks/useMicroFrontendAttributes.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\ntype KeyType = 'string' | 'boolean' | 'number';\n\ninterface KeyConfig {\n key: string;\n type?: KeyType; // type is optional, defaults to 'string'\n}\n\nconst ALWAYS_RETURN_KEYS: (string | KeyConfig)[] = ['orgId', 'appId', { key: 'isFlipdishStaff', type: 'boolean' }] as const;\n\ntype AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig\n ? (typeof ALWAYS_RETURN_KEYS)[number]['key']\n : (typeof ALWAYS_RETURN_KEYS)[number];\n\ntype ExtractKey<T> = T extends KeyConfig ? T['key'] : T;\n\ntype AttributeValue = string | boolean | number | null;\n\n// Utility functions moved outside\ntype KeyArg<T> = string | T | AlwaysReturnKeys;\nconst getKeyConfig = <T extends string | KeyConfig>(key: KeyArg<T>, allConfigs: (string | KeyConfig)[]) => {\n return allConfigs.find((config) => (typeof config === 'string' ? config === key : config.key === key));\n};\n\nconst getValueType = (keyConfig: KeyConfig | string | undefined): KeyType => {\n return keyConfig && typeof keyConfig !== 'string' && 'type' in keyConfig ? keyConfig.type : 'string';\n};\n\nconst parseValue = (value: string | null, type: KeyType): AttributeValue => {\n if (!value && type !== 'boolean') return null;\n if (type === 'boolean') return value === 'true';\n if (type === 'number') return Number(value);\n return value;\n};\n\nconst getAllKeys = <T extends string | KeyConfig>(customKeys: (T | KeyConfig)[]): (string | T | AlwaysReturnKeys)[] => {\n return [\n ...ALWAYS_RETURN_KEYS.map((key) => (typeof key === 'string' ? key : key.key)),\n ...customKeys.map((key) => (typeof key === 'string' ? key : key.key)),\n ];\n};\n\nconst getInitialState = <T extends string | KeyConfig>(customKeys: (T | KeyConfig)[]): Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue> => {\n const allKeys = getAllKeys(customKeys);\n const initialState = {} as Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue>;\n allKeys.forEach((key) => {\n const typedKey = (typeof key === 'string' ? key : key.key) as ExtractKey<AlwaysReturnKeys | T>;\n initialState[typedKey] = null;\n });\n return initialState;\n};\n\nconst processAttribute = <T extends string | KeyConfig>(\n key: string | T | AlwaysReturnKeys,\n microFrontendDiv: HTMLElement,\n allConfigs: (string | KeyConfig)[],\n): { value: AttributeValue; key: ExtractKey<AlwaysReturnKeys | T> } => {\n const keyConfig = getKeyConfig(key, allConfigs);\n const type = getValueType(keyConfig);\n const keyString = typeof key === 'string' ? key : key.key;\n\n const envVar = import.meta.env[`VITE_${keyString.toUpperCase()}_OVERRIDE`] as string | undefined | null;\n const attributeKey = `data-${keyString}`;\n const domValue = microFrontendDiv.getAttribute(attributeKey);\n\n const value = envVar ? parseValue(envVar.toString(), type) : parseValue(domValue, type);\n return { value, key: keyString as ExtractKey<AlwaysReturnKeys | T> };\n};\n\n/**\n * Custom hook to manage micro-frontend attributes.\n *\n * This hook initializes and updates a set of attributes based on a combination of predefined keys (ALWAYS_RETURN_KEYS)\n * and custom keys provided as arguments. The attributes are fetched from environment variables or DOM attributes\n * and are updated dynamically using a MutationObserver.\n *\n * @template T - The type of custom keys, which can be either a string or a KeyConfig object.\n *\n * @param {Array<T | KeyConfig>} [customKeys=[]] - An array of custom keys or KeyConfig objects to be included in the attributes.\n *\n * @returns {Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null>} - A record of attributes with their values.\n *\n * @example\n * const attributes = useMicroFrontendAttributes(['customKey1', { key: 'customKey2', type: 'boolean' }]);\n * console.log(attributes);\n */\nconst useMicroFrontendAttributes = <T extends string | KeyConfig>(\n customKeys: (T | KeyConfig)[] = [],\n): Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue> => {\n const [attributes, setAttributes] = useState(() => getInitialState(customKeys));\n\n useEffect(() => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n if (!microFrontendDiv) {\n console.warn('Micro-frontend div not found');\n return;\n }\n\n const allKeys = getAllKeys(customKeys);\n const allConfigs = [...ALWAYS_RETURN_KEYS, ...customKeys];\n\n const updateValues = () => {\n setAttributes((prev) => {\n const newAttributes = { ...prev };\n let isChanged = false;\n\n allKeys.forEach((key) => {\n const { value, key: typedKey } = processAttribute(key, microFrontendDiv, allConfigs);\n if (newAttributes[typedKey] !== value) {\n newAttributes[typedKey] = value;\n isChanged = true;\n }\n });\n\n return isChanged ? newAttributes : prev;\n });\n };\n\n updateValues();\n\n const observer = new MutationObserver(updateValues);\n observer.observe(microFrontendDiv, { attributes: true });\n\n return () => observer.disconnect();\n }, [customKeys]);\n\n return attributes;\n};\n\nexport default useMicroFrontendAttributes;\n"],"names":["ALWAYS_RETURN_KEYS","key","type","parseValue","value","Number","getAllKeys","customKeys","map","attributes","setAttributes","useState","allKeys","initialState","forEach","typedKey","getInitialState","useEffect","microFrontendDiv","document","getElementById","console","warn","allConfigs","updateValues","prev","newAttributes","isChanged","keyConfig","find","config","getKeyConfig","getValueType","keyString","envVar","undefined","toUpperCase","attributeKey","domValue","getAttribute","toString","processAttribute","observer","MutationObserver","observe","disconnect"],"mappings":"oCASA,MAAMA,EAA6C,CAAC,QAAS,QAAS,CAAEC,IAAK,kBAAmBC,KAAM,YAoBhGC,EAAa,CAACC,EAAsBF,IACjCE,GAAkB,YAATF,EACD,YAATA,EAAqC,SAAVE,EAClB,WAATF,EAA0BG,OAAOD,GAC9BA,EAHkC,KAMvCE,EAA4CC,GACvC,IACAP,EAAmBQ,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,SACrEM,EAAWC,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,sBAgDrC,CAC/BM,EAAgC,MAEhC,MAAOE,EAAYC,GAAiBC,EAAQA,UAAC,IA/CzB,CAA+BJ,IACnD,MAAMK,EAAUN,EAAWC,GACrBM,EAAe,CAAA,EAKrB,OAJAD,EAAQE,SAASb,IACb,MAAMc,EAA2B,iBAARd,EAAmBA,EAAMA,EAAIA,IACtDY,EAAaE,GAAY,IAAI,IAE1BF,CAAY,EAwCgCG,CAAgBT,KAqCnE,OAnCAU,EAAAA,WAAU,KACN,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,IAAKF,EAED,YADAG,QAAQC,KAAK,gCAIjB,MAAMV,EAAUN,EAAWC,GACrBgB,EAAa,IAAIvB,KAAuBO,GAExCiB,EAAe,KACjBd,GAAee,IACX,MAAMC,EAAgB,IAAKD,GAC3B,IAAIE,GAAY,EAUhB,OARAf,EAAQE,SAASb,IACb,MAAMG,MAAEA,EAAOH,IAAKc,GAvDf,EACrBd,EACAiB,EACAK,KAEA,MAAMK,EArCW,EAA+B3B,EAAgBsB,IACzDA,EAAWM,MAAMC,GAA8B,iBAAXA,EAAsBA,IAAW7B,EAAM6B,EAAO7B,MAAQA,IAoC/E8B,CAAa9B,EAAKsB,GAC9BrB,EAlCW,CAAC0B,GACXA,GAAkC,iBAAdA,GAA0B,SAAUA,EAAYA,EAAU1B,KAAO,SAiC/E8B,CAAaJ,GACpBK,EAA2B,iBAARhC,EAAmBA,EAAMA,EAAIA,IAEhDiC,QAASC,GAAgB,QAAQF,EAAUG,0BAC3CC,EAAe,QAAQJ,IACvBK,EAAWpB,EAAiBqB,aAAaF,GAG/C,MAAO,CAAEjC,MADcD,EAAT+B,EAAoBA,EAAOM,WAA+BF,EAAnBpC,GACrCD,IAAKgC,EAA+C,EAyCnBQ,CAAiBxC,EAAKiB,EAAkBK,GACrEG,EAAcX,KAAcX,IAC5BsB,EAAcX,GAAYX,EAC1BuB,GAAY,EACf,IAGEA,EAAYD,EAAgBD,CAAI,GACzC,EAGND,IAEA,MAAMkB,EAAW,IAAIC,iBAAiBnB,GAGtC,OAFAkB,EAASE,QAAQ1B,EAAkB,CAAET,YAAY,IAE1C,IAAMiC,EAASG,YAAY,GACnC,CAACtC,IAEGE,CAAU"}
|
|
@@ -6,6 +6,7 @@ interface KeyConfig {
|
|
|
6
6
|
declare const ALWAYS_RETURN_KEYS: (string | KeyConfig)[];
|
|
7
7
|
type AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig ? (typeof ALWAYS_RETURN_KEYS)[number]['key'] : (typeof ALWAYS_RETURN_KEYS)[number];
|
|
8
8
|
type ExtractKey<T> = T extends KeyConfig ? T['key'] : T;
|
|
9
|
+
type AttributeValue = string | boolean | number | null;
|
|
9
10
|
/**
|
|
10
11
|
* Custom hook to manage micro-frontend attributes.
|
|
11
12
|
*
|
|
@@ -23,6 +24,6 @@ type ExtractKey<T> = T extends KeyConfig ? T['key'] : T;
|
|
|
23
24
|
* const attributes = useMicroFrontendAttributes(['customKey1', { key: 'customKey2', type: 'boolean' }]);
|
|
24
25
|
* console.log(attributes);
|
|
25
26
|
*/
|
|
26
|
-
declare const useMicroFrontendAttributes: <T extends string | KeyConfig>(customKeys?: (T | KeyConfig)[]) => Record<ExtractKey<AlwaysReturnKeys | T>,
|
|
27
|
+
declare const useMicroFrontendAttributes: <T extends string | KeyConfig>(customKeys?: (T | KeyConfig)[]) => Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue>;
|
|
27
28
|
|
|
28
29
|
export { useMicroFrontendAttributes as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as t,useEffect as e}from"react";const n=["orgId","appId",{key:"isFlipdishStaff",type:"boolean"}],o=(
|
|
1
|
+
import{useState as t,useEffect as e}from"react";const n=["orgId","appId",{key:"isFlipdishStaff",type:"boolean"}],o=(t,e)=>t||"boolean"===e?"boolean"===e?"true"===t:"number"===e?Number(t):t:null,r=t=>[...n.map((t=>"string"==typeof t?t:t.key)),...t.map((t=>"string"==typeof t?t:t.key))],s=(s=[])=>{const[i,a]=t((()=>(t=>{const e=r(t),n={};return e.forEach((t=>{const e="string"==typeof t?t:t.key;n[e]=null})),n})(s)));return e((()=>{const t=document.getElementById("flipdish-micro-frontend");if(!t)return void console.warn("Micro-frontend div not found");const e=r(s),i=[...n,...s],p=()=>{a((n=>{const r={...n};let s=!1;return e.forEach((e=>{const{value:n,key:a}=((t,e,n)=>{const r=((t,e)=>e.find((e=>"string"==typeof e?e===t:e.key===t)))(t,n),s=(t=>t&&"string"!=typeof t&&"type"in t?t.type:"string")(r),i="string"==typeof t?t:t.key,a=import.meta.env[`VITE_${i.toUpperCase()}_OVERRIDE`],p=`data-${i}`,c=e.getAttribute(p);return{value:o(a?a.toString():c,s),key:i}})(e,t,i);r[a]!==n&&(r[a]=n,s=!0)})),s?r:n}))};p();const c=new MutationObserver(p);return c.observe(t,{attributes:!0}),()=>c.disconnect()}),[s]),i};export{s as default};
|
|
2
2
|
//# sourceMappingURL=useMicroFrontendAttributes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMicroFrontendAttributes.js","sources":["../../../src/components/custom-hooks/useMicroFrontendAttributes.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\ntype KeyType = 'string' | 'boolean' | 'number';\n\ninterface KeyConfig {\n key: string;\n type?: KeyType; // type is optional, defaults to 'string'\n}\n\nconst ALWAYS_RETURN_KEYS: (string | KeyConfig)[] = ['orgId', 'appId', { key: 'isFlipdishStaff', type: 'boolean' }] as const;\n\ntype AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig\n ? (typeof ALWAYS_RETURN_KEYS)[number]['key']\n : (typeof ALWAYS_RETURN_KEYS)[number];\n\ntype ExtractKey<T> = T extends KeyConfig ? T['key'] : T;\n\
|
|
1
|
+
{"version":3,"file":"useMicroFrontendAttributes.js","sources":["../../../src/components/custom-hooks/useMicroFrontendAttributes.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\n\ntype KeyType = 'string' | 'boolean' | 'number';\n\ninterface KeyConfig {\n key: string;\n type?: KeyType; // type is optional, defaults to 'string'\n}\n\nconst ALWAYS_RETURN_KEYS: (string | KeyConfig)[] = ['orgId', 'appId', { key: 'isFlipdishStaff', type: 'boolean' }] as const;\n\ntype AlwaysReturnKeys = (typeof ALWAYS_RETURN_KEYS)[number] extends KeyConfig\n ? (typeof ALWAYS_RETURN_KEYS)[number]['key']\n : (typeof ALWAYS_RETURN_KEYS)[number];\n\ntype ExtractKey<T> = T extends KeyConfig ? T['key'] : T;\n\ntype AttributeValue = string | boolean | number | null;\n\n// Utility functions moved outside\ntype KeyArg<T> = string | T | AlwaysReturnKeys;\nconst getKeyConfig = <T extends string | KeyConfig>(key: KeyArg<T>, allConfigs: (string | KeyConfig)[]) => {\n return allConfigs.find((config) => (typeof config === 'string' ? config === key : config.key === key));\n};\n\nconst getValueType = (keyConfig: KeyConfig | string | undefined): KeyType => {\n return keyConfig && typeof keyConfig !== 'string' && 'type' in keyConfig ? keyConfig.type : 'string';\n};\n\nconst parseValue = (value: string | null, type: KeyType): AttributeValue => {\n if (!value && type !== 'boolean') return null;\n if (type === 'boolean') return value === 'true';\n if (type === 'number') return Number(value);\n return value;\n};\n\nconst getAllKeys = <T extends string | KeyConfig>(customKeys: (T | KeyConfig)[]): (string | T | AlwaysReturnKeys)[] => {\n return [\n ...ALWAYS_RETURN_KEYS.map((key) => (typeof key === 'string' ? key : key.key)),\n ...customKeys.map((key) => (typeof key === 'string' ? key : key.key)),\n ];\n};\n\nconst getInitialState = <T extends string | KeyConfig>(customKeys: (T | KeyConfig)[]): Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue> => {\n const allKeys = getAllKeys(customKeys);\n const initialState = {} as Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue>;\n allKeys.forEach((key) => {\n const typedKey = (typeof key === 'string' ? key : key.key) as ExtractKey<AlwaysReturnKeys | T>;\n initialState[typedKey] = null;\n });\n return initialState;\n};\n\nconst processAttribute = <T extends string | KeyConfig>(\n key: string | T | AlwaysReturnKeys,\n microFrontendDiv: HTMLElement,\n allConfigs: (string | KeyConfig)[],\n): { value: AttributeValue; key: ExtractKey<AlwaysReturnKeys | T> } => {\n const keyConfig = getKeyConfig(key, allConfigs);\n const type = getValueType(keyConfig);\n const keyString = typeof key === 'string' ? key : key.key;\n\n const envVar = import.meta.env[`VITE_${keyString.toUpperCase()}_OVERRIDE`] as string | undefined | null;\n const attributeKey = `data-${keyString}`;\n const domValue = microFrontendDiv.getAttribute(attributeKey);\n\n const value = envVar ? parseValue(envVar.toString(), type) : parseValue(domValue, type);\n return { value, key: keyString as ExtractKey<AlwaysReturnKeys | T> };\n};\n\n/**\n * Custom hook to manage micro-frontend attributes.\n *\n * This hook initializes and updates a set of attributes based on a combination of predefined keys (ALWAYS_RETURN_KEYS)\n * and custom keys provided as arguments. The attributes are fetched from environment variables or DOM attributes\n * and are updated dynamically using a MutationObserver.\n *\n * @template T - The type of custom keys, which can be either a string or a KeyConfig object.\n *\n * @param {Array<T | KeyConfig>} [customKeys=[]] - An array of custom keys or KeyConfig objects to be included in the attributes.\n *\n * @returns {Record<ExtractKey<AlwaysReturnKeys | T>, string | boolean | number | null>} - A record of attributes with their values.\n *\n * @example\n * const attributes = useMicroFrontendAttributes(['customKey1', { key: 'customKey2', type: 'boolean' }]);\n * console.log(attributes);\n */\nconst useMicroFrontendAttributes = <T extends string | KeyConfig>(\n customKeys: (T | KeyConfig)[] = [],\n): Record<ExtractKey<AlwaysReturnKeys | T>, AttributeValue> => {\n const [attributes, setAttributes] = useState(() => getInitialState(customKeys));\n\n useEffect(() => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n if (!microFrontendDiv) {\n console.warn('Micro-frontend div not found');\n return;\n }\n\n const allKeys = getAllKeys(customKeys);\n const allConfigs = [...ALWAYS_RETURN_KEYS, ...customKeys];\n\n const updateValues = () => {\n setAttributes((prev) => {\n const newAttributes = { ...prev };\n let isChanged = false;\n\n allKeys.forEach((key) => {\n const { value, key: typedKey } = processAttribute(key, microFrontendDiv, allConfigs);\n if (newAttributes[typedKey] !== value) {\n newAttributes[typedKey] = value;\n isChanged = true;\n }\n });\n\n return isChanged ? newAttributes : prev;\n });\n };\n\n updateValues();\n\n const observer = new MutationObserver(updateValues);\n observer.observe(microFrontendDiv, { attributes: true });\n\n return () => observer.disconnect();\n }, [customKeys]);\n\n return attributes;\n};\n\nexport default useMicroFrontendAttributes;\n"],"names":["ALWAYS_RETURN_KEYS","key","type","parseValue","value","Number","getAllKeys","customKeys","map","useMicroFrontendAttributes","attributes","setAttributes","useState","allKeys","initialState","forEach","typedKey","getInitialState","useEffect","microFrontendDiv","document","getElementById","console","warn","allConfigs","updateValues","prev","newAttributes","isChanged","keyConfig","find","config","getKeyConfig","getValueType","keyString","envVar","env","toUpperCase","attributeKey","domValue","getAttribute","toString","processAttribute","observer","MutationObserver","observe","disconnect"],"mappings":"gDASA,MAAMA,EAA6C,CAAC,QAAS,QAAS,CAAEC,IAAK,kBAAmBC,KAAM,YAoBhGC,EAAa,CAACC,EAAsBF,IACjCE,GAAkB,YAATF,EACD,YAATA,EAAqC,SAAVE,EAClB,WAATF,EAA0BG,OAAOD,GAC9BA,EAHkC,KAMvCE,EAA4CC,GACvC,IACAP,EAAmBQ,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,SACrEM,EAAWC,KAAKP,GAAwB,iBAARA,EAAmBA,EAAMA,EAAIA,OAgDlEQ,EAA6B,CAC/BF,EAAgC,MAEhC,MAAOG,EAAYC,GAAiBC,GAAS,IA/CzB,CAA+BL,IACnD,MAAMM,EAAUP,EAAWC,GACrBO,EAAe,CAAA,EAKrB,OAJAD,EAAQE,SAASd,IACb,MAAMe,EAA2B,iBAARf,EAAmBA,EAAMA,EAAIA,IACtDa,EAAaE,GAAY,IAAI,IAE1BF,CAAY,EAwCgCG,CAAgBV,KAqCnE,OAnCAW,GAAU,KACN,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,IAAKF,EAED,YADAG,QAAQC,KAAK,gCAIjB,MAAMV,EAAUP,EAAWC,GACrBiB,EAAa,IAAIxB,KAAuBO,GAExCkB,EAAe,KACjBd,GAAee,IACX,MAAMC,EAAgB,IAAKD,GAC3B,IAAIE,GAAY,EAUhB,OARAf,EAAQE,SAASd,IACb,MAAMG,MAAEA,EAAOH,IAAKe,GAvDf,EACrBf,EACAkB,EACAK,KAEA,MAAMK,EArCW,EAA+B5B,EAAgBuB,IACzDA,EAAWM,MAAMC,GAA8B,iBAAXA,EAAsBA,IAAW9B,EAAM8B,EAAO9B,MAAQA,IAoC/E+B,CAAa/B,EAAKuB,GAC9BtB,EAlCW,CAAC2B,GACXA,GAAkC,iBAAdA,GAA0B,SAAUA,EAAYA,EAAU3B,KAAO,SAiC/E+B,CAAaJ,GACpBK,EAA2B,iBAARjC,EAAmBA,EAAMA,EAAIA,IAEhDkC,cAAqBC,IAAI,QAAQF,EAAUG,0BAC3CC,EAAe,QAAQJ,IACvBK,EAAWpB,EAAiBqB,aAAaF,GAG/C,MAAO,CAAElC,MADcD,EAATgC,EAAoBA,EAAOM,WAA+BF,EAAnBrC,GACrCD,IAAKiC,EAA+C,EAyCnBQ,CAAiBzC,EAAKkB,EAAkBK,GACrEG,EAAcX,KAAcZ,IAC5BuB,EAAcX,GAAYZ,EAC1BwB,GAAY,EACf,IAGEA,EAAYD,EAAgBD,CAAI,GACzC,EAGND,IAEA,MAAMkB,EAAW,IAAIC,iBAAiBnB,GAGtC,OAFAkB,EAASE,QAAQ1B,EAAkB,CAAET,YAAY,IAE1C,IAAMiC,EAASG,YAAY,GACnC,CAACvC,IAEGG,CAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("react/jsx-runtime"),e=require("react"),s=require("../../providers/TranslationProvider.cjs.js");module.exports=({fieldError:t,showError:a,touched:o,value:i})=>{const[u,c]=e.useState(""),{translate:l}=s.useTranslation()
|
|
1
|
+
"use strict";var r=require("react/jsx-runtime"),e=require("react"),s=require("../../providers/TranslationProvider.cjs.js");module.exports=({fieldError:t,showError:a,touched:o,value:i})=>{const[u,c]=e.useState(""),{translate:l}=s.useTranslation(),n=()=>!a&&o&&i?r.jsx("span",{style:{color:"#1dc798"},children:l("Valid")}):a?t:"";return e.useEffect((()=>{c(n())}),[t,i,a,o]),u};
|
|
2
2
|
//# sourceMappingURL=useRenderValidText.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRenderValidText.cjs.js","sources":["../../../src/components/custom-hooks/useRenderValidText.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useTranslation } from '../../providers/TranslationProvider';\n\ntype
|
|
1
|
+
{"version":3,"file":"useRenderValidText.cjs.js","sources":["../../../src/components/custom-hooks/useRenderValidText.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useTranslation } from '../../providers/TranslationProvider';\n\ntype ValidationState = {\n fieldError?: string;\n showError?: boolean;\n touched: boolean;\n value: string;\n};\n\ntype ValidationElement = JSX.Element | string | undefined;\n\n/**\n * @description Custom hook for rendering validation text in form fields\n * @description Handles different validation states with separate methods for better clarity\n */\nconst useRenderValidText = ({ fieldError, showError, touched, value }: ValidationState) => {\n const [validTextElement, setValidTextElement] = useState<ValidationElement>('');\n const { translate } = useTranslation();\n\n const renderValidState = (): ValidationElement => {\n return <span style={{ color: '#1dc798' }}>{translate('Valid')}</span>;\n };\n\n const renderErrorState = (): ValidationElement => {\n return fieldError;\n };\n\n const renderEmptyState = (): ValidationElement => {\n return '';\n };\n\n const determineValidationState = (): ValidationElement => {\n if (!showError && touched && value) {\n return renderValidState();\n }\n\n if (showError) {\n return renderErrorState();\n }\n\n return renderEmptyState();\n };\n\n useEffect(() => {\n setValidTextElement(determineValidationState());\n }, [fieldError, value, showError, touched]);\n\n return validTextElement;\n};\n\nexport default useRenderValidText;\n"],"names":["fieldError","showError","touched","value","validTextElement","setValidTextElement","useState","translate","useTranslation","determineValidationState","_jsx","style","color","children","useEffect"],"mappings":"0IAgB2B,EAAGA,aAAYC,YAAWC,UAASC,YAC1D,MAAOC,EAAkBC,GAAuBC,EAAQA,SAAoB,KACtEC,UAAEA,GAAcC,EAAAA,iBAchBC,EAA2B,KACxBR,GAAaC,GAAWC,EAZtBO,MAAM,OAAA,CAAAC,MAAO,CAAEC,MAAO,WAAWC,SAAGN,EAAU,WAgBjDN,EAZGD,EAIA,GAmBX,OAJAc,EAAAA,WAAU,KACNT,EAAoBI,IAA2B,GAChD,CAACT,EAAYG,EAAOF,EAAWC,IAE3BE,CAAgB"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
type
|
|
1
|
+
type ValidationState = {
|
|
2
2
|
fieldError?: string;
|
|
3
3
|
showError?: boolean;
|
|
4
4
|
touched: boolean;
|
|
5
5
|
value: string;
|
|
6
6
|
};
|
|
7
|
+
type ValidationElement = JSX.Element | string | undefined;
|
|
7
8
|
/**
|
|
8
|
-
* @description
|
|
9
|
-
* @description
|
|
9
|
+
* @description Custom hook for rendering validation text in form fields
|
|
10
|
+
* @description Handles different validation states with separate methods for better clarity
|
|
10
11
|
*/
|
|
11
|
-
declare const useRenderValidText: ({ fieldError, showError, touched, value }:
|
|
12
|
+
declare const useRenderValidText: ({ fieldError, showError, touched, value }: ValidationState) => ValidationElement;
|
|
12
13
|
|
|
13
14
|
export { useRenderValidText as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{useState as o,useEffect as t}from"react";import{useTranslation as e}from"../../providers/TranslationProvider.js";const a=({fieldError:a,showError:s,touched:i,value:l})=>{const[n,c]=o(""),{translate:d}=e()
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useState as o,useEffect as t}from"react";import{useTranslation as e}from"../../providers/TranslationProvider.js";const a=({fieldError:a,showError:s,touched:i,value:l})=>{const[n,c]=o(""),{translate:d}=e(),m=()=>!s&&i&&l?r("span",{style:{color:"#1dc798"},children:d("Valid")}):s?a:"";return t((()=>{c(m())}),[a,l,s,i]),n};export{a as default};
|
|
2
2
|
//# sourceMappingURL=useRenderValidText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRenderValidText.js","sources":["../../../src/components/custom-hooks/useRenderValidText.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useTranslation } from '../../providers/TranslationProvider';\n\ntype
|
|
1
|
+
{"version":3,"file":"useRenderValidText.js","sources":["../../../src/components/custom-hooks/useRenderValidText.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useTranslation } from '../../providers/TranslationProvider';\n\ntype ValidationState = {\n fieldError?: string;\n showError?: boolean;\n touched: boolean;\n value: string;\n};\n\ntype ValidationElement = JSX.Element | string | undefined;\n\n/**\n * @description Custom hook for rendering validation text in form fields\n * @description Handles different validation states with separate methods for better clarity\n */\nconst useRenderValidText = ({ fieldError, showError, touched, value }: ValidationState) => {\n const [validTextElement, setValidTextElement] = useState<ValidationElement>('');\n const { translate } = useTranslation();\n\n const renderValidState = (): ValidationElement => {\n return <span style={{ color: '#1dc798' }}>{translate('Valid')}</span>;\n };\n\n const renderErrorState = (): ValidationElement => {\n return fieldError;\n };\n\n const renderEmptyState = (): ValidationElement => {\n return '';\n };\n\n const determineValidationState = (): ValidationElement => {\n if (!showError && touched && value) {\n return renderValidState();\n }\n\n if (showError) {\n return renderErrorState();\n }\n\n return renderEmptyState();\n };\n\n useEffect(() => {\n setValidTextElement(determineValidationState());\n }, [fieldError, value, showError, touched]);\n\n return validTextElement;\n};\n\nexport default useRenderValidText;\n"],"names":["useRenderValidText","fieldError","showError","touched","value","validTextElement","setValidTextElement","useState","translate","useTranslation","determineValidationState","_jsx","style","color","children","useEffect"],"mappings":"gKAgBA,MAAMA,EAAqB,EAAGC,aAAYC,YAAWC,UAASC,YAC1D,MAAOC,EAAkBC,GAAuBC,EAA4B,KACtEC,UAAEA,GAAcC,IAchBC,EAA2B,KACxBR,GAAaC,GAAWC,EAZtBO,EAAM,OAAA,CAAAC,MAAO,CAAEC,MAAO,WAAWC,SAAGN,EAAU,WAgBjDN,EAZGD,EAIA,GAmBX,OAJAc,GAAU,KACNT,EAAoBI,IAA2B,GAChD,CAACT,EAAYG,EAAOF,EAAWC,IAE3BE,CAAgB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./themes/flipdishPublicTheme.cjs.js"),i=require("./ui/NotFoundPage/NotFoundPage.cjs.js"),r=require("./ui/FlipdishStaffContainer/FlipdishStaffContainer.cjs.js"),t=require("./ui/PageLayout/PageLayout.cjs.js"),o=require("./ui/PortalMock/PortalMock.cjs.js"),s=require("./ui/LazyComponent/LazyComponent.cjs.js"),c=require("./ui/Spacer/Spacer.cjs.js"),u=require("./ui/Chip/Chip.cjs.js"),
|
|
1
|
+
"use strict";var e=require("./themes/flipdishPublicTheme.cjs.js"),i=require("./ui/NotFoundPage/NotFoundPage.cjs.js"),r=require("./ui/FlipdishStaffContainer/FlipdishStaffContainer.cjs.js"),t=require("./ui/PageLayout/PageLayout.cjs.js"),o=require("./ui/PortalMock/PortalMock.cjs.js"),s=require("./ui/LazyComponent/LazyComponent.cjs.js"),c=require("./ui/Spacer/Spacer.cjs.js"),u=require("./ui/Chip/Chip.cjs.js"),a=require("./ui/Switch/Switch.cjs.js"),n=require("./ui/Tooltip/Tooltip.cjs.js"),l=require("./ui/Form/utilities/formValidation.cjs.js"),d=require("./ui/Form/GenericAutocompleteField.cjs.js"),p=require("./ui/Form/GenericFormContainer.cjs.js"),j=require("./ui/Form/GenericTextField.cjs.js"),m=require("./ui/Form/PaginatedAutocompleteField.cjs.js"),x=require("./ui/FlipdishLogoLoader/FlipdishLogoLoader.cjs.js"),q=require("./ui/GenericDatePickerField/GenericDatePickerField.cjs.js"),F=require("./ui/GenericDateTimePickerField/GenericDateTimePickerField.cjs.js"),T=require("./ui/GenericRadioButtons/GenericRadioButtons.cjs.js"),L=require("./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.cjs.js"),G=require("./ui/GenericTable/GenericTable.cjs.js"),h=require("./ui/GenericTableBody/GenericTableBody.cjs.js"),g=require("./ui/GenericTableBodyRow/GenericTableBodyRow.cjs.js"),P=require("./ui/GenericTableTitle/GenericTableTitle.cjs.js"),b=require("./ui/ListItemLink/ListItemLink.cjs.js"),k=require("./ui/ListItemLinkButton/ListItemLinkButton.cjs.js"),I=require("./ui/NoResults/NoResults.cjs.js"),y=require("@mui/icons-material/Search"),f=require("@mui/icons-material/CalendarToday"),B=require("@mui/icons-material/AccessTime"),C=require("@mui/icons-material/Done"),R=require("./custom-hooks/useRenderValidText.cjs.js"),S=require("./custom-hooks/useMicroFrontendAttributes.cjs.js"),A=require("./renderUtilities/renderUtilities.cjs.js"),D=require("./genericUtilities/index.cjs.js");exports.flipdishPublicTheme=e,exports.NotFoundPage=i,exports.FlipdishStaffContainer=r,exports.PageLayout=t.default,exports.PortalMock=o,exports.LazyComponent=s,exports.Spacer=c,exports.Chip=u.default,exports.Switch=a,exports.Tooltip=n,exports.formikValidate=l.formikValidate,exports.GenericAutocompleteField=d,exports.GenericFormContainer=p,exports.GenericTextField=j,exports.PaginatedAutocompleteField=m,exports.FlipdishLogoLoader=x,exports.GenericDatePickerField=q,exports.GenericDateTimePickerField=F,exports.GenericRadioButtons=T,exports.DateTimeLocalizationProvider=L,exports.GenericTable=G,exports.GenericTableBody=h,exports.GenericTableBodyRow=g,exports.GenericTableTitle=P,exports.ListItemLink=b,exports.ListItemLinkButton=k.ListItemLinkButton,exports.NoResults=I,exports.SearchIcon=y,exports.CalendarTodayIcon=f,exports.AccessTimeIcon=B,exports.DoneIcon=C,exports.useRenderValidText=R,exports.useMicroFrontendAttributes=S,exports.getAppId=A.getAppId,exports.getBrandId=A.getBrandId,exports.getIsFlipdishStaff=A.getIsFlipdishStaff,exports.getMicroFrontendAttribute=A.getMicroFrontendAttribute,exports.getOrgId=A.getOrgId,exports.lazyWithRetry=A.lazyWithRetry,exports.debounce=D.debounce;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -13,6 +13,7 @@ export { default as GenericAutocompleteField } from './ui/Form/GenericAutocomple
|
|
|
13
13
|
export { default as GenericFormContainer } from './ui/Form/GenericFormContainer.js';
|
|
14
14
|
export { default as GenericTextField } from './ui/Form/GenericTextField.js';
|
|
15
15
|
export { default as PaginatedAutocompleteField } from './ui/Form/PaginatedAutocompleteField.js';
|
|
16
|
+
export { default as FlipdishLogoLoader } from './ui/FlipdishLogoLoader/FlipdishLogoLoader.js';
|
|
16
17
|
export { default as GenericDatePickerField } from './ui/GenericDatePickerField/GenericDatePickerField.js';
|
|
17
18
|
export { default as GenericDateTimePickerField } from './ui/GenericDateTimePickerField/GenericDateTimePickerField.js';
|
|
18
19
|
export { default as GenericRadioButtons } from './ui/GenericRadioButtons/GenericRadioButtons.js';
|
package/dist/components/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as FlipdishStaffContainer}from"./ui/FlipdishStaffContainer/FlipdishStaffContainer.js";export{default as PageLayout}from"./ui/PageLayout/PageLayout.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";export{default as Chip}from"./ui/Chip/Chip.js";export{default as Switch}from"./ui/Switch/Switch.js";export{default as Tooltip}from"./ui/Tooltip/Tooltip.js";export{formikValidate}from"./ui/Form/utilities/formValidation.js";export{default as GenericAutocompleteField}from"./ui/Form/GenericAutocompleteField.js";export{default as GenericFormContainer}from"./ui/Form/GenericFormContainer.js";export{default as GenericTextField}from"./ui/Form/GenericTextField.js";export{default as PaginatedAutocompleteField}from"./ui/Form/PaginatedAutocompleteField.js";export{default as GenericDatePickerField}from"./ui/GenericDatePickerField/GenericDatePickerField.js";export{default as GenericDateTimePickerField}from"./ui/GenericDateTimePickerField/GenericDateTimePickerField.js";export{default as GenericRadioButtons}from"./ui/GenericRadioButtons/GenericRadioButtons.js";export{default as DateTimeLocalizationProvider}from"./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.js";export{default as GenericTable}from"./ui/GenericTable/GenericTable.js";export{default as GenericTableBody}from"./ui/GenericTableBody/GenericTableBody.js";export{default as GenericTableBodyRow}from"./ui/GenericTableBodyRow/GenericTableBodyRow.js";export{default as GenericTableTitle}from"./ui/GenericTableTitle/GenericTableTitle.js";export{default as ListItemLink}from"./ui/ListItemLink/ListItemLink.js";export{ListItemLinkButton}from"./ui/ListItemLinkButton/ListItemLinkButton.js";export{default as NoResults}from"./ui/NoResults/NoResults.js";export{default as SearchIcon}from"@mui/icons-material/Search";export{default as CalendarTodayIcon}from"@mui/icons-material/CalendarToday";export{default as AccessTimeIcon}from"@mui/icons-material/AccessTime";export{default as DoneIcon}from"@mui/icons-material/Done";export{default as useRenderValidText}from"./custom-hooks/useRenderValidText.js";export{default as useMicroFrontendAttributes}from"./custom-hooks/useMicroFrontendAttributes.js";export{getAppId,getBrandId,getIsFlipdishStaff,getMicroFrontendAttribute,getOrgId,lazyWithRetry}from"./renderUtilities/renderUtilities.js";export{debounce}from"./genericUtilities/index.js";
|
|
1
|
+
export{default as flipdishPublicTheme}from"./themes/flipdishPublicTheme.js";export{default as NotFoundPage}from"./ui/NotFoundPage/NotFoundPage.js";export{default as FlipdishStaffContainer}from"./ui/FlipdishStaffContainer/FlipdishStaffContainer.js";export{default as PageLayout}from"./ui/PageLayout/PageLayout.js";export{default as PortalMock}from"./ui/PortalMock/PortalMock.js";export{default as LazyComponent}from"./ui/LazyComponent/LazyComponent.js";export{default as Spacer}from"./ui/Spacer/Spacer.js";export{default as Chip}from"./ui/Chip/Chip.js";export{default as Switch}from"./ui/Switch/Switch.js";export{default as Tooltip}from"./ui/Tooltip/Tooltip.js";export{formikValidate}from"./ui/Form/utilities/formValidation.js";export{default as GenericAutocompleteField}from"./ui/Form/GenericAutocompleteField.js";export{default as GenericFormContainer}from"./ui/Form/GenericFormContainer.js";export{default as GenericTextField}from"./ui/Form/GenericTextField.js";export{default as PaginatedAutocompleteField}from"./ui/Form/PaginatedAutocompleteField.js";export{default as FlipdishLogoLoader}from"./ui/FlipdishLogoLoader/FlipdishLogoLoader.js";export{default as GenericDatePickerField}from"./ui/GenericDatePickerField/GenericDatePickerField.js";export{default as GenericDateTimePickerField}from"./ui/GenericDateTimePickerField/GenericDateTimePickerField.js";export{default as GenericRadioButtons}from"./ui/GenericRadioButtons/GenericRadioButtons.js";export{default as DateTimeLocalizationProvider}from"./ui/DateTimeLocalizationProvider/DateTimeLocalizationProvider.js";export{default as GenericTable}from"./ui/GenericTable/GenericTable.js";export{default as GenericTableBody}from"./ui/GenericTableBody/GenericTableBody.js";export{default as GenericTableBodyRow}from"./ui/GenericTableBodyRow/GenericTableBodyRow.js";export{default as GenericTableTitle}from"./ui/GenericTableTitle/GenericTableTitle.js";export{default as ListItemLink}from"./ui/ListItemLink/ListItemLink.js";export{ListItemLinkButton}from"./ui/ListItemLinkButton/ListItemLinkButton.js";export{default as NoResults}from"./ui/NoResults/NoResults.js";export{default as SearchIcon}from"@mui/icons-material/Search";export{default as CalendarTodayIcon}from"@mui/icons-material/CalendarToday";export{default as AccessTimeIcon}from"@mui/icons-material/AccessTime";export{default as DoneIcon}from"@mui/icons-material/Done";export{default as useRenderValidText}from"./custom-hooks/useRenderValidText.js";export{default as useMicroFrontendAttributes}from"./custom-hooks/useMicroFrontendAttributes.js";export{getAppId,getBrandId,getIsFlipdishStaff,getMicroFrontendAttribute,getOrgId,lazyWithRetry}from"./renderUtilities/renderUtilities.js";export{debounce}from"./genericUtilities/index.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react");const t=e=>{const t=document.getElementById("flipdish-micro-frontend");return t
|
|
1
|
+
"use strict";var e=require("react");const t=e=>{const t=document.getElementById("flipdish-micro-frontend");return t?.getAttribute(e)};exports.getAppId=()=>(void 0).VITE_APPID_OVERRIDE||t("data-appId"),exports.getBrandId=()=>(void 0).VITE_BRANDID_OVERRIDE||t("data-brandId"),exports.getIsFlipdishStaff=()=>{const e=(void 0).VITE_ISFLIPDISHSTAFFOVERRIDE||t("data-isFlipdishStaff");return"true"===e?.toString()},exports.getMicroFrontendAttribute=t,exports.getOrgId=()=>(void 0).VITE_ORGID_OVERRIDE||t("data-orgId"),exports.lazyWithRetry=t=>e.lazy((async()=>{const e=JSON.parse(window.sessionStorage.getItem("page-has-been-force-refreshed")||"false");try{const e=await t();return window.sessionStorage.setItem("page-has-been-force-refreshed","false"),e}catch(t){if(!e)return window.sessionStorage.setItem("page-has-been-force-refreshed","true"),window.location.reload();throw t}}));
|
|
2
2
|
//# sourceMappingURL=renderUtilities.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUtilities.cjs.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv
|
|
1
|
+
{"version":3,"file":"renderUtilities.cjs.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv?.getAttribute(key);\n};\n\n/**\n * Retrieves the AppId.\n *\n * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-appId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\n/**\n * Retrieves the OrgId.\n *\n * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-orgId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\n/**\n * Retrieves the BrandId.\n *\n * Attempts to get the value from the environment variable `VITE_BRANDID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-brandId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getBrandId = (): string | null => {\n return import.meta.env.VITE_BRANDID_OVERRIDE || getMicroFrontendAttribute('data-brandId');\n};\n\n/**\n * Retrieves the isFlipdishStaff attribute.\n *\n * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-isFlipdishStaff`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","undefined","VITE_APPID_OVERRIDE","VITE_BRANDID_OVERRIDE","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","VITE_ORGID_OVERRIDE","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"oCAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAkBG,aAAaJ,EAAI,mBAWtB,UACbK,GAAgBC,qBAAuBP,EAA0B,iCAuBlD,UACfM,GAAgBE,uBAAyBR,EAA0B,2CAW5C,KAC9B,MAAMS,QAAcH,GAAgBI,8BAAgCV,EAA0B,wBAC9F,MAAmC,SAA5BS,GAAaE,UAAqB,uDA1BrB,UACbL,GAAgBM,qBAAuBZ,EAA0B,oCA6B9Ca,GAC1BC,EAAAA,MAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{lazy as e}from"react";const t=e=>{const t=document.getElementById("flipdish-micro-frontend");return t
|
|
1
|
+
import{lazy as e}from"react";const t=e=>{const t=document.getElementById("flipdish-micro-frontend");return t?.getAttribute(e)},r=()=>import.meta.env.VITE_APPID_OVERRIDE||t("data-appId"),a=()=>import.meta.env.VITE_ORGID_OVERRIDE||t("data-orgId"),o=()=>import.meta.env.VITE_BRANDID_OVERRIDE||t("data-brandId"),n=()=>{const e=import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE||t("data-isFlipdishStaff");return"true"===e?.toString()},s=t=>e((async()=>{const e=JSON.parse(window.sessionStorage.getItem("page-has-been-force-refreshed")||"false");try{const e=await t();return window.sessionStorage.setItem("page-has-been-force-refreshed","false"),e}catch(t){if(!e)return window.sessionStorage.setItem("page-has-been-force-refreshed","true"),window.location.reload();throw t}}));export{r as getAppId,o as getBrandId,n as getIsFlipdishStaff,t as getMicroFrontendAttribute,a as getOrgId,s as lazyWithRetry};
|
|
2
2
|
//# sourceMappingURL=renderUtilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderUtilities.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv
|
|
1
|
+
{"version":3,"file":"renderUtilities.js","sources":["../../../src/components/renderUtilities/renderUtilities.ts"],"sourcesContent":["import { lazy } from 'react';\n\nexport const getMicroFrontendAttribute = (key: string): string | null => {\n const microFrontendDiv = document.getElementById('flipdish-micro-frontend');\n return microFrontendDiv?.getAttribute(key);\n};\n\n/**\n * Retrieves the AppId.\n *\n * Attempts to get the value from the environment variable `VITE_APPID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-appId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getAppId = (): string | null => {\n return import.meta.env.VITE_APPID_OVERRIDE || getMicroFrontendAttribute('data-appId');\n};\n\n/**\n * Retrieves the OrgId.\n *\n * Attempts to get the value from the environment variable `VITE_ORGID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-orgId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getOrgId = (): string | null => {\n return import.meta.env.VITE_ORGID_OVERRIDE || getMicroFrontendAttribute('data-orgId');\n};\n\n/**\n * Retrieves the BrandId.\n *\n * Attempts to get the value from the environment variable `VITE_BRANDID_OVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-brandId`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getBrandId = (): string | null => {\n return import.meta.env.VITE_BRANDID_OVERRIDE || getMicroFrontendAttribute('data-brandId');\n};\n\n/**\n * Retrieves the isFlipdishStaff attribute.\n *\n * Attempts to get the value from the environment variable `VITE_ISFLIPDISHSTAFFOVERRIDE`.\n * If the environment variable is not set, it falls back to retrieving from a micro frontend attribute `data-isFlipdishStaff`.\n *\n * @warning Your component will not re-render if the value changes. Use 'useMicroFrontendAttributes' custom hook instead if you care about reactivity.\n */\nexport const getIsFlipdishStaff = (): boolean => {\n const stringValue = import.meta.env.VITE_ISFLIPDISHSTAFFOVERRIDE || getMicroFrontendAttribute('data-isFlipdishStaff');\n return stringValue?.toString() === 'true';\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const lazyWithRetry = (componentImport: () => any) =>\n lazy(async () => {\n const pageHasAlreadyBeenForceRefreshed = JSON.parse(window.sessionStorage.getItem('page-has-been-force-refreshed') || 'false');\n\n try {\n const component = await componentImport();\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'false');\n\n return component;\n } catch (error) {\n if (!pageHasAlreadyBeenForceRefreshed) {\n // Assuming that the user is not on the latest version of the application.\n // Let's refresh the page immediately.\n window.sessionStorage.setItem('page-has-been-force-refreshed', 'true');\n return window.location.reload();\n }\n\n // The page has already been reloaded\n // Assuming that user is already using the latest version of the application.\n // Let's let the application crash and raise the error.\n throw error;\n }\n });\n"],"names":["getMicroFrontendAttribute","key","microFrontendDiv","document","getElementById","getAttribute","getAppId","env","VITE_APPID_OVERRIDE","getOrgId","VITE_ORGID_OVERRIDE","getBrandId","VITE_BRANDID_OVERRIDE","getIsFlipdishStaff","stringValue","VITE_ISFLIPDISHSTAFFOVERRIDE","toString","lazyWithRetry","componentImport","lazy","async","pageHasAlreadyBeenForceRefreshed","JSON","parse","window","sessionStorage","getItem","component","setItem","error","location","reload"],"mappings":"6BAEa,MAAAA,EAA6BC,IACtC,MAAMC,EAAmBC,SAASC,eAAe,2BACjD,OAAOF,GAAkBG,aAAaJ,EAAI,EAWjCK,EAAW,gBACDC,IAAIC,qBAAuBR,EAA0B,cAW/DS,EAAW,gBACDF,IAAIG,qBAAuBV,EAA0B,cAW/DW,EAAa,gBACHJ,IAAIK,uBAAyBZ,EAA0B,gBAWjEa,EAAqB,KAC9B,MAAMC,cAA0BP,IAAIQ,8BAAgCf,EAA0B,wBAC9F,MAAmC,SAA5Bc,GAAaE,UAAqB,EAIhCC,EAAiBC,GAC1BC,GAAKC,UACD,MAAMC,EAAmCC,KAAKC,MAAMC,OAAOC,eAAeC,QAAQ,kCAAoC,SAEtH,IACI,MAAMC,QAAkBT,IAGxB,OAFAM,OAAOC,eAAeG,QAAQ,gCAAiC,SAExDD,CACV,CAAC,MAAOE,GACL,IAAKR,EAID,OADAG,OAAOC,eAAeG,QAAQ,gCAAiC,QACxDJ,OAAOM,SAASC,SAM3B,MAAMF,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=require("react/jsx-runtime"),e=require("react-error-boundary"),t=require("../../../providers/TranslationProvider.cjs.js");require("react");const n=require("@mui/material/styles").styled("div")((({theme:r})=>({marginTop:r.spacing(2),display:"flex",justifyContent:"center",alignItems:"center"})))
|
|
1
|
+
"use strict";var r=require("react/jsx-runtime"),e=require("react-error-boundary"),t=require("../../../providers/TranslationProvider.cjs.js");require("react");const n=require("@mui/material/styles").styled("div")((({theme:r})=>({marginTop:r.spacing(2),display:"flex",justifyContent:"center",alignItems:"center"}))),s=()=>{const{translate:e}=t.useTranslation();return r.jsx(n,{children:e("Something_went_wrong_please_refresh_the_page")})};module.exports=({identifier:t,children:n})=>r.jsx(e.ErrorBoundary,{FallbackComponent:s,onError:(r,e)=>{window.fdlogger?.error(`${t?.toString()} Error Boundary`,{message:r?.message,stack:e})},children:n});
|
|
2
2
|
//# sourceMappingURL=FDErrorBoundary.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FDErrorBoundary.cjs.js","sources":["../../../../src/components/ui/FDErrorBoundary/FDErrorBoundary.tsx"],"sourcesContent":["import { ErrorBoundary } from 'react-error-boundary';\nimport { useTranslation } from '../../../providers/TranslationProvider';\nimport { type ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nconst StyledTextContainer = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}));\nconst FDErrorBoundary = ({ identifier, children }: { identifier: string; children: ReactNode }) => {\n
|
|
1
|
+
{"version":3,"file":"FDErrorBoundary.cjs.js","sources":["../../../../src/components/ui/FDErrorBoundary/FDErrorBoundary.tsx"],"sourcesContent":["import { ErrorBoundary } from 'react-error-boundary';\nimport { useTranslation } from '../../../providers/TranslationProvider';\nimport { type ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nconst StyledTextContainer = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}));\n\nconst FallbackComponent = () => {\n const { translate } = useTranslation();\n return <StyledTextContainer>{translate('Something_went_wrong_please_refresh_the_page')}</StyledTextContainer>;\n};\n\nconst FDErrorBoundary = ({ identifier, children }: { identifier: string; children: ReactNode }) => {\n return (\n <ErrorBoundary\n FallbackComponent={FallbackComponent}\n onError={(error, info) => {\n window.fdlogger?.error(`${identifier?.toString()} Error Boundary`, {\n message: error?.message,\n stack: info,\n });\n }}\n >\n {children}\n </ErrorBoundary>\n );\n};\n\nexport default FDErrorBoundary;\n"],"names":["StyledTextContainer","styled","theme","marginTop","spacing","display","justifyContent","alignItems","FallbackComponent","translate","useTranslation","_jsx","children","identifier","jsx","ErrorBoundary","onError","error","info","window","fdlogger","toString","message","stack"],"mappings":"8JAKA,MAAMA,kCAAsBC,OAAO,MAAPA,EAAc,EAAGC,YAAa,CACtDC,UAAWD,EAAME,QAAQ,GACzBC,QAAS,OACTC,eAAgB,SAChBC,WAAY,aAGVC,EAAoB,KACtB,MAAMC,UAAEA,GAAcC,EAAAA,iBACtB,OAAOC,EAAAA,IAACX,EAAqB,CAAAY,SAAAH,EAAU,iDAAsE,iBAGzF,EAAGI,aAAYD,cAE/BD,EAAAG,IAACC,EAAaA,cAAA,CACVP,kBAAmBA,EACnBQ,QAAS,CAACC,EAAOC,KACbC,OAAOC,UAAUH,MAAM,GAAGJ,GAAYQ,4BAA6B,CAC/DC,QAASL,GAAOK,QAChBC,MAAOL,GACT,EAGLN,SAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{ErrorBoundary as e}from"react-error-boundary";import{useTranslation as t}from"../../../providers/TranslationProvider.js";import"react";import{styled as o}from"@mui/material/styles";const n=o("div")((({theme:r})=>({marginTop:r.spacing(2),display:"flex",justifyContent:"center",alignItems:"center"}))),i=(
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{ErrorBoundary as e}from"react-error-boundary";import{useTranslation as t}from"../../../providers/TranslationProvider.js";import"react";import{styled as o}from"@mui/material/styles";const n=o("div")((({theme:r})=>({marginTop:r.spacing(2),display:"flex",justifyContent:"center",alignItems:"center"}))),i=()=>{const{translate:e}=t();return r(n,{children:e("Something_went_wrong_please_refresh_the_page")})},a=({identifier:t,children:o})=>r(e,{FallbackComponent:i,onError:(r,e)=>{window.fdlogger?.error(`${t?.toString()} Error Boundary`,{message:r?.message,stack:e})},children:o});export{a as default};
|
|
2
2
|
//# sourceMappingURL=FDErrorBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FDErrorBoundary.js","sources":["../../../../src/components/ui/FDErrorBoundary/FDErrorBoundary.tsx"],"sourcesContent":["import { ErrorBoundary } from 'react-error-boundary';\nimport { useTranslation } from '../../../providers/TranslationProvider';\nimport { type ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nconst StyledTextContainer = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}));\nconst FDErrorBoundary = ({ identifier, children }: { identifier: string; children: ReactNode }) => {\n
|
|
1
|
+
{"version":3,"file":"FDErrorBoundary.js","sources":["../../../../src/components/ui/FDErrorBoundary/FDErrorBoundary.tsx"],"sourcesContent":["import { ErrorBoundary } from 'react-error-boundary';\nimport { useTranslation } from '../../../providers/TranslationProvider';\nimport { type ReactNode } from 'react';\nimport { styled } from '@mui/material/styles';\n\nconst StyledTextContainer = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n}));\n\nconst FallbackComponent = () => {\n const { translate } = useTranslation();\n return <StyledTextContainer>{translate('Something_went_wrong_please_refresh_the_page')}</StyledTextContainer>;\n};\n\nconst FDErrorBoundary = ({ identifier, children }: { identifier: string; children: ReactNode }) => {\n return (\n <ErrorBoundary\n FallbackComponent={FallbackComponent}\n onError={(error, info) => {\n window.fdlogger?.error(`${identifier?.toString()} Error Boundary`, {\n message: error?.message,\n stack: info,\n });\n }}\n >\n {children}\n </ErrorBoundary>\n );\n};\n\nexport default FDErrorBoundary;\n"],"names":["StyledTextContainer","styled","theme","marginTop","spacing","display","justifyContent","alignItems","FallbackComponent","translate","useTranslation","_jsx","children","FDErrorBoundary","identifier","ErrorBoundary","onError","error","info","window","fdlogger","toString","message","stack"],"mappings":"oOAKA,MAAMA,EAAsBC,EAAO,MAAPA,EAAc,EAAGC,YAAa,CACtDC,UAAWD,EAAME,QAAQ,GACzBC,QAAS,OACTC,eAAgB,SAChBC,WAAY,aAGVC,EAAoB,KACtB,MAAMC,UAAEA,GAAcC,IACtB,OAAOC,EAACX,EAAqB,CAAAY,SAAAH,EAAU,iDAAsE,EAG3GI,EAAkB,EAAGC,aAAYF,cAE/BD,EAACI,EAAa,CACVP,kBAAmBA,EACnBQ,QAAS,CAACC,EAAOC,KACbC,OAAOC,UAAUH,MAAM,GAAGH,GAAYO,4BAA6B,CAC/DC,QAASL,GAAOK,QAChBC,MAAOL,GACT,EAGLN,SAAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("@mui/material/styles"),i=require("../../../assets/images/fd-loader.gif.cjs.js"),r=require("@mui/material/Typography");const l=t.styled("div")((({theme:e,fullscreen:t})=>({display:"flex",alignItems:"center",justifyContent:"center",background:e.palette.white.main,flexDirection:"column",...t&&{width:"100vw",height:"100vh",position:"absolute",top:0,left:0}}))),a=t.styled("div")((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"160px",height:"160px",borderRadius:"80px",background:e.palette.white.main,boxShadow:"0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)",marginBottom:"32px"}))),s=t.styled("img")({height:"96px",width:"96px"}),n=t.styled(r)((({theme:e})=>({color:e.palette.flippyBlue.dark,lineHeight:"1.2",marginBottom:"4px"}))),o=t.styled(r)({fontSize:"20px",color:"rgba(0, 0, 0, 0.54)",lineHeight:"1.4",letterSpacing:"normal"});module.exports=({headline:t,subHeadline:r,fullscreen:d=!1})=>e.jsxs(l,{fullscreen:d,"data-testid":"FlipdishLogoLoader",children:[e.jsx(a,{children:e.jsx(s,{src:i,alt:"Flipdish Logo Loader"})}),e.jsx(n,{variant:"h2",children:t}),r&&e.jsx(o,{children:r})]});
|
|
2
|
+
//# sourceMappingURL=FlipdishLogoLoader.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlipdishLogoLoader.cjs.js","sources":["../../../../src/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport FdLoader from '../../../assets/images/fd-loader.gif';\nimport Typography from '@mui/material/Typography';\n\nconst StyledContainer = styled('div')<{ fullscreen?: boolean }>(({ theme, fullscreen }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: theme.palette.white.main,\n flexDirection: 'column',\n ...(fullscreen && {\n width: '100vw',\n height: '100vh',\n position: 'absolute',\n top: 0,\n left: 0,\n }),\n}));\n\nconst ImageContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '160px',\n height: '160px',\n borderRadius: '80px',\n background: theme.palette.white.main,\n boxShadow: '0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)',\n marginBottom: '32px',\n}));\n\nconst StyledImage = styled('img')({\n height: '96px',\n width: '96px',\n});\n\nconst StyledHeadline = styled(Typography)(({ theme }) => ({\n color: theme.palette.flippyBlue.dark,\n lineHeight: '1.2',\n marginBottom: '4px',\n}));\n\nconst StyledSubHeadline = styled(Typography)({\n fontSize: '20px',\n color: 'rgba(0, 0, 0, 0.54)',\n lineHeight: '1.4',\n letterSpacing: 'normal',\n});\n\ntype FlipdishLogoLoaderProps = {\n headline: string;\n subHeadline?: string;\n fullscreen?: boolean;\n};\n\nconst FlipdishLogoLoader = ({ headline, subHeadline, fullscreen = false }: FlipdishLogoLoaderProps) => {\n return (\n <StyledContainer fullscreen={fullscreen} data-testid=\"FlipdishLogoLoader\">\n <ImageContainer>\n <StyledImage src={FdLoader} alt=\"Flipdish Logo Loader\" />\n </ImageContainer>\n <StyledHeadline variant=\"h2\">{headline}</StyledHeadline>\n {subHeadline && <StyledSubHeadline>{subHeadline}</StyledSubHeadline>}\n </StyledContainer>\n );\n};\n\nexport default FlipdishLogoLoader;\n"],"names":["StyledContainer","styled","theme","fullscreen","display","alignItems","justifyContent","background","palette","white","main","flexDirection","width","height","position","top","left","ImageContainer","borderRadius","boxShadow","marginBottom","StyledImage","StyledHeadline","Typography","color","flippyBlue","dark","lineHeight","StyledSubHeadline","fontSize","letterSpacing","headline","subHeadline","_jsxs","children","_jsx","src","FdLoader","alt","variant","jsx"],"mappings":"iLAIA,MAAMA,EAAkBC,EAAMA,OAAC,MAAPA,EAAwC,EAAGC,QAAOC,iBAAkB,CACxFC,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBC,WAAYL,EAAMM,QAAQC,MAAMC,KAChCC,cAAe,YACXR,GAAc,CACdS,MAAO,QACPC,OAAQ,QACRC,SAAU,WACVC,IAAK,EACLC,KAAM,OAIRC,EAAiBhB,EAAAA,OAAO,MAAPA,EAAc,EAAGC,YAAa,CACjDE,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBM,MAAO,QACPC,OAAQ,QACRK,aAAc,OACdX,WAAYL,EAAMM,QAAQC,MAAMC,KAChCS,UAAW,4GACXC,aAAc,WAGZC,EAAcpB,EAAAA,OAAO,MAAPA,CAAc,CAC9BY,OAAQ,OACRD,MAAO,SAGLU,EAAiBrB,EAAAA,OAAOsB,EAAPtB,EAAmB,EAAGC,YAAa,CACtDsB,MAAOtB,EAAMM,QAAQiB,WAAWC,KAChCC,WAAY,MACZP,aAAc,UAGZQ,EAAoB3B,EAAAA,OAAOsB,EAAPtB,CAAmB,CACzC4B,SAAU,OACVL,MAAO,sBACPG,WAAY,MACZG,cAAe,0BASQ,EAAGC,WAAUC,cAAa7B,cAAa,KAE1D8B,EAAAA,KAACjC,EAAe,CAACG,WAAYA,gBAAwB,qBAAoB+B,SAAA,CACrEC,EAAAA,IAAClB,EAAc,CAAAiB,SACXC,EAAAA,IAACd,EAAW,CAACe,IAAKC,EAAUC,IAAI,2BAEpCH,MAACb,GAAeiB,QAAQ,KAAML,SAAAH,IAC7BC,GAAeG,EAACK,IAAAZ,YAAmBI"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type FlipdishLogoLoaderProps = {
|
|
4
|
+
headline: string;
|
|
5
|
+
subHeadline?: string;
|
|
6
|
+
fullscreen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const FlipdishLogoLoader: ({ headline, subHeadline, fullscreen }: FlipdishLogoLoaderProps) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { FlipdishLogoLoader as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{styled as i}from"@mui/material/styles";import r from"../../../assets/images/fd-loader.gif.js";import a from"@mui/material/Typography";const l=i("div")((({theme:e,fullscreen:t})=>({display:"flex",alignItems:"center",justifyContent:"center",background:e.palette.white.main,flexDirection:"column",...t&&{width:"100vw",height:"100vh",position:"absolute",top:0,left:0}}))),o=i("div")((({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:"160px",height:"160px",borderRadius:"80px",background:e.palette.white.main,boxShadow:"0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)",marginBottom:"32px"}))),n=i("img")({height:"96px",width:"96px"}),p=i(a)((({theme:e})=>({color:e.palette.flippyBlue.dark,lineHeight:"1.2",marginBottom:"4px"}))),d=i(a)({fontSize:"20px",color:"rgba(0, 0, 0, 0.54)",lineHeight:"1.4",letterSpacing:"normal"}),m=({headline:i,subHeadline:a,fullscreen:m=!1})=>e(l,{fullscreen:m,"data-testid":"FlipdishLogoLoader",children:[t(o,{children:t(n,{src:r,alt:"Flipdish Logo Loader"})}),t(p,{variant:"h2",children:i}),a&&t(d,{children:a})]});export{m as default};
|
|
2
|
+
//# sourceMappingURL=FlipdishLogoLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlipdishLogoLoader.js","sources":["../../../../src/components/ui/FlipdishLogoLoader/FlipdishLogoLoader.tsx"],"sourcesContent":["import { styled } from '@mui/material/styles';\nimport FdLoader from '../../../assets/images/fd-loader.gif';\nimport Typography from '@mui/material/Typography';\n\nconst StyledContainer = styled('div')<{ fullscreen?: boolean }>(({ theme, fullscreen }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n background: theme.palette.white.main,\n flexDirection: 'column',\n ...(fullscreen && {\n width: '100vw',\n height: '100vh',\n position: 'absolute',\n top: 0,\n left: 0,\n }),\n}));\n\nconst ImageContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '160px',\n height: '160px',\n borderRadius: '80px',\n background: theme.palette.white.main,\n boxShadow: '0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 8px 10px 1px rgba(0, 0, 0, 0.14)',\n marginBottom: '32px',\n}));\n\nconst StyledImage = styled('img')({\n height: '96px',\n width: '96px',\n});\n\nconst StyledHeadline = styled(Typography)(({ theme }) => ({\n color: theme.palette.flippyBlue.dark,\n lineHeight: '1.2',\n marginBottom: '4px',\n}));\n\nconst StyledSubHeadline = styled(Typography)({\n fontSize: '20px',\n color: 'rgba(0, 0, 0, 0.54)',\n lineHeight: '1.4',\n letterSpacing: 'normal',\n});\n\ntype FlipdishLogoLoaderProps = {\n headline: string;\n subHeadline?: string;\n fullscreen?: boolean;\n};\n\nconst FlipdishLogoLoader = ({ headline, subHeadline, fullscreen = false }: FlipdishLogoLoaderProps) => {\n return (\n <StyledContainer fullscreen={fullscreen} data-testid=\"FlipdishLogoLoader\">\n <ImageContainer>\n <StyledImage src={FdLoader} alt=\"Flipdish Logo Loader\" />\n </ImageContainer>\n <StyledHeadline variant=\"h2\">{headline}</StyledHeadline>\n {subHeadline && <StyledSubHeadline>{subHeadline}</StyledSubHeadline>}\n </StyledContainer>\n );\n};\n\nexport default FlipdishLogoLoader;\n"],"names":["StyledContainer","styled","theme","fullscreen","display","alignItems","justifyContent","background","palette","white","main","flexDirection","width","height","position","top","left","ImageContainer","borderRadius","boxShadow","marginBottom","StyledImage","StyledHeadline","Typography","color","flippyBlue","dark","lineHeight","StyledSubHeadline","fontSize","letterSpacing","FlipdishLogoLoader","headline","subHeadline","_jsxs","children","_jsx","src","FdLoader","alt","variant"],"mappings":"+LAIA,MAAMA,EAAkBC,EAAO,MAAPA,EAAwC,EAAGC,QAAOC,iBAAkB,CACxFC,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBC,WAAYL,EAAMM,QAAQC,MAAMC,KAChCC,cAAe,YACXR,GAAc,CACdS,MAAO,QACPC,OAAQ,QACRC,SAAU,WACVC,IAAK,EACLC,KAAM,OAIRC,EAAiBhB,EAAO,MAAPA,EAAc,EAAGC,YAAa,CACjDE,QAAS,OACTC,WAAY,SACZC,eAAgB,SAChBM,MAAO,QACPC,OAAQ,QACRK,aAAc,OACdX,WAAYL,EAAMM,QAAQC,MAAMC,KAChCS,UAAW,4GACXC,aAAc,WAGZC,EAAcpB,EAAO,MAAPA,CAAc,CAC9BY,OAAQ,OACRD,MAAO,SAGLU,EAAiBrB,EAAOsB,EAAPtB,EAAmB,EAAGC,YAAa,CACtDsB,MAAOtB,EAAMM,QAAQiB,WAAWC,KAChCC,WAAY,MACZP,aAAc,UAGZQ,EAAoB3B,EAAOsB,EAAPtB,CAAmB,CACzC4B,SAAU,OACVL,MAAO,sBACPG,WAAY,MACZG,cAAe,WASbC,EAAqB,EAAGC,WAAUC,cAAa9B,cAAa,KAE1D+B,EAAClC,EAAe,CAACG,WAAYA,gBAAwB,qBAAoBgC,SAAA,CACrEC,EAACnB,EAAc,CAAAkB,SACXC,EAACf,EAAW,CAACgB,IAAKC,EAAUC,IAAI,2BAEpCH,EAACd,GAAekB,QAAQ,KAAML,SAAAH,IAC7BC,GAAeG,EAACR,YAAmBK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormItemLayout.cjs.js","sources":["../../../../src/components/ui/Form/FormItemLayout.tsx"],"sourcesContent":["import React from 'react';\n\nimport Grid, { type GridSize } from '@mui/material/Grid';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nconst StyledGrid = styled(Grid)(({ theme }) => ({\n padding: theme.spacing(4.75, 0, 2.5, 0),\n alignItems: 'flex-start',\n flexWrap: 'wrap',\n borderBottom: '1px solid rgba(0,0,0,0.2)',\n}));\n\nconst StyledDescription = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n paddingRight: theme.spacing(1.75),\n}));\n\nexport interface FormItemLayoutProps {\n
|
|
1
|
+
{"version":3,"file":"FormItemLayout.cjs.js","sources":["../../../../src/components/ui/Form/FormItemLayout.tsx"],"sourcesContent":["import React from 'react';\n\nimport Grid, { type GridSize } from '@mui/material/Grid';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nconst StyledGrid = styled(Grid)(({ theme }) => ({\n padding: theme.spacing(4.75, 0, 2.5, 0),\n alignItems: 'flex-start',\n flexWrap: 'wrap',\n borderBottom: '1px solid rgba(0,0,0,0.2)',\n}));\n\nconst StyledDescription = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n paddingRight: theme.spacing(1.75),\n}));\n\nexport interface FormItemLayoutProps {\n children: React.ReactNode;\n description?: React.ReactNode;\n descriptionTranslated?: string;\n label?: React.ReactNode;\n labelTranslated?: string;\n mdProportion?: '4x8' | '8x4' | '10x2' | '12x12';\n smProportion?: '4x8' | '8x4' | '10x2' | '12x12';\n}\n\ntype Props = FormItemLayoutProps;\nconst FormItemLayout = (props: Props) => {\n const { children, description, descriptionTranslated, label, labelTranslated, mdProportion, smProportion } = props;\n\n const [titleProportion, dataProportion] = mdProportion ? mdProportion.split('x').map((m) => parseInt(m, 10)) : [4, 8];\n const [titleProportionSm, dataProportionSm] = smProportion ? smProportion.split('x').map((m) => parseInt(m, 10)) : [];\n const castToGridSize = (data: unknown) => data as GridSize;\n\n return (\n <StyledGrid container>\n <Grid item xs={12} sm={castToGridSize(titleProportionSm)} md={castToGridSize(titleProportion)}>\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {labelTranslated || label || null}\n </Typography>\n\n {descriptionTranslated || description ? (\n <StyledDescription>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {descriptionTranslated || description || null}\n </Typography>\n </StyledDescription>\n ) : null}\n </Grid>\n <Grid item xs={12} sm={castToGridSize(dataProportionSm)} md={castToGridSize(dataProportion)}>\n {children}\n </Grid>\n </StyledGrid>\n );\n};\n\nexport default FormItemLayout;\n"],"names":["StyledGrid","styled","Grid","theme","padding","spacing","alignItems","flexWrap","borderBottom","StyledDescription","paddingBottom","paddingRight","props","children","description","descriptionTranslated","label","labelTranslated","mdProportion","smProportion","titleProportion","dataProportion","split","map","m","parseInt","titleProportionSm","dataProportionSm","_jsxs","container","item","xs","sm","md","_jsx","Typography","variant","component","color"],"mappings":"6KAMA,MAAMA,EAAaC,EAAAA,OAAOC,EAAPD,EAAa,EAAGE,YAAa,CAC5CC,QAASD,EAAME,QAAQ,KAAM,EAAG,IAAK,GACrCC,WAAY,aACZC,SAAU,OACVC,aAAc,gCAGZC,EAAoBR,EAAAA,OAAO,MAAPA,EAAc,EAAGE,YAAa,CACpDO,cAAeP,EAAME,QAAQ,GAC7BM,aAAcR,EAAME,QAAQ,yBAcRO,IACpB,MAAMC,SAAEA,EAAQC,YAAEA,EAAWC,sBAAEA,EAAqBC,MAAEA,EAAKC,gBAAEA,EAAeC,aAAEA,EAAYC,aAAEA,GAAiBP,GAEtGQ,EAAiBC,GAAkBH,EAAeA,EAAaI,MAAM,KAAKC,KAAKC,GAAMC,SAASD,EAAG,MAAO,CAAC,EAAG,IAC5GE,EAAmBC,GAAoBR,EAAeA,EAAaG,MAAM,KAAKC,KAAKC,GAAMC,SAASD,EAAG,MAAO,GAGnH,OACII,EAAAA,KAAC5B,EAAW,CAAA6B,uBACRD,OAAC1B,EAAK,CAAA4B,MAAK,EAAAC,GAAI,GAAIC,GAAmBN,EAAoBO,GAAmBb,EACzEP,SAAA,CAAAqB,EAAAA,IAACC,EAAU,CAACC,QAAQ,YAAYC,UAAU,KAAKC,MAAM,cAAazB,SAC7DI,GAAmBD,GAAS,OAGhCD,GAAyBD,EACtBoB,EAAAA,IAACzB,EAAiB,CAAAI,SACdqB,EAAAA,IAACC,GAAWC,QAAQ,UAAUE,MAAM,gBAC/BzB,SAAAE,GAAyBD,GAAe,SAGjD,QAERoB,EAAAA,IAAChC,EAAK,CAAA4B,MAAK,EAAAC,GAAI,GAAIC,GAAmBL,EAAmBM,GAAmBZ,EAAeR,SACtFA,MAGX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormItemLayout.js","sources":["../../../../src/components/ui/Form/FormItemLayout.tsx"],"sourcesContent":["import React from 'react';\n\nimport Grid, { type GridSize } from '@mui/material/Grid';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nconst StyledGrid = styled(Grid)(({ theme }) => ({\n padding: theme.spacing(4.75, 0, 2.5, 0),\n alignItems: 'flex-start',\n flexWrap: 'wrap',\n borderBottom: '1px solid rgba(0,0,0,0.2)',\n}));\n\nconst StyledDescription = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n paddingRight: theme.spacing(1.75),\n}));\n\nexport interface FormItemLayoutProps {\n
|
|
1
|
+
{"version":3,"file":"FormItemLayout.js","sources":["../../../../src/components/ui/Form/FormItemLayout.tsx"],"sourcesContent":["import React from 'react';\n\nimport Grid, { type GridSize } from '@mui/material/Grid';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\n\nconst StyledGrid = styled(Grid)(({ theme }) => ({\n padding: theme.spacing(4.75, 0, 2.5, 0),\n alignItems: 'flex-start',\n flexWrap: 'wrap',\n borderBottom: '1px solid rgba(0,0,0,0.2)',\n}));\n\nconst StyledDescription = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n paddingRight: theme.spacing(1.75),\n}));\n\nexport interface FormItemLayoutProps {\n children: React.ReactNode;\n description?: React.ReactNode;\n descriptionTranslated?: string;\n label?: React.ReactNode;\n labelTranslated?: string;\n mdProportion?: '4x8' | '8x4' | '10x2' | '12x12';\n smProportion?: '4x8' | '8x4' | '10x2' | '12x12';\n}\n\ntype Props = FormItemLayoutProps;\nconst FormItemLayout = (props: Props) => {\n const { children, description, descriptionTranslated, label, labelTranslated, mdProportion, smProportion } = props;\n\n const [titleProportion, dataProportion] = mdProportion ? mdProportion.split('x').map((m) => parseInt(m, 10)) : [4, 8];\n const [titleProportionSm, dataProportionSm] = smProportion ? smProportion.split('x').map((m) => parseInt(m, 10)) : [];\n const castToGridSize = (data: unknown) => data as GridSize;\n\n return (\n <StyledGrid container>\n <Grid item xs={12} sm={castToGridSize(titleProportionSm)} md={castToGridSize(titleProportion)}>\n <Typography variant=\"subtitle1\" component=\"h3\" color=\"textPrimary\">\n {labelTranslated || label || null}\n </Typography>\n\n {descriptionTranslated || description ? (\n <StyledDescription>\n <Typography variant=\"caption\" color=\"textSecondary\">\n {descriptionTranslated || description || null}\n </Typography>\n </StyledDescription>\n ) : null}\n </Grid>\n <Grid item xs={12} sm={castToGridSize(dataProportionSm)} md={castToGridSize(dataProportion)}>\n {children}\n </Grid>\n </StyledGrid>\n );\n};\n\nexport default FormItemLayout;\n"],"names":["StyledGrid","styled","Grid","theme","padding","spacing","alignItems","flexWrap","borderBottom","StyledDescription","paddingBottom","paddingRight","FormItemLayout","props","children","description","descriptionTranslated","label","labelTranslated","mdProportion","smProportion","titleProportion","dataProportion","split","map","m","parseInt","titleProportionSm","dataProportionSm","_jsxs","container","item","xs","sm","md","_jsx","Typography","variant","component","color"],"mappings":"wLAMA,MAAMA,EAAaC,EAAOC,EAAPD,EAAa,EAAGE,YAAa,CAC5CC,QAASD,EAAME,QAAQ,KAAM,EAAG,IAAK,GACrCC,WAAY,aACZC,SAAU,OACVC,aAAc,gCAGZC,EAAoBR,EAAO,MAAPA,EAAc,EAAGE,YAAa,CACpDO,cAAeP,EAAME,QAAQ,GAC7BM,aAAcR,EAAME,QAAQ,UAc1BO,EAAkBC,IACpB,MAAMC,SAAEA,EAAQC,YAAEA,EAAWC,sBAAEA,EAAqBC,MAAEA,EAAKC,gBAAEA,EAAeC,aAAEA,EAAYC,aAAEA,GAAiBP,GAEtGQ,EAAiBC,GAAkBH,EAAeA,EAAaI,MAAM,KAAKC,KAAKC,GAAMC,SAASD,EAAG,MAAO,CAAC,EAAG,IAC5GE,EAAmBC,GAAoBR,EAAeA,EAAaG,MAAM,KAAKC,KAAKC,GAAMC,SAASD,EAAG,MAAO,GAGnH,OACII,EAAC7B,EAAW,CAAA8B,uBACRD,EAAC3B,EAAK,CAAA6B,MAAK,EAAAC,GAAI,GAAIC,GAAmBN,EAAoBO,GAAmBb,EACzEP,SAAA,CAAAqB,EAACC,EAAU,CAACC,QAAQ,YAAYC,UAAU,KAAKC,MAAM,cAAazB,SAC7DI,GAAmBD,GAAS,OAGhCD,GAAyBD,EACtBoB,EAAC1B,EAAiB,CAAAK,SACdqB,EAACC,GAAWC,QAAQ,UAAUE,MAAM,gBAC/BzB,SAAAE,GAAyBD,GAAe,SAGjD,QAERoB,EAACjC,EAAK,CAAA6B,MAAK,EAAAC,GAAI,GAAIC,GAAmBL,EAAmBM,GAAmBZ,EAAeR,SACtFA,MAGX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),l=require("@mui/material/Autocomplete"),i=require("@mui/material/CircularProgress"),r=require("@mui/material/TextField"),t=require("@mui/material/Typography"),a=require("formik");require("react");var o=require("../../custom-hooks/useRenderValidText.cjs.js"),n=require("./FormItemLayout.cjs.js");const u=({field:t,form:a,fieldName:n,options:u,label:d,variant:s,placeholder:p,getOptionLabel:m,isOptionEqualToValue:h,onChange:c,onInputChange:g,onScroll:x,layout:q="horizontal",disabled:v=!1,loading:b=!1,required:j=!1,multiple:T=!1,limitTags:f})=>{const{errors:y,touched:C,isSubmitting:I}=a,O=y[t.name],E=!!O&&C[t.name],F=o({fieldError:O,showError:E,touched:!!C[t.name],value:t.value});return e.jsx(l,{options:u,getOptionLabel:m,isOptionEqualToValue:h,onChange:(e,l)=>{a.setFieldValue(n,l),c&&c(e,l)},onInputChange:g,disabled:I||v,fullWidth:!0,value:t.value||(T?[]:null),loading:b,renderInput:l=>e.jsx(r,{...l,label:"standard"===s?void 0:d,variant:s,"data-testid":`text-field-${n}`,fullWidth:!0,style:{paddingRight:"horizontal"===q?16:0},placeholder:p||void 0,required:j,error:E,helperText:F,slotProps:{input:{...l.InputProps,endAdornment:e.jsxs(e.Fragment,{children:[b&&e.jsx(i,{color:"inherit",size:25}),l.InputProps.endAdornment]})},formHelperText:{children:" ",style:{textAlign:"right"}}}}),multiple:T,limitTags:T?f??2:void 0,slotProps:{listbox:{onScroll:x}}})};module.exports=({label:l,fieldName:i,options:r,placeholder:o,getOptionLabel:d,validation:s,onChange:p,onInputChange:m,isOptionEqualToValue:h,onScroll:c,layout:g="horizontal",variant:x="outlined",disabled:q=!1,loading:v=!1,required:b=!1,multiple:j=!1,limitTags:T})=>{const f=()=>e.jsx(a.Field,{name:i,validate:s,children:t=>e.jsx(u,{...t,fieldName:i,options:r,label:l,variant:x,placeholder:o,getOptionLabel:d,isOptionEqualToValue:h,onChange:p,onInputChange:m,onScroll:c,layout:g,disabled:q,loading:v,required:b,multiple:j,limitTags:T})});return"vertical"===g?e.jsxs(e.Fragment,{children:["standard"===x&&e.jsx(t,{variant:"subtitle1",component:"h3",color:"textPrimary",children:l}),f()]}):e.jsx(n,{label:l,children:f()})};
|
|
2
2
|
//# sourceMappingURL=GenericAutocompleteField.cjs.js.map
|