@dnb/eufemia 10.62.0 → 10.62.2
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 +16 -0
- package/cjs/components/date-picker/DatePicker.d.ts +1 -1
- package/cjs/components/date-picker/DatePicker.js.map +1 -1
- package/cjs/components/date-picker/DatePickerProvider.d.ts +2 -2
- package/cjs/components/date-picker/DatePickerProvider.js.map +1 -1
- package/cjs/components/date-picker/hooks/useDates.js.map +1 -1
- package/cjs/components/upload/UploadFileListLink.js +3 -1
- package/cjs/components/upload/UploadFileListLink.js.map +1 -1
- package/cjs/extensions/forms/Field/Upload/Upload.d.ts +1 -0
- package/cjs/extensions/forms/Field/Upload/Upload.js +32 -15
- package/cjs/extensions/forms/Field/Upload/Upload.js.map +1 -1
- package/cjs/extensions/forms/Value/Upload/Upload.js +12 -4
- package/cjs/extensions/forms/Value/Upload/Upload.js.map +1 -1
- package/cjs/extensions/forms/hooks/useExternalValue.d.ts +1 -1
- package/cjs/extensions/forms/hooks/useExternalValue.js +8 -6
- package/cjs/extensions/forms/hooks/useExternalValue.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/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-core.css +1 -1
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/components/date-picker/DatePicker.d.ts +1 -1
- package/components/date-picker/DatePicker.js.map +1 -1
- package/components/date-picker/DatePickerProvider.d.ts +2 -2
- package/components/date-picker/DatePickerProvider.js.map +1 -1
- package/components/date-picker/hooks/useDates.js.map +1 -1
- package/components/upload/UploadFileListLink.js +3 -1
- package/components/upload/UploadFileListLink.js.map +1 -1
- package/es/components/date-picker/DatePicker.d.ts +1 -1
- package/es/components/date-picker/DatePicker.js.map +1 -1
- package/es/components/date-picker/DatePickerProvider.d.ts +2 -2
- package/es/components/date-picker/DatePickerProvider.js.map +1 -1
- package/es/components/date-picker/hooks/useDates.js.map +1 -1
- package/es/components/upload/UploadFileListLink.js +3 -1
- package/es/components/upload/UploadFileListLink.js.map +1 -1
- package/es/extensions/forms/Field/Upload/Upload.d.ts +1 -0
- package/es/extensions/forms/Field/Upload/Upload.js +27 -8
- package/es/extensions/forms/Field/Upload/Upload.js.map +1 -1
- package/es/extensions/forms/Value/Upload/Upload.js +10 -4
- package/es/extensions/forms/Value/Upload/Upload.js.map +1 -1
- package/es/extensions/forms/hooks/useExternalValue.d.ts +1 -1
- package/es/extensions/forms/hooks/useExternalValue.js +8 -6
- package/es/extensions/forms/hooks/useExternalValue.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/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-core.css +1 -1
- package/es/style/dnb-ui-core.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 +1 -1
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/Field/Upload/Upload.d.ts +1 -0
- package/extensions/forms/Field/Upload/Upload.js +31 -15
- package/extensions/forms/Field/Upload/Upload.js.map +1 -1
- package/extensions/forms/Value/Upload/Upload.js +10 -4
- package/extensions/forms/Value/Upload/Upload.js.map +1 -1
- package/extensions/forms/hooks/useExternalValue.d.ts +1 -1
- package/extensions/forms/hooks/useExternalValue.js +8 -6
- package/extensions/forms/hooks/useExternalValue.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/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-core.css +1 -1
- package/style/dnb-ui-core.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 +2 -2
- package/umd/dnb-ui-lib.min.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Upload.js","names":["React","useCallback","useEffect","useMemo","useRef","classnames","FieldBlock","useFieldProps","useTranslation","useFormsTranslation","Upload","useUpload","pickSpacingProps","HelpButtonInline","HelpButtonInlineContent","useSharedTranslation","FormError","validateRequired","value","required","isChanged","error","hasError","some","file","errorMessage","hasFiles","length","undefined","updateFileLoadingState","files","isLoading","map","_objectSpread","UploadComponent","props","sharedTr","formsTr","errorMessages","errorRequired","preparedProps","_useFieldProps","executeOnChangeRegardlessOfError","id","className","width","widthProp","label","labelDescription","help","htmlAttributes","handleChange","handleFocus","handleBlur","fileHandler","rest","_objectWithoutProperties","_excluded","title","text","acceptedFileTypes","filesAmountLimit","fileMaxSize","skeleton","onFileDelete","onFileClick","setFiles","filesRef","current","hasInvalidFiles","name","handleChangeAsync","existingFiles","_filesRef$current","existingFileIds","newFiles","filter","includes","incomingFiles","uploadedFiles","indexOfFirstNewFile","findIndex","updatedFiles","slice","changeHandler","fieldBlockProps","forId","labelSrOnly","createElement","_extends","onChange","Fragment","contentId","left","_supportsSpacingProps"],"sources":["../../../../../../src/extensions/forms/Field/Upload/Upload.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport classnames from 'classnames'\nimport FieldBlock, {\n Props as FieldBlockProps,\n FieldBlockWidth,\n} from '../../FieldBlock'\nimport {\n useFieldProps,\n useTranslation as useFormsTranslation,\n} from '../../hooks'\nimport { FieldProps } from '../../types'\nimport Upload, {\n UploadFile,\n UploadFileNative,\n UploadProps,\n} from '../../../../components/Upload'\nimport useUpload from '../../../../components/upload/useUpload'\nimport { pickSpacingProps } from '../../../../components/flex/utils'\nimport HelpButtonInline, {\n HelpButtonInlineContent,\n} from '../../../../components/help-button/HelpButtonInline'\nimport { useTranslation as useSharedTranslation } from '../../../../shared'\nimport { SpacingProps } from '../../../../shared/types'\nimport { FormError } from '../../utils'\n\nexport type { UploadFile, UploadFileNative }\nexport type UploadValue = Array<UploadFile | UploadFileNative>\nexport type Props = Omit<\n FieldProps<UploadValue, UploadValue | undefined>,\n 'name'\n> &\n SpacingProps & {\n width?: Omit<FieldBlockWidth, 'medium' | 'small'>\n } & Pick<\n Partial<UploadProps>,\n | 'title'\n | 'text'\n | 'acceptedFileTypes'\n | 'filesAmountLimit'\n | 'fileMaxSize'\n | 'onFileDelete'\n | 'onFileClick'\n | 'skeleton'\n | 'download'\n > & {\n fileHandler?: (\n newFiles: UploadValue\n ) => UploadValue | Promise<UploadValue>\n }\n\nconst validateRequired = (\n value: UploadValue,\n { required, isChanged, error }\n) => {\n const hasError = value?.some((file) => file.errorMessage)\n if (hasError) {\n return new FormError('Upload.errorInvalidFiles')\n }\n\n const hasFiles = value?.length > 0\n if (required && ((!isChanged && !hasFiles) || !hasFiles)) {\n return error\n }\n\n return undefined\n}\n\nconst updateFileLoadingState = (\n files: UploadValue,\n { isLoading } = { isLoading: false }\n) => {\n return files.map((file) => ({ ...file, isLoading }))\n}\n\nfunction UploadComponent(props: Props) {\n const sharedTr = useSharedTranslation().Upload\n const formsTr = useFormsTranslation().Upload\n\n const errorMessages = useMemo(\n () => ({\n 'Field.errorRequired': formsTr.errorRequired,\n }),\n [formsTr.errorRequired]\n )\n\n const preparedProps = {\n errorMessages,\n validateRequired,\n ...props,\n }\n\n const {\n id,\n className,\n width: widthProp = 'stretch',\n value,\n label,\n labelDescription,\n help,\n htmlAttributes,\n handleChange,\n handleFocus,\n handleBlur,\n fileHandler,\n ...rest\n } = useFieldProps(preparedProps, {\n executeOnChangeRegardlessOfError: true,\n })\n\n // Upload props\n const {\n title = sharedTr.title,\n text = sharedTr.text,\n acceptedFileTypes = ['pdf', 'png', 'jpg', 'jpeg'],\n filesAmountLimit = 100,\n fileMaxSize = 5,\n skeleton,\n onFileDelete,\n onFileClick,\n } = rest\n\n const { files, setFiles } = useUpload(id)\n\n const filesRef = useRef<Array<UploadFile>>()\n\n useEffect(() => {\n filesRef.current = files\n }, [files])\n\n useEffect(() => {\n // Files stored in session storage will not have a property (due to serialization).\n const hasInvalidFiles = value?.some(({ file }) => !file?.name)\n if (!hasInvalidFiles) {\n setFiles(value)\n }\n }, [setFiles, value])\n\n const handleChangeAsync = useCallback(\n async (existingFiles: UploadValue) => {\n // Filter out existing files\n const existingFileIds =\n filesRef.current?.map((file) => file.id) || []\n const newFiles = existingFiles.filter(\n (file) => !existingFileIds.includes(file.id)\n )\n\n if (newFiles.length > 0) {\n // Set loading\n setFiles([\n ...filesRef.current,\n ...updateFileLoadingState(newFiles, { isLoading: true }),\n ])\n\n const incomingFiles = await fileHandler(newFiles)\n\n const uploadedFiles = updateFileLoadingState(incomingFiles, {\n isLoading: false,\n })\n\n const indexOfFirstNewFile = filesRef.current.findIndex(\n ({ id }) => id === newFiles[0].id\n )\n\n const updatedFiles = [\n ...filesRef.current.slice(0, indexOfFirstNewFile),\n ...uploadedFiles,\n ...filesRef.current.slice(indexOfFirstNewFile + newFiles.length),\n ]\n\n // Set error, if any\n handleChange(updatedFiles)\n } else {\n handleChange(existingFiles)\n }\n },\n [files, setFiles, fileHandler, handleChange]\n )\n\n const changeHandler = useCallback(\n ({ files }: { files: UploadValue }) => {\n // Prevents the form-status from showing up\n handleBlur()\n handleFocus()\n\n if (fileHandler) {\n handleChangeAsync(files)\n } else {\n handleChange(files)\n }\n },\n [handleBlur, handleFocus, fileHandler, handleChangeAsync, handleChange]\n )\n\n const width = widthProp as FieldBlockWidth\n const fieldBlockProps: FieldBlockProps = {\n id,\n forId: `${id}-input`,\n labelSrOnly: true,\n className: classnames('dnb-forms-field-upload', className),\n width,\n help: undefined,\n ...pickSpacingProps(props),\n }\n\n return (\n <FieldBlock {...fieldBlockProps}>\n <Upload\n id={id}\n acceptedFileTypes={acceptedFileTypes}\n filesAmountLimit={filesAmountLimit}\n fileMaxSize={fileMaxSize}\n skeleton={skeleton}\n onChange={changeHandler}\n onFileDelete={onFileDelete}\n onFileClick={onFileClick}\n title={label ?? title}\n text={\n help ? (\n <>\n {labelDescription ?? text}\n <HelpButtonInline\n contentId={`${id}-help`}\n left={text ? 'x-small' : false}\n help={help}\n />\n </>\n ) : (\n labelDescription ?? text\n )\n }\n {...htmlAttributes}\n >\n {help && (\n <HelpButtonInlineContent contentId={`${id}-help`} help={help} />\n )}\n </Upload>\n </FieldBlock>\n )\n}\n\nexport default UploadComponent\n\nUploadComponent._supportsSpacingProps = true\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACtE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,UAAU,MAGV,kBAAkB;AACzB,SACEC,aAAa,EACbC,cAAc,IAAIC,mBAAmB,QAChC,aAAa;AAEpB,OAAOC,MAAM,MAIN,+BAA+B;AACtC,OAAOC,SAAS,MAAM,yCAAyC;AAC/D,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,gBAAgB,IACrBC,uBAAuB,QAClB,qDAAqD;AAC5D,SAASN,cAAc,IAAIO,oBAAoB,QAAQ,oBAAoB;AAE3E,SAASC,SAAS,QAAQ,aAAa;AA2BvC,MAAMC,gBAAgB,GAAGA,CACvBC,KAAkB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AM;MAC/BV,IAAI,EAAEA;IAAK,CACZ,CACD,CAAC,GAEHD,gBAAgB,aAAhBA,gBAAgB,cAAhBA,gBAAgB,GAAIW;EAEvB,GACGT,cAAc,GAEjBD,IAAI,IACHjD,KAAA,CAAAwF,aAAA,CAAC1E,uBAAuB;IAAC8E,SAAS,EAAG,GAAEjD,EAAG,OAAO;IAACM,IAAI,EAAEA;EAAK,CAAE,CAE3D,CACE,CAAC;AAEjB;AAEA,eAAef,eAAe;AAE9BA,eAAe,CAAC4D,qBAAqB,GAAG,IAAI"}
|
|
1
|
+
{"version":3,"file":"Upload.js","names":["React","useCallback","useEffect","useMemo","useRef","classnames","FieldBlock","useFieldProps","useTranslation","useFormsTranslation","Upload","useUpload","pickSpacingProps","HelpButtonInline","HelpButtonInlineContent","useSharedTranslation","FormError","validateRequired","value","required","isChanged","error","hasError","some","file","errorMessage","hasFiles","length","undefined","updateFileLoadingState","files","isLoading","map","_objectSpread","UploadComponent","props","sharedTr","formsTr","errorMessages","errorRequired","fromInput","forEach","item","index","_item$file","name","preparedProps","toInput","transformFiles","_useFieldProps","executeOnChangeRegardlessOfError","id","className","width","widthProp","label","labelDescription","help","htmlAttributes","handleChange","handleFocus","handleBlur","fileHandler","rest","_objectWithoutProperties","_excluded","title","text","acceptedFileTypes","filesAmountLimit","fileMaxSize","skeleton","onFileDelete","onFileClick","setFiles","filesRef","current","handleChangeAsync","existingFiles","_filesRef$current","existingFileIds","newFiles","filter","includes","incomingFiles","uploadedFiles","indexOfFirstNewFile","findIndex","updatedFiles","slice","changeHandler","fieldBlockProps","forId","labelSrOnly","createElement","_extends","onChange","Fragment","contentId","left","_supportsSpacingProps","Array","isArray","File"],"sources":["../../../../../../src/extensions/forms/Field/Upload/Upload.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport classnames from 'classnames'\nimport FieldBlock, {\n Props as FieldBlockProps,\n FieldBlockWidth,\n} from '../../FieldBlock'\nimport {\n useFieldProps,\n useTranslation as useFormsTranslation,\n} from '../../hooks'\nimport { FieldProps } from '../../types'\nimport Upload, {\n UploadFile,\n UploadFileNative,\n UploadProps,\n} from '../../../../components/Upload'\nimport useUpload from '../../../../components/upload/useUpload'\nimport { pickSpacingProps } from '../../../../components/flex/utils'\nimport HelpButtonInline, {\n HelpButtonInlineContent,\n} from '../../../../components/help-button/HelpButtonInline'\nimport { useTranslation as useSharedTranslation } from '../../../../shared'\nimport { SpacingProps } from '../../../../shared/types'\nimport { FormError } from '../../utils'\n\nexport type { UploadFile, UploadFileNative }\nexport type UploadValue = Array<UploadFile | UploadFileNative>\nexport type Props = Omit<\n FieldProps<UploadValue, UploadValue | undefined>,\n 'name'\n> &\n SpacingProps & {\n width?: Omit<FieldBlockWidth, 'medium' | 'small'>\n } & Pick<\n Partial<UploadProps>,\n | 'title'\n | 'text'\n | 'acceptedFileTypes'\n | 'filesAmountLimit'\n | 'fileMaxSize'\n | 'onFileDelete'\n | 'onFileClick'\n | 'skeleton'\n | 'download'\n > & {\n fileHandler?: (\n newFiles: UploadValue\n ) => UploadValue | Promise<UploadValue>\n }\n\nconst validateRequired = (\n value: UploadValue,\n { required, isChanged, error }\n) => {\n const hasError = value?.some((file) => file.errorMessage)\n if (hasError) {\n return new FormError('Upload.errorInvalidFiles')\n }\n\n const hasFiles = value?.length > 0\n if (required && ((!isChanged && !hasFiles) || !hasFiles)) {\n return error\n }\n\n return undefined\n}\n\nconst updateFileLoadingState = (\n files: UploadValue,\n { isLoading } = { isLoading: false }\n) => {\n return files.map((file) => ({ ...file, isLoading }))\n}\n\nfunction UploadComponent(props: Props) {\n const sharedTr = useSharedTranslation().Upload\n const formsTr = useFormsTranslation().Upload\n\n const errorMessages = useMemo(\n () => ({\n 'Field.errorRequired': formsTr.errorRequired,\n }),\n [formsTr.errorRequired]\n )\n\n const fromInput = useCallback((value: UploadValue) => {\n value.forEach((item, index) => {\n value[index] = item\n\n // Store the name in the value, to support session storage (serialization)\n value[index]['name'] = item['name'] || item.file?.name\n })\n\n return value\n }, [])\n\n const preparedProps = {\n errorMessages,\n validateRequired,\n fromInput,\n toInput: transformFiles,\n ...props,\n }\n\n const {\n id,\n className,\n width: widthProp = 'stretch',\n value,\n label,\n labelDescription,\n help,\n htmlAttributes,\n handleChange,\n handleFocus,\n handleBlur,\n fileHandler,\n ...rest\n } = useFieldProps(preparedProps, {\n executeOnChangeRegardlessOfError: true,\n })\n\n // Upload props\n const {\n title = sharedTr.title,\n text = sharedTr.text,\n acceptedFileTypes = ['pdf', 'png', 'jpg', 'jpeg'],\n filesAmountLimit = 100,\n fileMaxSize = 5,\n skeleton,\n onFileDelete,\n onFileClick,\n } = rest\n\n const { files, setFiles } = useUpload(id)\n\n const filesRef = useRef<Array<UploadFile>>()\n\n useEffect(() => {\n filesRef.current = files\n }, [files])\n\n useEffect(() => {\n setFiles(value)\n }, [setFiles, value])\n\n const handleChangeAsync = useCallback(\n async (existingFiles: UploadValue) => {\n // Filter out existing files\n const existingFileIds =\n filesRef.current?.map((file) => file.id) || []\n const newFiles = existingFiles.filter(\n (file) => !existingFileIds.includes(file.id)\n )\n\n if (newFiles.length > 0) {\n // Set loading\n setFiles([\n ...filesRef.current,\n ...updateFileLoadingState(newFiles, { isLoading: true }),\n ])\n\n const incomingFiles = await fileHandler(newFiles)\n\n const uploadedFiles = updateFileLoadingState(incomingFiles, {\n isLoading: false,\n })\n\n const indexOfFirstNewFile = filesRef.current.findIndex(\n ({ id }) => id === newFiles[0].id\n )\n\n const updatedFiles = [\n ...filesRef.current.slice(0, indexOfFirstNewFile),\n ...uploadedFiles,\n ...filesRef.current.slice(indexOfFirstNewFile + newFiles.length),\n ]\n\n // Set error, if any\n handleChange(updatedFiles)\n } else {\n handleChange(existingFiles)\n }\n },\n [setFiles, fileHandler, handleChange]\n )\n\n const changeHandler = useCallback(\n ({ files }: { files: UploadValue }) => {\n // Prevents the form-status from showing up\n handleBlur()\n handleFocus()\n\n if (fileHandler) {\n handleChangeAsync(files)\n } else {\n handleChange(files)\n }\n },\n [handleBlur, handleFocus, fileHandler, handleChangeAsync, handleChange]\n )\n\n const width = widthProp as FieldBlockWidth\n const fieldBlockProps: FieldBlockProps = {\n id,\n forId: `${id}-input`,\n labelSrOnly: true,\n className: classnames('dnb-forms-field-upload', className),\n width,\n help: undefined,\n ...pickSpacingProps(props),\n }\n\n return (\n <FieldBlock {...fieldBlockProps}>\n <Upload\n id={id}\n acceptedFileTypes={acceptedFileTypes}\n filesAmountLimit={filesAmountLimit}\n fileMaxSize={fileMaxSize}\n skeleton={skeleton}\n onChange={changeHandler}\n onFileDelete={onFileDelete}\n onFileClick={onFileClick}\n title={label ?? title}\n text={\n help ? (\n <>\n {labelDescription ?? text}\n <HelpButtonInline\n contentId={`${id}-help`}\n left={text ? 'x-small' : false}\n help={help}\n />\n </>\n ) : (\n labelDescription ?? text\n )\n }\n {...htmlAttributes}\n >\n {help && (\n <HelpButtonInlineContent contentId={`${id}-help`} help={help} />\n )}\n </Upload>\n </FieldBlock>\n )\n}\n\nexport default UploadComponent\n\nUploadComponent._supportsSpacingProps = true\n\nexport function transformFiles(value: UploadValue) {\n if (Array.isArray(value)) {\n if (value.length === 0) {\n return undefined\n }\n\n value.map((item) => {\n if (item?.file && !(item.file instanceof File)) {\n // To support session storage, we recreated the file blob.\n item['file'] = new File([], item['name'])\n }\n return item\n })\n }\n\n return value\n}\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACtE,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,UAAU,MAGV,kBAAkB;AACzB,SACEC,aAAa,EACbC,cAAc,IAAIC,mBAAmB,QAChC,aAAa;AAEpB,OAAOC,MAAM,MAIN,+BAA+B;AACtC,OAAOC,SAAS,MAAM,yCAAyC;AAC/D,SAASC,gBAAgB,QAAQ,mCAAmC;AACpE,OAAOC,gBAAgB,IACrBC,uBAAuB,QAClB,qDAAqD;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}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
const _excluded = ["value", "format", "className", "variant", "listType", "download", "displaySize", "onFileClick"];
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
9
|
import React, { useMemo, useState } from 'react';
|
|
7
10
|
import classnames from 'classnames';
|
|
8
11
|
import { useValueProps } from '../../hooks';
|
|
@@ -10,13 +13,16 @@ import ValueBlock from '../../ValueBlock';
|
|
|
10
13
|
import ListFormat from '../../../../components/list-format';
|
|
11
14
|
import { getFileIcon } from '../../../../components/upload/UploadFileListCell';
|
|
12
15
|
import { BYTES_IN_A_MEGA_BYTE } from '../../../../components/upload/UploadVerify';
|
|
16
|
+
import { transformFiles } from '../../Field/Upload/Upload';
|
|
13
17
|
import { format } from '../../../../components/number-format/NumberUtils';
|
|
14
18
|
import { UploadFileLink } from '../../../../components/upload/UploadFileListLink';
|
|
15
19
|
import { isAsync } from '../../../../shared/helpers/isAsync';
|
|
16
20
|
function Upload(props) {
|
|
17
|
-
const
|
|
21
|
+
const preparedProps = _objectSpread({
|
|
22
|
+
fromExternal: transformFiles
|
|
23
|
+
}, props);
|
|
24
|
+
const _useValueProps = useValueProps(preparedProps),
|
|
18
25
|
{
|
|
19
|
-
path,
|
|
20
26
|
value,
|
|
21
27
|
format,
|
|
22
28
|
className,
|
|
@@ -48,7 +54,7 @@ function Upload(props) {
|
|
|
48
54
|
listType: listType
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
|
-
}, [
|
|
57
|
+
}, [value, download, displaySize, onFileClick, format, variant, listType]);
|
|
52
58
|
return React.createElement(ValueBlock, _extends({
|
|
53
59
|
className: classnames('dnb-forms-value-upload', className)
|
|
54
60
|
}, rest), list);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Upload.js","names":["React","useMemo","useState","classnames","useValueProps","ValueBlock","ListFormat","getFileIcon","BYTES_IN_A_MEGA_BYTE","format","UploadFileLink","isAsync","Upload","props","
|
|
1
|
+
{"version":3,"file":"Upload.js","names":["React","useMemo","useState","classnames","useValueProps","ValueBlock","ListFormat","getFileIcon","BYTES_IN_A_MEGA_BYTE","transformFiles","format","UploadFileLink","isAsync","Upload","props","preparedProps","_objectSpread","fromExternal","_useValueProps","value","className","variant","listType","download","displaySize","onFileClick","rest","_objectWithoutProperties","_excluded","list","valueToUse","map","uploadFile","index","createElement","UploadFileItem","key","undefined","_extends","getSize","size","sizeInMb","decimals","_supportsSpacingProps","loading","setLoading","file","isLoading","fileIsLoading","handleFileClickAsync","fileItem","onFileClickHandler","imageUrl","URL","createObjectURL","text","name","left","href","onClick"],"sources":["../../../../../../src/extensions/forms/Value/Upload/Upload.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react'\nimport classnames from 'classnames'\nimport { useValueProps } from '../../hooks'\nimport { ValueProps } from '../../types'\nimport ValueBlock from '../../ValueBlock'\nimport ListFormat, {\n ListFormatProps,\n} from '../../../../components/list-format'\nimport type { UploadFile } from '../../../../components/upload/types'\nimport { getFileIcon } from '../../../../components/upload/UploadFileListCell'\nimport { BYTES_IN_A_MEGA_BYTE } from '../../../../components/upload/UploadVerify'\nimport {\n Props as FieldUploadProps,\n transformFiles,\n} from '../../Field/Upload/Upload'\nimport { format } from '../../../../components/number-format/NumberUtils'\nimport { UploadFileLink } from '../../../../components/upload/UploadFileListLink'\nimport { isAsync } from '../../../../shared/helpers/isAsync'\n\nexport type Props = ValueProps<Array<UploadFile>> &\n Omit<ListFormatProps, 'value'> &\n Pick<FieldUploadProps, 'download' | 'onFileClick'> & {\n displaySize?: boolean\n }\n\nfunction Upload(props: Props) {\n const preparedProps = {\n fromExternal: transformFiles,\n ...props,\n }\n\n const {\n value,\n format,\n className,\n variant = 'text',\n listType,\n download = false,\n displaySize = false,\n onFileClick,\n ...rest\n } = useValueProps(preparedProps)\n\n const list = useMemo(() => {\n const valueToUse =\n value?.map((uploadFile, index) => {\n if (!uploadFile) {\n return\n }\n\n return (\n <UploadFileItem\n key={index}\n uploadFile={uploadFile}\n download={download}\n displaySize={displaySize}\n onFileClick={onFileClick}\n />\n )\n }) || undefined\n\n if (valueToUse) {\n return (\n <ListFormat\n value={valueToUse}\n format={format}\n variant={variant}\n listType={listType}\n />\n )\n }\n }, [\n value,\n download,\n displaySize,\n onFileClick,\n format,\n variant,\n listType,\n ])\n\n return (\n <ValueBlock\n className={classnames('dnb-forms-value-upload', className)}\n {...rest}\n >\n {list}\n </ValueBlock>\n )\n}\n\nfunction getSize(size: number) {\n if (!size) {\n return\n }\n // Converts from b (binary) to MB (decimal)\n const sizeInMb = size / BYTES_IN_A_MEGA_BYTE\n return ` (${format(sizeInMb, {\n decimals: 0,\n })} MB)`\n}\n\nUpload._supportsSpacingProps = true\nexport default Upload\n\nfunction UploadFileItem(\n props: { uploadFile: UploadFile } & Pick<\n Props,\n 'download' | 'onFileClick' | 'displaySize'\n >\n) {\n const {\n uploadFile,\n download = false,\n displaySize = false,\n onFileClick,\n } = props\n\n const [loading, setLoading] = useState(false)\n\n const { file, isLoading: fileIsLoading } = uploadFile || {}\n\n if (!file) {\n return null\n }\n\n const handleFileClickAsync = async (uploadFile: UploadFile) => {\n setLoading(true)\n await onFileClick({ fileItem: uploadFile })\n setLoading(false)\n }\n\n const onFileClickHandler = async () => {\n if (typeof onFileClick === 'function') {\n if (isAsync(onFileClick)) {\n handleFileClickAsync(uploadFile)\n } else {\n onFileClick({ fileItem: uploadFile })\n }\n }\n }\n\n const imageUrl = file?.size > 0 ? URL.createObjectURL(file) : null\n\n const text = file.name + (displaySize ? ' ' + getSize(file.size) : '')\n const isLoading = fileIsLoading || loading\n return (\n <span className=\"dnb-forms-value-upload__item\">\n {getFileIcon(file, { isLoading, size: 'medium' }, false)}\n <UploadFileLink\n left=\"x-small\"\n text={text}\n href={imageUrl}\n download={download}\n onClick={onFileClick && onFileClickHandler}\n />\n </span>\n )\n}\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,aAAa,QAAQ,aAAa;AAE3C,OAAOC,UAAU,MAAM,kBAAkB;AACzC,OAAOC,UAAU,MAEV,oCAAoC;AAE3C,SAASC,WAAW,QAAQ,kDAAkD;AAC9E,SAASC,oBAAoB,QAAQ,4CAA4C;AACjF,SAEEC,cAAc,QACT,2BAA2B;AAClC,SAASC,MAAM,QAAQ,kDAAkD;AACzE,SAASC,cAAc,QAAQ,kDAAkD;AACjF,SAASC,OAAO,QAAQ,oCAAoC;AAQ5D,SAASC,MAAMA,CAACC,KAAY,EAAE;EAC5B,MAAMC,aAAa,GAAAC,aAAA;IACjBC,YAAY,EAAER;EAAc,GACzBK,KAAK,CACT;EAED,MAAAI,cAAA,GAUId,aAAa,CAACW,aAAa,CAAC;IAV1B;MACJI,KAAK;MACLT,MAAM;MACNU,SAAS;MACTC,OAAO,GAAG,MAAM;MAChBC,QAAQ;MACRC,QAAQ,GAAG,KAAK;MAChBC,WAAW,GAAG,KAAK;M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aAAA;IAAMd,SAAS,EAAC;EAA8B,GAC3Cb,WAAW,CAACuC,IAAI,EAAE;IAAEC,SAAS;IAAEP,IAAI,EAAE;EAAS,CAAC,EAAE,KAAK,CAAC,EACxDxC,KAAA,CAAAkC,aAAA,CAACvB,cAAc;IACb8C,IAAI,EAAC,SAAS;IACdF,IAAI,EAAEA,IAAK;IACXG,IAAI,EAAEN,QAAS;IACf7B,QAAQ,EAAEA,QAAS;IACnBoC,OAAO,EAAElC,WAAW,IAAI0B;EAAmB,CAC5C,CACG,CAAC;AAEX"}
|
|
@@ -27,20 +27,22 @@ export default function useExternalValue(props) {
|
|
|
27
27
|
}
|
|
28
28
|
if (inIterate && itemPath) {
|
|
29
29
|
if (itemPath === '/') {
|
|
30
|
-
|
|
30
|
+
var _transformers$current4, _transformers$current5, _transformers$current6;
|
|
31
|
+
return (_transformers$current4 = transformers === null || transformers === void 0 ? void 0 : (_transformers$current5 = transformers.current) === null || _transformers$current5 === void 0 ? void 0 : (_transformers$current6 = _transformers$current5.fromExternal) === null || _transformers$current6 === void 0 ? void 0 : _transformers$current6.call(_transformers$current5, iterateElementValue)) !== null && _transformers$current4 !== void 0 ? _transformers$current4 : emptyValue;
|
|
31
32
|
}
|
|
32
33
|
if (pointer.has(iterateElementValue, itemPath)) {
|
|
33
|
-
var
|
|
34
|
-
return (
|
|
34
|
+
var _transformers$current7, _transformers$current8, _transformers$current9;
|
|
35
|
+
return (_transformers$current7 = transformers === null || transformers === void 0 ? void 0 : (_transformers$current8 = transformers.current) === null || _transformers$current8 === void 0 ? void 0 : (_transformers$current9 = _transformers$current8.fromExternal) === null || _transformers$current9 === void 0 ? void 0 : _transformers$current9.call(_transformers$current8, pointer.get(iterateElementValue, itemPath))) !== null && _transformers$current7 !== void 0 ? _transformers$current7 : emptyValue;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
if (data && path) {
|
|
38
39
|
if (path === '/') {
|
|
39
|
-
|
|
40
|
+
var _transformers$current10, _transformers$current11, _transformers$current12;
|
|
41
|
+
return (_transformers$current10 = transformers === null || transformers === void 0 ? void 0 : (_transformers$current11 = transformers.current) === null || _transformers$current11 === void 0 ? void 0 : (_transformers$current12 = _transformers$current11.fromExternal) === null || _transformers$current12 === void 0 ? void 0 : _transformers$current12.call(_transformers$current11, data)) !== null && _transformers$current10 !== void 0 ? _transformers$current10 : emptyValue;
|
|
40
42
|
}
|
|
41
43
|
if (pointer.has(data, path)) {
|
|
42
|
-
var
|
|
43
|
-
return (
|
|
44
|
+
var _transformers$current13, _transformers$current14, _transformers$current15;
|
|
45
|
+
return (_transformers$current13 = transformers === null || transformers === void 0 ? void 0 : (_transformers$current14 = transformers.current) === null || _transformers$current14 === void 0 ? void 0 : (_transformers$current15 = _transformers$current14.fromExternal) === null || _transformers$current15 === void 0 ? void 0 : _transformers$current15.call(_transformers$current14, pointer.get(data, path))) !== null && _transformers$current13 !== void 0 ? _transformers$current13 : emptyValue;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
return emptyValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExternalValue.js","names":["useContext","useMemo","pointer","DataContext","IterateElementContext","useExternalValue","props","path","itemPath","value","transformers","emptyValue","undefined","data","iterateItemContext","inIterate","Boolean","iterateElementValue","_transformers$current","_transformers$current2","_transformers$current3","current","fromExternal","call","has","
|
|
1
|
+
{"version":3,"file":"useExternalValue.js","names":["useContext","useMemo","pointer","DataContext","IterateElementContext","useExternalValue","props","path","itemPath","value","transformers","emptyValue","undefined","data","iterateItemContext","inIterate","Boolean","iterateElementValue","_transformers$current","_transformers$current2","_transformers$current3","current","fromExternal","call","_transformers$current4","_transformers$current5","_transformers$current6","has","_transformers$current7","_transformers$current8","_transformers$current9","get","_transformers$current10","_transformers$current11","_transformers$current12","_transformers$current13","_transformers$current14","_transformers$current15"],"sources":["../../../../../src/extensions/forms/hooks/useExternalValue.ts"],"sourcesContent":["import { useContext, useMemo } from 'react'\nimport pointer from '../utils/json-pointer'\nimport { FieldProps, Path } from '../types'\nimport DataContext from '../DataContext/Context'\nimport IterateElementContext from '../Iterate/IterateItemContext'\n\nexport type Props<Value> = {\n path?: Path | undefined\n itemPath?: Path\n value?: Value\n transformers?: React.MutableRefObject<{\n fromExternal: FieldProps<Value>['fromExternal']\n }>\n emptyValue?: FieldProps<Value>['emptyValue']\n}\n\nexport default function useExternalValue<Value>(props: Props<Value>) {\n const {\n path,\n itemPath,\n value,\n transformers,\n emptyValue = undefined,\n } = props\n const { data } = useContext(DataContext) || {}\n const iterateItemContext = useContext(IterateElementContext)\n const inIterate = Boolean(iterateItemContext)\n const { value: iterateElementValue } = iterateItemContext || {}\n\n return useMemo(() => {\n if (value !== emptyValue) {\n // Value-prop sent directly to the field has highest priority, overriding any surrounding source\n return transformers?.current?.fromExternal?.(value) ?? emptyValue\n }\n\n if (inIterate && itemPath) {\n // This field is inside an iterate, and has a pointer from the base of the element being iterated\n if (itemPath === '/') {\n return (\n transformers?.current?.fromExternal?.(\n iterateElementValue as Value\n ) ?? emptyValue\n )\n }\n\n if (pointer.has(iterateElementValue, itemPath)) {\n return (\n transformers?.current?.fromExternal?.(\n pointer.get(iterateElementValue, itemPath) as Value\n ) ?? emptyValue\n )\n }\n }\n\n if (data && path) {\n // There is a surrounding data context and a path for where in the source to find the data\n if (path === '/') {\n return transformers?.current?.fromExternal?.(data) ?? emptyValue\n }\n\n if (pointer.has(data, path)) {\n return (\n transformers?.current?.fromExternal?.(pointer.get(data, path)) ??\n emptyValue\n )\n }\n }\n\n return emptyValue\n }, [\n data,\n emptyValue,\n inIterate,\n itemPath,\n iterateElementValue,\n path,\n transformers,\n value,\n ])\n}\n"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAC3C,OAAOC,OAAO,MAAM,uBAAuB;AAE3C,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,qBAAqB,MAAM,+BAA+B;AAYjE,eAAe,SAASC,gBAAgBA,CAAQC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4B,uBAAA,cAAAA,uBAAA,GAC9DxB,UAAU;MAEd;IACF;IAEA,OAAOA,UAAU;EACnB,CAAC,EAAE,CACDE,IAAI,EACJF,UAAU,EACVI,SAAS,EACTP,QAAQ,EACRS,mBAAmB,EACnBV,IAAI,EACJG,YAAY,EACZD,KAAK,CACN,CAAC;AACJ"}
|
package/es/shared/Eufemia.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "10.62.
|
|
1
|
+
export declare const version = "10.62.2";
|
|
2
2
|
export declare function init(): void;
|
package/es/shared/Eufemia.js
CHANGED
package/es/shared/Eufemia.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Eufemia.js","names":["version","init","window","Eufemia"],"sources":["../../../src/shared/Eufemia.ts"],"sourcesContent":["export const version = '10.62.
|
|
1
|
+
{"version":3,"file":"Eufemia.js","names":["version","init","window","Eufemia"],"sources":["../../../src/shared/Eufemia.ts"],"sourcesContent":["export const version = '10.62.2'\n\nexport function init() {\n if (typeof window !== 'undefined') {\n class Eufemia {\n get version() {\n return '10.62.2'\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 +1 @@
|
|
|
1
|
-
@charset "UTF-8";html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}body{margin:0}.dnb-core-style{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.62.
|
|
1
|
+
@charset "UTF-8";html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}body{margin:0}.dnb-core-style{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.62.2";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr{height:0;overflow:visible}.dnb-core-style main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul{list-style:none}.dnb-core-style abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video{display:inline-block}.dnb-core-style audio:not([controls]){display:none;height:0}.dnb-core-style img{border-style:none}.dnb-core-style svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root){overflow:hidden}.dnb-core-style table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select{margin:0}.dnb-core-style button{overflow:visible;text-transform:none}.dnb-core-style input{overflow:visible;word-break:normal}.dnb-core-style legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress{display:inline-block;vertical-align:baseline}.dnb-core-style select{text-transform:none}.dnb-core-style textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio]{padding:0}.dnb-core-style input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details{display:block}.dnb-core-style summary{display:list-item}.dnb-core-style canvas{display:inline-block}.dnb-core-style template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea{touch-action:manipulation}.dnb-core-style [hidden]{display:none}.dnb-core-style [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:""}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
|
package/es/style/dnb-ui-body.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.62.
|
|
1
|
+
html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.62.2";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}body :after,body :before{text-decoration:inherit;vertical-align:inherit}body hr{height:0;overflow:visible}body main{display:block}body nav ol,body nav ul{list-style:none}body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}body b,body strong{font-weight:bolder}body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}body audio,body video{display:inline-block}body audio:not([controls]){display:none;height:0}body img{border-style:none}body svg:not([fill]){fill:currentcolor}body svg:not(:root){overflow:hidden}body table{border-collapse:collapse}body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}body button,body figure,body input,body select{margin:0}body button{overflow:visible;text-transform:none}body input{overflow:visible;word-break:normal}body legend{color:inherit;display:table;max-width:100%;white-space:normal}body progress{display:inline-block;vertical-align:baseline}body select{text-transform:none}body textarea{overflow:auto;resize:vertical}body [type=checkbox],body [type=radio]{padding:0}body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}body ::input-placeholder{color:inherit;opacity:.54}body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}body ::-moz-focus-inner{border-style:none;padding:0}body details{display:block}body summary{display:list-item}body canvas{display:inline-block}body template{display:none}body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}body [hidden]{display:none}body [aria-busy=true]{cursor:progress}body [aria-controls]:not(input){cursor:pointer}body [aria-disabled=true],body [disabled]{cursor:not-allowed}body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{body{background-color:#fff;color:#000}}body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}
|
package/es/style/dnb-ui-core.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}.dnb-core-style,body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.62.0";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before,body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before,body :after,body :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr,body hr{height:0;overflow:visible}.dnb-core-style main,body main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul,body nav ol,body nav ul{list-style:none}.dnb-core-style abbr[title],body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong,body b,body strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp,body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection,body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video,body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video,body audio,body video{display:inline-block}.dnb-core-style audio:not([controls]),body audio:not([controls]){display:none;height:0}.dnb-core-style img,body img{border-style:none}.dnb-core-style svg:not([fill]),body svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root),body svg:not(:root){overflow:hidden}.dnb-core-style table,body table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea,body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select,body button,body figure,body input,body select{margin:0}.dnb-core-style button,body button{overflow:visible;text-transform:none}.dnb-core-style input,body input{overflow:visible;word-break:normal}.dnb-core-style legend,body legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress,body progress{display:inline-block;vertical-align:baseline}.dnb-core-style select,body select{text-transform:none}.dnb-core-style textarea,body textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio],body [type=checkbox],body [type=radio]{padding:0}.dnb-core-style input[type=search],body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button,body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder,body ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration,body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button,body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner,body ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details,body details{display:block}.dnb-core-style summary,body summary{display:list-item}.dnb-core-style canvas,body canvas{display:inline-block}.dnb-core-style template,body template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea,body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}.dnb-core-style [hidden],body [hidden]{display:none}.dnb-core-style [aria-busy=true],body [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input),body [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled],body [aria-disabled=true],body [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus),body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style,body{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme,body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:""}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
|
|
1
|
+
@charset "UTF-8";html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}.dnb-core-style,body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.62.2";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before,body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before,body :after,body :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr,body hr{height:0;overflow:visible}.dnb-core-style main,body main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul,body nav ol,body nav ul{list-style:none}.dnb-core-style abbr[title],body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong,body b,body strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp,body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection,body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video,body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video,body audio,body video{display:inline-block}.dnb-core-style audio:not([controls]),body audio:not([controls]){display:none;height:0}.dnb-core-style img,body img{border-style:none}.dnb-core-style svg:not([fill]),body svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root),body svg:not(:root){overflow:hidden}.dnb-core-style table,body table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea,body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select,body button,body figure,body input,body select{margin:0}.dnb-core-style button,body button{overflow:visible;text-transform:none}.dnb-core-style input,body input{overflow:visible;word-break:normal}.dnb-core-style legend,body legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress,body progress{display:inline-block;vertical-align:baseline}.dnb-core-style select,body select{text-transform:none}.dnb-core-style textarea,body textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio],body [type=checkbox],body [type=radio]{padding:0}.dnb-core-style input[type=search],body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button,body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder,body ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration,body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button,body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner,body ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details,body details{display:block}.dnb-core-style summary,body summary{display:list-item}.dnb-core-style canvas,body canvas{display:inline-block}.dnb-core-style template,body template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea,body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}.dnb-core-style [hidden],body [hidden]{display:none}.dnb-core-style [aria-busy=true],body [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input),body [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled],body [aria-disabled=true],body [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus),body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style,body{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme,body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:""}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
|
package/esm/dnb-ui-basis.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"react";var e,t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n={};e=function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t){e.exports=function(){if("undefined"==typeof document||"undefined"==typeof window)return{ask:function(){return"initial"},element:function(){return null},ignoreKeys:function(){},specificKeys:function(){},registerOnChange:function(){},unRegisterOnChange:function(){}};var e=document.documentElement,t=null,n="initial",o=n,i=Date.now(),r="false",a=["button","input","select","textarea"],d=[],u=[16,17,18,91,93],s=[],c={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch",touchend:"touch"},f=!1,w={x:null,y:null},l={2:"touch",3:"touch",4:"mouse"},p=!1;try{var m=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("test",null,m)}catch(e){}var v=function(){var e=!!p&&{passive:!0};document.addEventListener("DOMContentLoaded",g),window.PointerEvent?(window.addEventListener("pointerdown",h),window.addEventListener("pointermove",E)):window.MSPointerEvent?(window.addEventListener("MSPointerDown",h),window.addEventListener("MSPointerMove",E)):(window.addEventListener("mousedown",h),window.addEventListener("mousemove",E),"ontouchstart"in window&&(window.addEventListener("touchstart",h,e),window.addEventListener("touchend",h))),window.addEventListener(M(),E,e),window.addEventListener("keydown",h),window.addEventListener("keyup",h),window.addEventListener("focusin",x),window.addEventListener("focusout",L)},g=function(){if(r=!(e.getAttribute("data-whatpersist")||"false"===document.body.getAttribute("data-whatpersist")))try{window.sessionStorage.getItem("what-input")&&(n=window.sessionStorage.getItem("what-input")),window.sessionStorage.getItem("what-intent")&&(o=window.sessionStorage.getItem("what-intent"))}catch(e){}y("input"),y("intent")},h=function(e){var t=e.which,i=c[e.type];"pointer"===i&&(i=S(e));var r=!s.length&&-1===u.indexOf(t),d=s.length&&-1!==s.indexOf(t),f="keyboard"===i&&t&&(r||d)||"mouse"===i||"touch"===i;if(A(i)&&(f=!1),f&&n!==i&&(b("input",n=i),y("input")),f&&o!==i){var w=document.activeElement;w&&w.nodeName&&(-1===a.indexOf(w.nodeName.toLowerCase())||"button"===w.nodeName.toLowerCase()&&!k(w,"form"))&&(b("intent",o=i),y("intent"))}},y=function(t){e.setAttribute("data-what"+t,"input"===t?n:o),O(t)},E=function(e){var t=c[e.type];"pointer"===t&&(t=S(e)),P(e),(!f&&!A(t)||f&&"wheel"===e.type||"mousewheel"===e.type||"DOMMouseScroll"===e.type)&&o!==t&&(b("intent",o=t),y("intent"))},x=function(n){n.target.nodeName?(t=n.target.nodeName.toLowerCase(),e.setAttribute("data-whatelement",t),n.target.classList&&n.target.classList.length&&e.setAttribute("data-whatclasses",n.target.classList.toString().replace(" ",","))):L()},L=function(){t=null,e.removeAttribute("data-whatelement"),e.removeAttribute("data-whatclasses")},b=function(e,t){if(r)try{window.sessionStorage.setItem("what-"+e,t)}catch(e){}},S=function(e){return"number"==typeof e.pointerType?l[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType},A=function(e){var t=Date.now(),o="mouse"===e&&"touch"===n&&t-i<200;return i=t,o},M=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"},O=function(e){for(var t=0,i=d.length;t<i;t++)d[t].type===e&&d[t].fn.call(void 0,"input"===e?n:o)},P=function(e){w.x!==e.screenX||w.y!==e.screenY?(f=!1,w.x=e.screenX,w.y=e.screenY):f=!0},k=function(e,t){var n=window.Element.prototype;if(n.matches||(n.matches=n.msMatchesSelector||n.webkitMatchesSelector),n.closest)return e.closest(t);do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null};return"addEventListener"in window&&Array.prototype.indexOf&&(c[M()]="mouse",v()),{ask:function(e){return"intent"===e?o:n},element:function(){return t},ignoreKeys:function(e){u=e},specificKeys:function(e){s=e},registerOnChange:function(e,t){d.push({fn:e,type:t||"input"})},unRegisterOnChange:function(e){var t=function(e){for(var t=0,n=d.length;t<n;t++)if(d[t].fn===e)return t}(e);(t||0===t)&&d.splice(t,1)},clearStorage:function(){window.sessionStorage.clear()}}}()}])},{get exports(){return n},set exports(e){n=e}}.exports=e();var o=n;"function"==typeof t.setTimeout&&setTimeout,"function"==typeof t.clearTimeout&&clearTimeout;function i(e,t){this.fun=e,this.array=t}i.prototype.run=function(){this.fun.apply(null,this.array)};var r=t.performance||{};r.now||r.mozNow||r.msNow||r.oNow||r.webkitNow;new Date;const a="Mac|iPad|iPhone|iPod",d="Linux";let u=!1;var s,c,f,w,l,p,m,v;"undefined"!=typeof navigator&&/edge/i.test(null===(s=navigator)||void 0===s?void 0:s.userAgent),"undefined"!=typeof navigator&&new RegExp("iOS|iPhone|iPad|iPod","i").test(null===(c=navigator)||void 0===c?void 0:c.platform),u="undefined"!=typeof navigator&&/safari/i.test(null===(f=navigator)||void 0===f?void 0:f.userAgent)&&!/chrome/i.test(null===(w=navigator)||void 0===w?void 0:w.userAgent),"undefined"!=typeof navigator&&new RegExp("Win","i").test(null===(l=navigator)||void 0===l?void 0:l.platform),"undefined"!=typeof navigator&&new RegExp("Android","i").test(null===(p=navigator)||void 0===p?void 0:p.userAgent),"undefined"!=typeof navigator&&new RegExp(a,"i").test(null===(m=navigator)||void 0===m?void 0:m.platform),"undefined"!=typeof navigator&&new RegExp(d,"i").test(null===(v=navigator)||void 0===v?void 0:v.platform);function g(){if("undefined"!=typeof document){let e=!1;try{e=document.documentElement.getAttribute("data-whatintent")}catch(e){}return"touch"===e}return!1}function h(){const e=()=>{if("undefined"!=typeof document&&"undefined"!=typeof window&&"undefined"!=typeof navigator){try{"undefined"!=typeof window&&window.IS_TEST?document.documentElement.setAttribute("data-os","other"):null!==navigator.platform.match(new RegExp(a))?document.documentElement.setAttribute("data-os","mac"):null!==navigator.platform.match(new RegExp("Win"))?document.documentElement.setAttribute("data-os","win"):null!==navigator.platform.match(new RegExp(d))&&document.documentElement.setAttribute("data-os","linux")}catch(e){}document.removeEventListener("DOMContentLoaded",e)}};"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}!function(){try{0}catch(e){console.error(e)}}(),function(){if("undefined"!=typeof window){class e{get version(){return"10.62.
|
|
1
|
+
import"react";var e,t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n={};e=function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t){e.exports=function(){if("undefined"==typeof document||"undefined"==typeof window)return{ask:function(){return"initial"},element:function(){return null},ignoreKeys:function(){},specificKeys:function(){},registerOnChange:function(){},unRegisterOnChange:function(){}};var e=document.documentElement,t=null,n="initial",o=n,i=Date.now(),r="false",a=["button","input","select","textarea"],d=[],u=[16,17,18,91,93],s=[],c={keydown:"keyboard",keyup:"keyboard",mousedown:"mouse",mousemove:"mouse",MSPointerDown:"pointer",MSPointerMove:"pointer",pointerdown:"pointer",pointermove:"pointer",touchstart:"touch",touchend:"touch"},f=!1,w={x:null,y:null},l={2:"touch",3:"touch",4:"mouse"},p=!1;try{var m=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("test",null,m)}catch(e){}var v=function(){var e=!!p&&{passive:!0};document.addEventListener("DOMContentLoaded",g),window.PointerEvent?(window.addEventListener("pointerdown",h),window.addEventListener("pointermove",E)):window.MSPointerEvent?(window.addEventListener("MSPointerDown",h),window.addEventListener("MSPointerMove",E)):(window.addEventListener("mousedown",h),window.addEventListener("mousemove",E),"ontouchstart"in window&&(window.addEventListener("touchstart",h,e),window.addEventListener("touchend",h))),window.addEventListener(M(),E,e),window.addEventListener("keydown",h),window.addEventListener("keyup",h),window.addEventListener("focusin",x),window.addEventListener("focusout",L)},g=function(){if(r=!(e.getAttribute("data-whatpersist")||"false"===document.body.getAttribute("data-whatpersist")))try{window.sessionStorage.getItem("what-input")&&(n=window.sessionStorage.getItem("what-input")),window.sessionStorage.getItem("what-intent")&&(o=window.sessionStorage.getItem("what-intent"))}catch(e){}y("input"),y("intent")},h=function(e){var t=e.which,i=c[e.type];"pointer"===i&&(i=S(e));var r=!s.length&&-1===u.indexOf(t),d=s.length&&-1!==s.indexOf(t),f="keyboard"===i&&t&&(r||d)||"mouse"===i||"touch"===i;if(A(i)&&(f=!1),f&&n!==i&&(b("input",n=i),y("input")),f&&o!==i){var w=document.activeElement;w&&w.nodeName&&(-1===a.indexOf(w.nodeName.toLowerCase())||"button"===w.nodeName.toLowerCase()&&!k(w,"form"))&&(b("intent",o=i),y("intent"))}},y=function(t){e.setAttribute("data-what"+t,"input"===t?n:o),O(t)},E=function(e){var t=c[e.type];"pointer"===t&&(t=S(e)),P(e),(!f&&!A(t)||f&&"wheel"===e.type||"mousewheel"===e.type||"DOMMouseScroll"===e.type)&&o!==t&&(b("intent",o=t),y("intent"))},x=function(n){n.target.nodeName?(t=n.target.nodeName.toLowerCase(),e.setAttribute("data-whatelement",t),n.target.classList&&n.target.classList.length&&e.setAttribute("data-whatclasses",n.target.classList.toString().replace(" ",","))):L()},L=function(){t=null,e.removeAttribute("data-whatelement"),e.removeAttribute("data-whatclasses")},b=function(e,t){if(r)try{window.sessionStorage.setItem("what-"+e,t)}catch(e){}},S=function(e){return"number"==typeof e.pointerType?l[e.pointerType]:"pen"===e.pointerType?"touch":e.pointerType},A=function(e){var t=Date.now(),o="mouse"===e&&"touch"===n&&t-i<200;return i=t,o},M=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"},O=function(e){for(var t=0,i=d.length;t<i;t++)d[t].type===e&&d[t].fn.call(void 0,"input"===e?n:o)},P=function(e){w.x!==e.screenX||w.y!==e.screenY?(f=!1,w.x=e.screenX,w.y=e.screenY):f=!0},k=function(e,t){var n=window.Element.prototype;if(n.matches||(n.matches=n.msMatchesSelector||n.webkitMatchesSelector),n.closest)return e.closest(t);do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null};return"addEventListener"in window&&Array.prototype.indexOf&&(c[M()]="mouse",v()),{ask:function(e){return"intent"===e?o:n},element:function(){return t},ignoreKeys:function(e){u=e},specificKeys:function(e){s=e},registerOnChange:function(e,t){d.push({fn:e,type:t||"input"})},unRegisterOnChange:function(e){var t=function(e){for(var t=0,n=d.length;t<n;t++)if(d[t].fn===e)return t}(e);(t||0===t)&&d.splice(t,1)},clearStorage:function(){window.sessionStorage.clear()}}}()}])},{get exports(){return n},set exports(e){n=e}}.exports=e();var o=n;"function"==typeof t.setTimeout&&setTimeout,"function"==typeof t.clearTimeout&&clearTimeout;function i(e,t){this.fun=e,this.array=t}i.prototype.run=function(){this.fun.apply(null,this.array)};var r=t.performance||{};r.now||r.mozNow||r.msNow||r.oNow||r.webkitNow;new Date;const a="Mac|iPad|iPhone|iPod",d="Linux";let u=!1;var s,c,f,w,l,p,m,v;"undefined"!=typeof navigator&&/edge/i.test(null===(s=navigator)||void 0===s?void 0:s.userAgent),"undefined"!=typeof navigator&&new RegExp("iOS|iPhone|iPad|iPod","i").test(null===(c=navigator)||void 0===c?void 0:c.platform),u="undefined"!=typeof navigator&&/safari/i.test(null===(f=navigator)||void 0===f?void 0:f.userAgent)&&!/chrome/i.test(null===(w=navigator)||void 0===w?void 0:w.userAgent),"undefined"!=typeof navigator&&new RegExp("Win","i").test(null===(l=navigator)||void 0===l?void 0:l.platform),"undefined"!=typeof navigator&&new RegExp("Android","i").test(null===(p=navigator)||void 0===p?void 0:p.userAgent),"undefined"!=typeof navigator&&new RegExp(a,"i").test(null===(m=navigator)||void 0===m?void 0:m.platform),"undefined"!=typeof navigator&&new RegExp(d,"i").test(null===(v=navigator)||void 0===v?void 0:v.platform);function g(){if("undefined"!=typeof document){let e=!1;try{e=document.documentElement.getAttribute("data-whatintent")}catch(e){}return"touch"===e}return!1}function h(){const e=()=>{if("undefined"!=typeof document&&"undefined"!=typeof window&&"undefined"!=typeof navigator){try{"undefined"!=typeof window&&window.IS_TEST?document.documentElement.setAttribute("data-os","other"):null!==navigator.platform.match(new RegExp(a))?document.documentElement.setAttribute("data-os","mac"):null!==navigator.platform.match(new RegExp("Win"))?document.documentElement.setAttribute("data-os","win"):null!==navigator.platform.match(new RegExp(d))&&document.documentElement.setAttribute("data-os","linux")}catch(e){}document.removeEventListener("DOMContentLoaded",e)}};"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}!function(){try{0}catch(e){console.error(e)}}(),function(){if("undefined"!=typeof window){class e{get version(){return"10.62.2"}}window.Eufemia=new e}}(),o.specificKeys([9]),h();export{h as defineNavigator,g as isTouchDevice};
|