@x15ventures/x15-ui-library 3.16.1 → 3.18.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/dist/cjs/autoGenerated/libraryThemes.js +12 -12
- package/dist/cjs/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/cjs/autoGenerated/libraryThemes.json +12 -12
- package/dist/cjs/components/design/accordion/Accordion.js +7 -23
- package/dist/cjs/components/design/accordion/Accordion.js.map +1 -1
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js +2 -4
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/cjs/components/design/card/cardContent/CardContentLine.js +2 -2
- package/dist/cjs/components/design/card/cardContent/CardContentLine.js.map +1 -1
- package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js +2 -2
- package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
- package/dist/cjs/components/design/dialog/Dialog.js +3 -1
- package/dist/cjs/components/design/dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/design/dialog/dialog.css +5 -0
- package/dist/cjs/components/design/headerBar/HeaderBar.js +3 -3
- package/dist/cjs/components/design/headerBar/HeaderBar.js.map +1 -1
- package/dist/cjs/components/design/icons/notificationIcon/NotificationIcon.js +4 -5
- package/dist/cjs/components/design/icons/notificationIcon/NotificationIcon.js.map +1 -1
- package/dist/cjs/components/design/paginators/Paginator.js +4 -12
- package/dist/cjs/components/design/paginators/Paginator.js.map +1 -1
- package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js +89 -0
- package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js.map +1 -0
- package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/circularProgressIndicator.css +301 -0
- package/dist/cjs/components/design/revealMore/RevealMoreBelow.js +1 -3
- package/dist/cjs/components/design/revealMore/RevealMoreBelow.js.map +1 -1
- package/dist/cjs/components/design/revealMore/RevealMoreInline.js +3 -5
- package/dist/cjs/components/design/revealMore/RevealMoreInline.js.map +1 -1
- package/dist/cjs/components/design/revealMore/types/revealMoreTypes.js.map +1 -1
- package/dist/cjs/components/design/sidePanel/SidePanel.js +3 -5
- package/dist/cjs/components/design/sidePanel/SidePanel.js.map +1 -1
- package/dist/cjs/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js +6 -11
- package/dist/cjs/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js.map +1 -1
- package/dist/cjs/components/design/tabs/Tabs.js +2 -2
- package/dist/cjs/components/design/tabs/Tabs.js.map +1 -1
- package/dist/cjs/components/design/themeLoader/ThemeLoader.js +2 -2
- package/dist/cjs/components/design/themeLoader/ThemeLoader.js.map +1 -1
- package/dist/cjs/components/design/tooltip/Tooltip.js +43 -13
- package/dist/cjs/components/design/tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/design/tooltip/index.js +6 -0
- package/dist/cjs/components/design/tooltip/index.js.map +1 -1
- package/dist/cjs/components/design/tooltip/tooltip.css +18 -7
- package/dist/cjs/components/form/buttons/SimpleButton.js +3 -3
- package/dist/cjs/components/form/buttons/SimpleButton.js.map +1 -1
- package/dist/cjs/components/form/buttons/button.interface.js.map +1 -1
- package/dist/cjs/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +5 -5
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js +176 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js.map +1 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/_checkboxSwitchVariables.css +0 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitch.css +306 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js +6 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js.map +1 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +3 -5
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js +12 -22
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileInputProps.js.map +1 -1
- package/dist/cjs/components/index.js +14 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/navigation/menu/Menu.interfaces.js.map +1 -1
- package/dist/cjs/components/navigation/menu/menuItemContent/MenuItemIcon.js +19 -31
- package/dist/cjs/components/navigation/menu/menuItemContent/MenuItemIcon.js.map +1 -1
- package/dist/cjs/helpers/iconHelpers.js +83 -0
- package/dist/cjs/helpers/iconHelpers.js.map +1 -0
- package/dist/cjs/helpers/index.js +43 -0
- package/dist/cjs/helpers/index.js.map +1 -1
- package/dist/cjs/helpers/objectHelpers.js +9 -2
- package/dist/cjs/helpers/objectHelpers.js.map +1 -1
- package/dist/cjs/hooks/InteractiveHostFocus.js +62 -0
- package/dist/cjs/hooks/InteractiveHostFocus.js.map +1 -0
- package/dist/cjs/hooks/index.js +7 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/index.js +79 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/headerText.interface.js.map +1 -1
- package/dist/cjs/package.json +16 -28
- package/dist/cjs/styles/index.css +61 -0
- package/dist/cjs/styles/storybook/storybook.css +7 -0
- package/dist/cjs/styles/variables/cssVars/_darkModeVariables.css +21 -0
- package/dist/cjs/styles/variables/cssVars/_formVariables.css +40 -0
- package/dist/cjs/widgets/index.js +14 -0
- package/dist/cjs/widgets/index.js.map +1 -0
- package/dist/cjs/widgets/processLauncher/ProcessLauncher.js +272 -0
- package/dist/cjs/widgets/processLauncher/ProcessLauncher.js.map +1 -0
- package/dist/cjs/widgets/processLauncher/index.js +13 -0
- package/dist/cjs/widgets/processLauncher/index.js.map +1 -0
- package/dist/cjs/widgets/processLauncher/processLauncher.interfaces.js +6 -0
- package/dist/cjs/widgets/processLauncher/processLauncher.interfaces.js.map +1 -0
- package/dist/components/design/accordion/Accordion.d.ts +3 -2
- package/dist/components/design/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/design/banners/pageBanner/PageBanner.d.ts +2 -1
- package/dist/components/design/banners/pageBanner/PageBanner.d.ts.map +1 -1
- package/dist/components/design/card/cardContent/CardContentLine.d.ts +2 -2
- package/dist/components/design/card/cardContent/CardContentLine.d.ts.map +1 -1
- package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts +2 -2
- package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts.map +1 -1
- package/dist/components/design/dialog/Dialog.d.ts.map +1 -1
- package/dist/components/design/headerBar/HeaderBar.d.ts.map +1 -1
- package/dist/components/design/icons/notificationIcon/NotificationIcon.d.ts +2 -2
- package/dist/components/design/icons/notificationIcon/NotificationIcon.d.ts.map +1 -1
- package/dist/components/design/paginators/Paginator.d.ts +3 -2
- package/dist/components/design/paginators/Paginator.d.ts.map +1 -1
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.d.ts +18 -0
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.d.ts.map +1 -0
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts +5 -0
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts.map +1 -0
- package/dist/components/design/revealMore/RevealMoreBelow.d.ts.map +1 -1
- package/dist/components/design/revealMore/RevealMoreInline.d.ts.map +1 -1
- package/dist/components/design/revealMore/types/revealMoreTypes.d.ts +3 -2
- package/dist/components/design/revealMore/types/revealMoreTypes.d.ts.map +1 -1
- package/dist/components/design/sidePanel/SidePanel.d.ts +3 -2
- package/dist/components/design/sidePanel/SidePanel.d.ts.map +1 -1
- package/dist/components/design/statusIndicators/statusIconLabel/StatusIconLabel.d.ts +2 -2
- package/dist/components/design/statusIndicators/statusIconLabel/StatusIconLabel.d.ts.map +1 -1
- package/dist/components/design/tabs/Tabs.d.ts +3 -3
- package/dist/components/design/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/design/tooltip/Tooltip.d.ts +17 -3
- package/dist/components/design/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/design/tooltip/Tooltip.test.d.ts +1 -1
- package/dist/components/design/tooltip/Tooltip.test.d.ts.map +1 -1
- package/dist/components/design/tooltip/index.d.ts +1 -1
- package/dist/components/design/tooltip/index.d.ts.map +1 -1
- package/dist/components/form/buttons/SimpleButton.test.d.ts +5 -0
- package/dist/components/form/buttons/SimpleButton.test.d.ts.map +1 -0
- package/dist/components/form/buttons/button.interface.d.ts +3 -3
- package/dist/components/form/buttons/button.interface.d.ts.map +1 -1
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +2 -1
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.d.ts +29 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts +5 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.d.ts +52 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts +3 -3
- package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/file/fileInputProps.d.ts +4 -3
- package/dist/components/form/formFields/subComponents/inputs/file/fileInputProps.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/navigation/menu/Menu.interfaces.d.ts +4 -3
- package/dist/components/navigation/menu/Menu.interfaces.d.ts.map +1 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.d.ts +2 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.d.ts.map +1 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts +5 -0
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts.map +1 -0
- package/dist/esm/autoGenerated/libraryThemes.js +12 -12
- package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/esm/autoGenerated/libraryThemes.json +12 -12
- package/dist/esm/components/design/accordion/Accordion.js +7 -23
- package/dist/esm/components/design/accordion/Accordion.js.map +1 -1
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js +2 -4
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/esm/components/design/card/cardContent/CardContentLine.js +2 -2
- package/dist/esm/components/design/card/cardContent/CardContentLine.js.map +1 -1
- package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js +2 -2
- package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
- package/dist/esm/components/design/dialog/Dialog.js +3 -1
- package/dist/esm/components/design/dialog/Dialog.js.map +1 -1
- package/dist/esm/components/design/dialog/dialog.css +5 -0
- package/dist/esm/components/design/headerBar/HeaderBar.js +3 -3
- package/dist/esm/components/design/headerBar/HeaderBar.js.map +1 -1
- package/dist/esm/components/design/icons/notificationIcon/NotificationIcon.js +4 -5
- package/dist/esm/components/design/icons/notificationIcon/NotificationIcon.js.map +1 -1
- package/dist/esm/components/design/paginators/Paginator.js +4 -12
- package/dist/esm/components/design/paginators/Paginator.js.map +1 -1
- package/dist/esm/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js +82 -0
- package/dist/esm/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js.map +1 -0
- package/dist/esm/components/design/progressIndicators/circularProgressIndicator/circularProgressIndicator.css +301 -0
- package/dist/esm/components/design/revealMore/RevealMoreBelow.js +1 -3
- package/dist/esm/components/design/revealMore/RevealMoreBelow.js.map +1 -1
- package/dist/esm/components/design/revealMore/RevealMoreInline.js +2 -4
- package/dist/esm/components/design/revealMore/RevealMoreInline.js.map +1 -1
- package/dist/esm/components/design/revealMore/types/revealMoreTypes.js.map +1 -1
- package/dist/esm/components/design/sidePanel/SidePanel.js +3 -5
- package/dist/esm/components/design/sidePanel/SidePanel.js.map +1 -1
- package/dist/esm/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js +6 -11
- package/dist/esm/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js.map +1 -1
- package/dist/esm/components/design/tabs/Tabs.js +2 -2
- package/dist/esm/components/design/tabs/Tabs.js.map +1 -1
- package/dist/esm/components/design/themeLoader/ThemeLoader.js +1 -1
- package/dist/esm/components/design/themeLoader/ThemeLoader.js.map +1 -1
- package/dist/esm/components/design/tooltip/Tooltip.js +41 -12
- package/dist/esm/components/design/tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/design/tooltip/index.js +1 -1
- package/dist/esm/components/design/tooltip/index.js.map +1 -1
- package/dist/esm/components/design/tooltip/tooltip.css +18 -7
- package/dist/esm/components/form/buttons/SimpleButton.js +3 -3
- package/dist/esm/components/form/buttons/SimpleButton.js.map +1 -1
- package/dist/esm/components/form/buttons/button.interface.js.map +1 -1
- package/dist/esm/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +5 -5
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js +167 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js.map +1 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/_checkboxSwitchVariables.css +0 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitch.css +306 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js +2 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js.map +1 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +3 -5
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js +12 -22
- package/dist/esm/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/fileInputProps.js.map +1 -1
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/navigation/menu/Menu.interfaces.js.map +1 -1
- package/dist/esm/components/navigation/menu/menuItemContent/MenuItemIcon.js +17 -30
- package/dist/esm/components/navigation/menu/menuItemContent/MenuItemIcon.js.map +1 -1
- package/dist/esm/helpers/iconHelpers.js +73 -0
- package/dist/esm/helpers/iconHelpers.js.map +1 -0
- package/dist/esm/helpers/index.js +2 -1
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/objectHelpers.js +7 -3
- package/dist/esm/helpers/objectHelpers.js.map +1 -1
- package/dist/esm/hooks/InteractiveHostFocus.js +56 -0
- package/dist/esm/hooks/InteractiveHostFocus.js.map +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/headerText.interface.js.map +1 -1
- package/dist/esm/package.json +16 -28
- package/dist/esm/styles/index.css +61 -0
- package/dist/esm/styles/storybook/storybook.css +7 -0
- package/dist/esm/styles/variables/cssVars/_darkModeVariables.css +21 -0
- package/dist/esm/styles/variables/cssVars/_formVariables.css +40 -0
- package/dist/esm/widgets/index.js +4 -0
- package/dist/esm/widgets/index.js.map +1 -0
- package/dist/esm/widgets/processLauncher/ProcessLauncher.js +263 -0
- package/dist/esm/widgets/processLauncher/ProcessLauncher.js.map +1 -0
- package/dist/esm/widgets/processLauncher/index.js +2 -0
- package/dist/esm/widgets/processLauncher/index.js.map +1 -0
- package/dist/esm/widgets/processLauncher/processLauncher.interfaces.js +2 -0
- package/dist/esm/widgets/processLauncher/processLauncher.interfaces.js.map +1 -0
- package/dist/helpers/iconHelpers.d.ts +30 -0
- package/dist/helpers/iconHelpers.d.ts.map +1 -0
- package/dist/helpers/iconHelpers.test.d.ts +5 -0
- package/dist/helpers/iconHelpers.test.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +4 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/objectHelpers.d.ts +10 -3
- package/dist/helpers/objectHelpers.d.ts.map +1 -1
- package/dist/hooks/InteractiveHostFocus.d.ts +12 -0
- package/dist/hooks/InteractiveHostFocus.d.ts.map +1 -0
- package/dist/hooks/InteractiveHostFocus.test.d.ts +5 -0
- package/dist/hooks/InteractiveHostFocus.test.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/interfaces/headerText.interface.d.ts +3 -3
- package/dist/interfaces/headerText.interface.d.ts.map +1 -1
- package/dist/package.json +16 -28
- package/dist/widgets/index.d.ts +3 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/processLauncher/ProcessLauncher.d.ts +21 -0
- package/dist/widgets/processLauncher/ProcessLauncher.d.ts.map +1 -0
- package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts +5 -0
- package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts.map +1 -0
- package/dist/widgets/processLauncher/index.d.ts +4 -0
- package/dist/widgets/processLauncher/index.d.ts.map +1 -0
- package/dist/widgets/processLauncher/processLauncher.interfaces.d.ts +45 -0
- package/dist/widgets/processLauncher/processLauncher.interfaces.d.ts.map +1 -0
- package/package.json +16 -28
- package/readme.md +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragAndDropFileUpload.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","arrowUpFromBracket","SvgIcon","useFormContext","HookFormWrapper","Spinner","FormFieldLabel","InputFile","ValidationMessages","generateButtonClass","FileAttachmentsList","DEFAULT_UPLOAD_FILE_EXTENSIONS","DEFAULT_UPLOAD_FILE_TYPES","BLACKLISTED_FILE_TYPES","DragAndDropFileUpload","props","createElement","formContext","DragAndDropFileUploadField","label","field","showSpinner","fileDisplayStyle","fileListSettings","fileList","validation","customContent","customCssClasses","labelStyle","labelAsButtonStyles","color","variant","labelUploadIcon","svgDefinition","multiple","restrictionsTxt","validFiles","extensions","fileTypes","maxFileCount","maxFileSize","onFilesChange","setValue","trigger","activeFileList","setFileList","isTouched","setIsTouched","isDragActive","setIsDragActive","inputId","id","inputElRef","dialogOpenRef","current","document","getElementById","onFocus","noneSelected","files","length","name","window","addEventListener","removeEventListener","supportedFileTypes","join","validateAndCommit","validated","filter","file","ext","split","pop","toLowerCase","isBlacklisted","includes","isValidExt","isValidSize","size","clipped","slice","shouldValidate","shouldDirty","shouldTouch","handleFileInputChange","event","target","Array","from","handleDrop","dropped","handleFilesEdited","wrapperCssClass","wrapper","position","labelProps","isRequired","required","labelStyleAsButtonClasses","cssClass","buttonStyle","hideLabel","hide","labelCssClass","className","onDragOver","e","preventDefault","onDragLeave","currentTarget","onDrop","dataTransfer","labelId","htmlFor","onClick","type","defaultValue","accept","onInput","map","index","key","customFileListSettings","onFilesRemoved","onFilesEdited"],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.tsx"],"sourcesContent":["'use client';\n\nimport React, { FormEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { arrowUpFromBracket } from '@x15ventures/x15-ui-library-icons/iconDefinitions';\nimport { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../../../hookFormWrapper/HookFormWrapper';\nimport { Spinner } from '../../../../../../design/spinner/Spinner';\nimport { FormFieldLabel } from '../../../../subComponents/labels/FormFieldLabel';\nimport { InputFile } from '../../../../subComponents/inputs/file/InputFile';\nimport { ValidationMessages } from '../../../../../validation/ValidationMessages';\nimport { generateButtonClass } from '../../../../../buttons/button.helpers';\nimport { FileAttachmentsList } from '../fileAttachmentList/FileAttachmentsList';\nimport { DragAndDropFileUploadProps } from '../fileInputProps';\nimport {\n DEFAULT_UPLOAD_FILE_EXTENSIONS,\n DEFAULT_UPLOAD_FILE_TYPES,\n BLACKLISTED_FILE_TYPES\n} from '../../../../../../../constants';\n\nimport './dragAndDropFileUpload.scss';\n\nexport const DragAndDropFileUpload: React.FC<DragAndDropFileUploadProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <DragAndDropFileUploadField { ...props } />\n </HookFormWrapper>\n);\n\nconst DragAndDropFileUploadField: React.FC<DragAndDropFileUploadProps> = (\n {\n label,\n field,\n showSpinner,\n fileDisplayStyle = 'names',\n fileListSettings,\n fileList,\n validation,\n customContent,\n customCssClasses,\n labelStyle = 'dragArea',\n labelAsButtonStyles = { color: 'primary', variant: 'outline' },\n labelUploadIcon = <SvgIcon svgDefinition={ arrowUpFromBracket } />,\n multiple = false,\n restrictionsTxt = '',\n validFiles = {\n extensions: DEFAULT_UPLOAD_FILE_EXTENSIONS,\n fileTypes: DEFAULT_UPLOAD_FILE_TYPES,\n maxFileCount: 5,\n maxFileSize: 52428800 // 50 MB\n },\n onFilesChange = () => {}\n }\n) => {\n const { setValue, trigger } = useFormContext();\n\n const [activeFileList, setFileList] = useState<File[]>(fileList || []);\n const [isTouched, setIsTouched] = useState(false);\n const [isDragActive, setIsDragActive] = useState(false);\n\n const inputId = field.id;\n const inputElRef = useRef<HTMLInputElement | null>(null);\n const dialogOpenRef = useRef(false);\n\n useEffect(() => {\n inputElRef.current = document.getElementById(inputId) as HTMLInputElement | null;\n }, [inputId]);\n\n // Detect “Cancel” -> dialog closes, window regains focus, but input had no change.\n useEffect(() => {\n const onFocus = () => {\n if (!dialogOpenRef.current) { return; }\n dialogOpenRef.current = false;\n const noneSelected = !inputElRef.current?.files?.length;\n if (noneSelected) {\n // Trigger React Hook Form validators (e.g., required)\n trigger(field.name);\n }\n };\n window.addEventListener('focus', onFocus);\n return () => window.removeEventListener('focus', onFocus);\n }, [trigger, field.name]);\n\n const supportedFileTypes = useMemo(\n () => validFiles?.fileTypes?.join(', ') || '',\n [validFiles?.fileTypes]\n );\n\n const validateAndCommit = useCallback(\n (files: File[]) => {\n // basic validations\n const validated = files.filter((file) => {\n const ext = file.name.split('.').pop()?.toLowerCase() || '';\n const isBlacklisted = BLACKLISTED_FILE_TYPES.includes(ext);\n const isValidExt = validFiles.extensions ? validFiles.extensions.includes(ext) : true;\n const isValidSize = validFiles.maxFileSize ? file.size <= validFiles.maxFileSize : true;\n return !isBlacklisted && isValidExt && isValidSize;\n });\n\n const clipped = validFiles.maxFileCount\n ? validated.slice(0, validFiles.maxFileCount)\n : validated;\n\n setFileList(clipped);\n setIsTouched(true);\n\n setValue(field.name, clipped.length ? clipped : null, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true\n });\n\n onFilesChange(clipped);\n },\n [field.name, onFilesChange, setValue, fileDisplayStyle, validFiles]\n );\n\n const handleFileInputChange = useCallback((event: FormEvent<HTMLInputElement>) => {\n const target = event.target as HTMLInputElement;\n const files = Array.from(target.files ?? []);\n validateAndCommit(files);\n trigger(field.name);\n dialogOpenRef.current = false;\n }, [trigger, field.name, validateAndCommit]);\n\n const handleDrop = useCallback((dropped: File[]) => {\n validateAndCommit(dropped);\n trigger(field.name);\n }, [trigger, field.name, validateAndCommit]);\n\n const handleFilesEdited = useCallback((files: File[]) => {\n // No need to validate again as they were already validated\n // Changes may include renaming or removing files\n setFileList(files);\n setValue(field.name, files.length > 0 ? files : null, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true\n });\n onFilesChange(files);\n }, [field.name, setValue, onFilesChange]);\n\n const wrapperCssClass = `\n formField \n dragAndDropFileUpload \n ${ fileDisplayStyle === 'list' ? 'withFileList' : '' } \n ${ labelStyle || '' }Style \n ${ customCssClasses?.wrapper || '' } \n ${ isTouched ? 'touched' : '' } \n ${ typeof validation !== 'undefined' ? 'withValidation' : '' } \n ${ label?.position === 'inset' ? 'insetLabel' : '' } \n ${ isDragActive ? 'isDragActive' : '' }\n `;\n\n const labelProps = {\n ...label,\n inputId: inputId,\n isRequired: validation && typeof validation.required !== 'undefined',\n customContent\n };\n\n const labelStyleAsButtonClasses = generateButtonClass({\n cssClass: 'button dragAndDropFileUploadButtonLabel',\n buttonStyle: labelAsButtonStyles,\n hideLabel: label.hide\n });\n\n const labelCssClass = `\n ${ labelStyle === 'button' ? labelStyleAsButtonClasses : '' }\n ${ customCssClasses?.label || '' } \n ${ showSpinner ? 'withSpinner' : '' } \n ${ label.hide ? 'hiddenLabel' : '' }\n `;\n\n return (\n <div\n className={ wrapperCssClass }\n onDragOver={ (e) => {\n e.preventDefault();\n if (!isDragActive) setIsDragActive(true);\n } }\n onDragLeave={ (e) => {\n if (e.currentTarget === e.target) setIsDragActive(false);\n } }\n onDrop={ (e) => {\n e.preventDefault();\n setIsDragActive(false);\n const files = Array.from(e.dataTransfer?.files ?? []);\n handleDrop(files);\n } }\n >\n <label\n id={ label.labelId || `${ inputId }_label` }\n className={ labelCssClass }\n htmlFor={ inputId }\n onClick={ () => { dialogOpenRef.current = true; } }\n >\n <span className=\"dragAndDropFileUploadLabel\">\n { labelUploadIcon || null }\n <FormFieldLabel { ...labelProps } />\n { restrictionsTxt && <span className=\"fileRestrictionsText\">{ restrictionsTxt }</span> }\n </span>\n\n <span className=\"inputContainer\">\n <InputFile\n {\n ...{\n label,\n field: {\n ...field,\n type: 'file',\n id: inputId, // ensure we can query it by id\n defaultValue: '',\n multiple,\n accept: supportedFileTypes,\n onInput: (event: FormEvent<HTMLInputElement>) => {\n handleFileInputChange(event);\n }\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n }\n />\n </span>\n\n { showSpinner && <Spinner /> }\n\n { fileDisplayStyle === 'names' && activeFileList.length > 0 && (\n <span className=\"uploadedFileNames\">\n { activeFileList.map((file, index) => (\n <small key={ index } className=\"uploadedFileName\">\n { file.name }{ index < activeFileList.length - 1 ? ', ' : '' }\n </small>\n )) }\n </span>\n ) }\n\n <ValidationMessages name={ field.name } validation={ validation } />\n </label>\n\n { fileDisplayStyle === 'list' && activeFileList.length > 0 && (\n <FileAttachmentsList\n customFileListSettings={ fileListSettings }\n files={ activeFileList }\n onFilesRemoved={ handleFilesEdited }\n onFilesEdited={ handleFilesEdited }\n />\n ) }\n </div>\n );\n};\n\nexport default { DragAndDropFileUpload };\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAeC,WAAW,E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CAACX,OAAO,MAAE,CAAC,EAE1BiB,gBAAgB,KAAK,OAAO,IAAIsB,cAAc,CAACgB,MAAM,GAAG,CAAC,iBACzDjE,KAAA,CAAAqB,aAAA;IAAMyF,SAAS,EAAC;EAAmB,GAC/B7D,cAAc,CAAC4E,GAAG,CAAC,CAAClD,IAAI,EAAEmD,KAAK,kBAC/B9H,KAAA,CAAAqB,aAAA;IAAO0G,GAAG,EAAGD,KAAO;IAAChB,SAAS,EAAC;EAAkB,GAC7CnC,IAAI,CAACT,IAAI,EAAI4D,KAAK,GAAG7E,cAAc,CAACgB,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,EACrD,CACR,CACG,CACP,eAEDjE,KAAA,CAAAqB,aAAA,CAACR,kBAAkB;IAACqD,IAAI,EAAGzC,KAAK,CAACyC,IAAM;IAACpC,UAAU,EAAGA;EAAY,CAAE,CAC9D,CAAC,EAENH,gBAAgB,KAAK,MAAM,IAAIsB,cAAc,CAACgB,MAAM,GAAG,CAAC,iBACxDjE,KAAA,CAAAqB,aAAA,CAACN,mBAAmB;IAClBiH,sBAAsB,EAAGpG,gBAAkB;IAC3CoC,KAAK,EAAGf,cAAgB;IACxBgF,cAAc,EAAGhC,iBAAmB;IACpCiC,aAAa,EAAGjC;EAAmB,CACpC,CAEA,CAAC;AAEV,CAAC;AAED,eAAe;EAAE9E;AAAsB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"DragAndDropFileUpload.js","names":["React","useCallback","useEffect","useMemo","useRef","useState","arrowUpFromBracket","useFormContext","renderIcon","HookFormWrapper","Spinner","FormFieldLabel","InputFile","ValidationMessages","generateButtonClass","FileAttachmentsList","DEFAULT_UPLOAD_FILE_EXTENSIONS","DEFAULT_UPLOAD_FILE_TYPES","BLACKLISTED_FILE_TYPES","DragAndDropFileUpload","props","createElement","formContext","DragAndDropFileUploadField","label","field","showSpinner","fileDisplayStyle","fileListSettings","fileList","validation","customContent","customCssClasses","labelStyle","labelAsButtonStyles","color","variant","labelUploadIcon","multiple","restrictionsTxt","validFiles","extensions","fileTypes","maxFileCount","maxFileSize","onFilesChange","setValue","trigger","activeFileList","setFileList","isTouched","setIsTouched","isDragActive","setIsDragActive","inputId","id","inputElRef","dialogOpenRef","current","document","getElementById","onFocus","noneSelected","files","length","name","window","addEventListener","removeEventListener","supportedFileTypes","join","validateAndCommit","validated","filter","file","ext","split","pop","toLowerCase","isBlacklisted","includes","isValidExt","isValidSize","size","clipped","slice","shouldValidate","shouldDirty","shouldTouch","handleFileInputChange","event","target","Array","from","handleDrop","dropped","handleFilesEdited","wrapperCssClass","wrapper","position","labelProps","isRequired","required","labelStyleAsButtonClasses","cssClass","buttonStyle","hideLabel","hide","labelCssClass","className","onDragOver","e","preventDefault","onDragLeave","currentTarget","onDrop","dataTransfer","labelId","htmlFor","onClick","type","defaultValue","accept","onInput","map","index","key","customFileListSettings","onFilesRemoved","onFilesEdited"],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.tsx"],"sourcesContent":["'use client';\n\nimport React, { FormEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { arrowUpFromBracket } from '@x15ventures/x15-ui-library-icons/iconDefinitions';\nimport { useFormContext } from 'react-hook-form';\nimport { renderIcon } from '../../../../../../../helpers/iconHelpers';\nimport { HookFormWrapper } from '../../../../../hookFormWrapper/HookFormWrapper';\nimport { Spinner } from '../../../../../../design/spinner/Spinner';\nimport { FormFieldLabel } from '../../../../subComponents/labels/FormFieldLabel';\nimport { InputFile } from '../../../../subComponents/inputs/file/InputFile';\nimport { ValidationMessages } from '../../../../../validation/ValidationMessages';\nimport { generateButtonClass } from '../../../../../buttons/button.helpers';\nimport { FileAttachmentsList } from '../fileAttachmentList/FileAttachmentsList';\nimport { DragAndDropFileUploadProps } from '../fileInputProps';\nimport {\n DEFAULT_UPLOAD_FILE_EXTENSIONS,\n DEFAULT_UPLOAD_FILE_TYPES,\n BLACKLISTED_FILE_TYPES\n} from '../../../../../../../constants';\n\nimport './dragAndDropFileUpload.scss';\n\nexport const DragAndDropFileUpload: React.FC<DragAndDropFileUploadProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <DragAndDropFileUploadField { ...props } />\n </HookFormWrapper>\n);\n\nconst DragAndDropFileUploadField: React.FC<DragAndDropFileUploadProps> = (\n {\n label,\n field,\n showSpinner,\n fileDisplayStyle = 'names',\n fileListSettings,\n fileList,\n validation,\n customContent,\n customCssClasses,\n labelStyle = 'dragArea',\n labelAsButtonStyles = { color: 'primary', variant: 'outline' },\n labelUploadIcon = arrowUpFromBracket,\n multiple = false,\n restrictionsTxt = '',\n validFiles = {\n extensions: DEFAULT_UPLOAD_FILE_EXTENSIONS,\n fileTypes: DEFAULT_UPLOAD_FILE_TYPES,\n maxFileCount: 5,\n maxFileSize: 52428800 // 50 MB\n },\n onFilesChange = () => {}\n }\n) => {\n const { setValue, trigger } = useFormContext();\n\n const [activeFileList, setFileList] = useState<File[]>(fileList || []);\n const [isTouched, setIsTouched] = useState(false);\n const [isDragActive, setIsDragActive] = useState(false);\n\n const inputId = field.id;\n const inputElRef = useRef<HTMLInputElement | null>(null);\n const dialogOpenRef = useRef(false);\n\n useEffect(() => {\n inputElRef.current = document.getElementById(inputId) as HTMLInputElement | null;\n }, [inputId]);\n\n // Detect “Cancel” -> dialog closes, window regains focus, but input had no change.\n useEffect(() => {\n const onFocus = () => {\n if (!dialogOpenRef.current) { return; }\n dialogOpenRef.current = false;\n const noneSelected = !inputElRef.current?.files?.length;\n if (noneSelected) {\n // Trigger React Hook Form validators (e.g., required)\n trigger(field.name);\n }\n };\n window.addEventListener('focus', onFocus);\n return () => window.removeEventListener('focus', onFocus);\n }, [trigger, field.name]);\n\n const supportedFileTypes = useMemo(\n () => validFiles?.fileTypes?.join(', ') || '',\n [validFiles?.fileTypes]\n );\n\n const validateAndCommit = useCallback(\n (files: File[]) => {\n // basic validations\n const validated = files.filter((file) => {\n const ext = file.name.split('.').pop()?.toLowerCase() || '';\n const isBlacklisted = BLACKLISTED_FILE_TYPES.includes(ext);\n const isValidExt = validFiles.extensions ? validFiles.extensions.includes(ext) : true;\n const isValidSize = validFiles.maxFileSize ? file.size <= validFiles.maxFileSize : true;\n return !isBlacklisted && isValidExt && isValidSize;\n });\n\n const clipped = validFiles.maxFileCount\n ? validated.slice(0, validFiles.maxFileCount)\n : validated;\n\n setFileList(clipped);\n setIsTouched(true);\n\n setValue(field.name, clipped.length ? clipped : null, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true\n });\n\n onFilesChange(clipped);\n },\n [field.name, onFilesChange, setValue, fileDisplayStyle, validFiles]\n );\n\n const handleFileInputChange = useCallback((event: FormEvent<HTMLInputElement>) => {\n const target = event.target as HTMLInputElement;\n const files = Array.from(target.files ?? []);\n validateAndCommit(files);\n trigger(field.name);\n dialogOpenRef.current = false;\n }, [trigger, field.name, validateAndCommit]);\n\n const handleDrop = useCallback((dropped: File[]) => {\n validateAndCommit(dropped);\n trigger(field.name);\n }, [trigger, field.name, validateAndCommit]);\n\n const handleFilesEdited = useCallback((files: File[]) => {\n // No need to validate again as they were already validated\n // Changes may include renaming or removing files\n setFileList(files);\n setValue(field.name, files.length > 0 ? files : null, {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true\n });\n onFilesChange(files);\n }, [field.name, setValue, onFilesChange]);\n\n const wrapperCssClass = `\n formField \n dragAndDropFileUpload \n ${ fileDisplayStyle === 'list' ? 'withFileList' : '' } \n ${ labelStyle || '' }Style \n ${ customCssClasses?.wrapper || '' } \n ${ isTouched ? 'touched' : '' } \n ${ typeof validation !== 'undefined' ? 'withValidation' : '' } \n ${ label?.position === 'inset' ? 'insetLabel' : '' } \n ${ isDragActive ? 'isDragActive' : '' }\n `;\n\n const labelProps = {\n ...label,\n inputId: inputId,\n isRequired: validation && typeof validation.required !== 'undefined',\n customContent\n };\n\n const labelStyleAsButtonClasses = generateButtonClass({\n cssClass: 'button dragAndDropFileUploadButtonLabel',\n buttonStyle: labelAsButtonStyles,\n hideLabel: label.hide\n });\n\n const labelCssClass = `\n ${ labelStyle === 'button' ? labelStyleAsButtonClasses : '' }\n ${ customCssClasses?.label || '' } \n ${ showSpinner ? 'withSpinner' : '' } \n ${ label.hide ? 'hiddenLabel' : '' }\n `;\n\n return (\n <div\n className={ wrapperCssClass }\n onDragOver={ (e) => {\n e.preventDefault();\n if (!isDragActive) setIsDragActive(true);\n } }\n onDragLeave={ (e) => {\n if (e.currentTarget === e.target) setIsDragActive(false);\n } }\n onDrop={ (e) => {\n e.preventDefault();\n setIsDragActive(false);\n const files = Array.from(e.dataTransfer?.files ?? []);\n handleDrop(files);\n } }\n >\n <label\n id={ label.labelId || `${ inputId }_label` }\n className={ labelCssClass }\n htmlFor={ inputId }\n onClick={ () => { dialogOpenRef.current = true; } }\n >\n <span className=\"dragAndDropFileUploadLabel\">\n { renderIcon(labelUploadIcon) }\n <FormFieldLabel { ...labelProps } />\n { restrictionsTxt && <span className=\"fileRestrictionsText\">{ restrictionsTxt }</span> }\n </span>\n\n <span className=\"inputContainer\">\n <InputFile\n {\n ...{\n label,\n field: {\n ...field,\n type: 'file',\n id: inputId, // ensure we can query it by id\n defaultValue: '',\n multiple,\n accept: supportedFileTypes,\n onInput: (event: FormEvent<HTMLInputElement>) => {\n handleFileInputChange(event);\n }\n },\n validation,\n showSpinner,\n customCssClasses,\n customContent\n }\n }\n />\n </span>\n\n { showSpinner && <Spinner /> }\n\n { fileDisplayStyle === 'names' && activeFileList.length > 0 && (\n <span className=\"uploadedFileNames\">\n { activeFileList.map((file, index) => (\n <small key={ index } className=\"uploadedFileName\">\n { file.name }{ index < activeFileList.length - 1 ? ', ' : '' }\n </small>\n )) }\n </span>\n ) }\n\n <ValidationMessages name={ field.name } validation={ validation } />\n </label>\n\n { fileDisplayStyle === 'list' && activeFileList.length > 0 && (\n <FileAttachmentsList\n customFileListSettings={ fileListSettings }\n files={ activeFileList }\n onFilesRemoved={ handleFilesEdited }\n onFil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ChBD;EAAa,CAGlB,CACG,CAAC,EAELL,WAAW,iBAAI1B,KAAA,CAAAqB,aAAA,CAACX,OAAO,MAAE,CAAC,EAE1BiB,gBAAgB,KAAK,OAAO,IAAIqB,cAAc,CAACgB,MAAM,GAAG,CAAC,iBACzDhE,KAAA,CAAAqB,aAAA;IAAMwF,SAAS,EAAC;EAAmB,GAC/B7D,cAAc,CAAC4E,GAAG,CAAC,CAAClD,IAAI,EAAEmD,KAAK,kBAC/B7H,KAAA,CAAAqB,aAAA;IAAOyG,GAAG,EAAGD,KAAO;IAAChB,SAAS,EAAC;EAAkB,GAC7CnC,IAAI,CAACT,IAAI,EAAI4D,KAAK,GAAG7E,cAAc,CAACgB,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,EACrD,CACR,CACG,CACP,eAEDhE,KAAA,CAAAqB,aAAA,CAACR,kBAAkB;IAACoD,IAAI,EAAGxC,KAAK,CAACwC,IAAM;IAACnC,UAAU,EAAGA;EAAY,CAAE,CAC9D,CAAC,EAENH,gBAAgB,KAAK,MAAM,IAAIqB,cAAc,CAACgB,MAAM,GAAG,CAAC,iBACxDhE,KAAA,CAAAqB,aAAA,CAACN,mBAAmB;IAClBgH,sBAAsB,EAAGnG,gBAAkB;IAC3CmC,KAAK,EAAGf,cAAgB;IACxBgF,cAAc,EAAGhC,iBAAmB;IACpCiC,aAAa,EAAGjC;EAAmB,CACpC,CAEA,CAAC;AAEV,CAAC;AAED,eAAe;EAAE7E;AAAsB,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ import { SimpleButton } from '../../../../../buttons/SimpleButton';
|
|
|
6
6
|
import { pencil, trash, xmark, check } from '@x15ventures/x15-ui-library-icons/iconDefinitions';
|
|
7
7
|
import { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';
|
|
8
8
|
import { deepMergeObjects } from '../../../../../../../helpers';
|
|
9
|
+
import { renderIcon } from '../../../../../../../helpers/iconHelpers';
|
|
9
10
|
import './fileAttachmentsList.css';
|
|
10
11
|
export const DefaultFileListSettings = {
|
|
11
12
|
isEditable: true,
|
|
@@ -77,18 +78,15 @@ export const FileAttachmentsList = ({
|
|
|
77
78
|
setAdjustedFiles(updatedFiles);
|
|
78
79
|
onFilesRemoved(updatedFiles);
|
|
79
80
|
};
|
|
80
|
-
const
|
|
81
|
-
|
|
81
|
+
const editIcon = renderIcon(fileListSettings.design?.editing?.edit?.icon, {
|
|
82
|
+
fallback: pencil
|
|
82
83
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
84
|
+
const deleteIcon = renderIcon(fileListSettings.design?.editing?.delete?.icon, {
|
|
85
|
+
fallback: trash
|
|
85
86
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const SaveIcon = () => /*#__PURE__*/React.createElement(SvgIcon, {
|
|
90
|
-
svgDefinition: check,
|
|
91
|
-
customCssClass: "saveIcon"
|
|
87
|
+
const cancelIcon = renderIcon(xmark);
|
|
88
|
+
const saveIcon = renderIcon(check, {
|
|
89
|
+
customCssClass: 'saveIcon'
|
|
92
90
|
});
|
|
93
91
|
const isFileNameEditable = fileListSettings.isEditable && !fileListSettings.design?.editing?.edit?.disable;
|
|
94
92
|
const isFileDeletable = fileListSettings.isEditable && !fileListSettings.design?.editing?.delete?.disable;
|
|
@@ -126,9 +124,7 @@ export const FileAttachmentsList = ({
|
|
|
126
124
|
variant: 'icon-only',
|
|
127
125
|
size: 'compact'
|
|
128
126
|
},
|
|
129
|
-
leftIcon:
|
|
130
|
-
icon: /*#__PURE__*/React.createElement(CancelIcon, null)
|
|
131
|
-
},
|
|
127
|
+
leftIcon: cancelIcon,
|
|
132
128
|
id: `cancelEditFileButton${index}`,
|
|
133
129
|
onClickHandler: () => setEditingIndex(null)
|
|
134
130
|
}), /*#__PURE__*/React.createElement(SimpleButton, {
|
|
@@ -139,9 +135,7 @@ export const FileAttachmentsList = ({
|
|
|
139
135
|
size: 'compact',
|
|
140
136
|
color: 'primary'
|
|
141
137
|
},
|
|
142
|
-
leftIcon:
|
|
143
|
-
icon: /*#__PURE__*/React.createElement(SaveIcon, null)
|
|
144
|
-
},
|
|
138
|
+
leftIcon: saveIcon,
|
|
145
139
|
id: `saveEditFileButton${index}`,
|
|
146
140
|
onClickHandler: () => handleFileNameEdit(index)
|
|
147
141
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
@@ -150,18 +144,14 @@ export const FileAttachmentsList = ({
|
|
|
150
144
|
label: "Edit file name",
|
|
151
145
|
hideLabel: true,
|
|
152
146
|
buttonStyle: fileListSettings.design?.editing?.edit?.buttonStyle,
|
|
153
|
-
leftIcon:
|
|
154
|
-
icon: /*#__PURE__*/React.createElement(EditIcon, null)
|
|
155
|
-
},
|
|
147
|
+
leftIcon: editIcon,
|
|
156
148
|
id: `editFileButton${index}`,
|
|
157
149
|
onClickHandler: () => setEditingIndex(index)
|
|
158
150
|
}), isFileDeletable && /*#__PURE__*/React.createElement(SimpleButton, {
|
|
159
151
|
label: "Remove file",
|
|
160
152
|
hideLabel: true,
|
|
161
153
|
buttonStyle: fileListSettings.design?.editing?.delete?.buttonStyle,
|
|
162
|
-
leftIcon:
|
|
163
|
-
icon: /*#__PURE__*/React.createElement(DeleteIcon, null)
|
|
164
|
-
},
|
|
154
|
+
leftIcon: deleteIcon,
|
|
165
155
|
id: `removeFileButton${index}`,
|
|
166
156
|
onClickHandler: () => handleFileRemoved(index)
|
|
167
157
|
}))))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileAttachmentsList.js","names":["React","useEffect","useState","SimpleButton","pencil","trash","xmark","check","SvgIcon","deepMergeObjects","DefaultFileListSettings","isEditable","design","animation","editing","delete","icon","createElement","svgDefinition","label","disable","buttonStyle","variant","size","edit","heading","isVisible","prefix","includeFileCount","FileAttachmentsList","customFileListSettings","onFilesRemoved","onFilesEdited","files","adjustedFiles","setAdjustedFiles","editingIndex","setEditingIndex","filesList","createRef","fileListSettings","baseObject","overrideObject","handleFileNameEdit","index","newName","adjustedName","current","children","querySelector","value","trim","updatedFiles","map","file","i","File","type","handleFileRemoved","filter","_","EditIcon","DeleteIcon","CancelIcon","SaveIcon","customCssClass","isFileNameEditable","isFileDeletable","className","length","ref","key","name","defaultValue","onKeyDown","e","target","autoFocus","hideLabel","leftIcon","id","onClickHandler","color"],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\n'use client';\nimport React, { FC, useEffect, useState } from 'react';\nimport { SimpleButton } from '../../../../../buttons/SimpleButton';\nimport { pencil, trash, xmark, check } from '@x15ventures/x15-ui-library-icons/iconDefinitions';\nimport { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';\nimport { FileAttachmentListSettingsProps } from '../fileInputProps';\nimport { deepMergeObjects } from '../../../../../../../helpers';\n\nimport './fileAttachmentsList.scss';\n\ninterface FileAttachmentsProps {\n customFileListSettings?: FileAttachmentListSettingsProps;\n onFilesRemoved: (files: File[]) => void;\n onFilesEdited: (files: File[]) => void;\n files: File[];\n}\n\nexport const DefaultFileListSettings: FileAttachmentListSettingsProps = {\n isEditable: true,\n design: {\n animation: 'reveal',\n editing: {\n delete: {\n icon: <SvgIcon svgDefinition={ trash }/>,\n label: 'Remove file',\n disable: false,\n buttonStyle: {\n variant: 'icon-only',\n size: 'compact',\n }\n },\n edit: {\n icon: <SvgIcon svgDefinition={ pencil }/>,\n label: 'Edit file name',\n disable: false,\n buttonStyle: {\n variant: 'icon-only',\n size: 'compact',\n }\n }\n },\n heading: {\n isVisible: false,\n prefix: 'Attached files',\n includeFileCount: true\n }\n }\n};\n\nexport const FileAttachmentsList: FC<FileAttachmentsProps> = (\n {\n customFileListSettings,\n onFilesRemoved = () => {},\n onFilesEdited = () => {},\n files\n }\n) => {\n const [adjustedFiles, setAdjustedFiles] = useState<File[]>(files);\n const [editingIndex, setEditingIndex] = useState<number | null>(null);\n const filesList = React.createRef<HTMLUListElement>();\n\n const fileListSettings: FileAttachmentListSettingsProps = deepMergeObjects({\n baseObject: DefaultFileListSettings,\n overrideObject: customFileListSettings || {}\n });\n\n useEffect(() => {\n setAdjustedFiles(files);\n }, [files]);\n\n const handleFileNameEdit = (index: number, newName?: string) => {\n const adjustedName = newName || (filesList.current?.children[index].querySelector('input') as HTMLInputElement)?.value.trim();\n\n const updatedFiles = adjustedFiles.map((file, i) => {\n if (i === index) {\n return new File([file], adjustedName, { type: file.type });\n }\n return file;\n });\n setAdjustedFiles(updatedFiles);\n setEditingIndex(null);\n onFilesEdited(updatedFiles);\n };\n\n const handleFileRemoved = (index: number) => {\n const updatedFiles = adjustedFiles.filter((_, i) => i !== index);\n setAdjustedFiles(updatedFiles);\n onFilesRemoved(updatedFiles);\n };\n\n const EditIcon: FC = () => fileListSettings.design?.editing?.edit?.icon || <SvgIcon svgDefinition={ pencil } />;\n const DeleteIcon: FC = () => fileListSettings.design?.editing?.delete?.icon || <SvgIcon svgDefinition={ trash } />;\n const CancelIcon: FC = () => <SvgIcon svgDefinition={ xmark } />;\n const SaveIcon: FC = () => <SvgIcon svgDefinition={ check } customCssClass=\"saveIcon\" />;\n\n const isFileNameEditable = fileListSettings.isEditable && !fileListSettings.design?.editing?.edit?.disable;\n const isFileDeletable = fileListSettings.isEditable && !fileListSettings.design?.editing?.delete?.disable;\n\n return (\n <div className=\"fileAttachmentsList\">\n {\n fileListSettings.design?.heading?.isVisible && (\n <h4>\n {\n fileListSettings.design?.heading?.prefix || 'Attached files'\n }\n {\n fileListSettings.design?.heading?.includeFileCount && ` (${ adjustedFiles.length })`\n }\n </h4>\n )\n }\n <div className={ `fileUploadList ${ adjustedFiles.length > 0 ? 'withFiles' : 'noFiles' }` }>\n { adjustedFiles.length > 0 && (\n <ul className=\"noBullet\" ref={ filesList }>\n { adjustedFiles.map((file, index) => (\n <li key={ index }>\n {\n editingIndex === index && isFileNameEditable ? (\n <span className=\"editFileNameContainer\">\n <input\n type=\"text\"\n aria-label={ `Edit file name (${ file.name })` }\n defaultValue={ file.name }\n className=\"fileNameInput\"\n onKeyDown={ (e) => {\n if (e.key === 'Enter') {\n const newName = (e.target as HTMLInputElement).value.trim();\n if (newName && newName !== file.name) {\n handleFileNameEdit(index, newName);\n }\n } else if (e.key === 'Escape' || e.key === 'Tab') {\n setEditingIndex(null);\n }\n } }\n autoFocus\n />\n <SimpleButton\n label=\"Cancel\"\n hideLabel\n buttonStyle={ { variant: 'icon-only', size: 'compact' } }\n leftIcon={ { icon: <CancelIcon /> } }\n id={ `cancelEditFileButton${ index }` }\n onClickHandler={ () => setEditingIndex(null) }\n />\n <SimpleButton\n label=\"Save\"\n hideLabel\n buttonStyle={ { variant: 'icon-only', size: 'compact', color: 'primary' } }\n leftIcon={ { icon: <SaveIcon /> } }\n id={ `saveEditFileButton${ index }` }\n onClickHandler={ () => handleFileNameEdit(index) }\n />\n </span>\n ) :\n <span className=\"fileNameDisplay\">{ file.name }</span>\n }\n\n {\n isFileNameEditable && (\n <SimpleButton\n label=\"Edit file name\"\n hideLabel\n buttonStyle={ fileListSettings.design?.editing?.edit?.buttonStyle }\n leftIcon={ { icon: <EditIcon /> } }\n id={ `editFileButton${ index }` }\n onClickHandler={ () => setEditingIndex(index) }\n />\n )\n }\n\n {\n isFileDeletable && (\n <SimpleButton\n label=\"Remove file\"\n hideLabel\n buttonStyle={ fileListSettings.design?.editing?.delete?.buttonStyle }\n leftIcon={ { icon: <DeleteIcon /> } }\n id={ `removeFileButton${ index }` }\n onClickHandler={ () => handleFileRemoved(index) }\n />\n )\n }\n </li>\n )) }\n </ul>\n ) }\n </div>\n </div>\n );\n};\n\nexport default {\n FileAttachmentsList\n};\n"],"mappings":"AAAA;AACA,YAAY;;AACZ,OAAOA,KAAK,IAAQC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACtD,SAASC,YAAY,QAAQ,qCAAqC;AAClE,SAASC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAA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ACrCkB,EAAE,EAAG,mBAAoBpC,KAAK,EAAK;IACnCqC,cAAc,EAAGA,CAAA,KAAMvB,iBAAiB,CAACd,KAAK;EAAG,CAClD,CAGH,CACL,CACC,CAEH,CACF,CAAC;AAEV,CAAC;AAED,eAAe;EACbf;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FileAttachmentsList.js","names":["React","useEffect","useState","SimpleButton","pencil","trash","xmark","check","SvgIcon","deepMergeObjects","renderIcon","DefaultFileListSettings","isEditable","design","animation","editing","delete","icon","createElement","svgDefinition","label","disable","buttonStyle","variant","size","edit","heading","isVisible","prefix","includeFileCount","FileAttachmentsList","customFileListSettings","onFilesRemoved","onFilesEdited","files","adjustedFiles","setAdjustedFiles","editingIndex","setEditingIndex","filesList","createRef","fileListSettings","baseObject","overrideObject","handleFileNameEdit","index","newName","adjustedName","current","children","querySelector","value","trim","updatedFiles","map","file","i","File","type","handleFileRemoved","filter","_","editIcon","fallback","deleteIcon","cancelIcon","saveIcon","customCssClass","isFileNameEditable","isFileDeletable","className","length","ref","key","name","defaultValue","onKeyDown","e","target","autoFocus","hideLabel","leftIcon","id","onClickHandler","color"],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.tsx"],"sourcesContent":["/* eslint-disable no-unused-vars */\n'use client';\nimport React, { FC, useEffect, useState } from 'react';\nimport { SimpleButton } from '../../../../../buttons/SimpleButton';\nimport { pencil, trash, xmark, check } from '@x15ventures/x15-ui-library-icons/iconDefinitions';\nimport { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';\nimport { FileAttachmentListSettingsProps } from '../fileInputProps';\nimport { deepMergeObjects } from '../../../../../../../helpers';\nimport { renderIcon } from '../../../../../../../helpers/iconHelpers';\n\nimport './fileAttachmentsList.scss';\n\ninterface FileAttachmentsProps {\n customFileListSettings?: FileAttachmentListSettingsProps;\n onFilesRemoved: (files: File[]) => void;\n onFilesEdited: (files: File[]) => void;\n files: File[];\n}\n\nexport const DefaultFileListSettings: FileAttachmentListSettingsProps = {\n isEditable: true,\n design: {\n animation: 'reveal',\n editing: {\n delete: {\n icon: <SvgIcon svgDefinition={ trash }/>,\n label: 'Remove file',\n disable: false,\n buttonStyle: {\n variant: 'icon-only',\n size: 'compact',\n }\n },\n edit: {\n icon: <SvgIcon svgDefinition={ pencil }/>,\n label: 'Edit file name',\n disable: false,\n buttonStyle: {\n variant: 'icon-only',\n size: 'compact',\n }\n }\n },\n heading: {\n isVisible: false,\n prefix: 'Attached files',\n includeFileCount: true\n }\n }\n};\n\nexport const FileAttachmentsList: FC<FileAttachmentsProps> = (\n {\n customFileListSettings,\n onFilesRemoved = () => {},\n onFilesEdited = () => {},\n files\n }\n) => {\n const [adjustedFiles, setAdjustedFiles] = useState<File[]>(files);\n const [editingIndex, setEditingIndex] = useState<number | null>(null);\n const filesList = React.createRef<HTMLUListElement>();\n\n const fileListSettings: FileAttachmentListSettingsProps = deepMergeObjects({\n baseObject: DefaultFileListSettings,\n overrideObject: customFileListSettings || {}\n });\n\n useEffect(() => {\n setAdjustedFiles(files);\n }, [files]);\n\n const handleFileNameEdit = (index: number, newName?: string) => {\n const adjustedName = newName || (filesList.current?.children[index].querySelector('input') as HTMLInputElement)?.value.trim();\n\n const updatedFiles = adjustedFiles.map((file, i) => {\n if (i === index) {\n return new File([file], adjustedName, { type: file.type });\n }\n return file;\n });\n setAdjustedFiles(updatedFiles);\n setEditingIndex(null);\n onFilesEdited(updatedFiles);\n };\n\n const handleFileRemoved = (index: number) => {\n const updatedFiles = adjustedFiles.filter((_, i) => i !== index);\n setAdjustedFiles(updatedFiles);\n onFilesRemoved(updatedFiles);\n };\n\n const editIcon = renderIcon(fileListSettings.design?.editing?.edit?.icon, { fallback: pencil });\n const deleteIcon = renderIcon(fileListSettings.design?.editing?.delete?.icon, { fallback: trash });\n const cancelIcon = renderIcon(xmark);\n const saveIcon = renderIcon(check, { customCssClass: 'saveIcon' });\n\n const isFileNameEditable = fileListSettings.isEditable && !fileListSettings.design?.editing?.edit?.disable;\n const isFileDeletable = fileListSettings.isEditable && !fileListSettings.design?.editing?.delete?.disable;\n\n return (\n <div className=\"fileAttachmentsList\">\n {\n fileListSettings.design?.heading?.isVisible && (\n <h4>\n {\n fileListSettings.design?.heading?.prefix || 'Attached files'\n }\n {\n fileListSettings.design?.heading?.includeFileCount && ` (${ adjustedFiles.length })`\n }\n </h4>\n )\n }\n <div className={ `fileUploadList ${ adjustedFiles.length > 0 ? 'withFiles' : 'noFiles' }` }>\n { adjustedFiles.length > 0 && (\n <ul className=\"noBullet\" ref={ filesList }>\n { adjustedFiles.map((file, index) => (\n <li key={ index }>\n {\n editingIndex === index && isFileNameEditable ? (\n <span className=\"editFileNameContainer\">\n <input\n type=\"text\"\n aria-label={ `Edit file name (${ file.name })` }\n defaultValue={ file.name }\n className=\"fileNameInput\"\n onKeyDown={ (e) => {\n if (e.key === 'Enter') {\n const newName = (e.target as HTMLInputElement).value.trim();\n if (newName && newName !== file.name) {\n handleFileNameEdit(index, newName);\n }\n } else if (e.key === 'Escape' || e.key === 'Tab') {\n setEditingIndex(null);\n }\n } }\n autoFocus\n />\n <SimpleButton\n label=\"Cancel\"\n hideLabel\n buttonStyle={ { variant: 'icon-only', size: 'compact' } }\n leftIcon={ cancelIcon }\n id={ `cancelEditFileButton${ index }` }\n onClickHandler={ () => setEditingIndex(null) }\n />\n <SimpleButton\n label=\"Save\"\n hideLabel\n buttonStyle={ { variant: 'icon-only', size: 'compact', color: 'primary' } }\n leftIcon={ saveIcon }\n id={ `saveEditFileButton${ index }` }\n onClickHandler={ () => handleFileNameEdit(index) }\n />\n </span>\n ) :\n <span className=\"fileNameDisplay\">{ file.name }</span>\n }\n\n {\n isFileNameEditable && (\n <SimpleButton\n label=\"Edit file name\"\n hideLabel\n buttonStyle={ fileListSettings.design?.editing?.edit?.buttonStyle }\n leftIcon={ editIcon }\n id={ `editFileButton${ index }` }\n onClickHandler={ () => setEditingIndex(index) }\n />\n )\n }\n\n {\n isFileDeletable && (\n <SimpleButton\n label=\"Remove file\"\n hideLabel\n buttonStyle={ fileListSettings.design?.editing?.delete?.buttonStyle }\n leftIcon={ deleteIcon }\n id={ `removeFileButton${ index }` }\n onClickHandler={ () => handleFileRemoved(index) }\n />\n )\n }\n </li>\n )) }\n </ul>\n ) }\n </div>\n </div>\n );\n};\n\nexport default {\n FileAttachmentsList\n};\n"],"mappings":"AAAA;AACA,YAAY;;AACZ,OAAOA,KAAK,IAAQC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACtD,SAASC,YAAY,QAAQ,qCAAqC;AAClE,SAASC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,KAAK,QAAQ,mDAAmD;AAC/F,SAASC,OAAO,QAAQ,mDAAmD;AAE3E,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,UAAU,QAAQ,0CAA0C;AAErE,OAAO,4BAA4B;AASnC,OAAO,MAAMC,uBAAwD,GAAG;EACtEC,UAAU,EAAE,IAAI;EAChBC,MAAM,EAAE;IACNC,SAAS,EAAE,QAAQ;IACnBC,OAAO,EAAE;MACPC,MAAM,EAAE;QACNC,IAAI,eAAEjB,KAAA,CAAAkB,aAAA,CAACV,OAAO;UAACW,aAAa,EAAGd;QAAO,CAAC,CAAC;QACxCe,KAAK,EAAE,aAAa;QACpBC,OAAO,EAAE,KAAK;QACdC,WAAW,EAAE;UACXC,OAAO,EAAE,WAAW;UACpBC,IAAI,EAAE;QACR;MACF,CAAC;MACDC,IAAI,EAAE;QACJR,IAAI,eAAEjB,KAAA,CAAAkB,aAAA,CAACV,OAAO;UAACW,aAAa,EAAGf;QAAQ,CAAC,CAAC;QACzCgB,KAAK,EAAE,gBAAgB;QACvBC,OAAO,EAAE,KAAK;QACdC,WAAW,EAAE;UACXC,OAAO,EAAE,WAAW;UACpBC,IAAI,EAAE;QACR;MACF;IACF,CAAC;IACDE,OAAO,EAAE;MACPC,SAAS,EAAE,KAAK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EM,WAAa;IACrE2D,QAAQ,EAAGjB,UAAY;IACvBkB,EAAE,EAAG,mBAAoBrC,KAAK,EAAK;IACnCsC,cAAc,EAAGA,CAAA,KAAMxB,iBAAiB,CAACd,KAAK;EAAG,CAClD,CAGH,CACL,CACC,CAEH,CACF,CAAC;AAEV,CAAC;AAED,eAAe;EACbf;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileInputProps.js","names":[],"sources":["../../../../../../../../src/components/form/formFields/subComponents/inputs/file/fileInputProps.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport React, { FormEvent } from 'react';\nimport { FieldProps, FormFieldProps } from '../../../formFieldWrapper/formFieldProps';\nimport { ButtonStyles } from '../../../../buttons/button.interface';\n\nexport interface ValidFilesProps {\n extensions?: string[];\n fileTypes?: string[];\n maxFileCount?: number;\n maxFileSize?: number;\n}\n\nexport interface FileAttachmentListSettingsProps {\n design?: {\n animation?: 'reveal' | 'slide' | 'none';\n editing?: {\n delete?: {\n icon?:
|
|
1
|
+
{"version":3,"file":"fileInputProps.js","names":[],"sources":["../../../../../../../../src/components/form/formFields/subComponents/inputs/file/fileInputProps.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\nimport React, { FormEvent } from 'react';\nimport { FieldProps, FormFieldProps } from '../../../formFieldWrapper/formFieldProps';\nimport { ButtonStyles } from '../../../../buttons/button.interface';\nimport { IconSource } from '../../../../../../helpers/iconHelpers';\n\nexport interface ValidFilesProps {\n extensions?: string[];\n fileTypes?: string[];\n maxFileCount?: number;\n maxFileSize?: number;\n}\n\nexport interface FileAttachmentListSettingsProps {\n design?: {\n animation?: 'reveal' | 'slide' | 'none';\n editing?: {\n delete?: {\n icon?: IconSource;\n label?: string;\n disable?: boolean;\n buttonStyle?: ButtonStyles;\n };\n edit?: {\n icon?: IconSource;\n label?: string;\n disable?: boolean;\n buttonStyle?: ButtonStyles;\n };\n },\n heading?: {\n isVisible?: boolean;\n prefix?: string;\n includeFileCount?: boolean;\n }\n };\n isEditable?: boolean;\n}\n\nexport interface DragAndDropFileUploadProps extends Omit<FormFieldProps, 'field'> {\n field: Omit<FieldProps, 'type' | 'onInput'> & {\n type?: 'file';\n };\n labelStyle?: 'simple' | 'button' | 'dragArea';\n labelUploadIcon?: IconSource | null;\n labelAsButtonStyles?: ButtonStyles;\n fileDisplayStyle?: 'list' | 'names' | 'none';\n fileListSettings?: FileAttachmentListSettingsProps;\n labelStyleButtonProps?: ButtonStyles;\n customFileUploadLabel?: string | React.ReactElement;\n fileList?: File[];\n validFiles?: ValidFilesProps;\n onFilesChange?: (files: File[] | null) => void;\n restrictionsTxt?: string | React.ReactElement;\n multiple?: boolean;\n}\n\nexport interface FileInputProps extends DragAndDropFileUploadProps, React.InputHTMLAttributes<HTMLInputElement> {\n field: Omit<FieldProps, 'type' | 'onInput'> & {\n type: 'file';\n multiple?: boolean;\n accept: string;\n onInput?: (event: FormEvent<HTMLInputElement>) => void;\n };\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -19,6 +19,7 @@ export { Spinner } from './design/spinner/Spinner';
|
|
|
19
19
|
export { StatusIconButton } from './design/statusIndicators/statusIconButton/StatusIconButton';
|
|
20
20
|
export { StatusLight } from './design/statusIndicators/statusLight/StatusLight';
|
|
21
21
|
export { StatusLightsBar } from './design/statusIndicators/statusLightsBar/StatusLightsBar';
|
|
22
|
+
export { CircularProgressIndicator } from './design/progressIndicators/circularProgressIndicator/CircularProgressIndicator';
|
|
22
23
|
export { Tabs } from './design/tabs/Tabs';
|
|
23
24
|
export { Tooltip } from './design/tooltip/Tooltip';
|
|
24
25
|
export { EllipsisTooltip } from './design/tooltip/ellipsisTooltip/EllipsisTooltip';
|
|
@@ -30,6 +31,7 @@ export { PageBanner, Banner, Alert } from './design/banners/pageBanner/PageBanne
|
|
|
30
31
|
export { SimpleButton, Button } from './form/buttons/SimpleButton';
|
|
31
32
|
export { FormField } from './form/formFields/formFieldWrapper/FormField';
|
|
32
33
|
export { InputCheckbox, CheckboxInput } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';
|
|
34
|
+
export { CheckboxSwitch } from './form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch';
|
|
33
35
|
export { StyledRadioGroup } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup';
|
|
34
36
|
export { StyledRadioInput } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioInput';
|
|
35
37
|
export { StyledRadioLabel } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioLabel';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Accordion","Chip","Pill","Badge","Dialog","HeaderBar","Icon","NotificationIcon","VentureLogo","CreditSavvyLogo","HomeInLogo","KitLogo","DoshiiLogo","TruyuLogo","SidePanel","Skeleton","Spinner","StatusIconButton","StatusLight","StatusLightsBar","Tabs","Tooltip","EllipsisTooltip","RevealMore","CopyText","Paginator","PageBanner","Banner","Alert","SimpleButton","Button","FormField","InputCheckbox","CheckboxInput","StyledRadioGroup","StyledRadioInput","StyledRadioLabel","HookFormWrapper","TextInput","EmailInput","FileInput","SearchInput","NumberInput","PhoneInput","UrlInput","PasswordInput","PasswordInputSignup","SelectDropdown","Combobox","Textarea","InputDate","DateInput","Card","ReportFooter","MainHeader","ThemeLoader","DevToolbar","ThemeSwitch","LoremIpsum","GlobalDashboard","Menu","PopupMenu","SearchPanelMenu","Link","TemplateForm","TemplateLoading","TemplateDashboard","TemplatePage","Select","Checkbox"],"sources":["../../../src/components/index.ts"],"sourcesContent":["'use client';\n\n// UI components\nexport { Accordion } from './design/accordion/Accordion';\nexport { Chip, Pill, Badge } from './design/chip/Chip';\nexport { Dialog } from './design/dialog/Dialog';\nexport { HeaderBar } from './design/headerBar/HeaderBar';\nexport { Icon } from './design/icons/basicIcon/Icon';\nexport { NotificationIcon } from './design/icons/notificationIcon/NotificationIcon';\nexport { VentureLogo } from './design/logos/VentureLogo';\n\nexport { CreditSavvyLogo } from './design/logos/ventures/credit-savvy-logo';\nexport { HomeInLogo } from './design/logos/ventures/home-in-logo';\nexport { KitLogo } from './design/logos/ventures/kit-logo';\nexport { DoshiiLogo } from './design/logos/ventures/doshii-logo';\nexport { TruyuLogo } from './design/logos/ventures/truyu-logo';\n\nexport { SidePanel } from './design/sidePanel/SidePanel';\nexport { Skeleton } from './design/skeleton/Skeleton';\nexport type { SkeletonProps } from './design/skeleton/Skeleton';\nexport { Spinner } from './design/spinner/Spinner';\nexport { StatusIconButton } from './design/statusIndicators/statusIconButton/StatusIconButton';\nexport { StatusLight } from './design/statusIndicators/statusLight/StatusLight';\nexport { StatusLightsBar } from './design/statusIndicators/statusLightsBar/StatusLightsBar';\nexport { Tabs } from './design/tabs/Tabs';\nexport { Tooltip } from './design/tooltip/Tooltip';\nexport { EllipsisTooltip } from './design/tooltip/ellipsisTooltip/EllipsisTooltip';\nexport { RevealMore } from './design/revealMore/RevealMore';\nexport { CopyText } from './design/copyText/CopyText';\nexport { Paginator } from './design/paginators/Paginator';\nexport { PageBanner, Banner, Alert } from './design/banners/pageBanner/PageBanner';\nexport type { PageBannerProps } from './design/banners/pageBanner/PageBanner';\n\n// Form components\nexport { SimpleButton, Button } from './form/buttons/SimpleButton';\nexport { FormField } from './form/formFields/formFieldWrapper/FormField';\nexport { InputCheckbox, CheckboxInput } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';\nexport { StyledRadioGroup } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup';\nexport { StyledRadioInput } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioInput';\nexport { StyledRadioLabel } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioLabel';\nexport { HookFormWrapper } from './form/hookFormWrapper/HookFormWrapper';\n\nexport {\n TextInput,\n EmailInput,\n FileInput,\n SearchInput,\n NumberInput,\n PhoneInput,\n UrlInput,\n PasswordInput,\n PasswordInputSignup,\n SelectDropdown,\n Combobox,\n Textarea\n} from './form/formFields/subComponents/InputVariants';\nexport type {\n FormComponentProps,\n DropdownSelectProps,\n PasswordInputProps\n} from './form/formFields/subComponents/InputVariants';\n\nexport {\n InputDate\n} from './form/formFields/subComponents/inputs/date/InputDate';\nexport { DateInput } from './form/formFields/subComponents/inputs/date/DateInput';\nexport type { StyledRadioGroupProps } from './form/formFields/subComponents/inputs/radio/radioInputsProps';\n\n// Layout\nexport { Card } from './design/card/Card';\nexport { ReportFooter } from './layout/footers/reports/ReportFooter';\nexport { MainHeader } from './layout/mainHeader/MainHeader';\n\nexport { ThemeLoader } from './design/themeLoader/ThemeLoader';\nexport type { ThemeStructure } from './design/themeLoader/ThemeLoader';\n\n// Testing\nexport { DevToolbar } from './testing/devToolbar/DevToolbar';\nexport { ThemeSwitch } from './testing/themeSwitch/ThemeSwitch';\nexport { LoremIpsum } from './testing/loremIpsum/LoremIpsum';\n\nexport { GlobalDashboard } from './layout/dashboard/layouts/globalDashboard/GlobalDashboard';\nexport { Menu } from './navigation/menu/Menu';\nexport { PopupMenu } from './navigation/popupMenu/PopupMenu';\nexport { SearchPanelMenu } from './navigation/searchPanelMenu/SearchPanelMenu';\nexport { Link } from './navigation/link/Link';\n\nexport type { MenuItemPropTypes, MenuButtonPropTypes, MenuItemIconStates } from './navigation/menu/Menu.interfaces';\n\n// Templates\nexport { TemplateForm } from './templates/templateForm/TemplateForm';\nexport type { TemplateFormProps } from './templates/templateForm/TemplateForm';\nexport { TemplateLoading } from './templates/templateLoading/TemplateLoading';\nexport type { TemplateLoadingProps } from './templates/templateLoading/TemplateLoading';\nexport { TemplateDashboard } from './templates/templateDashboard/TemplateDashboard';\nexport type { TemplateDashboardProps } from './templates/templateDashboard/TemplateDashboard';\nexport { TemplatePage } from './templates/templatePage/TemplatePage';\nexport type { TemplatePageProps } from './templates/templatePage/TemplatePage';\n\n// Aliases to match common libraries\nexport { SelectDropdown as Select } from './form/formFields/subComponents/InputVariants';\nexport { InputCheckbox as Checkbox } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';"],"mappings":"AAAA,YAAY;;AAEZ;AACA,SAASA,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,oBAAoB;AACtD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,gBAAgB,QAAQ,kDAAkD;AACnF,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,UAAU,QAAQ,qCAAqC;AAChE,SAASC,SAAS,QAAQ,oCAAoC;AAE9D,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,OAAO,QAAQ,0BAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","names":["Accordion","Chip","Pill","Badge","Dialog","HeaderBar","Icon","NotificationIcon","VentureLogo","CreditSavvyLogo","HomeInLogo","KitLogo","DoshiiLogo","TruyuLogo","SidePanel","Skeleton","Spinner","StatusIconButton","StatusLight","StatusLightsBar","CircularProgressIndicator","Tabs","Tooltip","EllipsisTooltip","RevealMore","CopyText","Paginator","PageBanner","Banner","Alert","SimpleButton","Button","FormField","InputCheckbox","CheckboxInput","CheckboxSwitch","StyledRadioGroup","StyledRadioInput","StyledRadioLabel","HookFormWrapper","TextInput","EmailInput","FileInput","SearchInput","NumberInput","PhoneInput","UrlInput","PasswordInput","PasswordInputSignup","SelectDropdown","Combobox","Textarea","InputDate","DateInput","Card","ReportFooter","MainHeader","ThemeLoader","DevToolbar","ThemeSwitch","LoremIpsum","GlobalDashboard","Menu","PopupMenu","SearchPanelMenu","Link","TemplateForm","TemplateLoading","TemplateDashboard","TemplatePage","Select","Checkbox"],"sources":["../../../src/components/index.ts"],"sourcesContent":["'use client';\n\n// UI components\nexport { Accordion } from './design/accordion/Accordion';\nexport { Chip, Pill, Badge } from './design/chip/Chip';\nexport { Dialog } from './design/dialog/Dialog';\nexport { HeaderBar } from './design/headerBar/HeaderBar';\nexport { Icon } from './design/icons/basicIcon/Icon';\nexport { NotificationIcon } from './design/icons/notificationIcon/NotificationIcon';\nexport { VentureLogo } from './design/logos/VentureLogo';\n\nexport { CreditSavvyLogo } from './design/logos/ventures/credit-savvy-logo';\nexport { HomeInLogo } from './design/logos/ventures/home-in-logo';\nexport { KitLogo } from './design/logos/ventures/kit-logo';\nexport { DoshiiLogo } from './design/logos/ventures/doshii-logo';\nexport { TruyuLogo } from './design/logos/ventures/truyu-logo';\n\nexport { SidePanel } from './design/sidePanel/SidePanel';\nexport { Skeleton } from './design/skeleton/Skeleton';\nexport type { SkeletonProps } from './design/skeleton/Skeleton';\nexport { Spinner } from './design/spinner/Spinner';\n\nexport { StatusIconButton } from './design/statusIndicators/statusIconButton/StatusIconButton';\nexport { StatusLight } from './design/statusIndicators/statusLight/StatusLight';\nexport { StatusLightsBar } from './design/statusIndicators/statusLightsBar/StatusLightsBar';\nexport { CircularProgressIndicator } from './design/progressIndicators/circularProgressIndicator/CircularProgressIndicator';\nexport type { CircularProgressIndicatorProps } from './design/progressIndicators/circularProgressIndicator/CircularProgressIndicator';\n\nexport { Tabs } from './design/tabs/Tabs';\nexport { Tooltip } from './design/tooltip/Tooltip';\nexport { EllipsisTooltip } from './design/tooltip/ellipsisTooltip/EllipsisTooltip';\nexport { RevealMore } from './design/revealMore/RevealMore';\nexport { CopyText } from './design/copyText/CopyText';\nexport { Paginator } from './design/paginators/Paginator';\nexport { PageBanner, Banner, Alert } from './design/banners/pageBanner/PageBanner';\nexport type { PageBannerProps } from './design/banners/pageBanner/PageBanner';\n\n// Form components\nexport { SimpleButton, Button } from './form/buttons/SimpleButton';\nexport { FormField } from './form/formFields/formFieldWrapper/FormField';\nexport { InputCheckbox, CheckboxInput } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';\nexport { CheckboxSwitch } from './form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch';\nexport { StyledRadioGroup } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioGroup';\nexport { StyledRadioInput } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioInput';\nexport { StyledRadioLabel } from './form/formFields/subComponents/inputs/radio/styled/StyledRadioLabel';\nexport { HookFormWrapper } from './form/hookFormWrapper/HookFormWrapper';\n\nexport {\n TextInput,\n EmailInput,\n FileInput,\n SearchInput,\n NumberInput,\n PhoneInput,\n UrlInput,\n PasswordInput,\n PasswordInputSignup,\n SelectDropdown,\n Combobox,\n Textarea\n} from './form/formFields/subComponents/InputVariants';\nexport type {\n FormComponentProps,\n DropdownSelectProps,\n PasswordInputProps\n} from './form/formFields/subComponents/InputVariants';\n\nexport {\n InputDate\n} from './form/formFields/subComponents/inputs/date/InputDate';\nexport { DateInput } from './form/formFields/subComponents/inputs/date/DateInput';\nexport type { StyledRadioGroupProps } from './form/formFields/subComponents/inputs/radio/radioInputsProps';\nexport type {\n CheckboxSwitchProps,\n CheckboxSwitchSize,\n CheckboxSwitchVariant,\n CheckboxSwitchShape,\n CheckboxSwitchStateDisplay,\n CheckboxSwitchGlowTheme,\n CheckboxSwitchButtonStyle,\n CheckboxSwitchStateProps\n} from './form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps';\n\n// Layout\nexport { Card } from './design/card/Card';\nexport { ReportFooter } from './layout/footers/reports/ReportFooter';\nexport { MainHeader } from './layout/mainHeader/MainHeader';\n\nexport { ThemeLoader } from './design/themeLoader/ThemeLoader';\nexport type { ThemeStructure } from './design/themeLoader/ThemeLoader';\n\n// Testing\nexport { DevToolbar } from './testing/devToolbar/DevToolbar';\nexport { ThemeSwitch } from './testing/themeSwitch/ThemeSwitch';\nexport { LoremIpsum } from './testing/loremIpsum/LoremIpsum';\n\nexport { GlobalDashboard } from './layout/dashboard/layouts/globalDashboard/GlobalDashboard';\nexport { Menu } from './navigation/menu/Menu';\nexport { PopupMenu } from './navigation/popupMenu/PopupMenu';\nexport { SearchPanelMenu } from './navigation/searchPanelMenu/SearchPanelMenu';\nexport { Link } from './navigation/link/Link';\n\nexport type { MenuItemPropTypes, MenuButtonPropTypes, MenuItemIconStates } from './navigation/menu/Menu.interfaces';\n\n// Templates\nexport { TemplateForm } from './templates/templateForm/TemplateForm';\nexport type { TemplateFormProps } from './templates/templateForm/TemplateForm';\nexport { TemplateLoading } from './templates/templateLoading/TemplateLoading';\nexport type { TemplateLoadingProps } from './templates/templateLoading/TemplateLoading';\nexport { TemplateDashboard } from './templates/templateDashboard/TemplateDashboard';\nexport type { TemplateDashboardProps } from './templates/templateDashboard/TemplateDashboard';\nexport { TemplatePage } from './templates/templatePage/TemplatePage';\nexport type { TemplatePageProps } from './templates/templatePage/TemplatePage';\n\n// Aliases to match common libraries\nexport { SelectDropdown as Select } from './form/formFields/subComponents/InputVariants';\nexport { InputCheckbox as Checkbox } from './form/formFields/subComponents/inputs/checkbox/InputCheckbox';"],"mappings":"AAAA,YAAY;;AAEZ;AACA,SAASA,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,oBAAoB;AACtD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,IAAI,QAAQ,+BAA+B;AACpD,SAASC,gBAAgB,QAAQ,kDAAkD;AACnF,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,eAAe,QAAQ,2CAA2C;AAC3E,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,UAAU,QAAQ,qCAAqC;AAChE,SAASC,SAAS,QAAQ,oCAAoC;AAE9D,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,OAAO,QAAQ,0BAA0B;AAElD,SAAS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4D;AAC5F,SAASC,IAAI,QAAQ,wBAAwB;AAC7C,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,SAASC,IAAI,QAAQ,wBAAwB;AAI7C;AACA,SAASC,YAAY,QAAQ,uCAAuC;AAEpE,SAASC,eAAe,QAAQ,6CAA6C;AAE7E,SAASC,iBAAiB,QAAQ,iDAAiD;AAEnF,SAASC,YAAY,QAAQ,uCAAuC;AAGpE;AACA,SAASpB,cAAc,IAAIqB,MAAM,QAAQ,+CAA+C;AACxF,SAASrC,aAAa,IAAIsC,QAAQ,QAAQ,+DAA+D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.interfaces.js","names":[],"sources":["../../../../../src/components/navigation/menu/Menu.interfaces.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\nimport { GenericFunction } from '../../../interfaces';\n\nexport type MenuItemIconStates = {\n open:
|
|
1
|
+
{"version":3,"file":"Menu.interfaces.js","names":[],"sources":["../../../../../src/components/navigation/menu/Menu.interfaces.ts"],"sourcesContent":["import { ReactElement, ReactNode } from 'react';\nimport { GenericFunction } from '../../../interfaces';\nimport { IconSource } from '../../../helpers/iconHelpers';\n\nexport type MenuItemIconStates = {\n open: IconSource,\n closed: IconSource\n}\n\nexport type MenuItemIconPropTypes = IconSource | MenuItemIconStates;\n\nexport type MenuItemIconsPropTypes = {\n left?: MenuItemIconPropTypes,\n right?: MenuItemIconPropTypes\n};\n\nexport interface MenuButtonPropTypes {\n url?: string;\n isOpen?: boolean;\n icons?: MenuItemIconsPropTypes;\n label: string | ReactElement | ReactNode;\n hideLabel?: boolean;\n onSelect?: GenericFunction;\n hideItem?: boolean;\n isActive?: boolean;\n customCssClass?: string;\n route?: string;\n path?: number[];\n id: string;\n menuItems?: MenuItemPropTypes[];\n}\n\nexport interface MenuItemPropTypes extends MenuButtonPropTypes {\n menuItems?: MenuItemPropTypes[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,42 +1,29 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { renderIcon } from '../../../../helpers/iconHelpers';
|
|
5
|
+
export const isMenuItemIconStates = icon => icon !== null && typeof icon === 'object' && ! /*#__PURE__*/React.isValidElement(icon) && 'open' in icon && 'closed' in icon;
|
|
5
6
|
export const MenuItemIcon = ({
|
|
6
7
|
icon,
|
|
7
8
|
isOpen = false,
|
|
8
9
|
isHoverTrigger
|
|
9
10
|
}) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
icon: icon
|
|
13
|
-
});
|
|
14
|
-
if (typeof icon === 'string') {
|
|
15
|
-
return /*#__PURE__*/React.createElement(Icon, {
|
|
16
|
-
icon: icon
|
|
17
|
-
});
|
|
11
|
+
if (!isMenuItemIconStates(icon)) {
|
|
12
|
+
return renderIcon(icon);
|
|
18
13
|
}
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const {
|
|
15
|
+
open,
|
|
16
|
+
closed
|
|
17
|
+
} = icon;
|
|
18
|
+
if (isHoverTrigger) {
|
|
19
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
className: "menuIconsHoverWrapper"
|
|
21
|
+
}, renderIcon(open, {
|
|
22
|
+
customCssClass: 'hover'
|
|
23
|
+
}), renderIcon(closed));
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
open,
|
|
26
|
-
closed
|
|
27
|
-
} = icon;
|
|
28
|
-
if (isHoverTrigger) {
|
|
29
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
30
|
-
className: "menuIconsHoverWrapper"
|
|
31
|
-
}, RenderIcon(open, true), RenderIcon(closed));
|
|
32
|
-
}
|
|
33
|
-
if (open && closed) {
|
|
34
|
-
if (isOpen) {
|
|
35
|
-
return RenderIcon(open, true);
|
|
36
|
-
}
|
|
37
|
-
return RenderIcon(closed);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return icon;
|
|
25
|
+
return isOpen ? renderIcon(open, {
|
|
26
|
+
customCssClass: 'hover'
|
|
27
|
+
}) : renderIcon(closed);
|
|
41
28
|
};
|
|
42
29
|
//# sourceMappingURL=MenuItemIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItemIcon.js","names":["React","
|
|
1
|
+
{"version":3,"file":"MenuItemIcon.js","names":["React","renderIcon","isMenuItemIconStates","icon","isValidElement","MenuItemIcon","isOpen","isHoverTrigger","open","closed","createElement","className","customCssClass"],"sources":["../../../../../../src/components/navigation/menu/menuItemContent/MenuItemIcon.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { MenuItemIconPropTypes, MenuItemIconStates } from '../Menu.interfaces';\nimport { renderIcon } from '../../../../helpers/iconHelpers';\n\ninterface MenuItemIconProps {\n icon: MenuItemIconPropTypes;\n isOpen?: boolean;\n isHoverTrigger?: boolean;\n}\n\nexport const isMenuItemIconStates = (icon: unknown): icon is MenuItemIconStates => (\n icon !== null\n && typeof icon === 'object'\n && !React.isValidElement(icon)\n && 'open' in icon\n && 'closed' in icon\n);\n\nexport const MenuItemIcon: React.FC<MenuItemIconProps> = (\n {\n icon,\n isOpen = false,\n isHoverTrigger\n }\n) => {\n if (!isMenuItemIconStates(icon)) {\n return renderIcon(icon);\n }\n\n const { open, closed } = icon;\n\n if (isHoverTrigger) {\n return (\n <span className=\"menuIconsHoverWrapper\">\n { renderIcon(open, { customCssClass: 'hover' }) }\n { renderIcon(closed) }\n </span>\n );\n }\n\n return isOpen ? renderIcon(open, { customCssClass: 'hover' }) : renderIcon(closed);\n};\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,iCAAiC;AAQ5D,OAAO,MAAMC,oBAAoB,GAAIC,IAAa,IAChDA,IAAI,KAAK,IAAI,IACV,OAAOA,IAAI,KAAK,QAAQ,IACxB,eAACH,KAAK,CAACI,cAAc,CAACD,IAAI,CAAC,IAC3B,MAAM,IAAIA,IAAI,IACd,QAAQ,IAAIA,IAChB;AAED,OAAO,MAAME,YAAyC,GAAGA,CACvD;EACEF,IAAI;EACJG,MAAM,GAAG,KAAK;EACdC;AACF,CAAC,KACE;EACH,IAAI,CAACL,oBAAoB,CAACC,IAAI,CAAC,EAAE;IAC/B,OAAOF,UAAU,CAACE,IAAI,CAAC;EACzB;EAEA,MAAM;IAAEK,IAAI;IAAEC;EAAO,CAAC,GAAGN,IAAI;EAE7B,IAAII,cAAc,EAAE;IAClB,oBACEP,KAAA,CAAAU,aAAA;MAAMC,SAAS,EAAC;IAAuB,GACnCV,UAAU,CAACO,IAAI,EAAE;MAAEI,cAAc,EAAE;IAAQ,CAAC,CAAC,EAC7CX,UAAU,CAACQ,MAAM,CACf,CAAC;EAEX;EAEA,OAAOH,MAAM,GAAGL,UAAU,CAACO,IAAI,EAAE;IAAEI,cAAc,EAAE;EAAQ,CAAC,CAAC,GAAGX,UAAU,CAACQ,MAAM,CAAC;AACpF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';
|
|
4
|
+
import { Icon } from '../components/design/icons/basicIcon/Icon';
|
|
5
|
+
import { isNonElementObject } from './objectHelpers';
|
|
6
|
+
import { cssClassesArrayToString } from './arrayHelpers';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Every supported way of specifying an icon:
|
|
10
|
+
* - `string`: an icon font name, rendered via `<Icon icon="name" />`
|
|
11
|
+
* - `SvgIconDefinition`: an icon definition from `@x15ventures/x15-ui-library-icons/iconDefinitions`, rendered via `<SvgIcon />`
|
|
12
|
+
* - `IconProps`: props for `<Icon />`, e.g. `{ icon: 'bell', customCssClass: 'large' }`
|
|
13
|
+
* - `ReactElement` / `ReactNode`: rendered as provided, e.g. `<SvgIcon svgDefinition={ car } />` or `<img />`
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const isSvgIconDefinition = value => isNonElementObject(value) && Array.isArray(value.paths);
|
|
17
|
+
export const isIconProps = value => isNonElementObject(value) && 'icon' in value;
|
|
18
|
+
export const isEmptyIconSource = value => value === undefined || value === null || value === false || value === true || value === '';
|
|
19
|
+
const isReactPortal = value => value !== null && typeof value === 'object' && '$$typeof' in value && value.$$typeof === Symbol.for('react.portal');
|
|
20
|
+
const isIterableReactNode = value => value !== null && typeof value === 'object' && Symbol.iterator in value && typeof value[Symbol.iterator] === 'function';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Normalises any supported `IconSource` into a renderable node.
|
|
24
|
+
* Returns `null` when there is nothing to render.
|
|
25
|
+
*/
|
|
26
|
+
export const renderIcon = (icon, options = {}) => {
|
|
27
|
+
const {
|
|
28
|
+
customCssClass,
|
|
29
|
+
svgSize,
|
|
30
|
+
fallback
|
|
31
|
+
} = options;
|
|
32
|
+
const isEmpty = isEmptyIconSource(icon) || isIconProps(icon) && isEmptyIconSource(icon.icon);
|
|
33
|
+
if (isEmpty) {
|
|
34
|
+
return isEmptyIconSource(fallback) ? null : renderIcon(fallback, {
|
|
35
|
+
customCssClass,
|
|
36
|
+
svgSize
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (typeof icon === 'string') {
|
|
40
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
41
|
+
icon: icon,
|
|
42
|
+
customCssClass: customCssClass
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (/*#__PURE__*/React.isValidElement(icon)) {
|
|
46
|
+
return icon;
|
|
47
|
+
}
|
|
48
|
+
if (isReactPortal(icon) || isIterableReactNode(icon)) {
|
|
49
|
+
return icon;
|
|
50
|
+
}
|
|
51
|
+
if (isSvgIconDefinition(icon)) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
53
|
+
svgDefinition: icon,
|
|
54
|
+
customCssClass: customCssClass
|
|
55
|
+
}, svgSize ? {
|
|
56
|
+
size: svgSize
|
|
57
|
+
} : {}));
|
|
58
|
+
}
|
|
59
|
+
if (isIconProps(icon)) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(Icon, _extends({}, icon, {
|
|
61
|
+
customCssClass: cssClassesArrayToString(icon.customCssClass, customCssClass)
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Unrecognised plain objects are not renderable and would crash React.
|
|
66
|
+
if (isNonElementObject(icon)) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Remaining ReactNode values (numbers, arrays, portals) render as provided.
|
|
71
|
+
return icon;
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=iconHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconHelpers.js","names":["React","SvgIcon","Icon","isNonElementObject","cssClassesArrayToString","isSvgIconDefinition","value","Array","isArray","paths","isIconProps","isEmptyIconSource","undefined","isReactPortal","$$typeof","Symbol","for","isIterableReactNode","iterator","renderIcon","icon","options","customCssClass","svgSize","fallback","isEmpty","createElement","isValidElement","_extends","svgDefinition","size"],"sources":["../../../src/helpers/iconHelpers.tsx"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react';\nimport { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';\nimport type { SvgIconDefinition } from '@x15ventures/x15-ui-library-icons/svgIcon/svgIconDefinition.interface';\nimport { Icon, IconProps } from '../components/design/icons/basicIcon/Icon';\nimport { isNonElementObject } from './objectHelpers';\nimport { cssClassesArrayToString } from './arrayHelpers';\n\nexport type { SvgIconDefinition };\n\nexport type SvgIconSize = 'xs' | 's' | 'm' | 'l' | 'xl';\n\n/**\n * Every supported way of specifying an icon:\n * - `string`: an icon font name, rendered via `<Icon icon=\"name\" />`\n * - `SvgIconDefinition`: an icon definition from `@x15ventures/x15-ui-library-icons/iconDefinitions`, rendered via `<SvgIcon />`\n * - `IconProps`: props for `<Icon />`, e.g. `{ icon: 'bell', customCssClass: 'large' }`\n * - `ReactElement` / `ReactNode`: rendered as provided, e.g. `<SvgIcon svgDefinition={ car } />` or `<img />`\n */\nexport type IconSource = string | SvgIconDefinition | IconProps | ReactElement | ReactNode;\n\nexport interface RenderIconOptions {\n /** Added to icons rendered via `<Icon />` or `<SvgIcon />`. Not applied to React elements. */\n customCssClass?: string;\n /** Only applied to `SvgIconDefinition` sources. */\n svgSize?: SvgIconSize | string;\n /** Used when the icon source is empty (`undefined`, `null`, `false` or `''`). */\n fallback?: IconSource;\n}\n\nexport const isSvgIconDefinition = (value: unknown): value is SvgIconDefinition => (\n isNonElementObject(value) && Array.isArray(value.paths)\n);\n\nexport const isIconProps = (value: unknown): value is IconProps => (\n isNonElementObject(value) && 'icon' in value\n);\n\nexport const isEmptyIconSource = (value: unknown): boolean => (\n value === undefined || value === null || value === false || value === true || value === ''\n);\n\nconst isReactPortal = (value: unknown): value is React.ReactPortal => (\n value !== null\n && typeof value === 'object'\n && '$$typeof' in value\n && value.$$typeof === Symbol.for('react.portal')\n);\n\nconst isIterableReactNode = (value: unknown): value is Iterable<ReactNode> => (\n value !== null\n && typeof value === 'object'\n && Symbol.iterator in value\n && typeof value[Symbol.iterator] === 'function'\n);\n\n/**\n * Normalises any supported `IconSource` into a renderable node.\n * Returns `null` when there is nothing to render.\n */\nexport const renderIcon = (icon: IconSource, options: RenderIconOptions = {}): ReactNode => {\n const { customCssClass, svgSize, fallback } = options;\n const isEmpty = isEmptyIconSource(icon) || (isIconProps(icon) && isEmptyIconSource(icon.icon));\n\n if (isEmpty) {\n return isEmptyIconSource(fallback) ? null : renderIcon(fallback, { customCssClass, svgSize });\n }\n\n if (typeof icon === 'string') {\n return <Icon icon={ icon } customCssClass={ customCssClass } />;\n }\n\n if (React.isValidElement(icon)) {\n return icon;\n }\n\n if (isReactPortal(icon) || isIterableReactNode(icon)) {\n return icon;\n }\n\n if (isSvgIconDefinition(icon)) {\n return <SvgIcon svgDefinition={ icon } customCssClass={ customCssClass } { ...(svgSize ? { size: svgSize } : {}) } />;\n }\n\n if (isIconProps(icon)) {\n return <Icon { ...icon } customCssClass={ cssClassesArrayToString(icon.customCssClass, customCssClass) } />;\n }\n\n // Unrecognised plain objects are not renderable and would crash React.\n if (isNonElementObject(icon)) {\n return null;\n }\n\n // Remaining ReactNode values (numbers, arrays, portals) render as provided.\n return icon as ReactNode;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAmC,OAAO;AACtD,SAASC,OAAO,QAAQ,mDAAmD;AAE3E,SAASC,IAAI,QAAmB,2CAA2C;AAC3E,SAASC,kBAAkB,QAAQ,iBAAiB;AACpD,SAASC,uBAAuB,QAAQ,gBAAgB;;AAMxD;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAO,MAAMC,mBAAmB,GAAIC,KAAc,IAChDH,kBAAkB,CAACG,KAAK,CAAC,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAACG,KAAK,CACvD;AAED,OAAO,MAAMC,WAAW,GAAIJ,KAAc,IACxCH,kBAAkB,CAACG,KAAK,CAAC,IAAI,MAAM,IAAIA,KACxC;AAED,OAAO,MAAMK,iBAAiB,GAAIL,KAAc,IAC9CA,KAAK,KAAKM,SAAS,IAAIN,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,KAAK,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAK,EACzF;AAED,MAAMO,aAAa,GAAIP,KAAc,IACnCA,KAAK,KAAK,IAAI,IACX,OAAOA,KAAK,KAAK,QAAQ,IACzB,UAAU,IAAIA,KAAK,IACnBA,KAAK,CAACQ,QAAQ,KAAKC,MAAM,CAACC,GAAG,CAAC,cAAc,CAChD;AAED,MAAMC,mBAAmB,GAAIX,KAAc,IACzCA,KAAK,KAAK,IA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AAI,CAAC,EAAE;IACrB,oBAAOpB,KAAA,CAAA0B,aAAA,CAACxB,IAAI,EAAA0B,QAAA,KAAMR,IAAI;MAAGE,cAAc,EAAGlB,uBAAuB,CAACgB,IAAI,CAACE,cAAc,EAAEA,cAAc;IAAG,EAAE,CAAC;EAC7G;;EAEA;EACA,IAAInB,kBAAkB,CAACiB,IAAI,CAAC,EAAE;IAC5B,OAAO,IAAI;EACb;;EAEA;EACA,OAAOA,IAAI;AACb,CAAC","ignoreList":[]}
|
|
@@ -5,5 +5,6 @@ export { dateToShortIsoString, isValidDate, dateToShortReadableDate, dateToShort
|
|
|
5
5
|
export { USER_CURRENCY, intlCurrencyFormatter, intlNumberFormatter, formatNumberForLocale, formatAsCurrencyForLocale, getNumberAbbreviation, formatRoundedNumberWithAbbreviation, formatNumberWithAbbreviation, formatNumberForChartAxis, formatAsSimpleCurrencyForChartAxis, formatAsInternationalCurrencyForChartAxis, formatAsCurrencyWithAbbreviation, formatFileSize } from './formatters';
|
|
6
6
|
export { getRandomNumberBelow, getRandomBetweenInclusive, getRandomBetweenExclusive, hashCode, roundToDecimal, formatNumberToMinDigits, formatDigitalTime } from './numberHelpers';
|
|
7
7
|
export { richTextParser, capitalize, capitalizeFirstLetter, lowerCaseFirstLetter, getCharacterCount, clampToGraphemeMax, useAnInsteadOfA, splitCamelCase, pluralize, pluralizeIfNeeded, getInitialsOrAcronym } from './stringHelpers';
|
|
8
|
-
export { objectsAreTheSame, isAnObject, createCompareValueOverride, deepMergeObjects, overrideMergeObjects, makeInheritanceObject, updateNestedProperty, filterObject, getArrayOfObjectKeys, getArrayOfReadableObjectKeys, getBranchFromPath, deepRemoveProps } from './objectHelpers';
|
|
8
|
+
export { objectsAreTheSame, isAnObject, createCompareValueOverride, isReactElement, isNonElementObject, isPlainObject, deepMergeObjects, overrideMergeObjects, makeInheritanceObject, updateNestedProperty, filterObject, getArrayOfObjectKeys, getArrayOfReadableObjectKeys, getBranchFromPath, deepRemoveProps } from './objectHelpers';
|
|
9
|
+
export { renderIcon, isSvgIconDefinition, isIconProps, isEmptyIconSource } from './iconHelpers';
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getMinAge","getMaxAge","getMinAndMaxAges","validateBirthdate","isDateEntryComplete","getAgeInWeeks","getAgeInYears","binaryFindInArray","addAndSortArray","moveItemInArrayMutate","moveItemInArrayCopy","getRandomItemFromArray","getItemIndexWithinArray","getRoundedMedian","getMostOccurringBoolean","cssClassesArrayToString","transformPlacesData","extractNamePieces","dateToShortIsoString","isValidDate","dateToShortReadableDate","dateToShortReadableMonth","timeStampToShortReadableDate","dateToReadableTime","dateToShortReadableDateTime","getLastDateOfMonth","daysSince","USER_CURRENCY","intlCurrencyFormatter","intlNumberFormatter","formatNumberForLocale","formatAsCurrencyForLocale","getNumberAbbreviation","formatRoundedNumberWithAbbreviation","formatNumberWithAbbreviation","formatNumberForChartAxis","formatAsSimpleCurrencyForChartAxis","formatAsInternationalCurrencyForChartAxis","formatAsCurrencyWithAbbreviation","formatFileSize","getRandomNumberBelow","getRandomBetweenInclusive","getRandomBetweenExclusive","hashCode","roundToDecimal","formatNumberToMinDigits","formatDigitalTime","richTextParser","capitalize","capitalizeFirstLetter","lowerCaseFirstLetter","getCharacterCount","clampToGraphemeMax","useAnInsteadOfA","splitCamelCase","pluralize","pluralizeIfNeeded","getInitialsOrAcronym","objectsAreTheSame","isAnObject","createCompareValueOverride","deepMergeObjects","overrideMergeObjects","makeInheritanceObject","updateNestedProperty","filterObject","getArrayOfObjectKeys","getArrayOfReadableObjectKeys","getBranchFromPath","deepRemoveProps"],"sources":["../../../src/helpers/index.ts"],"sourcesContent":["export {\n getMinAge,\n getMaxAge,\n getMinAndMaxAges,\n validateBirthdate,\n isDateEntryComplete,\n getAgeInWeeks,\n getAgeInYears\n} from './ageHelpers';\n\nexport {\n binaryFindInArray,\n addAndSortArray,\n moveItemInArrayMutate,\n moveItemInArrayCopy,\n getRandomItemFromArray,\n getItemIndexWithinArray,\n getRoundedMedian,\n getMostOccurringBoolean,\n cssClassesArrayToString\n} from './arrayHelpers';\n\nexport {\n transformPlacesData,\n extractNamePieces\n} from './dataHelpers';\nexport type { NamePieces } from './dataHelpers';\n\nexport {\n dateToShortIsoString,\n isValidDate,\n dateToShortReadableDate,\n dateToShortReadableMonth,\n timeStampToShortReadableDate,\n dateToReadableTime,\n dateToShortReadableDateTime,\n getLastDateOfMonth,\n daysSince\n} from './dateHelpers';\n\nexport {\n USER_CURRENCY,\n intlCurrencyFormatter,\n intlNumberFormatter,\n formatNumberForLocale,\n formatAsCurrencyForLocale,\n getNumberAbbreviation,\n formatRoundedNumberWithAbbreviation,\n formatNumberWithAbbreviation,\n formatNumberForChartAxis,\n formatAsSimpleCurrencyForChartAxis,\n formatAsInternationalCurrencyForChartAxis,\n formatAsCurrencyWithAbbreviation,\n formatFileSize\n} from './formatters';\n\nexport {\n getRandomNumberBelow,\n getRandomBetweenInclusive,\n getRandomBetweenExclusive,\n hashCode,\n roundToDecimal,\n formatNumberToMinDigits,\n formatDigitalTime\n} from './numberHelpers';\n\nexport {\n richTextParser,\n capitalize,\n capitalizeFirstLetter,\n lowerCaseFirstLetter,\n getCharacterCount,\n clampToGraphemeMax,\n useAnInsteadOfA,\n splitCamelCase,\n pluralize,\n pluralizeIfNeeded,\n getInitialsOrAcronym\n} from './stringHelpers';\n\nexport {\n objectsAreTheSame,\n isAnObject,\n createCompareValueOverride,\n deepMergeObjects,\n overrideMergeObjects,\n makeInheritanceObject,\n updateNestedProperty,\n filterObject,\n getArrayOfObjectKeys,\n getArrayOfReadableObjectKeys,\n getBranchFromPath,\n deepRemoveProps\n} from './objectHelpers';\n"],"mappings":"AAAA,SACEA,SAAS,EACTC,SAAS,EACTC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,QACR,cAAc;AAErB,SACEC,iBAAiB,EACjBC,eAAe,EACfC,qBAAqB,EACrBC,mBAAmB,EACnBC,sBAAsB,EACtBC,uBAAuB,EACvBC,gBAAgB,EAChBC,uBAAuB,EACvBC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,mBAAmB,EACnBC,iBAAiB,QACZ,eAAe;AAGtB,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,EACvBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,kBAAkB,EAClBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,SAAS,QACJ,eAAe;AAEtB,SACEC,aAAa,EACbC,qBAAqB,EACrBC,mBAAmB,EACnBC,qBAAqB,EACrBC,yBAAyB,EACzBC,qBAAqB,EACrBC,mCAAmC,EACnCC,4BAA4B,EAC5BC,wBAAwB,EACxBC,kCAAkC,EAClCC,yCAAyC,EACzCC,gCAAgC,EAChCC,cAAc,QACT,cAAc;AAErB,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,yBAAyB,EACzBC,QAAQ,EACRC,cAAc,EACdC,uBAAuB,EACvBC,iBAAiB,QACZ,iBAAiB;AAExB,SACEC,cAAc,EACdC,UAAU,EACVC,qBAAqB,EACrBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,iBAAiB,EACjBC,oBAAoB,QACf,iBAAiB;AAExB,SACEC,iBAAiB,EACjBC,UAAU,EACVC,0BAA0B,EAC1BC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,EACrBC,oBAAoB,EACpBC,YAAY,EACZC,oBAAoB,EACpBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,eAAe,QACV,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getMinAge","getMaxAge","getMinAndMaxAges","validateBirthdate","isDateEntryComplete","getAgeInWeeks","getAgeInYears","binaryFindInArray","addAndSortArray","moveItemInArrayMutate","moveItemInArrayCopy","getRandomItemFromArray","getItemIndexWithinArray","getRoundedMedian","getMostOccurringBoolean","cssClassesArrayToString","transformPlacesData","extractNamePieces","dateToShortIsoString","isValidDate","dateToShortReadableDate","dateToShortReadableMonth","timeStampToShortReadableDate","dateToReadableTime","dateToShortReadableDateTime","getLastDateOfMonth","daysSince","USER_CURRENCY","intlCurrencyFormatter","intlNumberFormatter","formatNumberForLocale","formatAsCurrencyForLocale","getNumberAbbreviation","formatRoundedNumberWithAbbreviation","formatNumberWithAbbreviation","formatNumberForChartAxis","formatAsSimpleCurrencyForChartAxis","formatAsInternationalCurrencyForChartAxis","formatAsCurrencyWithAbbreviation","formatFileSize","getRandomNumberBelow","getRandomBetweenInclusive","getRandomBetweenExclusive","hashCode","roundToDecimal","formatNumberToMinDigits","formatDigitalTime","richTextParser","capitalize","capitalizeFirstLetter","lowerCaseFirstLetter","getCharacterCount","clampToGraphemeMax","useAnInsteadOfA","splitCamelCase","pluralize","pluralizeIfNeeded","getInitialsOrAcronym","objectsAreTheSame","isAnObject","createCompareValueOverride","isReactElement","isNonElementObject","isPlainObject","deepMergeObjects","overrideMergeObjects","makeInheritanceObject","updateNestedProperty","filterObject","getArrayOfObjectKeys","getArrayOfReadableObjectKeys","getBranchFromPath","deepRemoveProps","renderIcon","isSvgIconDefinition","isIconProps","isEmptyIconSource"],"sources":["../../../src/helpers/index.ts"],"sourcesContent":["export {\n getMinAge,\n getMaxAge,\n getMinAndMaxAges,\n validateBirthdate,\n isDateEntryComplete,\n getAgeInWeeks,\n getAgeInYears\n} from './ageHelpers';\n\nexport {\n binaryFindInArray,\n addAndSortArray,\n moveItemInArrayMutate,\n moveItemInArrayCopy,\n getRandomItemFromArray,\n getItemIndexWithinArray,\n getRoundedMedian,\n getMostOccurringBoolean,\n cssClassesArrayToString\n} from './arrayHelpers';\n\nexport {\n transformPlacesData,\n extractNamePieces\n} from './dataHelpers';\nexport type { NamePieces } from './dataHelpers';\n\nexport {\n dateToShortIsoString,\n isValidDate,\n dateToShortReadableDate,\n dateToShortReadableMonth,\n timeStampToShortReadableDate,\n dateToReadableTime,\n dateToShortReadableDateTime,\n getLastDateOfMonth,\n daysSince\n} from './dateHelpers';\n\nexport {\n USER_CURRENCY,\n intlCurrencyFormatter,\n intlNumberFormatter,\n formatNumberForLocale,\n formatAsCurrencyForLocale,\n getNumberAbbreviation,\n formatRoundedNumberWithAbbreviation,\n formatNumberWithAbbreviation,\n formatNumberForChartAxis,\n formatAsSimpleCurrencyForChartAxis,\n formatAsInternationalCurrencyForChartAxis,\n formatAsCurrencyWithAbbreviation,\n formatFileSize\n} from './formatters';\n\nexport {\n getRandomNumberBelow,\n getRandomBetweenInclusive,\n getRandomBetweenExclusive,\n hashCode,\n roundToDecimal,\n formatNumberToMinDigits,\n formatDigitalTime\n} from './numberHelpers';\n\nexport {\n richTextParser,\n capitalize,\n capitalizeFirstLetter,\n lowerCaseFirstLetter,\n getCharacterCount,\n clampToGraphemeMax,\n useAnInsteadOfA,\n splitCamelCase,\n pluralize,\n pluralizeIfNeeded,\n getInitialsOrAcronym\n} from './stringHelpers';\n\nexport {\n objectsAreTheSame,\n isAnObject,\n createCompareValueOverride,\n isReactElement,\n isNonElementObject,\n isPlainObject,\n deepMergeObjects,\n overrideMergeObjects,\n makeInheritanceObject,\n updateNestedProperty,\n filterObject,\n getArrayOfObjectKeys,\n getArrayOfReadableObjectKeys,\n getBranchFromPath,\n deepRemoveProps\n} from './objectHelpers';\nexport type {\n DeepMergeObjectsArgs,\n MakeInheritanceObjectArgs,\n UpdateNestedPropertyArgs\n} from './objectHelpers';\n\nexport {\n renderIcon,\n isSvgIconDefinition,\n isIconProps,\n isEmptyIconSource\n} from './iconHelpers';\nexport type {\n IconSource,\n RenderIconOptions,\n SvgIconDefinition,\n SvgIconSize\n} from './iconHelpers';\n"],"mappings":"AAAA,SACEA,SAAS,EACTC,SAAS,EACTC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,aAAa,EACbC,aAAa,QACR,cAAc;AAErB,SACEC,iBAAiB,EACjBC,eAAe,EACfC,qBAAqB,EACrBC,mBAAmB,EACnBC,sBAAsB,EACtBC,uBAAuB,EACvBC,gBAAgB,EAChBC,uBAAuB,EACvBC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,mBAAmB,EACnBC,iBAAiB,QACZ,eAAe;AAGtB,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,EACvBC,wBAAwB,EACxBC,4BAA4B,EAC5BC,kBAAkB,EAClBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,SAAS,QACJ,eAAe;AAEtB,SACEC,aAAa,EACbC,qBAAqB,EACrBC,mBAAmB,EACnBC,qBAAqB,EACrBC,yBAAyB,EACzBC,qBAAqB,EACrBC,mCAAmC,EACnCC,4BAA4B,EAC5BC,wBAAwB,EACxBC,kCAAkC,EAClCC,yCAAyC,EACzCC,gCAAgC,EAChCC,cAAc,QACT,cAAc;AAErB,SACEC,oBAAoB,EACpBC,yBAAyB,EACzBC,yBAAyB,EACzBC,QAAQ,EACRC,cAAc,EACdC,uBAAuB,EACvBC,iBAAiB,QACZ,iBAAiB;AAExB,SACEC,cAAc,EACdC,UAAU,EACVC,qBAAqB,EACrBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,EAClBC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,iBAAiB,EACjBC,oBAAoB,QACf,iBAAiB;AAExB,SACEC,iBAAiB,EACjBC,UAAU,EACVC,0BAA0B,EAC1BC,cAAc,EACdC,kBAAkB,EAClBC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,EACrBC,oBAAoB,EACpBC,YAAY,EACZC,oBAAoB,EACpBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,eAAe,QACV,iBAAiB;AAOxB,SACEC,UAAU,EACVC,mBAAmB,EACnBC,WAAW,EACXC,iBAAiB,QACZ,eAAe","ignoreList":[]}
|
|
@@ -11,10 +11,11 @@ export const objectsAreTheSame = (obj1, obj2) => {
|
|
|
11
11
|
};
|
|
12
12
|
return JsonStringifySorted(obj1) === JsonStringifySorted(obj2);
|
|
13
13
|
};
|
|
14
|
-
export const isAnObject = value => typeof value !== 'undefined' && !Array.isArray(value) && typeof value === 'object';
|
|
14
|
+
export const isAnObject = value => value !== null && typeof value !== 'undefined' && !Array.isArray(value) && typeof value === 'object';
|
|
15
15
|
export const createCompareValueOverride = (key, compareValue) => `${key}:${JSON.stringify(compareValue)}`;
|
|
16
|
-
const isReactElement = val => !!val && /*#__PURE__*/React.isValidElement(val);
|
|
17
|
-
const
|
|
16
|
+
export const isReactElement = val => !!val && /*#__PURE__*/React.isValidElement(val);
|
|
17
|
+
export const isNonElementObject = value => value !== null && typeof value === 'object' && !Array.isArray(value) && ! /*#__PURE__*/React.isValidElement(value);
|
|
18
|
+
export const isPlainObject = val => {
|
|
18
19
|
if (val === null || typeof val !== 'object') return false;
|
|
19
20
|
if (isReactElement(val)) return false;
|
|
20
21
|
if (Array.isArray(val)) return false;
|
|
@@ -234,6 +235,9 @@ export default {
|
|
|
234
235
|
objectsAreTheSame,
|
|
235
236
|
isAnObject,
|
|
236
237
|
createCompareValueOverride,
|
|
238
|
+
isReactElement,
|
|
239
|
+
isNonElementObject,
|
|
240
|
+
isPlainObject,
|
|
237
241
|
deepMergeObjects,
|
|
238
242
|
overrideMergeObjects,
|
|
239
243
|
makeInheritanceObject,
|