@dnb/eufemia 10.52.0 → 10.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js +1 -1
  3. package/cjs/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js.map +1 -1
  4. package/cjs/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js +1 -1
  5. package/cjs/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js.map +1 -1
  6. package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +77 -58
  7. package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
  8. package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.d.ts +12 -12
  9. package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js +24 -24
  10. package/cjs/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js.map +1 -1
  11. package/cjs/shared/Eufemia.d.ts +1 -1
  12. package/cjs/shared/Eufemia.js +2 -2
  13. package/cjs/shared/Eufemia.js.map +1 -1
  14. package/cjs/style/core/scopes.scss +1 -1
  15. package/cjs/style/dnb-ui-basis.css +1 -1
  16. package/cjs/style/dnb-ui-basis.min.css +1 -1
  17. package/cjs/style/dnb-ui-body.css +1 -1
  18. package/cjs/style/dnb-ui-body.min.css +1 -1
  19. package/cjs/style/dnb-ui-core.css +1 -1
  20. package/cjs/style/dnb-ui-core.min.css +1 -1
  21. package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js +1 -1
  22. package/es/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js.map +1 -1
  23. package/es/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js +1 -1
  24. package/es/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js.map +1 -1
  25. package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +77 -58
  26. package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
  27. package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.d.ts +12 -12
  28. package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js +24 -24
  29. package/es/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js.map +1 -1
  30. package/es/shared/Eufemia.d.ts +1 -1
  31. package/es/shared/Eufemia.js +2 -2
  32. package/es/shared/Eufemia.js.map +1 -1
  33. package/es/style/core/scopes.scss +1 -1
  34. package/es/style/dnb-ui-basis.css +1 -1
  35. package/es/style/dnb-ui-basis.min.css +1 -1
  36. package/es/style/dnb-ui-body.css +1 -1
  37. package/es/style/dnb-ui-body.min.css +1 -1
  38. package/es/style/dnb-ui-core.css +1 -1
  39. package/es/style/dnb-ui-core.min.css +1 -1
  40. package/esm/dnb-ui-basis.min.mjs +1 -1
  41. package/esm/dnb-ui-components.min.mjs +1 -1
  42. package/esm/dnb-ui-elements.min.mjs +1 -1
  43. package/esm/dnb-ui-extensions.min.mjs +1 -1
  44. package/esm/dnb-ui-lib.min.mjs +1 -1
  45. package/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js +1 -1
  46. package/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.js.map +1 -1
  47. package/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js +1 -1
  48. package/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.js.map +1 -1
  49. package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js +77 -58
  50. package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.js.map +1 -1
  51. package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.d.ts +12 -12
  52. package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js +24 -24
  53. package/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.js.map +1 -1
  54. package/package.json +1 -1
  55. package/shared/Eufemia.d.ts +1 -1
  56. package/shared/Eufemia.js +2 -2
  57. package/shared/Eufemia.js.map +1 -1
  58. package/style/core/scopes.scss +1 -1
  59. package/style/dnb-ui-basis.css +1 -1
  60. package/style/dnb-ui-basis.min.css +1 -1
  61. package/style/dnb-ui-body.css +1 -1
  62. package/style/dnb-ui-body.min.css +1 -1
  63. package/style/dnb-ui-core.css +1 -1
  64. package/style/dnb-ui-core.min.css +1 -1
  65. package/umd/dnb-ui-basis.min.js +1 -1
  66. package/umd/dnb-ui-components.min.js +1 -1
  67. package/umd/dnb-ui-elements.min.js +1 -1
  68. package/umd/dnb-ui-extensions.min.js +1 -1
  69. package/umd/dnb-ui-lib.min.js +1 -1
@@ -10,7 +10,7 @@ export const OrganizationNumberProperties = {
10
10
  status: 'optional'
11
11
  },
12
12
  onBlurValidator: {
13
- doc: 'Custom validator function that is triggered when the user leaves a field (e.g., blurring a text input or closing a dropdown). The function can be either asynchronous or synchronous. The first parameter is the value, and the second parameter returns an object containing { errorMessages, connectWithPath, validators }. Defaults to organization number validation, using `organizationNumberValidator`.',
13
+ doc: 'Custom validator function that is triggered when the user leaves a field (e.g., blurring a text input or closing a dropdown). The function can be either asynchronous or synchronous. The first parameter is the value, and the second parameter returns an object containing { errorMessages, connectWithPath, validators }. Defaults to organization number validation, using `organizationNumberValidator`. Can be disabled using `false`.',
14
14
  type: 'function',
15
15
  status: 'optional'
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"OrganizationNumberDocs.js","names":["OrganizationNumberProperties","validate","doc","type","status","help","onBlurValidator"],"sources":["../../../../../../src/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.tsx"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const OrganizationNumberProperties: PropertiesTableProps = {\n validate: {\n doc: 'Using this prop you can disable the default validation.',\n type: 'boolean',\n status: 'optional',\n },\n help: {\n doc: 'Provide a help button. Object consisting of `title` and `content`.',\n type: 'object',\n status: 'optional',\n },\n onBlurValidator: {\n doc: 'Custom validator function that is triggered when the user leaves a field (e.g., blurring a text input or closing a dropdown). The function can be either asynchronous or synchronous. The first parameter is the value, and the second parameter returns an object containing { errorMessages, connectWithPath, validators }. Defaults to organization number validation, using `organizationNumberValidator`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,4BAAkD,GAAG;EAChEC,QAAQ,EAAE;IACRC,GAAG,EAAE,yDAAyD;IAC9DC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJH,GAAG,EAAE,oEAAoE;IACzEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,eAAe,EAAE;IACfJ,GAAG,EAAE,gZAAgZ;IACrZC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC"}
1
+ {"version":3,"file":"OrganizationNumberDocs.js","names":["OrganizationNumberProperties","validate","doc","type","status","help","onBlurValidator"],"sources":["../../../../../../src/extensions/forms/Field/OrganizationNumber/OrganizationNumberDocs.tsx"],"sourcesContent":["import { PropertiesTableProps } from '../../../../shared/types'\n\nexport const OrganizationNumberProperties: PropertiesTableProps = {\n validate: {\n doc: 'Using this prop you can disable the default validation.',\n type: 'boolean',\n status: 'optional',\n },\n help: {\n doc: 'Provide a help button. Object consisting of `title` and `content`.',\n type: 'object',\n status: 'optional',\n },\n onBlurValidator: {\n doc: 'Custom validator function that is triggered when the user leaves a field (e.g., blurring a text input or closing a dropdown). The function can be either asynchronous or synchronous. The first parameter is the value, and the second parameter returns an object containing { errorMessages, connectWithPath, validators }. Defaults to organization number validation, using `organizationNumberValidator`. Can be disabled using `false`.',\n type: 'function',\n status: 'optional',\n },\n}\n"],"mappings":"AAEA,OAAO,MAAMA,4BAAkD,GAAG;EAChEC,QAAQ,EAAE;IACRC,GAAG,EAAE,yDAAyD;IAC9DC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC;EACDC,IAAI,EAAE;IACJH,GAAG,EAAE,oEAAoE;IACzEC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE;EACV,CAAC;EACDE,eAAe,EAAE;IACfJ,GAAG,EAAE,+aAA+a;IACpbC,IAAI,EAAE,UAAU;IAChBC,MAAM,EAAE;EACV;AACF,CAAC"}
@@ -79,7 +79,7 @@ function SubmitConfirmation(props) {
79
79
  }
80
80
  };
81
81
  return {
82
- data: internalDataRef.current,
82
+ data: internalDataRef === null || internalDataRef === void 0 ? void 0 : internalDataRef.current,
83
83
  confirmationState,
84
84
  setConfirmationState,
85
85
  submitHandler,
@@ -1 +1 @@
1
- {"version":3,"file":"SubmitConfirmation.js","names":["React","useCallback","useContext","useMemo","useReducer","useRef","DataContext","SharedProvider","HeightAnimation","removeUndefinedProps","SubmitConfirmation","props","forceUpdate","preventSubmitWhen","onStateChange","onSubmitResult","renderWithState","children","setFormState","setHandleSubmit","handleSubmit","handleFinalSubmit","submitState","formElementRef","internalDataRef","confirmationStateRef","submitStateRef","preventSubmitRef","undefined","validatePreventSubmit","current","getParamsRef","setConfirmationState","state","window","requestAnimationFrame","keepPending","confirmationState","connectWithDialog","openState","onConfirm","submitHandler","onDecline","cancelHandler","onClose","_ref","triggeredBy","data","Object","keys","length","_objectSpread","setFocusOnButton","form","element","querySelector","focus","e","_ref2","preventSubmit","remove","sharedProviderParams","formElement","disabled","createElement","Fragment","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useMemo,\n useReducer,\n useRef,\n} from 'react'\nimport DataContext from '../../DataContext/Context'\nimport SharedProvider from '../../../../shared/Provider'\nimport { ContextProps } from '../../../../shared/Context'\nimport { HeightAnimation } from '../../../../components'\nimport {\n DialogContentProps,\n DialogProps,\n} from '../../../../components/dialog/types'\nimport { EventStateObject } from '../../types'\nimport { removeUndefinedProps } from '../../../../shared/component-helper'\n\nexport type ConfirmationState =\n | 'idle'\n | 'readyToBeSubmitted'\n | 'submitInProgress'\n | 'submissionComplete'\n\nexport type ConfirmParams = {\n data: unknown\n confirmationState: ConfirmationState\n submitState: EventStateObject | undefined\n connectWithDialog: Pick<\n DialogProps & DialogContentProps,\n 'openState' | 'onConfirm' | 'onDecline' | 'onClose'\n >\n setConfirmationState: (state: ConfirmationState) => void\n submitHandler: () => void | Promise<void>\n cancelHandler: () => void | Promise<void>\n}\n\nexport type ConfirmProps = {\n preventSubmitWhen?: (params: ConfirmParams) => boolean\n onStateChange?: (params: ConfirmParams) => void | Promise<void>\n onSubmitResult?: (params: ConfirmParams) => void\n renderWithState?: (params: ConfirmParams) => React.ReactNode\n children?: React.ReactNode\n}\n\nfunction SubmitConfirmation(props: ConfirmProps) {\n const [, forceUpdate] = useReducer(() => ({}), {})\n\n const {\n preventSubmitWhen,\n onStateChange,\n onSubmitResult,\n renderWithState,\n children,\n } = props\n\n const {\n setFormState,\n setHandleSubmit,\n handleSubmit: handleFinalSubmit,\n submitState,\n formElementRef,\n internalDataRef,\n } = useContext(DataContext)\n\n const confirmationStateRef = useRef<ConfirmationState>('idle')\n const submitStateRef = useRef<EventStateObject>()\n const preventSubmitRef = useRef<boolean>(undefined)\n\n const validatePreventSubmit = useCallback(() => {\n return (preventSubmitRef.current = preventSubmitWhen?.(\n getParamsRef.current()\n ))\n }, [preventSubmitWhen])\n\n const setConfirmationState = useCallback(\n async (state: ConfirmationState) => {\n confirmationStateRef.current = state\n await onStateChange?.(getParamsRef.current())\n if (typeof window !== 'undefined') {\n window.requestAnimationFrame(() => {\n switch (state) {\n case 'idle':\n setFormState('complete', { keepPending: false })\n break\n case 'readyToBeSubmitted':\n setFormState('pending', { keepPending: true })\n break\n case 'submitInProgress':\n setFormState('pending', { keepPending: true })\n break\n case 'submissionComplete':\n setFormState('complete', { keepPending: false })\n break\n default:\n forceUpdate()\n }\n })\n }\n },\n [onStateChange, setFormState]\n )\n\n const getParamsRef = useRef(() => {\n const confirmationState = confirmationStateRef.current\n\n const connectWithDialog = {\n openState: confirmationState === 'readyToBeSubmitted',\n onConfirm: submitHandler,\n onDecline: cancelHandler,\n onClose: ({ triggeredBy }) => {\n if (triggeredBy === 'keyboard') {\n cancelHandler()\n }\n },\n }\n\n return {\n data: internalDataRef.current,\n confirmationState,\n setConfirmationState,\n submitHandler,\n cancelHandler,\n connectWithDialog,\n submitState: submitStateRef.current,\n } satisfies ConfirmParams\n })\n\n useMemo(() => {\n if (Object.keys(removeUndefinedProps(submitState) || {}).length > 0) {\n submitStateRef.current = {\n ...submitState,\n } as EventStateObject\n onSubmitResult?.(getParamsRef.current())\n }\n }, [submitState, onSubmitResult])\n\n const setFocusOnButton = useCallback(() => {\n try {\n const form = formElementRef.current\n const element = (form.querySelector('.dnb-forms-submit-button') ||\n form) as HTMLElement\n element.focus()\n } catch (e) {\n //\n }\n }, [formElementRef])\n\n const cancelHandler = useCallback(async () => {\n await setConfirmationState('idle')\n setFocusOnButton()\n }, [setFocusOnButton, setConfirmationState])\n\n const handleSubmit = useCallback(\n async ({ preventSubmit }) => {\n if (confirmationStateRef.current === 'submitInProgress') {\n return // stop here\n }\n\n if (validatePreventSubmit() !== true) {\n await setConfirmationState('submitInProgress')\n return // stop here\n }\n\n submitStateRef.current = undefined\n\n // Prevent the form form from being submitted\n preventSubmit()\n\n await setConfirmationState('readyToBeSubmitted')\n },\n [setConfirmationState, validatePreventSubmit]\n )\n setHandleSubmit?.(handleSubmit)\n\n const submitHandler = useCallback(async () => {\n setHandleSubmit?.(handleSubmit, { remove: true })\n\n await setConfirmationState('submitInProgress')\n await handleFinalSubmit()\n await setConfirmationState('submissionComplete')\n\n setFocusOnButton()\n }, [\n handleFinalSubmit,\n handleSubmit,\n setFocusOnButton,\n setHandleSubmit,\n setConfirmationState,\n ])\n\n const sharedProviderParams: ContextProps = {\n formElement: {\n disabled: false,\n },\n }\n\n return (\n <>\n {children}\n\n <SharedProvider {...sharedProviderParams}>\n <HeightAnimation>\n {renderWithState?.(getParamsRef.current())}\n </HeightAnimation>\n </SharedProvider>\n </>\n )\n}\n\nSubmitConfirmation._supportsSpacingProps = 'children'\nexport default SubmitConfirmation\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,OAAO;AACd,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,cAAc,MAAM,6BAA6B;AAExD,SAASC,eAAe,QAAQ,wBAAwB;AAMxD,SAASC,oBAAoB,QAAQ,qCAAqC;AA6B1E,SAASC,kBAAkBA,CAACC,KAAmB,EAAE;EAC/C,MAAM,GAAGC,WAAW,CAAC,GAAGR,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAElD,MAAM;IACJS,iBAAiB;IACjBC,aAAa;IACbC,cAAc;IACdC,eAAe;IACfC;EACF,CAAC,GAAGN,KAAK;EAET,MAAM;IACJO,YAAY;IACZC,eAAe;IACfC,YAAY,EAAEC,iBAAiB;IAC/BC,WAAW;IACXC,cAAc;IACdC;EACF,CAAC,GAAGtB,UAAU,CAACI,WAAW,CAAC;EAE3B,MAAMmB,oBAAoB,GAAGpB,MAAM,CAAoB,MAAM,CAAC;EAC9D,MAAMqB,cAAc,GAAGrB,MAAM,CAAmB,CAAC;EACjD,MAAMsB,gBAAgB,GAAGtB,MAAM,CAAUuB,SAAS,CAAC;EAEnD,MAAMC,qBAAqB,GAAG5B,WAAW,CAAC,MAAM;IAC9C,OAAQ0B,gBAAgB,CAACG,OAAO,GAAGjB,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAClDkB,YAAY,CAACD,OAAO,CAAC,CACvB,CAAC;EACH,CAAC,EAAE,CAACjB,iBAAiB,CAAC,CAAC;EAEvB,MAAMmB,oBAAoB,GAAG/B,WA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IAEAN,cAAc,CAACI,OAAO,GAAGF,SAAS;IAGlC+B,aAAa,CAAC,CAAC;IAEf,MAAM3B,oBAAoB,CAAC,oBAAoB,CAAC;EAClD,CAAC,EACD,CAACA,oBAAoB,EAAEH,qBAAqB,CAC9C,CAAC;EACDV,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGC,YAAY,CAAC;EAE/B,MAAMqB,aAAa,GAAGxC,WAAW,CAAC,YAAY;IAC5CkB,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGC,YAAY,EAAE;MAAEwC,MAAM,EAAE;IAAK,CAAC,CAAC;IAEjD,MAAM5B,oBAAoB,CAAC,kBAAkB,CAAC;IAC9C,MAAMX,iBAAiB,CAAC,CAAC;IACzB,MAAMW,oBAAoB,CAAC,oBAAoB,CAAC;IAEhDoB,gBAAgB,CAAC,CAAC;EACpB,CAAC,EAAE,CACD/B,iBAAiB,EACjBD,YAAY,EACZgC,gBAAgB,EAChBjC,eAAe,EACfa,oBAAoB,CACrB,CAAC;EAEF,MAAM6B,oBAAkC,GAAG;IACzCC,WAAW,EAAE;MACXC,QAAQ,EAAE;IACZ;EACF,CAAC;EAED,OACE/D,KAAA,CAAAgE,aAAA,CAAAhE,KAAA,CAAAiE,QAAA,QACGhD,QAAQ,EAETjB,KAAA,CAAAgE,aAAA,CAACzD,cAAc,EAAKsD,oBAAoB,EACtC7D,KAAA,CAAAgE,aAAA,CAACxD,eAAe,QACbQ,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGe,YAAY,CAACD,OAAO,CAAC,CAAC,CAC1B,CACH,CAChB,CAAC;AAEP;AAEApB,kBAAkB,CAACwD,qBAAqB,GAAG,UAAU;AACrD,eAAexD,kBAAkB"}
1
+ {"version":3,"file":"SubmitConfirmation.js","names":["React","useCallback","useContext","useMemo","useReducer","useRef","DataContext","SharedProvider","HeightAnimation","removeUndefinedProps","SubmitConfirmation","props","forceUpdate","preventSubmitWhen","onStateChange","onSubmitResult","renderWithState","children","setFormState","setHandleSubmit","handleSubmit","handleFinalSubmit","submitState","formElementRef","internalDataRef","confirmationStateRef","submitStateRef","preventSubmitRef","undefined","validatePreventSubmit","current","getParamsRef","setConfirmationState","state","window","requestAnimationFrame","keepPending","confirmationState","connectWithDialog","openState","onConfirm","submitHandler","onDecline","cancelHandler","onClose","_ref","triggeredBy","data","Object","keys","length","_objectSpread","setFocusOnButton","form","element","querySelector","focus","e","_ref2","preventSubmit","remove","sharedProviderParams","formElement","disabled","createElement","Fragment","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Form/SubmitConfirmation/SubmitConfirmation.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useMemo,\n useReducer,\n useRef,\n} from 'react'\nimport DataContext from '../../DataContext/Context'\nimport SharedProvider from '../../../../shared/Provider'\nimport { ContextProps } from '../../../../shared/Context'\nimport { HeightAnimation } from '../../../../components'\nimport {\n DialogContentProps,\n DialogProps,\n} from '../../../../components/dialog/types'\nimport { EventStateObject } from '../../types'\nimport { removeUndefinedProps } from '../../../../shared/component-helper'\n\nexport type ConfirmationState =\n | 'idle'\n | 'readyToBeSubmitted'\n | 'submitInProgress'\n | 'submissionComplete'\n\nexport type ConfirmParams = {\n data: unknown\n confirmationState: ConfirmationState\n submitState: EventStateObject | undefined\n connectWithDialog: Pick<\n DialogProps & DialogContentProps,\n 'openState' | 'onConfirm' | 'onDecline' | 'onClose'\n >\n setConfirmationState: (state: ConfirmationState) => void\n submitHandler: () => void | Promise<void>\n cancelHandler: () => void | Promise<void>\n}\n\nexport type ConfirmProps = {\n preventSubmitWhen?: (params: ConfirmParams) => boolean\n onStateChange?: (params: ConfirmParams) => void | Promise<void>\n onSubmitResult?: (params: ConfirmParams) => void\n renderWithState?: (params: ConfirmParams) => React.ReactNode\n children?: React.ReactNode\n}\n\nfunction SubmitConfirmation(props: ConfirmProps) {\n const [, forceUpdate] = useReducer(() => ({}), {})\n\n const {\n preventSubmitWhen,\n onStateChange,\n onSubmitResult,\n renderWithState,\n children,\n } = props\n\n const {\n setFormState,\n setHandleSubmit,\n handleSubmit: handleFinalSubmit,\n submitState,\n formElementRef,\n internalDataRef,\n } = useContext(DataContext)\n\n const confirmationStateRef = useRef<ConfirmationState>('idle')\n const submitStateRef = useRef<EventStateObject>()\n const preventSubmitRef = useRef<boolean>(undefined)\n\n const validatePreventSubmit = useCallback(() => {\n return (preventSubmitRef.current = preventSubmitWhen?.(\n getParamsRef.current()\n ))\n }, [preventSubmitWhen])\n\n const setConfirmationState = useCallback(\n async (state: ConfirmationState) => {\n confirmationStateRef.current = state\n await onStateChange?.(getParamsRef.current())\n if (typeof window !== 'undefined') {\n window.requestAnimationFrame(() => {\n switch (state) {\n case 'idle':\n setFormState('complete', { keepPending: false })\n break\n case 'readyToBeSubmitted':\n setFormState('pending', { keepPending: true })\n break\n case 'submitInProgress':\n setFormState('pending', { keepPending: true })\n break\n case 'submissionComplete':\n setFormState('complete', { keepPending: false })\n break\n default:\n forceUpdate()\n }\n })\n }\n },\n [onStateChange, setFormState]\n )\n\n const getParamsRef = useRef(() => {\n const confirmationState = confirmationStateRef.current\n\n const connectWithDialog = {\n openState: confirmationState === 'readyToBeSubmitted',\n onConfirm: submitHandler,\n onDecline: cancelHandler,\n onClose: ({ triggeredBy }) => {\n if (triggeredBy === 'keyboard') {\n cancelHandler()\n }\n },\n }\n\n return {\n data: internalDataRef?.current,\n confirmationState,\n setConfirmationState,\n submitHandler,\n cancelHandler,\n connectWithDialog,\n submitState: submitStateRef.current,\n } satisfies ConfirmParams\n })\n\n useMemo(() => {\n if (Object.keys(removeUndefinedProps(submitState) || {}).length > 0) {\n submitStateRef.current = {\n ...submitState,\n } as EventStateObject\n onSubmitResult?.(getParamsRef.current())\n }\n }, [submitState, onSubmitResult])\n\n const setFocusOnButton = useCallback(() => {\n try {\n const form = formElementRef.current\n const element = (form.querySelector('.dnb-forms-submit-button') ||\n form) as HTMLElement\n element.focus()\n } catch (e) {\n //\n }\n }, [formElementRef])\n\n const cancelHandler = useCallback(async () => {\n await setConfirmationState('idle')\n setFocusOnButton()\n }, [setFocusOnButton, setConfirmationState])\n\n const handleSubmit = useCallback(\n async ({ preventSubmit }) => {\n if (confirmationStateRef.current === 'submitInProgress') {\n return // stop here\n }\n\n if (validatePreventSubmit() !== true) {\n await setConfirmationState('submitInProgress')\n return // stop here\n }\n\n submitStateRef.current = undefined\n\n // Prevent the form form from being submitted\n preventSubmit()\n\n await setConfirmationState('readyToBeSubmitted')\n },\n [setConfirmationState, validatePreventSubmit]\n )\n setHandleSubmit?.(handleSubmit)\n\n const submitHandler = useCallback(async () => {\n setHandleSubmit?.(handleSubmit, { remove: true })\n\n await setConfirmationState('submitInProgress')\n await handleFinalSubmit()\n await setConfirmationState('submissionComplete')\n\n setFocusOnButton()\n }, [\n handleFinalSubmit,\n handleSubmit,\n setFocusOnButton,\n setHandleSubmit,\n setConfirmationState,\n ])\n\n const sharedProviderParams: ContextProps = {\n formElement: {\n disabled: false,\n },\n }\n\n return (\n <>\n {children}\n\n <SharedProvider {...sharedProviderParams}>\n <HeightAnimation>\n {renderWithState?.(getParamsRef.current())}\n </HeightAnimation>\n </SharedProvider>\n </>\n )\n}\n\nSubmitConfirmation._supportsSpacingProps = 'children'\nexport default SubmitConfirmation\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,UAAU,EACVC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,OAAO;AACd,OAAOC,WAAW,MAAM,2BAA2B;AACnD,OAAOC,cAAc,MAAM,6BAA6B;AAExD,SAASC,eAAe,QAAQ,wBAAwB;AAMxD,SAASC,oBAAoB,QAAQ,qCAAqC;AA6B1E,SAASC,kBAAkBA,CAACC,KAAmB,EAAE;EAC/C,MAAM,GAAGC,WAAW,CAAC,GAAGR,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAElD,MAAM;IACJS,iBAAiB;IACjBC,aAAa;IACbC,cAAc;IACdC,eAAe;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ACfa,oBAAoB,CACrB,CAAC;EAEF,MAAM6B,oBAAkC,GAAG;IACzCC,WAAW,EAAE;MACXC,QAAQ,EAAE;IACZ;EACF,CAAC;EAED,OACE/D,KAAA,CAAAgE,aAAA,CAAAhE,KAAA,CAAAiE,QAAA,QACGhD,QAAQ,EAETjB,KAAA,CAAAgE,aAAA,CAACzD,cAAc,EAAKsD,oBAAoB,EACtC7D,KAAA,CAAAgE,aAAA,CAACxD,eAAe,QACbQ,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAGe,YAAY,CAACD,OAAO,CAAC,CAAC,CAC1B,CACH,CAChB,CAAC;AAEP;AAEApB,kBAAkB,CAACwD,qBAAqB,GAAG,UAAU;AACrD,eAAexD,kBAAkB"}
@@ -21,7 +21,8 @@ export default function ChildrenWithAge(_ref) {
21
21
  required: true
22
22
  }, restProps), mode === 'summary' ? React.createElement(SummaryContainer, {
23
23
  toWizardStep: toWizardStep,
24
- spacingProps: spacingProps
24
+ spacingProps: spacingProps,
25
+ enableAdditionalQuestions: enableAdditionalQuestions
25
26
  }) : React.createElement(EditContainer, {
26
27
  enableAdditionalQuestions: enableAdditionalQuestions,
27
28
  spacingProps: spacingProps
@@ -39,51 +40,37 @@ function EditContainer(_ref2) {
39
40
  path: "/hasChildren",
40
41
  label: tr.ChildrenWithAge.hasChildren.fieldLabel,
41
42
  variant: "buttons",
42
- defaultValue: false,
43
43
  errorMessages: {
44
44
  required: tr.ChildrenWithAge.hasChildren.required
45
45
  }
46
46
  }), React.createElement(Form.Visibility, {
47
47
  pathTrue: "/hasChildren",
48
48
  animate: true
49
- }, (enableAdditionalQuestions === null || enableAdditionalQuestions === void 0 ? void 0 : enableAdditionalQuestions.includes('joint-responsibility')) && React.createElement(Field.Boolean, {
50
- path: "/hasJointResponsibility",
51
- label: tr.ChildrenWithAge.hasJointResponsibility.fieldLabel,
52
- variant: "buttons",
53
- defaultValue: false,
54
- errorMessages: {
55
- required: tr.ChildrenWithAge.hasChildren.required
56
- }
57
- }), (enableAdditionalQuestions === null || enableAdditionalQuestions === void 0 ? void 0 : enableAdditionalQuestions.includes('daycare')) && React.createElement(Field.Boolean, {
58
- path: "/usesDaycare",
59
- label: tr.ChildrenWithAge.usesDaycare.fieldLabel,
60
- variant: "buttons",
61
- defaultValue: false,
62
- errorMessages: {
63
- required: tr.ChildrenWithAge.usesDaycare.required
64
- }
65
- }), React.createElement(Field.Number, {
49
+ }, React.createElement(Field.Number, {
66
50
  path: "/countChildren",
67
51
  label: tr.ChildrenWithAge.countChildren.fieldLabel,
68
52
  errorMessages: {
69
- minimum: tr.ChildrenWithAge.countChildren.required
53
+ minimum: tr.ChildrenWithAge.countChildren.required,
54
+ required: tr.ChildrenWithAge.countChildren.required
70
55
  },
71
56
  width: "small",
72
- defaultValue: 1,
73
57
  minimum: 1,
74
58
  maximum: 20,
75
59
  showStepControls: true,
76
- decimalLimit: 0
77
- }), React.createElement(Iterate.Array, {
60
+ decimalLimit: 0,
61
+ allowNegative: false
62
+ }), React.createElement(Form.Visibility, {
63
+ pathTruthy: "/countChildren",
64
+ animate: true
65
+ }, React.createElement(Iterate.Array, {
78
66
  path: "/children",
79
67
  countPath: "/countChildren",
80
68
  countPathTransform: transformAgeItem,
81
- countPathLimit: 20
82
- }, React.createElement(Field.Composition, {
83
- label: tr.ChildrenWithAge.childrenAge.fieldLabel,
84
- align: "center"
69
+ countPathLimit: 20,
70
+ animate: true
85
71
  }, React.createElement(Field.Number, {
86
72
  itemPath: "/age",
73
+ label: tr.ChildrenWithAge.childrenAge.fieldLabel,
87
74
  errorMessages: {
88
75
  required: tr.ChildrenWithAge.childrenAge.required
89
76
  },
@@ -91,18 +78,49 @@ function EditContainer(_ref2) {
91
78
  width: "small",
92
79
  minimum: 0,
93
80
  maximum: 17,
94
- decimalLimit: 0
95
- }), React.createElement(Form.Visibility, {
96
- pathTrue: "/hasJointResponsibility"
97
- }, React.createElement(Field.Boolean, {
98
- itemPath: "/jointResponsibility",
99
- label: tr.ChildrenWithAge.confirmJointResponsibility.fieldLabel
100
- })), React.createElement(Form.Visibility, {
101
- pathTrue: "/usesDaycare"
102
- }, React.createElement(Field.Boolean, {
103
- itemPath: "/hasDaycare",
104
- label: tr.ChildrenWithAge.hasDaycare.fieldLabel
105
- }))))));
81
+ decimalLimit: 0,
82
+ allowNegative: false
83
+ }))), (enableAdditionalQuestions === null || enableAdditionalQuestions === void 0 ? void 0 : enableAdditionalQuestions.includes('daycare')) && React.createElement(Field.Boolean, {
84
+ path: "/usesDaycare",
85
+ label: tr.ChildrenWithAge.usesDaycare.fieldLabel,
86
+ variant: "buttons",
87
+ errorMessages: {
88
+ required: tr.ChildrenWithAge.usesDaycare.required
89
+ },
90
+ help: {
91
+ title: tr.ChildrenWithAge.usesDaycare.fieldLabel,
92
+ content: tr.ChildrenWithAge.usesDaycare.helpText
93
+ }
94
+ }), (enableAdditionalQuestions === null || enableAdditionalQuestions === void 0 ? void 0 : enableAdditionalQuestions.includes('daycare')) && React.createElement(Form.Visibility, {
95
+ pathTrue: "/usesDaycare",
96
+ animate: true
97
+ }, React.createElement(Field.Currency, {
98
+ path: "/daycareExpenses",
99
+ label: tr.ChildrenWithAge.dayCareExpenses.fieldLabel,
100
+ errorMessages: {
101
+ required: tr.ChildrenWithAge.dayCareExpenses.required
102
+ },
103
+ minimum: 0,
104
+ allowNegative: false
105
+ })), (enableAdditionalQuestions === null || enableAdditionalQuestions === void 0 ? void 0 : enableAdditionalQuestions.includes('joint-responsibility')) && React.createElement(Field.Boolean, {
106
+ path: "/hasJointResponsibility",
107
+ label: tr.ChildrenWithAge.hasJointResponsibility.fieldLabel,
108
+ variant: "buttons",
109
+ errorMessages: {
110
+ required: tr.ChildrenWithAge.hasJointResponsibility.required
111
+ }
112
+ }), (enableAdditionalQuestions === null || enableAdditionalQuestions === void 0 ? void 0 : enableAdditionalQuestions.includes('joint-responsibility')) && React.createElement(Form.Visibility, {
113
+ pathTrue: "/hasJointResponsibility",
114
+ animate: true
115
+ }, React.createElement(Field.Currency, {
116
+ path: "/jointResponsibilityExpenses",
117
+ label: tr.ChildrenWithAge.jointResponsibilityExpenses.fieldLabel,
118
+ errorMessages: {
119
+ required: tr.ChildrenWithAge.jointResponsibilityExpenses.required
120
+ },
121
+ minimum: 0,
122
+ allowNegative: false
123
+ }))));
106
124
  }
107
125
  function SummaryContainer(_ref3) {
108
126
  let {
@@ -124,36 +142,37 @@ function SummaryContainer(_ref3) {
124
142
  }, React.createElement(Value.Number, {
125
143
  path: "/countChildren",
126
144
  label: tr.ChildrenWithAge.countChildren.fieldLabel,
127
- defaultValue: 0,
128
145
  suffix: tr.ChildrenWithAge.countChildren.suffix,
129
146
  maximum: 20,
130
147
  transformIn: value => hasNoChildren ? 0 : value
131
- })), React.createElement(Iterate.Array, {
148
+ }), React.createElement(Iterate.Array, {
132
149
  path: "/children",
133
150
  limit: hasNoChildren ? 0 : undefined
134
- }, React.createElement(Value.Composition, {
135
- label: tr.ChildrenWithAge.childrenAge.fieldLabel,
136
- gap: false
137
151
  }, React.createElement(Value.Number, {
138
152
  itemPath: "/age",
153
+ label: tr.ChildrenWithAge.childrenAge.fieldLabel,
139
154
  suffix: tr.ChildrenWithAge.childrenAge.suffix,
140
155
  defaultValue: "\u2013"
141
- }), React.createElement(Form.Visibility, {
142
- pathTrue: "/hasJointResponsibility"
143
- }, ', ', React.createElement(Value.Boolean, {
144
- inline: true,
145
- itemPath: "/jointResponsibility",
146
- trueText: tr.ChildrenWithAge.jointResponsibilityTrue,
147
- falseText: tr.ChildrenWithAge.jointResponsibilityFalse,
148
- defaultValue: false
149
156
  })), React.createElement(Form.Visibility, {
157
+ pathDefined: "/usesDaycare"
158
+ }, React.createElement(Value.Boolean, {
159
+ label: tr.ChildrenWithAge.usesDaycare.fieldLabel,
160
+ path: "/usesDaycare"
161
+ }), React.createElement(Form.Visibility, {
150
162
  pathTrue: "/usesDaycare"
151
- }, ', ', React.createElement(Value.Boolean, {
152
- inline: true,
153
- itemPath: "/hasDaycare",
154
- trueText: tr.ChildrenWithAge.daycareTrue,
155
- falseText: tr.ChildrenWithAge.daycareFalse,
156
- defaultValue: false
163
+ }, React.createElement(Value.Currency, {
164
+ label: tr.ChildrenWithAge.dayCareExpenses.fieldLabel,
165
+ path: "/daycareExpenses"
166
+ }))), React.createElement(Form.Visibility, {
167
+ pathDefined: "/hasJointResponsibility"
168
+ }, React.createElement(Value.Boolean, {
169
+ path: "/hasJointResponsibility",
170
+ label: tr.ChildrenWithAge.hasJointResponsibility.fieldLabel
171
+ }), React.createElement(Form.Visibility, {
172
+ pathTrue: "/hasJointResponsibility"
173
+ }, React.createElement(Value.Currency, {
174
+ label: tr.ChildrenWithAge.jointResponsibilityExpenses.fieldLabel,
175
+ path: "/jointResponsibilityExpenses"
157
176
  }))))), typeof toWizardStep === 'number' ? React.createElement(Wizard.EditButton, {
158
177
  toStep: toWizardStep
159
178
  }) : null);
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenWithAge.js","names":["React","Field","Form","Iterate","Value","Wizard","Card","Lead","translations","omitSpacingProps","pickSpacingProps","ChildrenWithAge","_ref","mode","enableAdditionalQuestions","toWizardStep","props","_objectWithoutProperties","_excluded","spacingProps","restProps","createElement","Section","_extends","required","SummaryContainer","EditContainer","_ref2","tr","useTranslation","stack","hasChildren","title","Boolean","path","label","fieldLabel","variant","defaultValue","errorMessages","Visibility","pathTrue","animate","includes","hasJointResponsibility","usesDaycare","Number","countChildren","minimum","width","maximum","showStepControls","decimalLimit","Array","countPath","countPathTransform","transformAgeItem","countPathLimit","Composition","childrenAge","align","itemPath","placeholder","confirmJointResponsibility","hasDaycare","_ref3","getValue","useData","hasNoChildren","SummaryList","suffix","transformIn","value","limit","undefined","gap","inline","trueText","jointResponsibilityTrue","falseText","jointResponsibilityFalse","daycareTrue","daycareFalse","EditButton","toStep","_ref4","Object","prototype","hasOwnProperty","call","age","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.tsx"],"sourcesContent":["import React from 'react'\nimport { Field, Form, Iterate, Value, Wizard } from '../..'\nimport { Card } from '../../../../components'\nimport { Lead } from '../../../../elements'\nimport { Translation, translations } from './ChildrenWithAgeTranslations'\nimport type { SectionProps } from '../../Form/Section'\nimport {\n omitSpacingProps,\n pickSpacingProps,\n} from '../../../../components/flex/utils'\nimport { SpacingProps } from '../../../../shared/types'\n\ntype Mode = 'edit' | 'summary'\ntype Variant = Array<'joint-responsibility' | 'daycare'>\n\nexport type Props = SectionProps & {\n mode?: Mode\n enableAdditionalQuestions?: Variant\n toWizardStep?: number\n} & SpacingProps\n\nexport default function ChildrenWithAge({\n mode,\n enableAdditionalQuestions,\n toWizardStep,\n ...props\n}: Props) {\n const spacingProps = pickSpacingProps<Props>(props)\n const restProps = omitSpacingProps(props)\n return (\n <Form.Section translations={translations} required {...restProps}>\n {mode === 'summary' ? (\n <SummaryContainer\n toWizardStep={toWizardStep}\n spacingProps={spacingProps}\n />\n ) : (\n <EditContainer\n enableAdditionalQuestions={enableAdditionalQuestions}\n spacingProps={spacingProps}\n />\n )}\n </Form.Section>\n )\n}\n\nfunction EditContainer({\n spacingProps,\n enableAdditionalQuestions,\n}: Props & {\n spacingProps?: SpacingProps\n}) {\n const tr = Form.useTranslation<Translation>()\n\n return (\n <Card stack {...spacingProps}>\n <Lead>{tr.ChildrenWithAge.hasChildren.title}</Lead>\n\n <Field.Boolean\n path=\"/hasChildren\"\n label={tr.ChildrenWithAge.hasChildren.fieldLabel}\n variant=\"buttons\"\n defaultValue={false}\n errorMessages={{\n required: tr.ChildrenWithAge.hasChildren.required,\n }}\n />\n\n <Form.Visibility pathTrue=\"/hasChildren\" animate>\n {enableAdditionalQuestions?.includes('joint-responsibility') && (\n <Field.Boolean\n path=\"/hasJointResponsibility\"\n label={tr.ChildrenWithAge.hasJointResponsibility.fieldLabel}\n variant=\"buttons\"\n defaultValue={false}\n errorMessages={{\n required: tr.ChildrenWithAge.hasChildren.required,\n }}\n />\n )}\n\n {enableAdditionalQuestions?.includes('daycare') && (\n <Field.Boolean\n path=\"/usesDaycare\"\n label={tr.ChildrenWithAge.usesDaycare.fieldLabel}\n variant=\"buttons\"\n defaultValue={false}\n errorMessages={{\n required: tr.ChildrenWithAge.usesDaycare.required,\n }}\n />\n )}\n\n <Field.Number\n path=\"/countChildren\"\n label={tr.ChildrenWithAge.countChildren.fieldLabel}\n errorMessages={{\n minimum: tr.ChildrenWithAge.countChildren.required,\n }}\n width=\"small\"\n defaultValue={1}\n minimum={1}\n maximum={20}\n showStepControls\n decimalLimit={0}\n />\n\n <Iterate.Array\n path=\"/children\"\n countPath=\"/countChildren\"\n countPathTransform={transformAgeItem}\n countPathLimit={20}\n >\n <Field.Composition\n label={tr.ChildrenWithAge.childrenAge.fieldLabel}\n align=\"center\"\n >\n <Field.Number\n itemPath=\"/age\"\n errorMessages={{\n required: tr.ChildrenWithAge.childrenAge.required,\n }}\n placeholder=\"0\"\n width=\"small\"\n minimum={0}\n maximum={17}\n decimalLimit={0}\n />\n\n <Form.Visibility pathTrue=\"/hasJointResponsibility\">\n <Field.Boolean\n itemPath=\"/jointResponsibility\"\n label={\n tr.ChildrenWithAge.confirmJointResponsibility.fieldLabel\n }\n />\n </Form.Visibility>\n\n <Form.Visibility pathTrue=\"/usesDaycare\">\n <Field.Boolean\n itemPath=\"/hasDaycare\"\n label={tr.ChildrenWithAge.hasDaycare.fieldLabel}\n />\n </Form.Visibility>\n </Field.Composition>\n </Iterate.Array>\n </Form.Visibility>\n </Card>\n )\n}\n\nfunction SummaryContainer({\n spacingProps,\n toWizardStep,\n}: Props & {\n spacingProps?: SpacingProps\n}) {\n const tr = Form.useTranslation<Translation>()\n\n const { getValue } = Form.useData()\n const hasNoChildren = getValue('/hasChildren') === false\n\n return (\n <Card stack {...spacingProps}>\n {<Lead>{tr.ChildrenWithAge.hasChildren.title}</Lead>}\n\n <Value.SummaryList>\n <Value.Boolean\n path=\"/hasChildren\"\n label={tr.ChildrenWithAge.hasChildren.fieldLabel}\n />\n <Form.Visibility pathTrue=\"/hasChildren\">\n <Value.Number\n path=\"/countChildren\"\n label={tr.ChildrenWithAge.countChildren.fieldLabel}\n defaultValue={0}\n suffix={tr.ChildrenWithAge.countChildren.suffix}\n maximum={20}\n transformIn={(value) => (hasNoChildren ? 0 : value)}\n />\n </Form.Visibility>\n <Iterate.Array\n path=\"/children\"\n limit={hasNoChildren ? 0 : undefined}\n >\n <Value.Composition\n label={tr.ChildrenWithAge.childrenAge.fieldLabel}\n gap={false}\n >\n <Value.Number\n itemPath=\"/age\"\n suffix={tr.ChildrenWithAge.childrenAge.suffix}\n defaultValue=\"–\"\n />\n\n <Form.Visibility pathTrue=\"/hasJointResponsibility\">\n {', '}\n <Value.Boolean\n inline\n itemPath=\"/jointResponsibility\"\n trueText={tr.ChildrenWithAge.jointResponsibilityTrue}\n falseText={tr.ChildrenWithAge.jointResponsibilityFalse}\n defaultValue={false}\n />\n </Form.Visibility>\n\n <Form.Visibility pathTrue=\"/usesDaycare\">\n {', '}\n <Value.Boolean\n inline\n itemPath=\"/hasDaycare\"\n trueText={tr.ChildrenWithAge.daycareTrue}\n falseText={tr.ChildrenWithAge.daycareFalse}\n defaultValue={false}\n />\n </Form.Visibility>\n </Value.Composition>\n </Iterate.Array>\n </Value.SummaryList>\n\n {typeof toWizardStep === 'number' ? (\n <Wizard.EditButton toStep={toWizardStep} />\n ) : null}\n </Card>\n )\n}\n\nconst transformAgeItem = ({ value }) =>\n Object.prototype.hasOwnProperty.call(value || {}, 'age')\n ? value\n : { age: undefined }\n\nChildrenWithAge._supportsSpacingProps = true\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEC,MAAM,QAAQ,OAAO;AAC3D,SAASC,IAAI,QAAQ,wBAAwB;AAC7C,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAAsBC,YAAY,QAAQ,+BAA+B;AAEzE,SACEC,gB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,aAAA,CAAChB,MAAM,CAAC8E,UAAU;IAACC,MAAM,EAAErE;EAAa,CAAE,CAAC,GACzC,IACA,CAAC;AAEX;AAEA,MAAMyC,gBAAgB,GAAG6B,KAAA;EAAA,IAAC;IAAEb;EAAM,CAAC,GAAAa,KAAA;EAAA,OACjCC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACjB,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,GACpDA,KAAK,GACL;IAAEkB,GAAG,EAAEhB;EAAU,CAAC;AAAA;AAExB/D,eAAe,CAACgF,qBAAqB,GAAG,IAAI"}
1
+ {"version":3,"file":"ChildrenWithAge.js","names":["React","Field","Form","Iterate","Value","Wizard","Card","Lead","translations","omitSpacingProps","pickSpacingProps","ChildrenWithAge","_ref","mode","enableAdditionalQuestions","toWizardStep","props","_objectWithoutProperties","_excluded","spacingProps","restProps","createElement","Section","_extends","required","SummaryContainer","EditContainer","_ref2","tr","useTranslation","stack","hasChildren","title","Boolean","path","label","fieldLabel","variant","errorMessages","Visibility","pathTrue","animate","Number","countChildren","minimum","width","maximum","showStepControls","decimalLimit","allowNegative","pathTruthy","Array","countPath","countPathTransform","transformAgeItem","countPathLimit","itemPath","childrenAge","placeholder","includes","usesDaycare","help","content","helpText","Currency","dayCareExpenses","hasJointResponsibility","jointResponsibilityExpenses","_ref3","getValue","useData","hasNoChildren","SummaryList","suffix","transformIn","value","limit","undefined","defaultValue","pathDefined","EditButton","toStep","_ref4","Object","prototype","hasOwnProperty","call","age","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAge.tsx"],"sourcesContent":["import React from 'react'\nimport { Field, Form, Iterate, Value, Wizard } from '../..'\nimport { Card } from '../../../../components'\nimport { Lead } from '../../../../elements'\nimport { Translation, translations } from './ChildrenWithAgeTranslations'\nimport type { SectionProps } from '../../Form/Section'\nimport {\n omitSpacingProps,\n pickSpacingProps,\n} from '../../../../components/flex/utils'\nimport { SpacingProps } from '../../../../shared/types'\n\ntype Mode = 'edit' | 'summary'\ntype Variant = Array<'joint-responsibility' | 'daycare'>\n\nexport type Props = SectionProps & {\n mode?: Mode\n enableAdditionalQuestions?: Variant\n toWizardStep?: number\n} & SpacingProps\n\nexport default function ChildrenWithAge({\n mode,\n enableAdditionalQuestions,\n toWizardStep,\n ...props\n}: Props) {\n const spacingProps = pickSpacingProps<Props>(props)\n const restProps = omitSpacingProps(props)\n return (\n <Form.Section translations={translations} required {...restProps}>\n {mode === 'summary' ? (\n <SummaryContainer\n toWizardStep={toWizardStep}\n spacingProps={spacingProps}\n enableAdditionalQuestions={enableAdditionalQuestions}\n />\n ) : (\n <EditContainer\n enableAdditionalQuestions={enableAdditionalQuestions}\n spacingProps={spacingProps}\n />\n )}\n </Form.Section>\n )\n}\n\nfunction EditContainer({\n spacingProps,\n enableAdditionalQuestions,\n}: Props & {\n spacingProps?: SpacingProps\n}) {\n const tr = Form.useTranslation<Translation>()\n\n return (\n <Card stack {...spacingProps}>\n <Lead>{tr.ChildrenWithAge.hasChildren.title}</Lead>\n\n <Field.Boolean\n path=\"/hasChildren\"\n label={tr.ChildrenWithAge.hasChildren.fieldLabel}\n variant=\"buttons\"\n errorMessages={{\n required: tr.ChildrenWithAge.hasChildren.required,\n }}\n />\n\n <Form.Visibility pathTrue=\"/hasChildren\" animate>\n <Field.Number\n path=\"/countChildren\"\n label={tr.ChildrenWithAge.countChildren.fieldLabel}\n errorMessages={{\n minimum: tr.ChildrenWithAge.countChildren.required,\n required: tr.ChildrenWithAge.countChildren.required,\n }}\n width=\"small\"\n minimum={1}\n maximum={20}\n showStepControls\n decimalLimit={0}\n allowNegative={false}\n />\n\n <Form.Visibility pathTruthy=\"/countChildren\" animate>\n <Iterate.Array\n path=\"/children\"\n countPath=\"/countChildren\"\n countPathTransform={transformAgeItem}\n countPathLimit={20}\n animate\n >\n <Field.Number\n itemPath=\"/age\"\n label={tr.ChildrenWithAge.childrenAge.fieldLabel}\n errorMessages={{\n required: tr.ChildrenWithAge.childrenAge.required,\n }}\n placeholder=\"0\"\n width=\"small\"\n minimum={0}\n maximum={17}\n decimalLimit={0}\n allowNegative={false}\n />\n </Iterate.Array>\n </Form.Visibility>\n\n {enableAdditionalQuestions?.includes('daycare') && (\n <Field.Boolean\n path=\"/usesDaycare\"\n label={tr.ChildrenWithAge.usesDaycare.fieldLabel}\n variant=\"buttons\"\n errorMessages={{\n required: tr.ChildrenWithAge.usesDaycare.required,\n }}\n help={{\n title: tr.ChildrenWithAge.usesDaycare.fieldLabel,\n content: tr.ChildrenWithAge.usesDaycare.helpText,\n }}\n />\n )}\n\n {enableAdditionalQuestions?.includes('daycare') && (\n <Form.Visibility pathTrue=\"/usesDaycare\" animate>\n <Field.Currency\n path=\"/daycareExpenses\"\n label={tr.ChildrenWithAge.dayCareExpenses.fieldLabel}\n errorMessages={{\n required: tr.ChildrenWithAge.dayCareExpenses.required,\n }}\n minimum={0}\n allowNegative={false}\n />\n </Form.Visibility>\n )}\n\n {enableAdditionalQuestions?.includes('joint-responsibility') && (\n <Field.Boolean\n path=\"/hasJointResponsibility\"\n label={tr.ChildrenWithAge.hasJointResponsibility.fieldLabel}\n variant=\"buttons\"\n errorMessages={{\n required: tr.ChildrenWithAge.hasJointResponsibility.required,\n }}\n />\n )}\n {enableAdditionalQuestions?.includes('joint-responsibility') && (\n <Form.Visibility pathTrue=\"/hasJointResponsibility\" animate>\n <Field.Currency\n path=\"/jointResponsibilityExpenses\"\n label={\n tr.ChildrenWithAge.jointResponsibilityExpenses.fieldLabel\n }\n errorMessages={{\n required:\n tr.ChildrenWithAge.jointResponsibilityExpenses.required,\n }}\n minimum={0}\n allowNegative={false}\n />\n </Form.Visibility>\n )}\n </Form.Visibility>\n </Card>\n )\n}\n\nfunction SummaryContainer({\n spacingProps,\n toWizardStep,\n}: Props & {\n spacingProps?: SpacingProps\n}) {\n const tr = Form.useTranslation<Translation>()\n\n const { getValue } = Form.useData()\n const hasNoChildren = getValue('/hasChildren') === false\n\n return (\n <Card stack {...spacingProps}>\n {<Lead>{tr.ChildrenWithAge.hasChildren.title}</Lead>}\n\n <Value.SummaryList>\n <Value.Boolean\n path=\"/hasChildren\"\n label={tr.ChildrenWithAge.hasChildren.fieldLabel}\n />\n <Form.Visibility pathTrue=\"/hasChildren\">\n <Value.Number\n path=\"/countChildren\"\n label={tr.ChildrenWithAge.countChildren.fieldLabel}\n suffix={tr.ChildrenWithAge.countChildren.suffix}\n maximum={20}\n transformIn={(value) => (hasNoChildren ? 0 : value)}\n />\n <Iterate.Array\n path=\"/children\"\n limit={hasNoChildren ? 0 : undefined}\n >\n <Value.Number\n itemPath=\"/age\"\n label={tr.ChildrenWithAge.childrenAge.fieldLabel}\n suffix={tr.ChildrenWithAge.childrenAge.suffix}\n defaultValue=\"–\"\n />\n </Iterate.Array>\n <Form.Visibility pathDefined=\"/usesDaycare\">\n <Value.Boolean\n label={tr.ChildrenWithAge.usesDaycare.fieldLabel}\n path=\"/usesDaycare\"\n />\n <Form.Visibility pathTrue=\"/usesDaycare\">\n <Value.Currency\n label={tr.ChildrenWithAge.dayCareExpenses.fieldLabel}\n path=\"/daycareExpenses\"\n />\n </Form.Visibility>\n </Form.Visibility>\n\n <Form.Visibility pathDefined=\"/hasJointResponsibility\">\n <Value.Boolean\n path=\"/hasJointResponsibility\"\n label={tr.ChildrenWithAge.hasJointResponsibility.fieldLabel}\n />\n <Form.Visibility pathTrue=\"/hasJointResponsibility\">\n <Value.Currency\n label={\n tr.ChildrenWithAge.jointResponsibilityExpenses.fieldLabel\n }\n path=\"/jointResponsibilityExpenses\"\n />\n </Form.Visibility>\n </Form.Visibility>\n </Form.Visibility>\n </Value.SummaryList>\n\n {typeof toWizardStep === 'number' ? (\n <Wizard.EditButton toStep={toWizardStep} />\n ) : null}\n </Card>\n )\n}\n\nconst transformAgeItem = ({ value }) =>\n Object.prototype.hasOwnProperty.call(value || {}, 'age')\n ? value\n : { age: undefined }\n\nChildrenWithAge._supportsSpac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AAC2E,UAAU;IAACC,MAAM,EAAElE;EAAa,CAAE,CAAC,GACzC,IACA,CAAC;AAEX;AAEA,MAAMuC,gBAAgB,GAAG4B,KAAA;EAAA,IAAC;IAAEP;EAAM,CAAC,GAAAO,KAAA;EAAA,OACjCC,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACX,KAAK,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,GACpDA,KAAK,GACL;IAAEY,GAAG,EAAEV;EAAU,CAAC;AAAA;AAExBlE,eAAe,CAAC6E,qBAAqB,GAAG,IAAI"}
@@ -18,21 +18,21 @@ export declare const translations: {
18
18
  };
19
19
  hasJointResponsibility: {
20
20
  fieldLabel: string;
21
+ required: string;
21
22
  };
22
- confirmJointResponsibility: {
23
+ jointResponsibilityExpenses: {
23
24
  fieldLabel: string;
25
+ required: string;
24
26
  };
25
27
  usesDaycare: {
26
28
  fieldLabel: string;
27
29
  required: string;
30
+ helpText: string;
28
31
  };
29
- hasDaycare: {
32
+ dayCareExpenses: {
30
33
  fieldLabel: string;
34
+ required: string;
31
35
  };
32
- jointResponsibilityTrue: string;
33
- jointResponsibilityFalse: string;
34
- daycareTrue: string;
35
- daycareFalse: string;
36
36
  };
37
37
  };
38
38
  'en-GB': {
@@ -54,21 +54,21 @@ export declare const translations: {
54
54
  };
55
55
  hasJointResponsibility: {
56
56
  fieldLabel: string;
57
+ required: string;
57
58
  };
58
- confirmJointResponsibility: {
59
+ jointResponsibilityExpenses: {
59
60
  fieldLabel: string;
61
+ required: string;
60
62
  };
61
63
  usesDaycare: {
62
64
  fieldLabel: string;
63
65
  required: string;
66
+ helpText: string;
64
67
  };
65
- hasDaycare: {
68
+ dayCareExpenses: {
66
69
  fieldLabel: string;
70
+ required: string;
67
71
  };
68
- jointResponsibilityTrue: string;
69
- jointResponsibilityFalse: string;
70
- daycareTrue: string;
71
- daycareFalse: string;
72
72
  };
73
73
  };
74
74
  };
@@ -15,22 +15,22 @@ const nbNO = {
15
15
  suffix: 'år'
16
16
  },
17
17
  hasJointResponsibility: {
18
- fieldLabel: 'Har du delt omsorg for noen av barna?'
18
+ fieldLabel: 'Betaler du/dere barnebidrag?',
19
+ required: 'Du må angi om du/dere betaler barnebidrag.'
19
20
  },
20
- confirmJointResponsibility: {
21
- fieldLabel: 'Delt omsorg'
21
+ jointResponsibilityExpenses: {
22
+ fieldLabel: 'Oppgi barnebidrag per måned',
23
+ required: 'Du må oppgi barnebidrag per måned.'
22
24
  },
23
25
  usesDaycare: {
24
- fieldLabel: 'Har du/dere SFO/AKS for noen av barna?',
25
- required: 'Du må angi om du har SFO/AKS for noen av barna.'
26
+ fieldLabel: 'Har du/dere utgifter til SFO/AKS?',
27
+ required: 'Du må angi om du/dere har utgifter til SFO/AKS.',
28
+ helpText: 'Oppgi totalt beløp per måned som du betaler til Skolefritidsordningen (SFO) eller Aktivitetsskolen (AKS).\n\nBarnehageutgifter skal ikke tas med her.'
26
29
  },
27
- hasDaycare: {
28
- fieldLabel: 'Er SFO/AKS'
29
- },
30
- jointResponsibilityTrue: 'delt omsorg',
31
- jointResponsibilityFalse: 'ikke delt omsorg',
32
- daycareTrue: 'SFO/AKS',
33
- daycareFalse: 'uten SFO/AKS'
30
+ dayCareExpenses: {
31
+ fieldLabel: 'Oppgi utgifter til SFO/AKS per måned',
32
+ required: 'Du må oppgi dine utgifter til SFO/AKS per måned.'
33
+ }
34
34
  };
35
35
  const enGB = {
36
36
  hasChildren: {
@@ -49,22 +49,22 @@ const enGB = {
49
49
  suffix: 'years old'
50
50
  },
51
51
  hasJointResponsibility: {
52
- fieldLabel: 'Do you have joint parental responsibility for any of the children?'
52
+ fieldLabel: 'Do you pay child support?',
53
+ required: 'You must state whether you pay child support.'
53
54
  },
54
- confirmJointResponsibility: {
55
- fieldLabel: 'Joint parental responsibility'
55
+ jointResponsibilityExpenses: {
56
+ fieldLabel: 'Enter child support per month',
57
+ required: 'You must enter child support per month.'
56
58
  },
57
59
  usesDaycare: {
58
- fieldLabel: 'Do you have SFO/AKS for any of the children?',
59
- required: 'You must state whether you have SFO/AKS for any of the children.'
60
+ fieldLabel: 'Do you have expenses for SFO/AKS?',
61
+ required: 'You must state whether you have any expenses for SFO/AKS.',
62
+ helpText: 'State the total amount per month that you pay to Skolefritidsordningen (SFO) or Aktivitetsskolen (AKS).\n\nKindergarten expenses are not to be included here.'
60
63
  },
61
- hasDaycare: {
62
- fieldLabel: 'Has SFO/AKS'
63
- },
64
- jointResponsibilityTrue: 'joint parental responsibility',
65
- jointResponsibilityFalse: 'not joint parental responsibility',
66
- daycareTrue: 'SFO/AKS',
67
- daycareFalse: 'without SFO/AKS'
64
+ dayCareExpenses: {
65
+ fieldLabel: 'Enter expenses for SFO/AKS per month',
66
+ required: 'You must enter your expenses for SFO/AKS per month.'
67
+ }
68
68
  };
69
69
  export const translations = {
70
70
  'nb-NO': {
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenWithAgeTranslations.js","names":["nbNO","hasChildren","title","fieldLabel","required","countChildren","suffix","childrenAge","hasJointResponsibility","confirmJointResponsibility","usesDaycare","hasDaycare","jointResponsibilityTrue","jointResponsibilityFalse","daycareTrue","daycareFalse","enGB","translations","ChildrenWithAge"],"sources":["../../../../../../src/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.ts"],"sourcesContent":["const nbNO = {\n hasChildren: {\n title: 'Antall barn',\n fieldLabel: 'Har du/dere barn under 18 år?',\n required: 'Du må angi om du har barn under 18 år eller ikke.',\n },\n countChildren: {\n fieldLabel: 'Antall barn under 18 år',\n required: 'Du må skrive inn antall barn.',\n suffix: 'barn',\n },\n childrenAge: {\n fieldLabel: 'Alder på barn nr. {itemNo}',\n required: 'Du må skrive inn alder på barnet.',\n suffix: 'år',\n },\n hasJointResponsibility: {\n fieldLabel: 'Har du delt omsorg for noen av barna?',\n },\n confirmJointResponsibility: {\n fieldLabel: 'Delt omsorg',\n },\n usesDaycare: {\n fieldLabel: 'Har du/dere SFO/AKS for noen av barna?',\n required: 'Du må angi om du har SFO/AKS for noen av barna.',\n },\n hasDaycare: {\n fieldLabel: 'Er SFO/AKS',\n },\n jointResponsibilityTrue: 'delt omsorg',\n jointResponsibilityFalse: 'ikke delt omsorg',\n daycareTrue: 'SFO/AKS',\n daycareFalse: 'uten SFO/AKS',\n}\n\nconst enGB = {\n hasChildren: {\n title: 'Number of children',\n fieldLabel: 'Do you have children under the age of 18?',\n required: 'You must state whether you have children under 18 or not.',\n },\n countChildren: {\n fieldLabel: 'Number of children under the age of 18',\n required: 'You must enter the number of children.',\n suffix: 'children',\n },\n childrenAge: {\n fieldLabel: 'Age of child no. {itemNo}',\n required: 'You must enter the age of the child.',\n suffix: 'years old',\n },\n hasJointResponsibility: {\n fieldLabel:\n 'Do you have joint parental responsibility for any of the children?',\n },\n confirmJointResponsibility: {\n fieldLabel: 'Joint parental responsibility',\n },\n usesDaycare: {\n fieldLabel: 'Do you have SFO/AKS for any of the children?',\n required:\n 'You must state whether you have SFO/AKS for any of the children.',\n },\n hasDaycare: {\n fieldLabel: 'Has SFO/AKS',\n },\n jointResponsibilityTrue: 'joint parental responsibility',\n jointResponsibilityFalse: 'not joint parental responsibility',\n daycareTrue: 'SFO/AKS',\n daycareFalse: 'without SFO/AKS',\n} satisfies typeof nbNO\n\nexport const translations = {\n 'nb-NO': { ChildrenWithAge: nbNO },\n 'en-GB': { ChildrenWithAge: enGB },\n}\n\nexport type Translation = (typeof translations)[keyof typeof translations]\n"],"mappings":"AAAA,MAAMA,IAAI,GAAG;EACXC,WAAW,EAAE;IACXC,KAAK,EAAE,aAAa;IACpBC,UAAU,EAAE,+BAA+B;IAC3CC,QAAQ,EAAE;EACZ,CAAC;EACDC,aAAa,EAAE;IACbF,UAAU,EAAE,yBAAyB;IACrCC,QAAQ,EAAE,+BAA+B;IACzCE,MAAM,EAAE;EACV,CAAC;EACDC,WAAW,EAAE;IACXJ,UAAU,EAAE,4BAA4B;IACxCC,QAAQ,EAAE,mCAAmC;IAC7CE,MAAM,EA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ren","title","fieldLabel","required","countChildren","suffix","childrenAge","hasJointResponsibility","jointResponsibilityExpenses","usesDaycare","helpText","dayCareExpenses","enGB","translations","ChildrenWithAge"],"sources":["../../../../../../src/extensions/forms/blocks/ChildrenWithAge/ChildrenWithAgeTranslations.ts"],"sourcesContent":["const nbNO = {\n hasChildren: {\n title: 'Antall barn',\n fieldLabel: 'Har du/dere barn under 18 år?',\n required: 'Du må angi om du har barn under 18 år eller ikke.',\n },\n countChildren: {\n fieldLabel: 'Antall barn under 18 år',\n required: 'Du må skrive inn antall barn.',\n suffix: 'barn',\n },\n childrenAge: {\n fieldLabel: 'Alder på barn nr. {itemNo}',\n required: 'Du må skrive inn alder på barnet.',\n suffix: 'år',\n },\n hasJointResponsibility: {\n fieldLabel: 'Betaler du/dere barnebidrag?',\n required: 'Du angi om du/dere betaler barnebidrag.',\n },\n jointResponsibilityExpenses: {\n fieldLabel: 'Oppgi barnebidrag per måned',\n required: 'Du må oppgi barnebidrag per måned.',\n },\n usesDaycare: {\n fieldLabel: 'Har du/dere utgifter til SFO/AKS?',\n required: 'Du må angi om du/dere har utgifter til SFO/AKS.',\n helpText:\n 'Oppgi totalt beløp per måned som du betaler til Skolefritidsordningen (SFO) eller Aktivitetsskolen (AKS).\\n\\nBarnehageutgifter skal ikke tas med her.',\n },\n dayCareExpenses: {\n fieldLabel: 'Oppgi utgifter til SFO/AKS per måned',\n required: 'Du oppgi dine utgifter til SFO/AKS per måned.',\n },\n}\n\nconst enGB = {\n hasChildren: {\n title: 'Number of children',\n fieldLabel: 'Do you have children under the age of 18?',\n required: 'You must state whether you have children under 18 or not.',\n },\n countChildren: {\n fieldLabel: 'Number of children under the age of 18',\n required: 'You must enter the number of children.',\n suffix: 'children',\n },\n childrenAge: {\n fieldLabel: 'Age of child no. {itemNo}',\n required: 'You must enter the age of the child.',\n suffix: 'years old',\n },\n hasJointResponsibility: {\n fieldLabel: 'Do you pay child support?',\n required: 'You must state whether you pay child support.',\n },\n jointResponsibilityExpenses: {\n fieldLabel: 'Enter child support per month',\n required: 'You must enter child support per month.',\n },\n usesDaycare: {\n fieldLabel: 'Do you have expenses for SFO/AKS?',\n required: 'You must state whether you have any expenses for SFO/AKS.',\n helpText:\n 'State the total amount per month that you pay to Skolefritidsordningen (SFO) or Aktivitetsskolen (AKS).\\n\\nKindergarten expenses are not to be included here.',\n },\n dayCareExpenses: {\n fieldLabel: 'Enter expenses for SFO/AKS per month',\n required: 'You must enter your expenses for SFO/AKS per month.',\n },\n} satisfies typeof nbNO\n\nexport const translations = {\n 'nb-NO': { ChildrenWithAge: nbNO },\n 'en-GB': { ChildrenWithAge: enGB },\n}\n\nexport type Translation = (typeof translations)[keyof typeof translations]\n"],"mappings":"AAAA,MAAMA,IAAI,GAAG;EACXC,WAAW,EAAE;IACXC,KAAK,EAAE,aAAa;IACpBC,UAAU,EAAE,+BAA+B;IAC3CC,QAAQ,EAAE;EACZ,CAAC;EACDC,aAAa,EAAE;IACbF,UAAU,EAAE,yBAAyB;IACrCC,QAAQ,EAAE,+BAA+B;IACzCE,MAAM,EAAE;EACV,CAAC;EACDC,WAAW,EAAE;IACXJ,UAAU,EAAE,4BAA4B;IACxCC,QAAQ,EAAE,mCAAmC;IAC7CE,MAAM,EAAE;EACV,CAAC;EACDE,sBAAsB,EAAE;IACtBL,UAAU,EAAE,8BAA8B;IAC1CC,QAAQ,EAAE;EACZ,CAAC;EACDK,2BAA2B,EAAE;IAC3BN,UAAU,EAAE,6BAA6B;IACzCC,QAAQ,EAAE;EACZ,CAAC;EACDM,WAAW,EAAE;IACXP,UAAU,EAAE,mCAAmC;IAC/CC,QAAQ,EAAE,iDAAiD;IAC3DO,QAAQ,EACN;EACJ,CAAC;EACDC,eAAe,EAAE;IACfT,UAAU,EAAE,sCAAsC;IAClDC,QAAQ,EAAE;EACZ;AACF,CAAC;AAED,MAAMS,IAAI,GAAG;EACXZ,WAAW,EAAE;IACXC,KAAK,EAAE,oBAAoB;IAC3BC,UAAU,EAAE,2CAA2C;IACvDC,QAAQ,EAAE;EACZ,CAAC;EACDC,aAAa,EAAE;IACbF,UAAU,EAAE,wCAAwC;IACpDC,QAAQ,EAAE,wCAAwC;IAClDE,MAAM,EAAE;EACV,CAAC;EACDC,WAAW,EAAE;IACXJ,UAAU,EAAE,2BAA2B;IACvCC,QAAQ,EAAE,sCAAsC;IAChDE,MAAM,EAAE;EACV,CAAC;EACDE,sBAAsB,EAAE;IACtBL,UAAU,EAAE,2BAA2B;IACvCC,QAAQ,EAAE;EACZ,CAAC;EACDK,2BAA2B,EAAE;IAC3BN,UAAU,EAAE,+BAA+B;IAC3CC,QAAQ,EAAE;EACZ,CAAC;EACDM,WAAW,EAAE;IACXP,UAAU,EAAE,mCAAmC;IAC/CC,QAAQ,EAAE,2DAA2D;IACrEO,QAAQ,EACN;EACJ,CAAC;EACDC,eAAe,EAAE;IACfT,UAAU,EAAE,sCAAsC;IAClDC,QAAQ,EAAE;EACZ;AACF,CAAuB;AAEvB,OAAO,MAAMU,YAAY,GAAG;EAC1B,OAAO,EAAE;IAAEC,eAAe,EAAEf;EAAK,CAAC;EAClC,OAAO,EAAE;IAAEe,eAAe,EAAEF;EAAK;AACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnb/eufemia",
3
- "version": "10.52.0",
3
+ "version": "10.52.1",
4
4
  "description": "DNB Eufemia Design System UI Library",
5
5
  "license": "SEE LICENSE IN LICENSE FILE",
6
6
  "author": "DNB Team & Tobias Høegh",
@@ -1,2 +1,2 @@
1
- export declare const version = "10.52.0";
1
+ export declare const version = "10.52.1";
2
2
  export declare function init(): void;
package/shared/Eufemia.js CHANGED
@@ -1,9 +1,9 @@
1
- export const version = '10.52.0';
1
+ export const version = '10.52.1';
2
2
  export function init() {
3
3
  if (typeof window !== 'undefined') {
4
4
  class Eufemia {
5
5
  get version() {
6
- return '10.52.0';
6
+ return '10.52.1';
7
7
  }
8
8
  }
9
9
  window.Eufemia = new Eufemia();
@@ -1 +1 @@
1
- {"version":3,"file":"Eufemia.js","names":["version","init","window","Eufemia"],"sources":["../../../src/shared/Eufemia.ts"],"sourcesContent":["export const version = '10.52.0'\n\nexport function init() {\n if (typeof window !== 'undefined') {\n class Eufemia {\n get version() {\n return '10.52.0'\n }\n }\n\n window.Eufemia = new Eufemia()\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,SAAS;AAEhC,OAAO,SAASC,IAAIA,CAAA,EAAG;EACrB,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,MAAMC,OAAO,CAAC;MACZ,IAAIH,OAAOA,CAAA,EAAG;QACZ,OAAO,SAAS;MAClB;IACF;IAEAE,MAAM,CAACC,OAAO,GAAG,IAAIA,OAAO,CAAC,CAAC;EAChC;AACF"}
1
+ {"version":3,"file":"Eufemia.js","names":["version","init","window","Eufemia"],"sources":["../../../src/shared/Eufemia.ts"],"sourcesContent":["export const version = '10.52.1'\n\nexport function init() {\n if (typeof window !== 'undefined') {\n class Eufemia {\n get version() {\n return '10.52.1'\n }\n }\n\n window.Eufemia = new Eufemia()\n }\n}\n"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,SAAS;AAEhC,OAAO,SAASC,IAAIA,CAAA,EAAG;EACrB,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,MAAMC,OAAO,CAAC;MACZ,IAAIH,OAAOA,CAAA,EAAG;QACZ,OAAO,SAAS;MAClB;IACF;IAEAE,MAAM,CAACC,OAAO,GAAG,IAAIA,OAAO,CAAC,CAAC;EAChC;AACF"}
@@ -45,7 +45,7 @@
45
45
  word-break: break-word;
46
46
 
47
47
  // Will add this to the body tag – later we can test for a version mismatch
48
- --eufemia-version: '10.52.0';
48
+ --eufemia-version: '10.52.1';
49
49
 
50
50
  @content;
51
51
  }
@@ -251,7 +251,7 @@ body {
251
251
  /* stylelint-disable-next-line */
252
252
  -webkit-text-size-adjust: 100%;
253
253
  word-break: break-word;
254
- --eufemia-version: "10.52.0";
254
+ --eufemia-version: "10.52.1";
255
255
  }
256
256
  .dnb-core-style *,
257
257
  .dnb-core-style ::before,