@dnb/eufemia 10.39.0 → 10.40.0
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/CHANGELOG.md +14 -0
- package/cjs/components/badge/Badge.js +2 -1
- package/cjs/components/badge/Badge.js.map +1 -1
- package/cjs/components/badge/style/dnb-badge.css +6 -0
- package/cjs/components/badge/style/dnb-badge.min.css +1 -1
- package/cjs/components/badge/style/dnb-badge.scss +12 -0
- package/cjs/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +3 -3
- package/cjs/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
- package/cjs/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js +2 -2
- package/cjs/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/EditToolbarTools.js +6 -5
- package/cjs/extensions/forms/Iterate/EditContainer/EditToolbarTools.js.map +1 -1
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js +2 -2
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js +3 -3
- package/cjs/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js.map +1 -1
- package/cjs/extensions/forms/Wizard/EditButton/EditButton.js +2 -2
- package/cjs/extensions/forms/Wizard/EditButton/EditButton.js.map +1 -1
- package/cjs/extensions/forms/Wizard/NextButton/NextButton.js +2 -2
- package/cjs/extensions/forms/Wizard/NextButton/NextButton.js.map +1 -1
- package/cjs/extensions/forms/Wizard/PreviousButton/PreviousButton.js +2 -2
- package/cjs/extensions/forms/Wizard/PreviousButton/PreviousButton.js.map +1 -1
- package/cjs/extensions/forms/constants/locales/en-GB.d.ts +28 -8
- package/cjs/extensions/forms/constants/locales/en-GB.js +28 -8
- package/cjs/extensions/forms/constants/locales/en-GB.js.map +1 -1
- package/cjs/extensions/forms/constants/locales/en-US.d.ts +28 -8
- package/cjs/extensions/forms/constants/locales/index.d.ts +56 -16
- package/cjs/extensions/forms/constants/locales/nb-NO.d.ts +28 -8
- package/cjs/extensions/forms/constants/locales/nb-NO.js +28 -8
- package/cjs/extensions/forms/constants/locales/nb-NO.js.map +1 -1
- package/cjs/shared/Eufemia.d.ts +1 -1
- package/cjs/shared/Eufemia.js +2 -2
- package/cjs/shared/Eufemia.js.map +1 -1
- package/cjs/shared/helpers/isAsync.js +5 -1
- package/cjs/shared/helpers/isAsync.js.map +1 -1
- package/cjs/style/core/scopes.scss +1 -1
- package/cjs/style/dnb-ui-basis.css +1 -1
- package/cjs/style/dnb-ui-basis.min.css +1 -1
- package/cjs/style/dnb-ui-body.css +1 -1
- package/cjs/style/dnb-ui-body.min.css +1 -1
- package/cjs/style/dnb-ui-components.css +6 -0
- package/cjs/style/dnb-ui-components.min.css +1 -1
- package/cjs/style/dnb-ui-core.css +1 -1
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/cjs/style/themes/theme-eiendom/eiendom-theme-components.css +6 -0
- package/cjs/style/themes/theme-eiendom/eiendom-theme-components.min.css +1 -1
- package/cjs/style/themes/theme-sbanken/sbanken-theme-components.css +6 -0
- package/cjs/style/themes/theme-sbanken/sbanken-theme-components.min.css +1 -1
- package/cjs/style/themes/theme-ui/ui-theme-components.css +6 -0
- package/cjs/style/themes/theme-ui/ui-theme-components.min.css +1 -1
- package/components/badge/Badge.js +2 -1
- package/components/badge/Badge.js.map +1 -1
- package/components/badge/style/dnb-badge.css +6 -0
- package/components/badge/style/dnb-badge.min.css +1 -1
- package/components/badge/style/dnb-badge.scss +12 -0
- package/es/components/badge/Badge.js +2 -1
- package/es/components/badge/Badge.js.map +1 -1
- package/es/components/badge/style/dnb-badge.css +6 -0
- package/es/components/badge/style/dnb-badge.min.css +1 -1
- package/es/components/badge/style/dnb-badge.scss +12 -0
- package/es/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +3 -3
- package/es/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
- package/es/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js +2 -2
- package/es/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/EditToolbarTools.js +5 -4
- package/es/extensions/forms/Iterate/EditContainer/EditToolbarTools.js.map +1 -1
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js +2 -2
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/es/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js +3 -3
- package/es/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js.map +1 -1
- package/es/extensions/forms/Wizard/EditButton/EditButton.js +2 -2
- package/es/extensions/forms/Wizard/EditButton/EditButton.js.map +1 -1
- package/es/extensions/forms/Wizard/NextButton/NextButton.js +2 -2
- package/es/extensions/forms/Wizard/NextButton/NextButton.js.map +1 -1
- package/es/extensions/forms/Wizard/PreviousButton/PreviousButton.js +2 -2
- package/es/extensions/forms/Wizard/PreviousButton/PreviousButton.js.map +1 -1
- package/es/extensions/forms/constants/locales/en-GB.d.ts +28 -8
- package/es/extensions/forms/constants/locales/en-GB.js +28 -8
- package/es/extensions/forms/constants/locales/en-GB.js.map +1 -1
- package/es/extensions/forms/constants/locales/en-US.d.ts +28 -8
- package/es/extensions/forms/constants/locales/index.d.ts +56 -16
- package/es/extensions/forms/constants/locales/nb-NO.d.ts +28 -8
- package/es/extensions/forms/constants/locales/nb-NO.js +28 -8
- package/es/extensions/forms/constants/locales/nb-NO.js.map +1 -1
- package/es/shared/Eufemia.d.ts +1 -1
- package/es/shared/Eufemia.js +2 -2
- package/es/shared/Eufemia.js.map +1 -1
- package/es/shared/helpers/isAsync.js +5 -1
- package/es/shared/helpers/isAsync.js.map +1 -1
- package/es/style/core/scopes.scss +1 -1
- package/es/style/dnb-ui-basis.css +1 -1
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-body.css +1 -1
- package/es/style/dnb-ui-body.min.css +1 -1
- package/es/style/dnb-ui-components.css +6 -0
- package/es/style/dnb-ui-components.min.css +1 -1
- package/es/style/dnb-ui-core.css +1 -1
- package/es/style/dnb-ui-core.min.css +1 -1
- package/es/style/themes/theme-eiendom/eiendom-theme-components.css +6 -0
- package/es/style/themes/theme-eiendom/eiendom-theme-components.min.css +1 -1
- package/es/style/themes/theme-sbanken/sbanken-theme-components.css +6 -0
- package/es/style/themes/theme-sbanken/sbanken-theme-components.min.css +1 -1
- package/es/style/themes/theme-ui/ui-theme-components.css +6 -0
- package/es/style/themes/theme-ui/ui-theme-components.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +3 -3
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js +3 -3
- package/extensions/forms/Form/Section/EditContainer/EditToolbarTools.js.map +1 -1
- package/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js +2 -2
- package/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/EditToolbarTools.js +5 -4
- package/extensions/forms/Iterate/EditContainer/EditToolbarTools.js.map +1 -1
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js +2 -2
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js +3 -3
- package/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.js.map +1 -1
- package/extensions/forms/Wizard/EditButton/EditButton.js +2 -2
- package/extensions/forms/Wizard/EditButton/EditButton.js.map +1 -1
- package/extensions/forms/Wizard/NextButton/NextButton.js +2 -2
- package/extensions/forms/Wizard/NextButton/NextButton.js.map +1 -1
- package/extensions/forms/Wizard/PreviousButton/PreviousButton.js +2 -2
- package/extensions/forms/Wizard/PreviousButton/PreviousButton.js.map +1 -1
- package/extensions/forms/constants/locales/en-GB.d.ts +28 -8
- package/extensions/forms/constants/locales/en-GB.js +28 -8
- package/extensions/forms/constants/locales/en-GB.js.map +1 -1
- package/extensions/forms/constants/locales/en-US.d.ts +28 -8
- package/extensions/forms/constants/locales/index.d.ts +56 -16
- package/extensions/forms/constants/locales/nb-NO.d.ts +28 -8
- package/extensions/forms/constants/locales/nb-NO.js +28 -8
- package/extensions/forms/constants/locales/nb-NO.js.map +1 -1
- package/package.json +1 -1
- package/shared/Eufemia.d.ts +1 -1
- package/shared/Eufemia.js +2 -2
- package/shared/Eufemia.js.map +1 -1
- package/shared/helpers/isAsync.js +5 -1
- package/shared/helpers/isAsync.js.map +1 -1
- package/style/core/scopes.scss +1 -1
- package/style/dnb-ui-basis.css +1 -1
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-body.css +1 -1
- package/style/dnb-ui-body.min.css +1 -1
- package/style/dnb-ui-components.css +6 -0
- package/style/dnb-ui-components.min.css +1 -1
- package/style/dnb-ui-core.css +1 -1
- package/style/dnb-ui-core.min.css +1 -1
- package/style/themes/theme-eiendom/eiendom-theme-components.css +6 -0
- package/style/themes/theme-eiendom/eiendom-theme-components.min.css +1 -1
- package/style/themes/theme-sbanken/sbanken-theme-components.css +6 -0
- package/style/themes/theme-sbanken/sbanken-theme-components.min.css +1 -1
- package/style/themes/theme-ui/ui-theme-components.css +6 -0
- package/style/themes/theme-ui/ui-theme-components.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +3 -3
- package/umd/dnb-ui-lib.min.js +1 -1
|
@@ -61,9 +61,10 @@ function Badge(localProps) {
|
|
|
61
61
|
if (!label && contentIsNum) {
|
|
62
62
|
warn(`Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`);
|
|
63
63
|
}
|
|
64
|
+
const isInline = !children && content;
|
|
64
65
|
return React.createElement("span", _extends({
|
|
65
66
|
role: "status",
|
|
66
|
-
className: classnames(`dnb-badge dnb-badge--variant-${variant}`, skeletonClasses, spacingClasses, className, horizontal && `dnb-badge--horizontal-${horizontal}`, vertical && `dnb-badge--vertical-${vertical}
|
|
67
|
+
className: classnames(`dnb-badge dnb-badge--variant-${variant}`, skeletonClasses, spacingClasses, className, horizontal && `dnb-badge--horizontal-${horizontal}`, vertical && `dnb-badge--vertical-${vertical}`, isInline && 'dnb-badge--inline')
|
|
67
68
|
}, props), label && (_span || (_span = React.createElement("span", {
|
|
68
69
|
className: "dnb-sr-only"
|
|
69
70
|
}, label, " "))), content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":["React","classnames","createSpacingClasses","createSkeletonClass","Context","warn","extendPropsWithContext","validateDOMAttributes","defaultProps","label","className","skeleton","children","content","vertical","horizontal","variant","Badge","localProps","_span","context","useContext","allProps","contentProp","props","_objectWithoutProperties","_excluded","createElement","BadgeRoot","BadgeElem","_ref","skeletonClasses","spacingClasses","contentIsNum","variantIsNotification","_extends","role","_supportsSpacingProps"],"sources":["../../../../src/components/badge/Badge.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\n\n// Components\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport { createSkeletonClass } from '../skeleton/SkeletonHelper'\n\n// Shared\nimport Context from '../../shared/Context'\nimport type { SpacingProps } from '../../shared/types'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport {\n warn,\n extendPropsWithContext,\n validateDOMAttributes,\n} from '../../shared/component-helper'\n\nexport type BadgeProps = {\n /**\n * Aria label to describe the badge\n * Default: null\n */\n label?: React.ReactNode\n\n /**\n * Custom className on the component root\n * Default: null\n */\n className?: string\n\n /**\n * Skeleton should be applied when loading content\n * Default: null\n */\n skeleton?: SkeletonShow\n\n /**\n * The content to display the badge on top of.\n * Default: null\n */\n children?: React.ReactNode\n\n /**\n * The content of the component.\n * Default: null\n */\n content?: string | number | React.ReactNode\n\n /**\n * The vertical positioning of the component.\n * Default: null\n */\n vertical?: 'bottom' | 'top'\n\n /**\n * The horizontal positioning of the component.\n * Default: null\n */\n horizontal?: 'left' | 'right'\n\n /**\n * The variant of the component.\n * Default: information.\n */\n variant?: 'information' | 'notification'\n}\n\ntype BadgeAndSpacingProps = BadgeProps & SpacingProps\n\nexport const defaultProps = {\n label: null,\n className: null,\n skeleton: false,\n children: null,\n content: null,\n vertical: null,\n horizontal: null,\n variant: 'information',\n}\n\nfunction Badge(localProps: BadgeAndSpacingProps) {\n // Every component should have a context\n const context = React.useContext(Context)\n\n // Extract additional props from global context\n const allProps = extendPropsWithContext(\n localProps,\n defaultProps,\n context?.Badge,\n { skeleton: context?.skeleton }\n )\n\n const {\n label,\n className,\n children, // eslint-disable-line\n skeleton,\n horizontal,\n vertical,\n content: contentProp,\n variant,\n ...props\n } = allProps\n\n validateDOMAttributes(allProps, props)\n\n if (children) {\n return (\n <BadgeRoot>\n {children}\n <BadgeElem />\n </BadgeRoot>\n )\n }\n\n return <BadgeElem />\n\n function BadgeRoot({ children }: { children: React.ReactNode }) {\n return <span className=\"dnb-badge__root\">{children}</span>\n }\n\n function BadgeElem() {\n const skeletonClasses = createSkeletonClass('shape', skeleton, context)\n const spacingClasses = createSpacingClasses(allProps)\n const contentIsNum = typeof contentProp === 'number'\n const variantIsNotification = variant === 'notification'\n\n const content =\n variantIsNotification && contentIsNum && contentProp > 9\n ? '9+'\n : contentProp\n\n if (variantIsNotification && !contentIsNum) {\n warn(\n `Type of content should be a number: A notification badge is best suited to display content of type number.`\n )\n }\n if (!label && contentIsNum) {\n warn(\n `Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`\n )\n }\n\n return (\n <span\n role=\"status\"\n className={classnames(\n 'dnb-badge',\n `dnb-badge--variant-${variant}`,\n horizontal && `dnb-badge--horizontal-${horizontal}`,\n vertical && `dnb-badge--vertical-${vertical}`,\n skeletonClasses,\n spacingClasses,\n className\n )}\n {...props}\n >\n {label && <span className=\"dnb-sr-only\">{label} </span>}\n {content}\n </span>\n )\n }\n}\n\nBadge._supportsSpacingProps = true\n\nexport default Badge\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAGnC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,4BAA4B;AAGhE,OAAOC,OAAO,MAAM,sBAAsB;AAG1C,SACEC,IAAI,EACJC,sBAAsB,EACtBC,qBAAqB,QAChB,+BAA+B;AAsDtC,OAAO,MAAMC,YAAY,GAAG;EAC1BC,KAAK,EAAE,IAAI;EACXC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE,IAAI;EACdC,UAAU,EAAE,IAAI;EAChBC,OAAO,EAAE;AACX,CAAC;AAED,SAASC,KAAKA,CAACC,UAAgC,EAAE;EAAA,IAAAC,KAAA;EAE/C,MAAMC,OAAO,GAAGpB,KAAK,CAACqB,UAAU,CAACjB,OAAO,CAAC;EAGzC,MAAMkB,QAAQ,GAAGhB,sBAAsB,CACrCY,UAAU,EACVV,YAAY,EACZY,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEH,KAAK,EACd;IAAEN,QAAQ,EAAES,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAET;EAAS,CAChC,CAAC;EAED,MAAM;MACJF,KAAK;MACLC,SAAS;MACTE,QAAQ;MACRD,QAAQ;MACRI,UAAU;MACVD,QAAQ;MACRD,OAAO,EAAEU,WAAW;MACpBP;IAEF,CAAC,GAAGM,QAAQ;IADPE,KAAK,GAAAC,wBAAA,CACNH,QAAQ,EAAAI,SAAA;EAEZnB,qBAAqB,CAACe,QAAQ,EAAEE,KAAK,CAAC;EAEtC,IAAIZ,QAAQ,EAAE;IACZ,OACEZ,KAAA,CAAA2B,aAAA,CAACC,SAAS,QACPhB,QAAQ,EACTZ,KAAA,CAAA2B,aAAA,CAACE,SAAS,MAAE,CACH,CAAC;EAEhB;EAEA,OAAO7B,KAAA,CAAA2B,aAAA,CAACE,SAAS,MAAE,CAAC;EAEpB,SAASD,SAASA,CAAAE,IAAA,EAA8C;IAAA,IAA7C;MAAElB;IAAwC,CAAC,GAAAkB,IAAA;IAC5D,OAAO9B,KAAA,CAAA2B,aAAA;MAAMjB,SAAS,EAAC;IAAiB,GAAEE,QAAe,CAAC;EAC5D;EAEA,SAASiB,SAASA,CAAA,EAAG;IACnB,MAAME,eAAe,GAAG5B,mBAAmB,CAAC,OAAO,EAAEQ,QAAQ,EAAES,OAAO,CAAC;IACvE,MAAMY,cAAc,GAAG9B,oBAAoB,CAACoB,QAAQ,CAAC;IACrD,MAAMW,YAAY,GAAG,OAAOV,WAAW,KAAK,QAAQ;IACpD,MAAMW,qBAAqB,GAAGlB,OAAO,KAAK,cAAc;IAExD,MAAMH,OAAO,GACXqB,qBAAqB,IAAID,YAAY,IAAIV,WAAW,GAAG,CAAC,GACpD,IAAI,GACJA,WAAW;IAEjB,IAAIW,qBAAqB,IAAI,CAACD,YAAY,EAAE;MAC1C5B,IAAI,CACD,4GACH,CAAC;IACH;IACA,IAAI,CAACI,KAAK,IAAIwB,YAAY,EAAE;MAC1B5B,IAAI,CACD,8JACH,CAAC;IACH;IAEA,
|
|
1
|
+
{"version":3,"file":"Badge.js","names":["React","classnames","createSpacingClasses","createSkeletonClass","Context","warn","extendPropsWithContext","validateDOMAttributes","defaultProps","label","className","skeleton","children","content","vertical","horizontal","variant","Badge","localProps","_span","context","useContext","allProps","contentProp","props","_objectWithoutProperties","_excluded","createElement","BadgeRoot","BadgeElem","_ref","skeletonClasses","spacingClasses","contentIsNum","variantIsNotification","isInline","_extends","role","_supportsSpacingProps"],"sources":["../../../../src/components/badge/Badge.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\n\n// Components\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport { createSkeletonClass } from '../skeleton/SkeletonHelper'\n\n// Shared\nimport Context from '../../shared/Context'\nimport type { SpacingProps } from '../../shared/types'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport {\n warn,\n extendPropsWithContext,\n validateDOMAttributes,\n} from '../../shared/component-helper'\n\nexport type BadgeProps = {\n /**\n * Aria label to describe the badge\n * Default: null\n */\n label?: React.ReactNode\n\n /**\n * Custom className on the component root\n * Default: null\n */\n className?: string\n\n /**\n * Skeleton should be applied when loading content\n * Default: null\n */\n skeleton?: SkeletonShow\n\n /**\n * The content to display the badge on top of.\n * Default: null\n */\n children?: React.ReactNode\n\n /**\n * The content of the component.\n * Default: null\n */\n content?: string | number | React.ReactNode\n\n /**\n * The vertical positioning of the component.\n * Default: null\n */\n vertical?: 'bottom' | 'top'\n\n /**\n * The horizontal positioning of the component.\n * Default: null\n */\n horizontal?: 'left' | 'right'\n\n /**\n * The variant of the component.\n * Default: information.\n */\n variant?: 'information' | 'notification'\n}\n\ntype BadgeAndSpacingProps = BadgeProps & SpacingProps\n\nexport const defaultProps = {\n label: null,\n className: null,\n skeleton: false,\n children: null,\n content: null,\n vertical: null,\n horizontal: null,\n variant: 'information',\n}\n\nfunction Badge(localProps: BadgeAndSpacingProps) {\n // Every component should have a context\n const context = React.useContext(Context)\n\n // Extract additional props from global context\n const allProps = extendPropsWithContext(\n localProps,\n defaultProps,\n context?.Badge,\n { skeleton: context?.skeleton }\n )\n\n const {\n label,\n className,\n children, // eslint-disable-line\n skeleton,\n horizontal,\n vertical,\n content: contentProp,\n variant,\n ...props\n } = allProps\n\n validateDOMAttributes(allProps, props)\n\n if (children) {\n return (\n <BadgeRoot>\n {children}\n <BadgeElem />\n </BadgeRoot>\n )\n }\n\n return <BadgeElem />\n\n function BadgeRoot({ children }: { children: React.ReactNode }) {\n return <span className=\"dnb-badge__root\">{children}</span>\n }\n\n function BadgeElem() {\n const skeletonClasses = createSkeletonClass('shape', skeleton, context)\n const spacingClasses = createSpacingClasses(allProps)\n const contentIsNum = typeof contentProp === 'number'\n const variantIsNotification = variant === 'notification'\n\n const content =\n variantIsNotification && contentIsNum && contentProp > 9\n ? '9+'\n : contentProp\n\n if (variantIsNotification && !contentIsNum) {\n warn(\n `Type of content should be a number: A notification badge is best suited to display content of type number.`\n )\n }\n if (!label && contentIsNum) {\n warn(\n `Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`\n )\n }\n\n const isInline = !children && content\n\n return (\n <span\n role=\"status\"\n className={classnames(\n 'dnb-badge',\n `dnb-badge--variant-${variant}`,\n horizontal && `dnb-badge--horizontal-${horizontal}`,\n vertical && `dnb-badge--vertical-${vertical}`,\n isInline && 'dnb-badge--inline',\n skeletonClasses,\n spacingClasses,\n className\n )}\n {...props}\n >\n {label && <span className=\"dnb-sr-only\">{label} </span>}\n {content}\n </span>\n )\n }\n}\n\nBadge._supportsSpacingProps = true\n\nexport default Badge\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAGnC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,4BAA4B;AAGhE,OAAOC,OAAO,MAAM,sBAAsB;AAG1C,SACEC,IAAI,EACJC,sBAAsB,EACtBC,qBAAqB,QAChB,+BAA+B;AAsDtC,OAAO,MAAMC,YAAY,GAAG;EAC1BC,KAAK,EAAE,IAAI;EACXC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE,IAAI;EACdC,UAAU,EAAE,IAAI;EAChBC,OAAO,EAAE;AACX,CAAC;AAED,SAASC,KAAKA,CAACC,UAAgC,EAAE;EAAA,IAAAC,KAA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AAW,GAAG,CAAC,GACpD,IAAI,GACJA,WAAW;IAEjB,IAAIW,qBAAqB,IAAI,CAACD,YAAY,EAAE;MAC1C5B,IAAI,CACD,4GACH,CAAC;IACH;IACA,IAAI,CAACI,KAAK,IAAIwB,YAAY,EAAE;MAC1B5B,IAAI,CACD,8JACH,CAAC;IACH;IAEA,MAAM8B,QAAQ,GAAG,CAACvB,QAAQ,IAAIC,OAAO;IAErC,OACEb,KAAA,CAAA2B,aAAA,SAAAS,QAAA;MACEC,IAAI,EAAC,QAAQ;MACb3B,SAAS,EAAET,UAAU,iCAEGe,OAAQ,IAI9Be,eAAe,EACfC,cAAc,EACdtB,SAAS,EALTK,UAAU,IAAK,yBAAwBA,UAAW,EAAC,EACnDD,QAAQ,IAAK,uBAAsBA,QAAS,EAAC,EAC7CqB,QAAQ,IAAI,mBAId;IAAE,GACEX,KAAK,GAERf,KAAK,KAAAU,KAAA,KAAAA,KAAA,GAAInB,KAAA,CAAA2B,aAAA;MAAMjB,SAAS,EAAC;IAAa,GAAED,KAAK,EAAC,GAAO,CAAC,IACtDI,OACG,CAAC;EAEX;AACF;AAEAI,KAAK,CAACqB,qBAAqB,GAAG,IAAI;AAElC,eAAerB,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.dnb-badge{--badge-font-size:var(--font-size-x-small);--badge-width:1.5rem;--badge-height:1.5rem;--badge-border-radius-information:calc(var(--badge-height)/4);--badge-border-radius-notification:calc(var(--badge-height)/2);--badge-line-height:var(--line-height-x-small);align-content:center;align-items:center;display:inline-flex;flex-flow:row wrap;font-size:var(--badge-font-size);font-weight:var(--font-weight-medium);height:var(--badge-height);justify-content:center;white-space:nowrap;width:var(--badge-width)}.dnb-badge,.dnb-core-style .dnb-badge{line-height:var(--badge-line-height)}.dnb-badge__root{display:inline-flex;flex-shrink:0;position:relative;vertical-align:middle}.dnb-badge__root .dnb-badge{display:flex;overflow:hidden;position:absolute;z-index:2}.dnb-badge--variant-notification{border-radius:var(--badge-border-radius-notification)}.dnb-badge--variant-information{border-radius:var(--badge-border-radius-information);min-width:var(--badge-width);padding:0 var(--spacing-xx-small);width:auto}.dnb-badge--horizontal-left{left:0}.dnb-badge--horizontal-right{right:0}.dnb-badge--vertical-bottom{bottom:0}.dnb-badge--vertical-top{top:0}
|
|
1
|
+
.dnb-badge{--badge-font-size:var(--font-size-x-small);--badge-width:1.5rem;--badge-height:1.5rem;--badge-border-radius-information:calc(var(--badge-height)/4);--badge-border-radius-notification:calc(var(--badge-height)/2);--badge-line-height:var(--line-height-x-small);align-content:center;align-items:center;display:inline-flex;flex-flow:row wrap;font-size:var(--badge-font-size);font-weight:var(--font-weight-medium);height:var(--badge-height);justify-content:center;white-space:nowrap;width:var(--badge-width)}.dnb-badge,.dnb-core-style .dnb-badge{line-height:var(--badge-line-height)}.dnb-badge__root{display:inline-flex;flex-shrink:0;position:relative;vertical-align:middle}.dnb-badge__root .dnb-badge{display:flex;overflow:hidden;position:absolute;z-index:2}.dnb-badge--variant-notification{border-radius:var(--badge-border-radius-notification)}.dnb-badge--variant-information{border-radius:var(--badge-border-radius-information);min-width:var(--badge-width);padding:0 var(--spacing-xx-small);width:auto}.dnb-badge--horizontal-left{left:0}.dnb-badge--horizontal-right{right:0}.dnb-badge--vertical-bottom{bottom:0}.dnb-badge--vertical-top{top:0}.dnb-badge--inline.dnb-badge--vertical-top{transform:translateY(-25%)}.dnb-badge--inline.dnb-badge--vertical-bottom{transform:translateY(25%)}
|
|
@@ -71,4 +71,16 @@
|
|
|
71
71
|
&--vertical-top {
|
|
72
72
|
top: 0;
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
&--inline {
|
|
76
|
+
&.dnb-badge--vertical-top {
|
|
77
|
+
// 1/4 of the badge height
|
|
78
|
+
transform: translateY(-25%);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.dnb-badge--vertical-bottom {
|
|
82
|
+
// 1/4 of the badge height
|
|
83
|
+
transform: translateY(25%);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
74
86
|
}
|
|
@@ -60,9 +60,10 @@ function Badge(localProps) {
|
|
|
60
60
|
if (!label && contentIsNum) {
|
|
61
61
|
warn(`Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`);
|
|
62
62
|
}
|
|
63
|
+
const isInline = !children && content;
|
|
63
64
|
return React.createElement("span", _extends({
|
|
64
65
|
role: "status",
|
|
65
|
-
className: classnames(`dnb-badge dnb-badge--variant-${variant}`, skeletonClasses, spacingClasses, className, horizontal && `dnb-badge--horizontal-${horizontal}`, vertical && `dnb-badge--vertical-${vertical}
|
|
66
|
+
className: classnames(`dnb-badge dnb-badge--variant-${variant}`, skeletonClasses, spacingClasses, className, horizontal && `dnb-badge--horizontal-${horizontal}`, vertical && `dnb-badge--vertical-${vertical}`, isInline && 'dnb-badge--inline')
|
|
66
67
|
}, props), label && (_span || (_span = React.createElement("span", {
|
|
67
68
|
className: "dnb-sr-only"
|
|
68
69
|
}, label, " "))), content);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":["React","classnames","createSpacingClasses","createSkeletonClass","Context","warn","extendPropsWithContext","validateDOMAttributes","defaultProps","label","className","skeleton","children","content","vertical","horizontal","variant","Badge","localProps","_span","context","useContext","allProps","contentProp","props","_objectWithoutProperties","_excluded","createElement","BadgeRoot","BadgeElem","skeletonClasses","spacingClasses","contentIsNum","variantIsNotification","_extends","role","_supportsSpacingProps"],"sources":["../../../../src/components/badge/Badge.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\n\n// Components\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport { createSkeletonClass } from '../skeleton/SkeletonHelper'\n\n// Shared\nimport Context from '../../shared/Context'\nimport type { SpacingProps } from '../../shared/types'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport {\n warn,\n extendPropsWithContext,\n validateDOMAttributes,\n} from '../../shared/component-helper'\n\nexport type BadgeProps = {\n /**\n * Aria label to describe the badge\n * Default: null\n */\n label?: React.ReactNode\n\n /**\n * Custom className on the component root\n * Default: null\n */\n className?: string\n\n /**\n * Skeleton should be applied when loading content\n * Default: null\n */\n skeleton?: SkeletonShow\n\n /**\n * The content to display the badge on top of.\n * Default: null\n */\n children?: React.ReactNode\n\n /**\n * The content of the component.\n * Default: null\n */\n content?: string | number | React.ReactNode\n\n /**\n * The vertical positioning of the component.\n * Default: null\n */\n vertical?: 'bottom' | 'top'\n\n /**\n * The horizontal positioning of the component.\n * Default: null\n */\n horizontal?: 'left' | 'right'\n\n /**\n * The variant of the component.\n * Default: information.\n */\n variant?: 'information' | 'notification'\n}\n\ntype BadgeAndSpacingProps = BadgeProps & SpacingProps\n\nexport const defaultProps = {\n label: null,\n className: null,\n skeleton: false,\n children: null,\n content: null,\n vertical: null,\n horizontal: null,\n variant: 'information',\n}\n\nfunction Badge(localProps: BadgeAndSpacingProps) {\n // Every component should have a context\n const context = React.useContext(Context)\n\n // Extract additional props from global context\n const allProps = extendPropsWithContext(\n localProps,\n defaultProps,\n context?.Badge,\n { skeleton: context?.skeleton }\n )\n\n const {\n label,\n className,\n children, // eslint-disable-line\n skeleton,\n horizontal,\n vertical,\n content: contentProp,\n variant,\n ...props\n } = allProps\n\n validateDOMAttributes(allProps, props)\n\n if (children) {\n return (\n <BadgeRoot>\n {children}\n <BadgeElem />\n </BadgeRoot>\n )\n }\n\n return <BadgeElem />\n\n function BadgeRoot({ children }: { children: React.ReactNode }) {\n return <span className=\"dnb-badge__root\">{children}</span>\n }\n\n function BadgeElem() {\n const skeletonClasses = createSkeletonClass('shape', skeleton, context)\n const spacingClasses = createSpacingClasses(allProps)\n const contentIsNum = typeof contentProp === 'number'\n const variantIsNotification = variant === 'notification'\n\n const content =\n variantIsNotification && contentIsNum && contentProp > 9\n ? '9+'\n : contentProp\n\n if (variantIsNotification && !contentIsNum) {\n warn(\n `Type of content should be a number: A notification badge is best suited to display content of type number.`\n )\n }\n if (!label && contentIsNum) {\n warn(\n `Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`\n )\n }\n\n return (\n <span\n role=\"status\"\n className={classnames(\n 'dnb-badge',\n `dnb-badge--variant-${variant}`,\n horizontal && `dnb-badge--horizontal-${horizontal}`,\n vertical && `dnb-badge--vertical-${vertical}`,\n skeletonClasses,\n spacingClasses,\n className\n )}\n {...props}\n >\n {label && <span className=\"dnb-sr-only\">{label} </span>}\n {content}\n </span>\n )\n }\n}\n\nBadge._supportsSpacingProps = true\n\nexport default Badge\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAGnC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,4BAA4B;AAGhE,OAAOC,OAAO,MAAM,sBAAsB;AAG1C,SACEC,IAAI,EACJC,sBAAsB,EACtBC,qBAAqB,QAChB,+BAA+B;AAsDtC,OAAO,MAAMC,YAAY,GAAG;EAC1BC,KAAK,EAAE,IAAI;EACXC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE,IAAI;EACdC,UAAU,EAAE,IAAI;EAChBC,OAAO,EAAE;AACX,CAAC;AAED,SAASC,KAAKA,CAACC,UAAgC,EAAE;EAAA,IAAAC,KAAA;EAE/C,MAAMC,OAAO,GAAGpB,KAAK,CAACqB,UAAU,CAACjB,OAAO,CAAC;EAGzC,MAAMkB,QAAQ,GAAGhB,sBAAsB,CACrCY,UAAU,EACVV,YAAY,EACZY,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEH,KAAK,EACd;IAAEN,QAAQ,EAAES,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAET;EAAS,CAChC,CAAC;EAED,MAAM;MACJF,KAAK;MACLC,SAAS;MACTE,QAAQ;MACRD,QAAQ;MACRI,UAAU;MACVD,QAAQ;MACRD,OAAO,EAAEU,WAAW;MACpBP;IAEF,CAAC,GAAGM,QAAQ;IADPE,KAAK,GAAAC,wBAAA,CACNH,QAAQ,EAAAI,SAAA;EAEZnB,qBAAqB,CAACe,QAAQ,EAAEE,KAAK,CAAC;EAEtC,IAAIZ,QAAQ,EAAE;IACZ,OACEZ,KAAA,CAAA2B,aAAA,CAACC,SAAS,QACPhB,QAAQ,EACTZ,KAAA,CAAA2B,aAAA,CAACE,SAAS,MAAE,CACH,CAAC;EAEhB;EAEA,OAAO7B,KAAA,CAAA2B,aAAA,CAACE,SAAS,MAAE,CAAC;EAEpB,SAASD,SAASA,CAAC;IAAEhB;EAAwC,CAAC,EAAE;IAC9D,OAAOZ,KAAA,CAAA2B,aAAA;MAAMjB,SAAS,EAAC;IAAiB,GAAEE,QAAe,CAAC;EAC5D;EAEA,SAASiB,SAASA,CAAA,EAAG;IACnB,MAAMC,eAAe,GAAG3B,mBAAmB,CAAC,OAAO,EAAEQ,QAAQ,EAAES,OAAO,CAAC;IACvE,MAAMW,cAAc,GAAG7B,oBAAoB,CAACoB,QAAQ,CAAC;IACrD,MAAMU,YAAY,GAAG,OAAOT,WAAW,KAAK,QAAQ;IACpD,MAAMU,qBAAqB,GAAGjB,OAAO,KAAK,cAAc;IAExD,MAAMH,OAAO,GACXoB,qBAAqB,IAAID,YAAY,IAAIT,WAAW,GAAG,CAAC,GACpD,IAAI,GACJA,WAAW;IAEjB,IAAIU,qBAAqB,IAAI,CAACD,YAAY,EAAE;MAC1C3B,IAAI,CACD,4GACH,CAAC;IACH;IACA,IAAI,CAACI,KAAK,IAAIuB,YAAY,EAAE;MAC1B3B,IAAI,CACD,8JACH,CAAC;IACH;IAEA,
|
|
1
|
+
{"version":3,"file":"Badge.js","names":["React","classnames","createSpacingClasses","createSkeletonClass","Context","warn","extendPropsWithContext","validateDOMAttributes","defaultProps","label","className","skeleton","children","content","vertical","horizontal","variant","Badge","localProps","_span","context","useContext","allProps","contentProp","props","_objectWithoutProperties","_excluded","createElement","BadgeRoot","BadgeElem","skeletonClasses","spacingClasses","contentIsNum","variantIsNotification","isInline","_extends","role","_supportsSpacingProps"],"sources":["../../../../src/components/badge/Badge.tsx"],"sourcesContent":["import React from 'react'\nimport classnames from 'classnames'\n\n// Components\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport { createSkeletonClass } from '../skeleton/SkeletonHelper'\n\n// Shared\nimport Context from '../../shared/Context'\nimport type { SpacingProps } from '../../shared/types'\nimport type { SkeletonShow } from '../skeleton/Skeleton'\nimport {\n warn,\n extendPropsWithContext,\n validateDOMAttributes,\n} from '../../shared/component-helper'\n\nexport type BadgeProps = {\n /**\n * Aria label to describe the badge\n * Default: null\n */\n label?: React.ReactNode\n\n /**\n * Custom className on the component root\n * Default: null\n */\n className?: string\n\n /**\n * Skeleton should be applied when loading content\n * Default: null\n */\n skeleton?: SkeletonShow\n\n /**\n * The content to display the badge on top of.\n * Default: null\n */\n children?: React.ReactNode\n\n /**\n * The content of the component.\n * Default: null\n */\n content?: string | number | React.ReactNode\n\n /**\n * The vertical positioning of the component.\n * Default: null\n */\n vertical?: 'bottom' | 'top'\n\n /**\n * The horizontal positioning of the component.\n * Default: null\n */\n horizontal?: 'left' | 'right'\n\n /**\n * The variant of the component.\n * Default: information.\n */\n variant?: 'information' | 'notification'\n}\n\ntype BadgeAndSpacingProps = BadgeProps & SpacingProps\n\nexport const defaultProps = {\n label: null,\n className: null,\n skeleton: false,\n children: null,\n content: null,\n vertical: null,\n horizontal: null,\n variant: 'information',\n}\n\nfunction Badge(localProps: BadgeAndSpacingProps) {\n // Every component should have a context\n const context = React.useContext(Context)\n\n // Extract additional props from global context\n const allProps = extendPropsWithContext(\n localProps,\n defaultProps,\n context?.Badge,\n { skeleton: context?.skeleton }\n )\n\n const {\n label,\n className,\n children, // eslint-disable-line\n skeleton,\n horizontal,\n vertical,\n content: contentProp,\n variant,\n ...props\n } = allProps\n\n validateDOMAttributes(allProps, props)\n\n if (children) {\n return (\n <BadgeRoot>\n {children}\n <BadgeElem />\n </BadgeRoot>\n )\n }\n\n return <BadgeElem />\n\n function BadgeRoot({ children }: { children: React.ReactNode }) {\n return <span className=\"dnb-badge__root\">{children}</span>\n }\n\n function BadgeElem() {\n const skeletonClasses = createSkeletonClass('shape', skeleton, context)\n const spacingClasses = createSpacingClasses(allProps)\n const contentIsNum = typeof contentProp === 'number'\n const variantIsNotification = variant === 'notification'\n\n const content =\n variantIsNotification && contentIsNum && contentProp > 9\n ? '9+'\n : contentProp\n\n if (variantIsNotification && !contentIsNum) {\n warn(\n `Type of content should be a number: A notification badge is best suited to display content of type number.`\n )\n }\n if (!label && contentIsNum) {\n warn(\n `Label required: A Badge with a number as content requires a label describing the content of the badge. This is to ensure correct semantic and accessibility.`\n )\n }\n\n const isInline = !children && content\n\n return (\n <span\n role=\"status\"\n className={classnames(\n 'dnb-badge',\n `dnb-badge--variant-${variant}`,\n horizontal && `dnb-badge--horizontal-${horizontal}`,\n vertical && `dnb-badge--vertical-${vertical}`,\n isInline && 'dnb-badge--inline',\n skeletonClasses,\n spacingClasses,\n className\n )}\n {...props}\n >\n {label && <span className=\"dnb-sr-only\">{label} </span>}\n {content}\n </span>\n )\n }\n}\n\nBadge._supportsSpacingProps = true\n\nexport default Badge\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAGnC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,4BAA4B;AAGhE,OAAOC,OAAO,MAAM,sBAAsB;AAG1C,SACEC,IAAI,EACJC,sBAAsB,EACtBC,qBAAqB,QAChB,+BAA+B;AAsDtC,OAAO,MAAMC,YAAY,GAAG;EAC1BC,KAAK,EAAE,IAAI;EACXC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE,IAAI;EACdC,UAAU,E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cAAc;IAExD,MAAMH,OAAO,GACXoB,qBAAqB,IAAID,YAAY,IAAIT,WAAW,GAAG,CAAC,GACpD,IAAI,GACJA,WAAW;IAEjB,IAAIU,qBAAqB,IAAI,CAACD,YAAY,EAAE;MAC1C3B,IAAI,CACD,4GACH,CAAC;IACH;IACA,IAAI,CAACI,KAAK,IAAIuB,YAAY,EAAE;MAC1B3B,IAAI,CACD,8JACH,CAAC;IACH;IAEA,MAAM6B,QAAQ,GAAG,CAACtB,QAAQ,IAAIC,OAAO;IAErC,OACEb,KAAA,CAAA2B,aAAA,SAAAQ,QAAA;MACEC,IAAI,EAAC,QAAQ;MACb1B,SAAS,EAAET,UAAU,iCAEGe,OAAQ,IAI9Bc,eAAe,EACfC,cAAc,EACdrB,SAAS,EALTK,UAAU,IAAK,yBAAwBA,UAAW,EAAC,EACnDD,QAAQ,IAAK,uBAAsBA,QAAS,EAAC,EAC7CoB,QAAQ,IAAI,mBAId;IAAE,GACEV,KAAK,GAERf,KAAK,KAAAU,KAAA,KAAAA,KAAA,GAAInB,KAAA,CAAA2B,aAAA;MAAMjB,SAAS,EAAC;IAAa,GAAED,KAAK,EAAC,GAAO,CAAC,IACtDI,OACG,CAAC;EAEX;AACF;AAEAI,KAAK,CAACoB,qBAAqB,GAAG,IAAI;AAElC,eAAepB,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.dnb-badge{--badge-font-size:var(--font-size-x-small);--badge-width:1.5rem;--badge-height:1.5rem;--badge-border-radius-information:calc(var(--badge-height)/4);--badge-border-radius-notification:calc(var(--badge-height)/2);--badge-line-height:var(--line-height-x-small);align-content:center;align-items:center;display:inline-flex;flex-flow:row wrap;font-size:var(--badge-font-size);font-weight:var(--font-weight-medium);height:var(--badge-height);justify-content:center;white-space:nowrap;width:var(--badge-width)}.dnb-badge,.dnb-core-style .dnb-badge{line-height:var(--badge-line-height)}.dnb-badge__root{display:inline-flex;flex-shrink:0;position:relative;vertical-align:middle}.dnb-badge__root .dnb-badge{display:flex;overflow:hidden;position:absolute;z-index:2}.dnb-badge--variant-notification{border-radius:var(--badge-border-radius-notification)}.dnb-badge--variant-information{border-radius:var(--badge-border-radius-information);min-width:var(--badge-width);padding:0 var(--spacing-xx-small);width:auto}.dnb-badge--horizontal-left{left:0}.dnb-badge--horizontal-right{right:0}.dnb-badge--vertical-bottom{bottom:0}.dnb-badge--vertical-top{top:0}
|
|
1
|
+
.dnb-badge{--badge-font-size:var(--font-size-x-small);--badge-width:1.5rem;--badge-height:1.5rem;--badge-border-radius-information:calc(var(--badge-height)/4);--badge-border-radius-notification:calc(var(--badge-height)/2);--badge-line-height:var(--line-height-x-small);align-content:center;align-items:center;display:inline-flex;flex-flow:row wrap;font-size:var(--badge-font-size);font-weight:var(--font-weight-medium);height:var(--badge-height);justify-content:center;white-space:nowrap;width:var(--badge-width)}.dnb-badge,.dnb-core-style .dnb-badge{line-height:var(--badge-line-height)}.dnb-badge__root{display:inline-flex;flex-shrink:0;position:relative;vertical-align:middle}.dnb-badge__root .dnb-badge{display:flex;overflow:hidden;position:absolute;z-index:2}.dnb-badge--variant-notification{border-radius:var(--badge-border-radius-notification)}.dnb-badge--variant-information{border-radius:var(--badge-border-radius-information);min-width:var(--badge-width);padding:0 var(--spacing-xx-small);width:auto}.dnb-badge--horizontal-left{left:0}.dnb-badge--horizontal-right{right:0}.dnb-badge--vertical-bottom{bottom:0}.dnb-badge--vertical-top{top:0}.dnb-badge--inline.dnb-badge--vertical-top{transform:translateY(-25%)}.dnb-badge--inline.dnb-badge--vertical-bottom{transform:translateY(25%)}
|
|
@@ -71,4 +71,16 @@
|
|
|
71
71
|
&--vertical-top {
|
|
72
72
|
top: 0;
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
&--inline {
|
|
76
|
+
&.dnb-badge--vertical-top {
|
|
77
|
+
// 1/4 of the badge height
|
|
78
|
+
transform: translateY(-25%);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.dnb-badge--vertical-bottom {
|
|
82
|
+
// 1/4 of the badge height
|
|
83
|
+
transform: translateY(25%);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
74
86
|
}
|
|
@@ -20,7 +20,7 @@ export default function EditToolbarTools() {
|
|
|
20
20
|
hasVisibleError,
|
|
21
21
|
hasSubmitError
|
|
22
22
|
} = useContext(FieldBoundaryContext) || {};
|
|
23
|
-
const translation = useTranslation().
|
|
23
|
+
const translation = useTranslation().SectionEditContainer;
|
|
24
24
|
const [showError, setShowError] = useState(false);
|
|
25
25
|
const cancelHandler = useCallback(() => {
|
|
26
26
|
if (hasSubmitError) {
|
|
@@ -49,11 +49,11 @@ export default function EditToolbarTools() {
|
|
|
49
49
|
icon: check,
|
|
50
50
|
icon_position: "left",
|
|
51
51
|
on_click: doneHandler
|
|
52
|
-
}, translation.
|
|
52
|
+
}, translation.doneButton), React.createElement(Button, {
|
|
53
53
|
variant: "tertiary",
|
|
54
54
|
icon: close,
|
|
55
55
|
icon_position: "left",
|
|
56
56
|
on_click: cancelHandler
|
|
57
|
-
}, translation.
|
|
57
|
+
}, translation.cancelButton)));
|
|
58
58
|
}
|
|
59
59
|
//# sourceMappingURL=EditToolbarTools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditToolbarTools.js","names":["React","useCallback","useContext","useState","Button","Flex","FormStatus","useTranslation","SectionContainerContext","FieldBoundaryContext","check","close","useContainerDataStore","useEditContainerToolbar","EditToolbarTools","restoreOriginalData","switchContainerMode","hasVisibleError","hasSubmitError","translation","
|
|
1
|
+
{"version":3,"file":"EditToolbarTools.js","names":["React","useCallback","useContext","useState","Button","Flex","FormStatus","useTranslation","SectionContainerContext","FieldBoundaryContext","check","close","useContainerDataStore","useEditContainerToolbar","EditToolbarTools","restoreOriginalData","switchContainerMode","hasVisibleError","hasSubmitError","translation","SectionEditContainer","showError","setShowError","cancelHandler","doneHandler","createElement","Fragment","show","no_animation","errorInSection","Horizontal","gap","variant","icon","icon_position","on_click","doneButton","cancelButton"],"sources":["../../../../../../../src/extensions/forms/Form/Section/EditContainer/EditToolbarTools.tsx"],"sourcesContent":["import React, { useCallback, useContext, useState } from 'react'\nimport { Button, Flex, FormStatus } from '../../../../../components'\nimport useTranslation from '../../../hooks/useTranslation'\nimport SectionContainerContext from '../containers/SectionContainerContext'\nimport FieldBoundaryContext from '../../../DataContext/FieldBoundary/FieldBoundaryContext'\nimport { check, close } from '../../../../../icons'\nimport useContainerDataStore from './useContainerDataStore'\nimport useEditContainerToolbar from './useEditContainerToolbar'\n\nexport default function EditToolbarTools() {\n useEditContainerToolbar()\n const { restoreOriginalData } = useContainerDataStore()\n\n const { switchContainerMode } = useContext(SectionContainerContext) || {}\n const { hasVisibleError, hasSubmitError } =\n useContext(FieldBoundaryContext) || {}\n\n const translation = useTranslation().SectionEditContainer\n\n const [showError, setShowError] = useState(false)\n\n const cancelHandler = useCallback(() => {\n if (hasSubmitError) {\n setShowError(true)\n } else {\n setShowError(false)\n restoreOriginalData()\n switchContainerMode?.('view')\n }\n }, [hasSubmitError, restoreOriginalData, switchContainerMode])\n const doneHandler = useCallback(() => {\n if (hasVisibleError) {\n setShowError(true)\n } else {\n setShowError(false)\n switchContainerMode?.('view')\n }\n }, [hasVisibleError, switchContainerMode])\n\n return (\n <>\n <FormStatus show={showError && hasVisibleError} no_animation={false}>\n {translation.errorInSection}\n </FormStatus>\n <Flex.Horizontal gap=\"large\">\n <Button\n variant=\"tertiary\"\n icon={check}\n icon_position=\"left\"\n on_click={doneHandler}\n >\n {translation.doneButton}\n </Button>\n\n <Button\n variant=\"tertiary\"\n icon={close}\n icon_position=\"left\"\n on_click={cancelHandler}\n >\n {translation.cancelButton}\n </Button>\n </Flex.Horizontal>\n </>\n )\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,OAAO;AAChE,SAASC,MAAM,EAAEC,IAAI,EAAEC,UAAU,QAAQ,2BAA2B;AACpE,OAAOC,cAAc,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E,CAACC,eAAe,EAAED,mBAAmB,CAAC,CAAC;EAE1C,OACEhB,KAAA,CAAAyB,aAAA,CAAAzB,KAAA,CAAA0B,QAAA,QACE1B,KAAA,CAAAyB,aAAA,CAACnB,UAAU;IAACqB,IAAI,EAAEN,SAAS,IAAIJ,eAAgB;IAACW,YAAY,EAAE;EAAM,GACjET,WAAW,CAACU,cACH,CAAC,EACb7B,KAAA,CAAAyB,aAAA,CAACpB,IAAI,CAACyB,UAAU;IAACC,GAAG,EAAC;EAAO,GAC1B/B,KAAA,CAAAyB,aAAA,CAACrB,MAAM;IACL4B,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAEvB,KAAM;IACZwB,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEX;EAAY,GAErBL,WAAW,CAACiB,UACP,CAAC,EAETpC,KAAA,CAAAyB,aAAA,CAACrB,MAAM;IACL4B,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAEtB,KAAM;IACZuB,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEZ;EAAc,GAEvBJ,WAAW,CAACkB,YACP,CACO,CACjB,CAAC;AAEP"}
|
|
@@ -10,7 +10,7 @@ export default function ViewToolbarTools() {
|
|
|
10
10
|
const {
|
|
11
11
|
switchContainerMode
|
|
12
12
|
} = sectionContainerContext !== null && sectionContainerContext !== void 0 ? sectionContainerContext : {};
|
|
13
|
-
const translation = useTranslation().
|
|
13
|
+
const translation = useTranslation().SectionViewContainer;
|
|
14
14
|
const editHandler = useCallback(() => {
|
|
15
15
|
switchContainerMode === null || switchContainerMode === void 0 ? void 0 : switchContainerMode('edit');
|
|
16
16
|
}, [switchContainerMode]);
|
|
@@ -21,6 +21,6 @@ export default function ViewToolbarTools() {
|
|
|
21
21
|
icon: edit,
|
|
22
22
|
icon_position: "left",
|
|
23
23
|
on_click: editHandler
|
|
24
|
-
}, translation.
|
|
24
|
+
}, translation.editButton));
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=ViewToolbarTools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewToolbarTools.js","names":["React","useCallback","useContext","Button","Flex","useTranslation","SectionContainerContext","edit","ViewToolbarTools","sectionContainerContext","switchContainerMode","translation","
|
|
1
|
+
{"version":3,"file":"ViewToolbarTools.js","names":["React","useCallback","useContext","Button","Flex","useTranslation","SectionContainerContext","edit","ViewToolbarTools","sectionContainerContext","switchContainerMode","translation","SectionViewContainer","editHandler","createElement","Horizontal","gap","variant","icon","icon_position","on_click","editButton"],"sources":["../../../../../../../src/extensions/forms/Form/Section/ViewContainer/ViewToolbarTools.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react'\nimport { Button, Flex } from '../../../../../components'\nimport useTranslation from '../../../hooks/useTranslation'\nimport SectionContainerContext from '../containers/SectionContainerContext'\nimport { edit } from '../../../../../icons'\n\nexport default function ViewToolbarTools() {\n const sectionContainerContext = useContext(SectionContainerContext)\n const { switchContainerMode } = sectionContainerContext ?? {}\n\n const translation = useTranslation().SectionViewContainer\n\n const editHandler = useCallback(() => {\n switchContainerMode?.('edit')\n }, [switchContainerMode])\n\n return (\n <Flex.Horizontal gap=\"large\">\n <Button\n variant=\"tertiary\"\n icon={edit}\n icon_position=\"left\"\n on_click={editHandler}\n >\n {translation.editButton}\n </Button>\n </Flex.Horizontal>\n )\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AACtD,SAASC,MAAM,EAAEC,IAAI,QAAQ,2BAA2B;AACxD,OAAOC,cAAc,MAAM,+BAA+B;AAC1D,OAAOC,uBAAuB,MAAM,uCAAuC;AAC3E,SAASC,IAAI,QAAQ,sBAAsB;AAE3C,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EACzC,MAAMC,uBAAuB,GAAGP,UAAU,CAACI,uBAAuB,CAAC;EACnE,MAAM;IAAEI;EAAoB,CAAC,GAAGD,uBAAuB,aAAvBA,uBAAuB,cAAvBA,uBAAuB,GAAI,CAAC,CAAC;EAE7D,MAAME,WAAW,GAAGN,cAAc,CAAC,CAAC,CAACO,oBAAoB;EAEzD,MAAMC,WAAW,GAAGZ,WAAW,CAAC,MAAM;IACpCS,mBAAmB,aAAnBA,mBAAmB,uBAAnBA,mBAAmB,CAAG,MAAM,CAAC;EAC/B,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzB,OACEV,KAAA,CAAAc,aAAA,CAACV,IAAI,CAACW,UAAU;IAACC,GAAG,EAAC;EAAO,GAC1BhB,KAAA,CAAAc,aAAA,CAACX,MAAM;IACLc,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAEX,IAAK;IACXY,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEP;EAAY,GAErBF,WAAW,CAACU,UACP,CACO,CAAC;AAEtB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
var _RemoveButton;
|
|
4
3
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
5
4
|
import { Button, Flex, FormStatus } from '../../../../components';
|
|
6
5
|
import useTranslation from '../../hooks/useTranslation';
|
|
@@ -20,7 +19,7 @@ export default function EditToolbarTools() {
|
|
|
20
19
|
const {
|
|
21
20
|
hasVisibleError
|
|
22
21
|
} = useContext(FieldBoundaryContext) || {};
|
|
23
|
-
const translation = useTranslation().
|
|
22
|
+
const translation = useTranslation().IterateEditContainer;
|
|
24
23
|
const valueBackupRef = useRef();
|
|
25
24
|
const wasNew = useWasNew({
|
|
26
25
|
isNew,
|
|
@@ -60,12 +59,14 @@ export default function EditToolbarTools() {
|
|
|
60
59
|
icon: check,
|
|
61
60
|
icon_position: "left",
|
|
62
61
|
on_click: doneHandler
|
|
63
|
-
}, translation.
|
|
62
|
+
}, translation.doneButton), wasNew ? React.createElement(RemoveButton, {
|
|
63
|
+
text: translation.removeButton
|
|
64
|
+
}) : React.createElement(Button, {
|
|
64
65
|
variant: "tertiary",
|
|
65
66
|
icon: close,
|
|
66
67
|
icon_position: "left",
|
|
67
68
|
on_click: cancelHandler
|
|
68
|
-
}, translation.
|
|
69
|
+
}, translation.cancelButton)));
|
|
69
70
|
}
|
|
70
71
|
export function useWasNew({
|
|
71
72
|
isNew,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditToolbarTools.js","names":["React","useCallback","useContext","useEffect","useRef","useState","Button","Flex","FormStatus","useTranslation","IterateElementContext","check","close","RemoveButton","FieldBoundaryContext","EditToolbarTools","restoreOriginalValue","switchContainerMode","containerMode","arrayValue","index","isNew","hasVisibleError","translation","
|
|
1
|
+
{"version":3,"file":"EditToolbarTools.js","names":["React","useCallback","useContext","useEffect","useRef","useState","Button","Flex","FormStatus","useTranslation","IterateElementContext","check","close","RemoveButton","FieldBoundaryContext","EditToolbarTools","restoreOriginalValue","switchContainerMode","containerMode","arrayValue","index","isNew","hasVisibleError","translation","IterateEditContainer","valueBackupRef","wasNew","useWasNew","showError","setShowError","current","cancelHandler","doneHandler","createElement","Fragment","show","no_animation","errorInSection","Horizontal","gap","variant","icon","icon_position","on_click","doneButton","text","removeButton","cancelButton","wasNewRef"],"sources":["../../../../../../src/extensions/forms/Iterate/EditContainer/EditToolbarTools.tsx"],"sourcesContent":["import React, {\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport { Button, Flex, FormStatus } from '../../../../components'\nimport useTranslation from '../../hooks/useTranslation'\nimport IterateElementContext from '../IterateElementContext'\nimport { check, close } from '../../../../icons'\nimport RemoveButton from '../RemoveButton'\nimport { ContainerMode } from '../Array/types'\nimport FieldBoundaryContext from '../../DataContext/FieldBoundary/FieldBoundaryContext'\n\nexport default function EditToolbarTools() {\n const {\n restoreOriginalValue,\n switchContainerMode,\n containerMode,\n arrayValue,\n index,\n isNew,\n } = useContext(IterateElementContext) || {}\n const { hasVisibleError } = useContext(FieldBoundaryContext) || {}\n\n const translation = useTranslation().IterateEditContainer\n const valueBackupRef = useRef<unknown>()\n const wasNew = useWasNew({ isNew, containerMode })\n const [showError, setShowError] = useState(false)\n\n useEffect(() => {\n if (containerMode === 'edit' && !valueBackupRef.current) {\n valueBackupRef.current = arrayValue?.[index]\n }\n if (containerMode === 'view') {\n valueBackupRef.current = null\n }\n }, [arrayValue, containerMode, index])\n\n const cancelHandler = useCallback(() => {\n if (valueBackupRef.current) {\n restoreOriginalValue?.(valueBackupRef.current)\n }\n setShowError(false)\n switchContainerMode?.('view')\n }, [restoreOriginalValue, switchContainerMode])\n const doneHandler = useCallback(() => {\n if (hasVisibleError) {\n setShowError(true)\n } else {\n setShowError(false)\n switchContainerMode?.('view')\n }\n }, [hasVisibleError, switchContainerMode])\n\n return (\n <>\n <FormStatus show={showError && hasVisibleError} no_animation={false}>\n {translation.errorInSection}\n </FormStatus>\n <Flex.Horizontal gap=\"large\">\n <Button\n variant=\"tertiary\"\n icon={check}\n icon_position=\"left\"\n on_click={doneHandler}\n >\n {translation.doneButton}\n </Button>\n\n {wasNew ? (\n <RemoveButton text={translation.removeButton} />\n ) : (\n <Button\n variant=\"tertiary\"\n icon={close}\n icon_position=\"left\"\n on_click={cancelHandler}\n >\n {translation.cancelButton}\n </Button>\n )}\n </Flex.Horizontal>\n </>\n )\n}\n\nexport function useWasNew({\n isNew,\n containerMode,\n}: {\n isNew: boolean\n containerMode: ContainerMode\n}) {\n const wasNewRef = useRef<unknown>(isNew)\n\n useEffect(() => {\n if (containerMode === 'view') {\n wasNewRef.current = false\n }\n }, [isNew, containerMode])\n\n return wasNewRef.current\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,MAAM,EAAEC,IAAI,EAAEC,UAAU,QAAQ,wBAAwB;AACjE,OAAOC,cAAc,MAAM,4BAA4B;AACvD,OAAOC,qBAAqB,MAAM,0BAA0B;AAC5D,SAASC,KAAK,EAAEC,KAAK,QAAQ,mBAAm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ExClB,SAAS,CAAC,MAAM;IACd,IAAIe,aAAa,KAAK,MAAM,EAAE;MAC5B8B,SAAS,CAAClB,OAAO,GAAG,KAAK;IAC3B;EACF,CAAC,EAAE,CAACT,KAAK,EAAEH,aAAa,CAAC,CAAC;EAE1B,OAAO8B,SAAS,CAAClB,OAAO;AAC1B"}
|
|
@@ -28,8 +28,8 @@ function RemoveButton(props) {
|
|
|
28
28
|
text
|
|
29
29
|
} = useFieldProps(restProps);
|
|
30
30
|
const buttonProps = omitDataValueReadWriteProps(restProps);
|
|
31
|
-
const translation = useTranslation().
|
|
32
|
-
const textContent = text || children || translation.
|
|
31
|
+
const translation = useTranslation().RemoveButton;
|
|
32
|
+
const textContent = text || children || translation.text;
|
|
33
33
|
const elementBlockContext = useContext(ElementBlockContext);
|
|
34
34
|
const {
|
|
35
35
|
handleRemoveBlock
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoveButton.js","names":["React","useCallback","useContext","classnames","Button","IterateElementContext","useFieldProps","useTranslation","ElementBlockContext","omitDataValueReadWriteProps","trash","RemoveButton","props","iterateElementContext","handleRemove","Error","className","restProps","_objectWithoutProperties","_excluded","children","text","buttonProps","translation","
|
|
1
|
+
{"version":3,"file":"RemoveButton.js","names":["React","useCallback","useContext","classnames","Button","IterateElementContext","useFieldProps","useTranslation","ElementBlockContext","omitDataValueReadWriteProps","trash","RemoveButton","props","iterateElementContext","handleRemove","Error","className","restProps","_objectWithoutProperties","_excluded","children","text","buttonProps","translation","textContent","elementBlockContext","handleRemoveBlock","handleClick","createElement","_extends","variant","icon","icon_position","on_click","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Iterate/RemoveButton/RemoveButton.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react'\nimport classnames from 'classnames'\nimport { Button } from '../../../../components'\nimport { ButtonProps } from '../../../../components/Button'\nimport IterateElementContext from '../IterateElementContext'\nimport { useFieldProps, useTranslation } from '../../hooks'\nimport ElementBlockContext from '../AnimatedContainer/ElementBlockContext'\nimport {\n DataValueReadWriteComponentProps,\n omitDataValueReadWriteProps,\n} from '../../types'\nimport { trash } from '../../../../icons'\n\nexport type Props = ButtonProps &\n DataValueReadWriteComponentProps<unknown[]>\n\nfunction RemoveButton(props: Props) {\n const iterateElementContext = useContext(IterateElementContext)\n const { handleRemove } = iterateElementContext ?? {}\n\n if (!iterateElementContext) {\n throw new Error('RemoveButton must be inside an Iterate.Array')\n }\n\n const { className, ...restProps } = props\n const { children, text } = useFieldProps(restProps)\n const buttonProps = omitDataValueReadWriteProps(restProps)\n const translation = useTranslation().RemoveButton\n const textContent = text || children || translation.text\n\n const elementBlockContext = useContext(ElementBlockContext)\n const { handleRemoveBlock } = elementBlockContext ?? {}\n\n const handleClick = useCallback(() => {\n if (handleRemoveBlock) {\n handleRemoveBlock()\n } else {\n handleRemove()\n }\n }, [handleRemove, handleRemoveBlock])\n\n return (\n <Button\n className={classnames(\n 'dnb-forms-iterate-remove-element-button',\n className\n )}\n variant={textContent ? 'tertiary' : 'secondary'}\n icon={trash}\n icon_position=\"left\"\n on_click={handleClick}\n {...buttonProps}\n >\n {textContent}\n </Button>\n )\n}\n\nRemoveButton._supportsSpacingProps = true\nexport default RemoveButton\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AACtD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,OAAOC,qBAAqB,MAAM,0BAA0B;AAC5D,SAASC,aAAa,EAAEC,cAAc,QAAQ,aAAa;AAC3D,OAAOC,mBAAmB,MAAM,0CAA0C;AAC1E,SAEEC,2BAA2B,QACtB,aAAa;AACpB,SAASC,KAAK,QAAQ,mBAAmB;AAKzC,SAASC,YAAYA,CAACC,KAAY,EAAE;EAClC,MAAMC,qBAAqB,GAAGX,UAAU,CAACG,qBAAqB,CAAC;EAC/D,MAAM;IAAES;EAAa,CAAC,GAAGD,qBAAqB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,7 @@ export default function ViewToolbarTools() {
|
|
|
11
11
|
const {
|
|
12
12
|
switchContainerMode
|
|
13
13
|
} = iterateElementContext !== null && iterateElementContext !== void 0 ? iterateElementContext : {};
|
|
14
|
-
const translation = useTranslation().
|
|
14
|
+
const translation = useTranslation().IterateViewContainer;
|
|
15
15
|
const editHandler = useCallback(() => {
|
|
16
16
|
switchContainerMode === null || switchContainerMode === void 0 ? void 0 : switchContainerMode('edit');
|
|
17
17
|
}, [switchContainerMode]);
|
|
@@ -22,8 +22,8 @@ export default function ViewToolbarTools() {
|
|
|
22
22
|
icon: edit,
|
|
23
23
|
icon_position: "left",
|
|
24
24
|
on_click: editHandler
|
|
25
|
-
}, translation.
|
|
26
|
-
text: translation.
|
|
25
|
+
}, translation.editButton), React.createElement(RemoveButton, {
|
|
26
|
+
text: translation.removeButton
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=ViewToolbarTools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewToolbarTools.js","names":["React","useCallback","useContext","Button","Flex","RemoveButton","useTranslation","IterateElementContext","edit","ViewToolbarTools","iterateElementContext","switchContainerMode","translation","
|
|
1
|
+
{"version":3,"file":"ViewToolbarTools.js","names":["React","useCallback","useContext","Button","Flex","RemoveButton","useTranslation","IterateElementContext","edit","ViewToolbarTools","iterateElementContext","switchContainerMode","translation","IterateViewContainer","editHandler","createElement","Horizontal","gap","variant","icon","icon_position","on_click","editButton","text","removeButton"],"sources":["../../../../../../src/extensions/forms/Iterate/ViewContainer/ViewToolbarTools.tsx"],"sourcesContent":["import React, { useCallback, useContext } from 'react'\nimport { Button, Flex } from '../../../../components'\nimport RemoveButton from '../RemoveButton'\nimport useTranslation from '../../hooks/useTranslation'\nimport IterateElementContext from '../IterateElementContext'\nimport { edit } from '../../../../icons'\n\nexport default function ViewToolbarTools() {\n const iterateElementContext = useContext(IterateElementContext)\n const { switchContainerMode } = iterateElementContext ?? {}\n\n const translation = useTranslation().IterateViewContainer\n\n const editHandler = useCallback(() => {\n switchContainerMode?.('edit')\n }, [switchContainerMode])\n\n return (\n <Flex.Horizontal gap=\"large\">\n <Button\n variant=\"tertiary\"\n icon={edit}\n icon_position=\"left\"\n on_click={editHandler}\n >\n {translation.editButton}\n </Button>\n\n <RemoveButton text={translation.removeButton} />\n </Flex.Horizontal>\n )\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AACtD,SAASC,MAAM,EAAEC,IAAI,QAAQ,wBAAwB;AACrD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,cAAc,MAAM,4BAA4B;AACvD,OAAOC,qBAAqB,MAAM,0BAA0B;AAC5D,SAASC,IAAI,QAAQ,mBAAmB;AAExC,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EACzC,MAAMC,qBAAqB,GAAGR,UAAU,CAACK,qBAAqB,CAAC;EAC/D,MAAM;IAAEI;EAAoB,CAAC,GAAGD,qBAAqB,aAArBA,qBAAqB,cAArBA,qBAAqB,GAAI,CAAC,CAAC;EAE3D,MAAME,WAAW,GAAGN,cAAc,CAAC,CAAC,CAACO,oBAAoB;EAEzD,MAAMC,WAAW,GAAGb,WAAW,CAAC,MAAM;IACpCU,mBAAmB,aAAnBA,mBAAmB,uBAAnBA,mBAAmB,CAAG,MAAM,CAAC;EAC/B,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzB,OACEX,KAAA,CAAAe,aAAA,CAACX,IAAI,CAACY,UAAU;IAACC,GAAG,EAAC;EAAO,GAC1BjB,KAAA,CAAAe,aAAA,CAACZ,MAAM;IACLe,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAEX,IAAK;IACXY,aAAa,EAAC,MAAM;IACpBC,QAAQ,EAAEP;EAAY,GAErBF,WAAW,CAACU,UACP,CAAC,EAETtB,KAAA,CAAAe,aAAA,CAACV,YAAY;IAACkB,IAAI,EAAEX,WAAW,CAACY;EAAa,CAAE,CAChC,CAAC;AAEtB"}
|
|
@@ -12,7 +12,7 @@ import { edit } from '../../../../icons';
|
|
|
12
12
|
import Hr from '../../../../elements/Hr';
|
|
13
13
|
import { omitSpacingProps, pickSpacingProps } from '../../../../components/flex/utils';
|
|
14
14
|
function EditButton(props) {
|
|
15
|
-
const translations = useTranslation().
|
|
15
|
+
const translations = useTranslation().WizardEditButton;
|
|
16
16
|
const {
|
|
17
17
|
setActiveIndex
|
|
18
18
|
} = useStep();
|
|
@@ -22,7 +22,7 @@ function EditButton(props) {
|
|
|
22
22
|
icon_position = 'left',
|
|
23
23
|
icon,
|
|
24
24
|
toStep,
|
|
25
|
-
children = translations.
|
|
25
|
+
children = translations.text
|
|
26
26
|
} = props,
|
|
27
27
|
rest = _objectWithoutProperties(props, _excluded);
|
|
28
28
|
const handleClick = useCallback(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditButton.js","names":["React","useCallback","classnames","Button","ButtonRow","useTranslation","useStep","edit","Hr","omitSpacingProps","pickSpacingProps","EditButton","props","translations","
|
|
1
|
+
{"version":3,"file":"EditButton.js","names":["React","useCallback","classnames","Button","ButtonRow","useTranslation","useStep","edit","Hr","omitSpacingProps","pickSpacingProps","EditButton","props","translations","WizardEditButton","setActiveIndex","className","variant","icon_position","icon","toStep","children","text","rest","_objectWithoutProperties","_excluded","handleClick","createElement","_Hr","space","_extends","on_click","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/EditButton/EditButton.tsx"],"sourcesContent":["import React, { useCallback } from 'react'\nimport classnames from 'classnames'\nimport type { ComponentProps } from '../../types'\nimport Button, { ButtonProps } from '../../../../components/button/Button'\nimport ButtonRow from '../../Form/ButtonRow'\nimport { StepIndex } from '../Context/WizardContext'\nimport useTranslation from '../../hooks/useTranslation'\nimport useStep from '../hooks/useStep'\nimport { edit } from '../../../../icons'\nimport Hr from '../../../../elements/Hr'\nimport {\n omitSpacingProps,\n pickSpacingProps,\n} from '../../../../components/flex/utils'\n\nexport type Props = ComponentProps & ButtonProps & { toStep?: StepIndex }\n\nfunction EditButton(props: Props) {\n const translations = useTranslation().WizardEditButton\n const { setActiveIndex } = useStep()\n\n const {\n className,\n variant = 'tertiary',\n icon_position = 'left',\n icon,\n toStep,\n children = translations.text,\n ...rest\n } = props\n\n const handleClick = useCallback(() => {\n if (toStep > -1) {\n setActiveIndex(toStep)\n }\n }, [toStep, setActiveIndex])\n\n return (\n <ButtonRow {...pickSpacingProps(props)}>\n <Hr space={0} />\n <Button\n className={classnames('dnb-forms-edit-button', className)}\n variant={variant}\n icon_position={icon_position}\n icon={edit || icon}\n on_click={handleClick}\n {...omitSpacingProps(rest)}\n >\n {children}\n </Button>\n </ButtonRow>\n )\n}\n\nEditButton._supportsSpacingProps = true\nexport default EditButton\n"],"mappings":";;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,MAAM,MAAuB,sCAAsC;AAC1E,OAAOC,SAAS,MAAM,sBAAsB;AAE5C,OAAOC,cAAc,MAAM,4BAA4B;AACvD,OAAOC,OAAO,MAAM,kBAAkB;AACtC,SAASC,IAAI,QAAQ,mBAAmB;AACxC,OAAOC,EAAE,MAAM,yBAAyB;AACxC,SACEC,gBAAgB,EAChBC,gBAAgB,QACX,mCAAmC;AAI1C,SAASC,UAAUA,CAACC,KAAY,EAAE;EAChC,MAAMC,YAAY,GAAGR,cAAc,CAAC,CAAC,CAACS,gBAAgB;EACtD,MAAM;IAAEC;EAAe,CAAC,GAAGT,OAAO,CAAC,CAAC;EAEpC,MAAM;MACJU,SAAS;MACTC,OAAO,GAAG,UAAU;MACpBC,aAAa,GAAG,MAAM;MACtBC,IAAI;MACJC,MAAM;MACNC,QAAQ,GAAGR,YAAY,CAACS;IAE1B,CAAC,GAAGV,KAAK;IADJW,IAAI,GAAAC,wBAAA,CACLZ,KAAK,EAAAa,SAAA;EAET,MAAMC,WAAW,GAAGzB,WAAW,CAAC,MAAM;IACpC,IAAImB,MAAM,GAAG,CAAC,CAAC,EAAE;MACfL,cAAc,CAACK,MAAM,CAAC;IACxB;EACF,CAAC,EAAE,CAACA,MAAM,EAAEL,cAAc,CAAC,CAAC;EAE5B,OACEf,KAAA,CAAA2B,aAAA,CAACvB,SAAS,EAAKM,gBAAgB,CAACE,KAAK,CAAC,EAAAgB,GAAA,KAAAA,GAAA,GACpC5B,KAAA,CAAA2B,aAAA,CAACnB,EAAE;IAACqB,KAAK,EAAE;EAAE,CAAE,CAAC,GAChB7B,KAAA,CAAA2B,aAAA,CAACxB,MAAM,EAAA2B,QAAA;IACLd,SAAS,EAAEd,UAAU,CAAC,uBAAuB,EAAEc,SAAS,CAAE;IAC1DC,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAc;IAC7BC,IAAI,EAAEZ,IAAI,IAAIY,IAAK;IACnBY,QAAQ,EAAEL;EAAY,GAClBjB,gBAAgB,CAACc,IAAI,CAAC,GAEzBF,QACK,CACC,CAAC;AAEhB;AAEAV,UAAU,CAACqB,qBAAqB,GAAG,IAAI;AACvC,eAAerB,UAAU"}
|
|
@@ -8,12 +8,12 @@ import ButtonRow from '../../Form/ButtonRow';
|
|
|
8
8
|
import SubmitButton from '../../Form/SubmitButton';
|
|
9
9
|
import useTranslation from '../../hooks/useTranslation';
|
|
10
10
|
function NextButton(props) {
|
|
11
|
-
const translations = useTranslation().
|
|
11
|
+
const translations = useTranslation().WizardNextButton;
|
|
12
12
|
const {
|
|
13
13
|
className,
|
|
14
14
|
icon_position = 'right',
|
|
15
15
|
icon = 'chevron_right',
|
|
16
|
-
children = translations.
|
|
16
|
+
children = translations.text
|
|
17
17
|
} = props;
|
|
18
18
|
const {
|
|
19
19
|
handleNext
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextButton.js","names":["React","useContext","classnames","WizardContext","ButtonRow","SubmitButton","useTranslation","NextButton","props","translations","
|
|
1
|
+
{"version":3,"file":"NextButton.js","names":["React","useContext","classnames","WizardContext","ButtonRow","SubmitButton","useTranslation","NextButton","props","translations","WizardNextButton","className","icon_position","icon","children","text","handleNext","createElement","_extends","type","onClick","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/NextButton/NextButton.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport classnames from 'classnames'\nimport type { ComponentProps } from '../../types'\nimport { ButtonProps } from '../../../../components/button/Button'\nimport WizardContext from '../Context/WizardContext'\nimport ButtonRow from '../../Form/ButtonRow'\nimport SubmitButton from '../../Form/SubmitButton'\nimport useTranslation from '../../hooks/useTranslation'\n\nexport type Props = ComponentProps & Omit<ButtonProps, 'variant'>\n\nfunction NextButton(props: Props) {\n const translations = useTranslation().WizardNextButton\n\n const {\n className,\n icon_position = 'right',\n icon = 'chevron_right',\n children = translations.text,\n } = props\n const { handleNext } = useContext(WizardContext) || {}\n\n return (\n <ButtonRow>\n {/* Use SubmitButton to inherit the indicator functionality */}\n <SubmitButton\n type=\"button\"\n className={classnames('dnb-forms-next-button', className)}\n onClick={handleNext}\n icon_position={icon_position}\n icon={icon}\n {...props}\n >\n {children}\n </SubmitButton>\n </ButtonRow>\n )\n}\n\nNextButton._supportsSpacingProps = true\nexport default NextButton\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AAGnC,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,OAAOC,YAAY,MAAM,yBAAyB;AAClD,OAAOC,cAAc,MAAM,4BAA4B;AAIvD,SAASC,UAAUA,CAACC,KAAY,EAAE;EAChC,MAAMC,YAAY,GAAGH,cAAc,CAAC,CAAC,CAACI,gBAAgB;EAEtD,MAAM;IACJC,SAAS;IACTC,aAAa,GAAG,OAAO;IACvBC,IAAI,GAAG,eAAe;IACtBC,QAAQ,GAAGL,YAAY,CAACM;EAC1B,CAAC,GAAGP,KAAK;EACT,MAAM;IAAEQ;EAAW,CAAC,GAAGf,UAAU,CAACE,aAAa,CAAC,IAAI,CAAC,CAAC;EAEtD,OACEH,KAAA,CAAAiB,aAAA,CAACb,SAAS,QAERJ,KAAA,CAAAiB,aAAA,CAACZ,YAAY,EAAAa,QAAA;IACXC,IAAI,EAAC,QAAQ;IACbR,SAAS,EAAET,UAAU,CAAC,uBAAuB,EAAES,SAAS,CAAE;IAC1DS,OAAO,EAAEJ,UAAW;IACpBJ,aAAa,EAAEA,aAAc;IAC7BC,IAAI,EAAEA;EAAK,GACPL,KAAK,GAERM,QACW,CACL,CAAC;AAEhB;AAEAP,UAAU,CAACc,qBAAqB,GAAG,IAAI;AACvC,eAAed,UAAU"}
|
|
@@ -8,13 +8,13 @@ import WizardContext from '../Context/WizardContext';
|
|
|
8
8
|
import ButtonRow from '../../Form/ButtonRow';
|
|
9
9
|
import useTranslation from '../../hooks/useTranslation';
|
|
10
10
|
function PreviousButton(props) {
|
|
11
|
-
const translations = useTranslation().
|
|
11
|
+
const translations = useTranslation().WizardPreviousButton;
|
|
12
12
|
const {
|
|
13
13
|
className,
|
|
14
14
|
variant = 'tertiary',
|
|
15
15
|
icon_position = 'left',
|
|
16
16
|
icon = 'chevron_left',
|
|
17
|
-
children = translations.
|
|
17
|
+
children = translations.text
|
|
18
18
|
} = props;
|
|
19
19
|
const {
|
|
20
20
|
activeIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviousButton.js","names":["React","useContext","classnames","Button","WizardContext","ButtonRow","useTranslation","PreviousButton","props","translations","
|
|
1
|
+
{"version":3,"file":"PreviousButton.js","names":["React","useContext","classnames","Button","WizardContext","ButtonRow","useTranslation","PreviousButton","props","translations","WizardPreviousButton","className","variant","icon_position","icon","children","text","activeIndex","handlePrevious","params","disabled","createElement","_extends","onClick","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Wizard/PreviousButton/PreviousButton.tsx"],"sourcesContent":["import React, { useContext } from 'react'\nimport classnames from 'classnames'\nimport type { ComponentProps } from '../../types'\nimport { Button } from '../../../../components'\nimport { ButtonProps } from '../../../../components/button/Button'\nimport WizardContext from '../Context/WizardContext'\nimport ButtonRow from '../../Form/ButtonRow'\nimport useTranslation from '../../hooks/useTranslation'\n\nexport type Props = ComponentProps & ButtonProps\n\nfunction PreviousButton(props: Props) {\n const translations = useTranslation().WizardPreviousButton\n\n const {\n className,\n variant = 'tertiary',\n icon_position = 'left',\n icon = 'chevron_left',\n children = translations.text,\n } = props\n const { activeIndex, handlePrevious } = useContext(WizardContext) || {}\n\n const params: Props = {}\n if (activeIndex === 0) {\n params.disabled = true\n }\n\n return (\n <ButtonRow>\n <Button\n className={classnames('dnb-forms-previous-button', className)}\n onClick={handlePrevious}\n variant={variant}\n icon_position={icon_position}\n icon={icon}\n {...params}\n {...props}\n >\n {children}\n </Button>\n </ButtonRow>\n )\n}\n\nPreviousButton._supportsSpacingProps = true\nexport default PreviousButton\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAAOC,SAAS,MAAM,sBAAsB;AAC5C,OAAOC,cAAc,MAAM,4BAA4B;AAIvD,SAASC,cAAcA,CAACC,KAAY,EAAE;EACpC,MAAMC,YAAY,GAAGH,cAAc,CAAC,CAAC,CAACI,oBAAoB;EAE1D,MAAM;IACJC,SAAS;IACTC,OAAO,GAAG,UAAU;IACpBC,aAAa,GAAG,MAAM;IACtBC,IAAI,GAAG,cAAc;IACrBC,QAAQ,GAAGN,YAAY,CAACO;EAC1B,CAAC,GAAGR,KAAK;EACT,MAAM;IAAES,WAAW;IAAEC;EAAe,CAAC,GAAGjB,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC,CAAC;EAEvE,MAAMe,MAAa,GAAG,CAAC,CAAC;EACxB,IAAIF,WAAW,KAAK,CAAC,EAAE;IACrBE,MAAM,CAACC,QAAQ,GAAG,IAAI;EACxB;EAEA,OACEpB,KAAA,CAAAqB,aAAA,CAAChB,SAAS,QACRL,KAAA,CAAAqB,aAAA,CAAClB,MAAM,EAAAmB,QAAA;IACLX,SAAS,EAAET,UAAU,CAAC,2BAA2B,EAAES,SAAS,CAAE;IAC9DY,OAAO,EAAEL,cAAe;IACxBN,OAAO,EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAc;IAC7BC,IAAI,EAAEA;EAAK,GACPK,MAAM,EACNX,KAAK,GAERO,QACK,CACC,CAAC;AAEhB;AAEAR,cAAc,CAACiB,qBAAqB,GAAG,IAAI;AAC3C,eAAejB,cAAc"}
|
|
@@ -15,16 +15,36 @@ declare const _default: {
|
|
|
15
15
|
sendText: string;
|
|
16
16
|
};
|
|
17
17
|
Step: {
|
|
18
|
-
next: string;
|
|
19
|
-
previous: string;
|
|
20
|
-
edit: string;
|
|
21
18
|
summaryTitle: string;
|
|
22
19
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
WizardEditButton: {
|
|
21
|
+
text: string;
|
|
22
|
+
};
|
|
23
|
+
WizardPreviousButton: {
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
26
|
+
WizardNextButton: {
|
|
27
|
+
text: string;
|
|
28
|
+
};
|
|
29
|
+
RemoveButton: {
|
|
30
|
+
text: string;
|
|
31
|
+
};
|
|
32
|
+
IterateViewContainer: {
|
|
33
|
+
removeButton: string;
|
|
34
|
+
editButton: string;
|
|
35
|
+
};
|
|
36
|
+
SectionViewContainer: {
|
|
37
|
+
editButton: string;
|
|
38
|
+
};
|
|
39
|
+
SectionEditContainer: {
|
|
40
|
+
doneButton: string;
|
|
41
|
+
cancelButton: string;
|
|
42
|
+
errorInSection: string;
|
|
43
|
+
};
|
|
44
|
+
IterateEditContainer: {
|
|
45
|
+
removeButton: string;
|
|
46
|
+
doneButton: string;
|
|
47
|
+
cancelButton: string;
|
|
28
48
|
errorInSection: string;
|
|
29
49
|
};
|
|
30
50
|
/**
|