@hitachivantara/uikit-react-core 5.26.1 → 5.26.3
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/components/Avatar/Avatar.cjs +4 -2
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/BaseDropdown/BaseDropdown.cjs +2 -3
- package/dist/cjs/components/BaseDropdown/BaseDropdown.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.cjs +3 -1
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/ColorPicker/ColorPicker.cjs +4 -2
- package/dist/cjs/components/ColorPicker/ColorPicker.cjs.map +1 -1
- package/dist/cjs/components/ColorPicker/SavedColors/SavedColors.cjs +8 -3
- package/dist/cjs/components/ColorPicker/SavedColors/SavedColors.cjs.map +1 -1
- package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs +1 -1
- package/dist/cjs/components/DropDownMenu/DropDownMenu.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs +29 -40
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/DropZone/DropZone.styles.cjs +2 -2
- package/dist/cjs/components/FileUploader/DropZone/DropZone.styles.cjs.map +1 -1
- package/dist/cjs/components/OverflowTooltip/OverflowTooltip.cjs +4 -2
- package/dist/cjs/components/OverflowTooltip/OverflowTooltip.cjs.map +1 -1
- package/dist/cjs/components/Tag/Tag.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs.map +1 -1
- package/dist/esm/components/Avatar/Avatar.js +4 -2
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/BaseDropdown/BaseDropdown.js +2 -3
- package/dist/esm/components/BaseDropdown/BaseDropdown.js.map +1 -1
- package/dist/esm/components/Button/Button.js +3 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/ColorPicker/ColorPicker.js +4 -2
- package/dist/esm/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/components/ColorPicker/SavedColors/SavedColors.js +8 -3
- package/dist/esm/components/ColorPicker/SavedColors/SavedColors.js.map +1 -1
- package/dist/esm/components/DropDownMenu/DropDownMenu.js +1 -1
- package/dist/esm/components/DropDownMenu/DropDownMenu.js.map +1 -1
- package/dist/esm/components/FileUploader/DropZone/DropZone.js +29 -40
- package/dist/esm/components/FileUploader/DropZone/DropZone.js.map +1 -1
- package/dist/esm/components/FileUploader/DropZone/DropZone.styles.js +2 -2
- package/dist/esm/components/FileUploader/DropZone/DropZone.styles.js.map +1 -1
- package/dist/esm/components/OverflowTooltip/OverflowTooltip.js +4 -2
- package/dist/esm/components/OverflowTooltip/OverflowTooltip.js.map +1 -1
- package/dist/esm/components/Tag/Tag.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.styles.js +1 -0
- package/dist/esm/components/Tooltip/Tooltip.styles.js.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/package.json +2 -2
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const uniqueId = require("lodash/uniqueId");
|
|
5
5
|
const accept = require("attr-accept");
|
|
6
|
-
const keyboardUtils = require("../../../utils/keyboardUtils.cjs");
|
|
7
6
|
const setId = require("../../../utils/setId.cjs");
|
|
8
7
|
const useUniqueId = require("../../../hooks/useUniqueId.cjs");
|
|
9
8
|
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
@@ -67,7 +66,6 @@ const HvDropZone = ({
|
|
|
67
66
|
children: [!hideLabels && /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
68
67
|
id,
|
|
69
68
|
className: classes.dropZoneLabelsGroup,
|
|
70
|
-
"aria-label": "File Dropzone",
|
|
71
69
|
children: [/* @__PURE__ */ jsxRuntime.jsx(Label.HvLabel, {
|
|
72
70
|
id: setId.setId(id, "input-file-label"),
|
|
73
71
|
htmlFor: setId.setId(id, "input-file"),
|
|
@@ -78,50 +76,13 @@ const HvDropZone = ({
|
|
|
78
76
|
children: [Number.isInteger(maxFileSize) && `${labels == null ? void 0 : labels.sizeWarning} ${utils.convertUnits(maxFileSize)}`, (labels == null ? void 0 : labels.acceptedFiles) && labels.acceptedFiles, !(labels == null ? void 0 : labels.acceptedFiles) && acceptedFiles.length > 0 && ` (${acceptedFiles.join(", ")})`]
|
|
79
77
|
})]
|
|
80
78
|
}), /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
81
|
-
id: setId.setId(id, "
|
|
79
|
+
id: setId.setId(id, "input-file-container"),
|
|
82
80
|
className: cx(classes.dropZoneContainer, {
|
|
83
81
|
[classes.dragAction]: dragState,
|
|
84
82
|
[classes.dropZoneContainerDisabled]: disabled
|
|
85
83
|
}),
|
|
86
|
-
role: "button",
|
|
87
|
-
tabIndex: 0,
|
|
88
|
-
onDragEnter: (event) => {
|
|
89
|
-
if (!disabled) {
|
|
90
|
-
enterDropArea();
|
|
91
|
-
event.stopPropagation();
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
onDragLeave: leaveDropArea,
|
|
96
|
-
onDropCapture: leaveDropArea,
|
|
97
|
-
onDragOver: (event) => {
|
|
98
|
-
if (!disabled) {
|
|
99
|
-
enterDropArea();
|
|
100
|
-
event.stopPropagation();
|
|
101
|
-
event.preventDefault();
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
onDrop: (event) => {
|
|
105
|
-
if (!disabled) {
|
|
106
|
-
const {
|
|
107
|
-
files
|
|
108
|
-
} = event.dataTransfer;
|
|
109
|
-
if (multiple === true || files.length === 1) {
|
|
110
|
-
event.stopPropagation();
|
|
111
|
-
event.preventDefault();
|
|
112
|
-
onChangeHandler(files);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
onKeyDown: (e) => {
|
|
117
|
-
var _a;
|
|
118
|
-
if (keyboardUtils.isKey(e, "Enter") || keyboardUtils.isKey(e, "Space")) {
|
|
119
|
-
(_a = inputRef.current) == null ? void 0 : _a.click();
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
84
|
children: [/* @__PURE__ */ jsxRuntime.jsx("input", {
|
|
123
85
|
id: setId.setId(id, "input-file"),
|
|
124
|
-
tabIndex: -1,
|
|
125
86
|
className: classes.inputArea,
|
|
126
87
|
type: "file",
|
|
127
88
|
multiple,
|
|
@@ -138,6 +99,34 @@ const HvDropZone = ({
|
|
|
138
99
|
onChangeHandler(inputRef.current.files);
|
|
139
100
|
}
|
|
140
101
|
},
|
|
102
|
+
onDragEnter: (event) => {
|
|
103
|
+
if (!disabled) {
|
|
104
|
+
enterDropArea();
|
|
105
|
+
event.stopPropagation();
|
|
106
|
+
event.preventDefault();
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
onDragLeave: leaveDropArea,
|
|
110
|
+
onDropCapture: leaveDropArea,
|
|
111
|
+
onDragOver: (event) => {
|
|
112
|
+
if (!disabled) {
|
|
113
|
+
enterDropArea();
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
onDrop: (event) => {
|
|
119
|
+
if (!disabled) {
|
|
120
|
+
const {
|
|
121
|
+
files
|
|
122
|
+
} = event.dataTransfer;
|
|
123
|
+
if (multiple === true || files.length === 1) {
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
onChangeHandler(files);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
141
130
|
ref: inputRef,
|
|
142
131
|
accept: acceptedFiles.join(","),
|
|
143
132
|
...inputProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropZone.cjs","sources":["../../../../../src/components/FileUploader/DropZone/DropZone.tsx"],"sourcesContent":["import React, { useRef, useState } from \"react\";\n\nimport uniqueId from \"lodash/uniqueId\";\n\nimport accept from \"attr-accept\";\n\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\n\nimport { HvTypography } from \"@core/components/Typography\";\nimport { Doc } from \"@hitachivantara/uikit-react-icons\";\nimport { HvInfoMessage, HvLabel } from \"@core/components/Forms\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { convertUnits } from \"../utils\";\nimport { HvFileData, HvFilesAddedEvent } from \"../File\";\n\nimport { staticClasses, useClasses } from \"./DropZone.styles\";\n\nexport { staticClasses as dropZoneClasses };\n\nexport type HvDropZoneClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDropZoneLabels {\n /**\n * Extensions of the accepted file types\n */\n acceptedFiles?: string;\n /**\n * Dropzone area label.\n */\n dropzone?: string;\n /**\n * Size file warning label.\n */\n sizeWarning?: string;\n /**\n * Size file warning label.\n */\n drag?: string;\n /**\n * Size file warning label.\n */\n selectFiles?: string;\n /**\n * Theming sheet used to style components\n * */\n dropFiles?: string;\n /**\n * Message to display when file size is greater than allowed\n * */\n fileSizeError?: string;\n /**\n * Message to display when file type is greater than allowed\n * */\n fileTypeError?: string;\n}\n\nexport interface HvDropZoneProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Labels to present in FileUploader.\n */\n labels?: HvDropZoneLabels;\n /**\n * Whether the Dropzone should accept multiple files at once.\n */\n multiple?: boolean;\n /**\n * If the input is disabled or not\n */\n disabled?: boolean;\n /**\n * Files extensions accepted for upload.\n */\n acceptedFiles: string[];\n /**\n * Max upload size\n * */\n maxFileSize: number;\n /**\n * Function responsible for processing files added to the drop zone.\n */\n onFilesAdded?: HvFilesAddedEvent;\n /**\n * Whether the DropZone should hide labels or not.\n */\n hideLabels?: boolean;\n /**\n * Attributes applied to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvDropZoneClasses;\n}\n\nexport const HvDropZone = ({\n id: idProp,\n classes: classesProp,\n labels,\n acceptedFiles,\n maxFileSize,\n inputProps,\n hideLabels,\n multiple = true,\n disabled = false,\n onFilesAdded,\n}: HvDropZoneProps) => {\n const id = useUniqueId(idProp, \"dropzone\");\n\n const { classes, cx } = useClasses(classesProp);\n\n const [dragState, setDrag] = useState<boolean>(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const leaveDropArea = () => {\n setDrag(false);\n };\n\n const enterDropArea = () => {\n setDrag(true);\n };\n\n const onChangeHandler = (filesList: FileList) => {\n const filesToProcess = Object.keys(filesList).map((e) => filesList[e]);\n\n const newFiles: HvFileData[] = [];\n\n filesToProcess.forEach((file: File) => {\n const newFile: HvFileData = file;\n\n const isSizeAllowed = file.size <= maxFileSize;\n const isFileAccepted =\n !acceptedFiles.length ||\n acceptedFiles.indexOf(file.type.split(\"/\")[1]) > -1 ||\n acceptedFiles.some((acceptExtension) =>\n accept({ name: file.name, type: file.type }, acceptExtension)\n );\n\n if (!isFileAccepted) {\n newFile.errorMessage = labels?.fileTypeError;\n newFile.status = \"fail\";\n } else if (!isSizeAllowed) {\n newFile.errorMessage = labels?.fileSizeError;\n newFile.status = \"fail\";\n }\n\n newFile.id = uniqueId(\"uploaded-file-data-\");\n newFiles.push(newFile);\n });\n\n onFilesAdded?.(newFiles);\n };\n\n return (\n <>\n {!hideLabels && (\n <div\n id={id}\n className={classes.dropZoneLabelsGroup}\n aria-label=\"File Dropzone\"\n >\n <HvLabel\n id={setId(id, \"input-file-label\")}\n htmlFor={setId(id, \"input-file\")}\n label={labels?.dropzone}\n className={classes.dropZoneLabel}\n />\n <HvInfoMessage id={setId(id, \"description\")}>\n {Number.isInteger(maxFileSize) &&\n `${labels?.sizeWarning} ${convertUnits(maxFileSize)}`}\n {labels?.acceptedFiles && labels.acceptedFiles}\n {!labels?.acceptedFiles &&\n acceptedFiles.length > 0 &&\n `\\u00A0(${acceptedFiles.join(\", \")})`}\n </HvInfoMessage>\n </div>\n )}\n <div\n id={setId(id, \"button\")}\n className={cx(classes.dropZoneContainer, {\n [classes.dragAction]: dragState,\n [classes.dropZoneContainerDisabled]: disabled,\n })}\n role=\"button\"\n tabIndex={0}\n onDragEnter={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDragLeave={leaveDropArea}\n onDropCapture={leaveDropArea}\n onDragOver={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDrop={(event) => {\n if (!disabled) {\n const { files } = event.dataTransfer;\n if (multiple === true || files.length === 1) {\n event.stopPropagation();\n event.preventDefault();\n onChangeHandler(files);\n }\n }\n }}\n onKeyDown={(e) => {\n if (isKey(e, \"Enter\") || isKey(e, \"Space\")) {\n inputRef.current?.click();\n }\n }}\n >\n <input\n id={setId(id, \"input-file\")}\n tabIndex={-1}\n className={classes.inputArea}\n type=\"file\"\n multiple={multiple}\n disabled={disabled}\n title={!disabled ? `${labels?.drag}\\xa0${labels?.selectFiles}` : \"\"}\n onClick={() => {\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n }}\n onChange={() => {\n if (!disabled && inputRef.current?.files) {\n onChangeHandler(inputRef.current.files);\n }\n }}\n ref={inputRef}\n accept={acceptedFiles.join(\",\")}\n {...inputProps}\n />\n <div className={classes?.dropArea}>\n {dragState ? (\n <div className={classes.dropZoneAreaLabels}>\n <HvTypography className={classes.dragText}>\n {labels?.dropFiles}\n </HvTypography>\n </div>\n ) : (\n <>\n <Doc\n iconSize=\"M\"\n className={classes.dropZoneAreaIcon}\n color={disabled ? \"secondary_60\" : \"secondary\"}\n />\n <div className={classes.dropZoneAreaLabels}>\n <HvTypography className={classes.dragText}>\n {labels?.drag}\n <span\n className={classes.selectFilesText}\n >{`\\xa0${labels?.selectFiles}`}</span>\n </HvTypography>\n </div>\n </>\n )}\n </div>\n </div>\n </>\n );\n};\n"],"names":["HvDropZone","id","idProp","classes","classesProp","labels","acceptedFiles","maxFileSize","inputProps","hideLabels","multiple","disabled","onFilesAdded","useUniqueId","cx","useClasses","dragState","setDrag","useState","inputRef","useRef","leaveDropArea","enterDropArea","onChangeHandler","filesList","filesToProcess","Object","keys","map","e","newFiles","forEach","file","newFile","isSizeAllowed","size","isFileAccepted","length","indexOf","type","split","some","acceptExtension","accept","name","errorMessage","fileTypeError","status","fileSizeError","uniqueId","push","_Fragment","children","className","dropZoneLabelsGroup","_jsx","HvLabel","setId","htmlFor","label","dropzone","dropZoneLabel","_jsxs","HvInfoMessage","Number","isInteger","sizeWarning","convertUnits","join","dropZoneContainer","dragAction","dropZoneContainerDisabled","role","tabIndex","onDragEnter","event","stopPropagation","preventDefault","onDragLeave","onDropCapture","onDragOver","onDrop","files","dataTransfer","onKeyDown","isKey","current","click","inputArea","title","drag","selectFiles","onClick","value","onChange","ref","dropArea","dropZoneAreaLabels","HvTypography","dragText","dropFiles","Doc","iconSize","dropZoneAreaIcon","color","selectFilesText"],"mappings":";;;;;;;;;;;;;;;;;;AAqGO,MAAMA,aAAaA,CAAC;AAAA,EACzBC,IAAIC;AAAAA,EACJC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,EACXC,WAAW;AAAA,EACXC;AACe,MAAM;AACfX,QAAAA,KAAKY,YAAAA,YAAYX,QAAQ,UAAU;AAEnC,QAAA;AAAA,IAAEC;AAAAA,IAASW;AAAAA,EAAAA,IAAOC,gBAAAA,WAAWX,WAAW;AAE9C,QAAM,CAACY,WAAWC,OAAO,IAAIC,eAAkB,KAAK;AAE9CC,QAAAA,WAAWC,aAAgC,IAAI;AAErD,QAAMC,gBAAgBA,MAAM;AAC1BJ,YAAQ,KAAK;AAAA,EAAA;AAGf,QAAMK,gBAAgBA,MAAM;AAC1BL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F;AAAAA,YAAmB7C,0CACxC8C,yBAAY;AAAA,cAAC7C,WAAWlD,QAAQgG;AAAAA,cAAS/C,UACvC/C,CAAAA,iCAAQqF,qCACT,QAAA;AAAA,gBACErC,WAAWlD,QAAQsG;AAAAA,gBAAgBrD,UAClC,IAAM/C,iCAAQsF;AAAAA,cAAAA,CAAoB,CAAC;AAAA,YAAA,CAC1B;AAAA,UAAA,CACX,CAAC;AAAA,QAAA,CACN;AAAA,MAAA,CAED,CAAC;AAAA,IAAA,CACH,CAAC;AAAA,EAAA,CACN;AAEN;;;"}
|
|
1
|
+
{"version":3,"file":"DropZone.cjs","sources":["../../../../../src/components/FileUploader/DropZone/DropZone.tsx"],"sourcesContent":["import React, { useRef, useState } from \"react\";\n\nimport uniqueId from \"lodash/uniqueId\";\n\nimport accept from \"attr-accept\";\n\nimport { setId } from \"@core/utils/setId\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\n\nimport { HvTypography } from \"@core/components/Typography\";\nimport { Doc } from \"@hitachivantara/uikit-react-icons\";\nimport { HvInfoMessage, HvLabel } from \"@core/components/Forms\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { convertUnits } from \"../utils\";\nimport { HvFileData, HvFilesAddedEvent } from \"../File\";\n\nimport { staticClasses, useClasses } from \"./DropZone.styles\";\n\nexport { staticClasses as dropZoneClasses };\n\nexport type HvDropZoneClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDropZoneLabels {\n /**\n * Extensions of the accepted file types\n */\n acceptedFiles?: string;\n /**\n * Dropzone area label.\n */\n dropzone?: string;\n /**\n * Size file warning label.\n */\n sizeWarning?: string;\n /**\n * Size file warning label.\n */\n drag?: string;\n /**\n * Size file warning label.\n */\n selectFiles?: string;\n /**\n * Theming sheet used to style components\n * */\n dropFiles?: string;\n /**\n * Message to display when file size is greater than allowed\n * */\n fileSizeError?: string;\n /**\n * Message to display when file type is greater than allowed\n * */\n fileTypeError?: string;\n}\n\nexport interface HvDropZoneProps {\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * Labels to present in FileUploader.\n */\n labels?: HvDropZoneLabels;\n /**\n * Whether the Dropzone should accept multiple files at once.\n */\n multiple?: boolean;\n /**\n * If the input is disabled or not\n */\n disabled?: boolean;\n /**\n * Files extensions accepted for upload.\n */\n acceptedFiles: string[];\n /**\n * Max upload size\n * */\n maxFileSize: number;\n /**\n * Function responsible for processing files added to the drop zone.\n */\n onFilesAdded?: HvFilesAddedEvent;\n /**\n * Whether the DropZone should hide labels or not.\n */\n hideLabels?: boolean;\n /**\n * Attributes applied to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes?: HvDropZoneClasses;\n}\n\nexport const HvDropZone = ({\n id: idProp,\n classes: classesProp,\n labels,\n acceptedFiles,\n maxFileSize,\n inputProps,\n hideLabels,\n multiple = true,\n disabled = false,\n onFilesAdded,\n}: HvDropZoneProps) => {\n const id = useUniqueId(idProp, \"dropzone\");\n\n const { classes, cx } = useClasses(classesProp);\n\n const [dragState, setDrag] = useState<boolean>(false);\n\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const leaveDropArea = () => {\n setDrag(false);\n };\n\n const enterDropArea = () => {\n setDrag(true);\n };\n\n const onChangeHandler = (filesList: FileList) => {\n const filesToProcess = Object.keys(filesList).map((e) => filesList[e]);\n\n const newFiles: HvFileData[] = [];\n\n filesToProcess.forEach((file: File) => {\n const newFile: HvFileData = file;\n\n const isSizeAllowed = file.size <= maxFileSize;\n const isFileAccepted =\n !acceptedFiles.length ||\n acceptedFiles.indexOf(file.type.split(\"/\")[1]) > -1 ||\n acceptedFiles.some((acceptExtension) =>\n accept({ name: file.name, type: file.type }, acceptExtension)\n );\n\n if (!isFileAccepted) {\n newFile.errorMessage = labels?.fileTypeError;\n newFile.status = \"fail\";\n } else if (!isSizeAllowed) {\n newFile.errorMessage = labels?.fileSizeError;\n newFile.status = \"fail\";\n }\n\n newFile.id = uniqueId(\"uploaded-file-data-\");\n newFiles.push(newFile);\n });\n\n onFilesAdded?.(newFiles);\n };\n\n return (\n <>\n {!hideLabels && (\n <div id={id} className={classes.dropZoneLabelsGroup}>\n <HvLabel\n id={setId(id, \"input-file-label\")}\n htmlFor={setId(id, \"input-file\")}\n label={labels?.dropzone}\n className={classes.dropZoneLabel}\n />\n <HvInfoMessage id={setId(id, \"description\")}>\n {Number.isInteger(maxFileSize) &&\n `${labels?.sizeWarning} ${convertUnits(maxFileSize)}`}\n {labels?.acceptedFiles && labels.acceptedFiles}\n {!labels?.acceptedFiles &&\n acceptedFiles.length > 0 &&\n `\\u00A0(${acceptedFiles.join(\", \")})`}\n </HvInfoMessage>\n </div>\n )}\n <div\n id={setId(id, \"input-file-container\")}\n className={cx(classes.dropZoneContainer, {\n [classes.dragAction]: dragState,\n [classes.dropZoneContainerDisabled]: disabled,\n })}\n >\n <input\n id={setId(id, \"input-file\")}\n className={classes.inputArea}\n type=\"file\"\n multiple={multiple}\n disabled={disabled}\n title={!disabled ? `${labels?.drag}\\xa0${labels?.selectFiles}` : \"\"}\n onClick={() => {\n if (inputRef.current) {\n inputRef.current.value = \"\";\n }\n }}\n onChange={() => {\n if (!disabled && inputRef.current?.files) {\n onChangeHandler(inputRef.current.files);\n }\n }}\n onDragEnter={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDragLeave={leaveDropArea}\n onDropCapture={leaveDropArea}\n onDragOver={(event) => {\n if (!disabled) {\n enterDropArea();\n event.stopPropagation();\n event.preventDefault();\n }\n }}\n onDrop={(event) => {\n if (!disabled) {\n const { files } = event.dataTransfer;\n if (multiple === true || files.length === 1) {\n event.stopPropagation();\n event.preventDefault();\n onChangeHandler(files);\n }\n }\n }}\n ref={inputRef}\n accept={acceptedFiles.join(\",\")}\n {...inputProps}\n />\n <div className={classes?.dropArea}>\n {dragState ? (\n <div className={classes.dropZoneAreaLabels}>\n <HvTypography className={classes.dragText}>\n {labels?.dropFiles}\n </HvTypography>\n </div>\n ) : (\n <>\n <Doc\n iconSize=\"M\"\n className={classes.dropZoneAreaIcon}\n color={disabled ? \"secondary_60\" : \"secondary\"}\n />\n <div className={classes.dropZoneAreaLabels}>\n <HvTypography className={classes.dragText}>\n {labels?.drag}\n <span\n className={classes.selectFilesText}\n >{`\\xa0${labels?.selectFiles}`}</span>\n </HvTypography>\n </div>\n </>\n )}\n </div>\n </div>\n </>\n );\n};\n"],"names":["HvDropZone","id","idProp","classes","classesProp","labels","acceptedFiles","maxFileSize","inputProps","hideLabels","multiple","disabled","onFilesAdded","useUniqueId","cx","useClasses","dragState","setDrag","useState","inputRef","useRef","leaveDropArea","enterDropArea","onChangeHandler","filesList","filesToProcess","Object","keys","map","e","newFiles","forEach","file","newFile","isSizeAllowed","size","isFileAccepted","length","indexOf","type","split","some","acceptExtension","accept","name","errorMessage","fileTypeError","status","fileSizeError","uniqueId","push","_Fragment","children","className","dropZoneLabelsGroup","_jsx","HvLabel","setId","htmlFor","label","dropzone","dropZoneLabel","_jsxs","HvInfoMessage","Number","isInteger","sizeWarning","convertUnits","join","dropZoneContainer","dragAction","dropZoneContainerDisabled","inputArea","title","drag","selectFiles","onClick","current","value","onChange","files","onDragEnter","event","stopPropagation","preventDefault","onDragLeave","onDropCapture","onDragOver","onDrop","dataTransfer","ref","dropArea","dropZoneAreaLabels","HvTypography","dragText","dropFiles","Doc","iconSize","dropZoneAreaIcon","color","selectFilesText"],"mappings":";;;;;;;;;;;;;;;;;AAoGO,MAAMA,aAAaA,CAAC;AAAA,EACzBC,IAAIC;AAAAA,EACJC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,EACXC,WAAW;AAAA,EACXC;AACe,MAAM;AACfX,QAAAA,KAAKY,YAAAA,YAAYX,QAAQ,UAAU;AAEnC,QAAA;AAAA,IAAEC;AAAAA,IAASW;AAAAA,E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,yBAAY;AAAA,cAACxC,WAAWlD,QAAQ2F;AAAAA,cAAS1C,UACvC/C,CAAAA,iCAAQqE,qCACT,QAAA;AAAA,gBACErB,WAAWlD,QAAQiG;AAAAA,gBAAgBhD,UAClC,IAAM/C,iCAAQsE;AAAAA,cAAAA,CAAoB,CAAC;AAAA,YAAA,CAC1B;AAAA,UAAA,CACX,CAAC;AAAA,QAAA,CACN;AAAA,MAAA,CAED,CAAC;AAAA,IAAA,CACH,CAAC;AAAA,EAAA,CACN;AAEN;;;"}
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
background: `${uikitStyles.theme.colors.atmo1}`,
|
|
20
20
|
border: `1px ${uikitStyles.theme.fileUploader.dropZone.borderType} ${uikitStyles.theme.colors.secondary}`
|
|
21
21
|
},
|
|
22
|
-
"&:focus": {
|
|
22
|
+
"&:focus-within": {
|
|
23
23
|
background: `${uikitStyles.theme.colors.atmo1}`,
|
|
24
24
|
border: `1px ${uikitStyles.theme.fileUploader.dropZone.borderType} ${uikitStyles.theme.colors.secondary}`,
|
|
25
25
|
...focusUtils.outlineStyles
|
|
@@ -69,7 +69,7 @@ const {
|
|
|
69
69
|
},
|
|
70
70
|
dropZoneAreaLabels: {
|
|
71
71
|
display: "flex",
|
|
72
|
-
|
|
72
|
+
maxWidth: 120,
|
|
73
73
|
margin: "auto"
|
|
74
74
|
},
|
|
75
75
|
dropZoneAreaIcon: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropZone.styles.cjs","sources":["../../../../../src/components/FileUploader/DropZone/DropZone.styles.tsx"],"sourcesContent":["import { createClasses } from \"@core/utils/classes\";\nimport { outlineStyles } from \"@core/utils/focusUtils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { CSSProperties } from \"react\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDropZone\", {\n dropZoneContainer: {\n position: \"relative\",\n width: \"100%\",\n display: \"flex\",\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColor}`,\n cursor: \"pointer\",\n background: theme.fileUploader.dropZone.backgroundColor,\n borderRadius: theme.fileUploader.dropZone.borderRadius,\n\n \"&:hover\": {\n background: `${theme.colors.atmo1}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.colors.secondary}`,\n },\n\n \"&:focus\": {\n background: `${theme.colors.atmo1}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.colors.secondary}`,\n ...outlineStyles,\n },\n },\n dropZoneLabelsGroup: {\n display: \"flex\",\n justifyContent: \"start\",\n\n \"& label:nth-of-type(1)\": {},\n\n \"& p:nth-of-type(2)\": {\n marginLeft: \"auto\",\n },\n },\n dragAction: {\n background: `${theme.colors.atmo1}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColorDrag}`,\n },\n dropZoneContainerDisabled: {\n background: `${theme.colors.atmo3}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColorDisabled}`,\n cursor: \"not-allowed\",\n \"&:hover\": {\n background: `${theme.colors.atmo3}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColorDisabled}`,\n },\n\n \"& $dragText\": {\n color: theme.colors.secondary_60,\n },\n \"& $selectFilesText\": {\n color: theme.colors.secondary_60,\n },\n },\n inputArea: {\n opacity: 0,\n width: \"100%\",\n position: \"absolute\",\n height: \"100%\",\n cursor: \"pointer\",\n\n \"&:disabled\": {\n cursor: \"not-allowed\",\n },\n },\n dropArea: {\n display: \"flex\",\n margin: `${theme.space.md} auto`,\n minHeight: 48,\n },\n dropZoneAreaLabels: {\n display: \"flex\",\n
|
|
1
|
+
{"version":3,"file":"DropZone.styles.cjs","sources":["../../../../../src/components/FileUploader/DropZone/DropZone.styles.tsx"],"sourcesContent":["import { createClasses } from \"@core/utils/classes\";\nimport { outlineStyles } from \"@core/utils/focusUtils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { CSSProperties } from \"react\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvDropZone\", {\n dropZoneContainer: {\n position: \"relative\",\n width: \"100%\",\n display: \"flex\",\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColor}`,\n cursor: \"pointer\",\n background: theme.fileUploader.dropZone.backgroundColor,\n borderRadius: theme.fileUploader.dropZone.borderRadius,\n\n \"&:hover\": {\n background: `${theme.colors.atmo1}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.colors.secondary}`,\n },\n\n \"&:focus-within\": {\n background: `${theme.colors.atmo1}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.colors.secondary}`,\n ...outlineStyles,\n },\n },\n dropZoneLabelsGroup: {\n display: \"flex\",\n justifyContent: \"start\",\n\n \"& label:nth-of-type(1)\": {},\n\n \"& p:nth-of-type(2)\": {\n marginLeft: \"auto\",\n },\n },\n dragAction: {\n background: `${theme.colors.atmo1}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColorDrag}`,\n },\n dropZoneContainerDisabled: {\n background: `${theme.colors.atmo3}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColorDisabled}`,\n cursor: \"not-allowed\",\n \"&:hover\": {\n background: `${theme.colors.atmo3}`,\n border: `1px ${theme.fileUploader.dropZone.borderType} ${theme.fileUploader.dropZone.borderColorDisabled}`,\n },\n\n \"& $dragText\": {\n color: theme.colors.secondary_60,\n },\n \"& $selectFilesText\": {\n color: theme.colors.secondary_60,\n },\n },\n inputArea: {\n opacity: 0,\n width: \"100%\",\n position: \"absolute\",\n height: \"100%\",\n cursor: \"pointer\",\n\n \"&:disabled\": {\n cursor: \"not-allowed\",\n },\n },\n dropArea: {\n display: \"flex\",\n margin: `${theme.space.md} auto`,\n minHeight: 48,\n },\n dropZoneAreaLabels: {\n display: \"flex\",\n maxWidth: 120,\n margin: \"auto\",\n },\n dropZoneAreaIcon: {\n margin: \"auto\",\n marginRight: theme.space.xs,\n },\n dropZoneLabel: {\n paddingBottom: 6,\n },\n dragText: {\n ...(theme.typography.body as CSSProperties),\n },\n selectFilesText: {\n ...(theme.typography.label as CSSProperties),\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","dropZoneContainer","position","width","display","border","theme","fileUploader","dropZone","borderType","borderColor","cursor","background","backgroundColor","borderRadius","colors","atmo1","secondary","outlineStyles","dropZoneLabelsGroup","justifyContent","marginLeft","dragAction","borderColorDrag","dropZoneContainerDisabled","atmo3","borderColorDisabled","color","secondary_60","inputArea","opacity","height","dropArea","margin","space","md","minHeight","dropZoneAreaLabels","maxWidth","dropZoneAreaIcon","marginRight","xs","dropZoneLabel","paddingBottom","dragText","typography","body","selectFilesText","label"],"mappings":";;;;;AAKa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,cAAc;AAAA,EACvEC,mBAAmB;AAAA,IACjBC,UAAU;AAAA,IACVC,OAAO;AAAA,IACPC,SAAS;AAAA,IACTC,QAAS,OAAMC,YAAMC,MAAAA,aAAaC,SAASC,cAAcH,YAAAA,MAAMC,aAAaC,SAASE;AAAAA,IACrFC,QAAQ;AAAA,IACRC,YAAYN,YAAMC,MAAAA,aAAaC,SAASK;AAAAA,IACxCC,cAAcR,YAAMC,MAAAA,aAAaC,SAASM;AAAAA,IAE1C,WAAW;AAAA,MACTF,YAAa,GAAEN,YAAAA,MAAMS,OAAOC;AAAAA,MAC5BX,QAAS,OAAMC,YAAAA,MAAMC,aAAaC,SAASC,cAAcH,YAAAA,MAAMS,OAAOE;AAAAA,IACxE;AAAA,IAEA,kBAAkB;AAAA,MAChBL,YAAa,GAAEN,YAAAA,MAAMS,OAAOC;AAAAA,MAC5BX,QAAS,OAAMC,YAAAA,MAAMC,aAAaC,SAASC,cAAcH,YAAAA,MAAMS,OAAOE;AAAAA,MACtE,GAAGC,WAAAA;AAAAA,IACL;AAAA,EACF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,kBAAkB;AAAA,IAChBN,QAAQ;AAAA,IACRO,aAAalC,YAAAA,MAAM4B,MAAMO;AAAAA,EAC3B;AAAA,EACAC,eAAe;AAAA,IACbC,eAAe;AAAA,EACjB;AAAA,EACAC,UAAU;AAAA,IACR,GAAItC,YAAAA,MAAMuC,WAAWC;AAAAA,EACvB;AAAA,EACAC,iBAAiB;AAAA,IACf,GAAIzC,YAAAA,MAAMuC,WAAWG;AAAAA,EACvB;AACF,CAAC;;;"}
|
|
@@ -45,7 +45,7 @@ const HvOverflowTooltip = (props) => {
|
|
|
45
45
|
}, className),
|
|
46
46
|
children: data
|
|
47
47
|
}), [className, classes.tooltipAnchor, classes.tooltipAnchorParagraph, cx, data, isParag, ref]);
|
|
48
|
-
return
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip.HvTooltip, {
|
|
49
49
|
id,
|
|
50
50
|
disableHoverListener: !isOverflowing,
|
|
51
51
|
open,
|
|
@@ -55,9 +55,11 @@ const HvOverflowTooltip = (props) => {
|
|
|
55
55
|
variant: "body",
|
|
56
56
|
children: data
|
|
57
57
|
}),
|
|
58
|
+
"aria-label": null,
|
|
59
|
+
"aria-labelledby": null,
|
|
58
60
|
...tooltipsProps,
|
|
59
61
|
children: content
|
|
60
|
-
})
|
|
62
|
+
});
|
|
61
63
|
};
|
|
62
64
|
exports.overflowTooltipClasses = OverflowTooltip_styles.staticClasses;
|
|
63
65
|
exports.HvOverflowTooltip = HvOverflowTooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverflowTooltip.cjs","sources":["../../../../src/components/OverflowTooltip/OverflowTooltip.tsx"],"sourcesContent":["import { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useMemo } from \"react\";\nimport { useResizeDetector } from \"react-resize-detector\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvTooltip, HvTooltipProps } from \"@core/components/Tooltip\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { staticClasses, useClasses } from \"./OverflowTooltip.styles\";\n\nexport { staticClasses as overflowTooltipClasses };\nexport type HvOverflowTooltipClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvOverflowTooltipProps extends HvBaseProps {\n /** The node that will be rendered inside the tooltip. */\n data: React.ReactNode;\n /** If true, the tooltip is shown. */\n open?: boolean;\n /** If `true` the overflow tooltip will always use the paragraph overflow style. */\n paragraphOverflow?: boolean;\n /** Tooltip placement. */\n placement?:\n | \"bottom-end\"\n | \"bottom-start\"\n | \"bottom\"\n | \"left-end\"\n | \"left-start\"\n | \"left\"\n | \"right-end\"\n | \"right-start\"\n | \"right\"\n | \"top-end\"\n | \"top-start\"\n | \"top\";\n /** Extra properties to add to the tooltip. */\n tooltipsProps?: Partial<HvTooltipProps>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvOverflowTooltipClasses;\n}\n\nconst isParagraph = (children = \"\") => /\\s/.test(children);\n\n/**\n * This component generates a tooltip whenever the text is overflowed.\n */\nexport const HvOverflowTooltip = (props: HvOverflowTooltipProps) => {\n const {\n id,\n classes: classesProp,\n className,\n data,\n open,\n paragraphOverflow,\n placement = \"top-start\",\n tooltipsProps,\n } = useDefaultProps(\"HvOverflowTooltip\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { width = 0, ref } = useResizeDetector({\n refreshMode: \"debounce\",\n refreshOptions: {\n trailing: true,\n },\n handleHeight: false,\n });\n const scrollWidth = ref.current?.scrollWidth || 0;\n // The difference should be higher than a pixel to be considered as overflowing\n const isOverflowing = scrollWidth - width >= 1;\n\n const isParag = useMemo(\n () => paragraphOverflow && isParagraph(data?.toString()),\n [data, paragraphOverflow]\n );\n\n const content = useMemo(\n () => (\n <div\n ref={ref}\n className={cx(\n {\n [classes.tooltipAnchor]: !isParag,\n [classes.tooltipAnchorParagraph]: isParag,\n },\n className\n )}\n >\n {data}\n </div>\n ),\n [\n className,\n classes.tooltipAnchor,\n classes.tooltipAnchorParagraph,\n cx,\n data,\n isParag,\n ref,\n ]\n );\n\n return
|
|
1
|
+
{"version":3,"file":"OverflowTooltip.cjs","sources":["../../../../src/components/OverflowTooltip/OverflowTooltip.tsx"],"sourcesContent":["import { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useMemo } from \"react\";\nimport { useResizeDetector } from \"react-resize-detector\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvTooltip, HvTooltipProps } from \"@core/components/Tooltip\";\nimport { HvTypography } from \"@core/components/Typography\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { staticClasses, useClasses } from \"./OverflowTooltip.styles\";\n\nexport { staticClasses as overflowTooltipClasses };\nexport type HvOverflowTooltipClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvOverflowTooltipProps extends HvBaseProps {\n /** The node that will be rendered inside the tooltip. */\n data: React.ReactNode;\n /** If true, the tooltip is shown. */\n open?: boolean;\n /** If `true` the overflow tooltip will always use the paragraph overflow style. */\n paragraphOverflow?: boolean;\n /** Tooltip placement. */\n placement?:\n | \"bottom-end\"\n | \"bottom-start\"\n | \"bottom\"\n | \"left-end\"\n | \"left-start\"\n | \"left\"\n | \"right-end\"\n | \"right-start\"\n | \"right\"\n | \"top-end\"\n | \"top-start\"\n | \"top\";\n /** Extra properties to add to the tooltip. */\n tooltipsProps?: Partial<HvTooltipProps>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvOverflowTooltipClasses;\n}\n\nconst isParagraph = (children = \"\") => /\\s/.test(children);\n\n/**\n * This component generates a tooltip whenever the text is overflowed.\n */\nexport const HvOverflowTooltip = (props: HvOverflowTooltipProps) => {\n const {\n id,\n classes: classesProp,\n className,\n data,\n open,\n paragraphOverflow,\n placement = \"top-start\",\n tooltipsProps,\n } = useDefaultProps(\"HvOverflowTooltip\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { width = 0, ref } = useResizeDetector({\n refreshMode: \"debounce\",\n refreshOptions: {\n trailing: true,\n },\n handleHeight: false,\n });\n const scrollWidth = ref.current?.scrollWidth || 0;\n // The difference should be higher than a pixel to be considered as overflowing\n const isOverflowing = scrollWidth - width >= 1;\n\n const isParag = useMemo(\n () => paragraphOverflow && isParagraph(data?.toString()),\n [data, paragraphOverflow]\n );\n\n const content = useMemo(\n () => (\n <div\n ref={ref}\n className={cx(\n {\n [classes.tooltipAnchor]: !isParag,\n [classes.tooltipAnchorParagraph]: isParag,\n },\n className\n )}\n >\n {data}\n </div>\n ),\n [\n className,\n classes.tooltipAnchor,\n classes.tooltipAnchorParagraph,\n cx,\n data,\n isParag,\n ref,\n ]\n );\n\n return (\n <HvTooltip\n id={id}\n disableHoverListener={!isOverflowing}\n open={open}\n placement={placement}\n title={\n <HvTypography className={classes.tooltipData} variant=\"body\">\n {data}\n </HvTypography>\n }\n // unset since `content` *is* the label\n aria-label={null as any}\n aria-labelledby={null as any}\n {...tooltipsProps}\n >\n {content}\n </HvTooltip>\n );\n};\n"],"names":["isParagraph","children","test","HvOverflowTooltip","props","id","classes","classesProp","className","data","open","paragraphOverflow","placement","tooltipsProps","useDefaultProps","cx","useClasses","width","ref","useResizeDetector","refreshMode","refreshOptions","trailing","handleHeight","scrollWidth","current","isOverflowing","isParag","useMemo","toString","content","_jsx","tooltipAnchor","tooltipAnchorParagraph","HvTooltip","disableHoverListener","title","HvTypography","tooltipData","variant"],"mappings":";;;;;;;;;AAuCA,MAAMA,cAAcA,CAACC,WAAW,OAAO,KAAKC,KAAKD,QAAQ;AAK5CE,MAAAA,oBAAoBA,CAACC,UAAkC;;AAC5D,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,YAAY;AAAA,IACZC;AAAAA,EAAAA,IACEC,gBAAgB,gBAAA,qBAAqBV,KAAK;AACxC,QAAA;AAAA,IAAEE;AAAAA,IAASS;AAAAA,EAAAA,IAAOC,uBAAAA,WAAWT,WAAW;AAExC,QAAA;AAAA,IAAEU,QAAQ;AAAA,IAAGC;AAAAA,MAAQC,sCAAkB;AAAA,IAC3CC,aAAa;AAAA,IACbC,gBAAgB;AAAA,MACdC,UAAU;AAAA,IACZ;AAAA,IACAC,cAAc;AAAA,EAAA,CACf;AACKC,QAAAA,gBAAcN,SAAIO,YAAJP,mBAAaM,gBAAe;AAE1CE,QAAAA,gBAAgBF,cAAcP,SAAS;AAE7C,QAAMU,UAAUC,MAAAA,QACd,MAAMjB,qBAAqBX,YAAYS,6BAAMoB,UAAU,GACvD,CAACpB,MAAME,iBAAiB,CAC1B;AAEA,QAAMmB,UAAUF,MAAAA,QACd,MACEG,2BAAAA,IAAA,OAAA;AAAA,IACEb;AAAAA,IACAV,WAAWO,GACT;AAAA,MACE,CAACT,QAAQ0B,aAAa,GAAG,CAACL;AAAAA,MAC1B,CAACrB,QAAQ2B,sBAAsB,GAAGN;AAAAA,OAEpCnB,SACF;AAAA,IAAEP,UAEDQ;AAAAA,EACE,CAAA,GAEP,CACED,WACAF,QAAQ0B,eACR1B,QAAQ2B,wBACRlB,IACAN,MACAkB,SACAT,GAAG,CAEP;AAEA,wCACGgB,QAAAA,WAAS;AAAA,IACR7B;AAAAA,IACA8B,sBAAsB,CAACT;AAAAA,IACvBhB;AAAAA,IACAE;AAAAA,IACAwB,sCACGC,yBAAY;AAAA,MAAC7B,WAAWF,QAAQgC;AAAAA,MAAaC,SAAQ;AAAA,MAAMtC,UACzDQ;AAAAA,IAAAA,CACW;AAAA,IAGhB,cAAY;AAAA,IACZ,mBAAiB;AAAA,IAAY,GACzBI;AAAAA,IAAaZ,UAEhB6B;AAAAA,EAAAA,CACQ;AAEf;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.cjs","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { CSSProperties, useState } from \"react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport Chip, { ChipProps as MuiChipProps } from \"@mui/material/Chip\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport {\n HvSemanticColorKeys,\n HvCategoricalColorKeys,\n} from \"@core/types/tokens\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { CloseXS } from \"@hitachivantara/uikit-react-icons\";\nimport { staticClasses, useClasses } from \"./Tag.styles\";\nimport { getOnDeleteCallback, hasDeleteAction, hasClickAction } from \"./utils\";\n\nexport { staticClasses as tagClasses };\n\nexport type HvTagClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagProps\n extends Omit<MuiChipProps, \"color\" | \"classes\">,\n HvBaseProps<HTMLDivElement, \"children\"> {\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** The label of the tag element. */\n label?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** The type of the tag element. A tag can be of semantic or categoric type. */\n type?: \"semantic\" | \"categorical\";\n /** Background color to be applied to the tag */\n color?: HvSemanticColorKeys | HvCategoricalColorKeys | string;\n /** Icon used to customize the delete icon in the Chip element */\n deleteIcon?: React.ReactElement;\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component, in order to render the delete icon\n * */\n onDelete?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Callback triggered when any item is clicked. */\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** The role of the element with an attributed event. */\n role?: string;\n /** Aria properties to apply to delete button in tag */\n deleteButtonArialLabel?: string;\n /** Props to apply to delete button */\n deleteButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagClasses;\n}\n\nconst getColor = (customColor, type, colors) => {\n const defaultSemanticColor = theme.colors.neutral_20;\n const defaultCategoricalColor = colors.cat1;\n\n let backgroundColor;\n\n if (type === \"semantic\") {\n backgroundColor =\n theme.colors[customColor] || customColor || defaultSemanticColor;\n }\n if (type === \"categorical\") {\n backgroundColor =\n colors[customColor] || customColor || defaultCategoricalColor;\n }\n return backgroundColor;\n};\n\n/**\n * A Tag is one word that describes a specific aspect of an asset. A single asset can have\n * multiple tags.\n * Use tags to highlight an item's status for quick recognition and navigation\n * Use color to indicate meanings that users can learn and recognize across products\n *\n * It leverages the Chip component from Material UI\n */\nexport const HvTag = (props: HvTagProps) => {\n const {\n classes: classesProp,\n className,\n style,\n label,\n disabled,\n type = \"semantic\",\n color,\n deleteIcon,\n onDelete,\n onClick,\n role,\n deleteButtonArialLabel = \"Delete tag\",\n deleteButtonProps = {},\n ...others\n } = useDefaultProps(\"HvTag\", props);\n const { activeTheme, selectedMode } = useTheme();\n const { classes, cx, css } = useClasses(classesProp);\n\n const getDeleteIcon = () => {\n const disabledSemanticColor =\n type === \"semantic\" ? \"secondary_60\" : \"base_dark\";\n const { tabIndex = 0 } = deleteButtonProps;\n\n const closeIconStyles = css({\n ...(disabled ? { cursor: \"not-allowed\" } : undefined),\n height: 16,\n \"& svg .color0\": {\n fill: theme.colors[disabled ? disabledSemanticColor : \"base_dark\"],\n },\n });\n return (\n <HvButton\n classes={{\n startIcon: classes.tagButton,\n focusVisible: classes.focusVisible,\n root: classes.button,\n }}\n aria-label={deleteButtonArialLabel}\n tabIndex={tabIndex}\n variant=\"secondaryGhost\"\n {...deleteButtonProps}\n >\n <CloseXS\n iconSize=\"XS\"\n className={closeIconStyles}\n color={disabled ? disabledSemanticColor : \"base_dark\"}\n />\n </HvButton>\n );\n };\n\n const inlineStyle = {\n ...style,\n };\n\n let categoricalBackgroundColor;\n\n if (type === \"semantic\") {\n inlineStyle.backgroundColor = getColor(color, type, {});\n } else if (type === \"categorical\") {\n categoricalBackgroundColor = getColor(\n color,\n type,\n activeTheme?.colors?.modes[selectedMode]\n );\n\n inlineStyle.backgroundColor = `${categoricalBackgroundColor}30`;\n }\n\n const [hover, setHover] = useState(false);\n\n return (\n <Chip\n label={label}\n className={cx(classes.root, className)}\n onMouseEnter={() => {\n setHover(!!onClick);\n }}\n onMouseLeave={() => {\n setHover(false);\n }}\n style={{\n ...(disabled ? null : inlineStyle),\n ...(hover && !disabled\n ? { boxShadow: `0 0 0 1pt ${categoricalBackgroundColor}` }\n : null),\n }}\n classes={{\n root: cx(classes.chipRoot, {\n [classes.disabled]: disabled,\n [classes.clickable]: !!onClick,\n [classes.categorical]: type === \"categorical\",\n [classes.categoricalFocus]: type === \"categorical\" && !disabled,\n [classes.categoricalDisabled]: type === \"categorical\" && disabled,\n }),\n label: classes.label,\n deleteIcon: cx(classes.deleteIcon, {\n [classes.disabledDeleteIcon]: disabled,\n }),\n }}\n deleteIcon={(hasDeleteAction(onDelete) && deleteIcon) || getDeleteIcon()}\n onDelete={getOnDeleteCallback(disabled, onDelete)}\n onClick={disabled ? undefined : onClick}\n role={role || (hasClickAction(onClick) ? \"button\" : undefined)}\n tabIndex={hasDeleteAction(onDelete) ? undefined : 0}\n {...others}\n />\n );\n};\n"],"names":["getColor","customColor","type","colors","defaultSemanticColor","theme","neutral_20","defaultCategoricalColor","cat1","backgroundColor","HvTag","props","classes","classesProp","className","style","label","disabled","color","deleteIcon","onDelete","onClick","role","deleteButtonArialLabel","deleteButtonProps","others","useDefaultProps","activeTheme","selectedMode","useTheme","cx","css","useClasses","getDeleteIcon","disabledSemanticColor","tabIndex","closeIconStyles","cursor","undefined","height","fill","HvButton","startIcon","tagButton","focusVisible","root","button","variant","children","CloseXS","iconSize","inlineStyle","categoricalBackgroundColor","modes","hover","setHover","useState","Chip","onMouseEnter","onMouseLeave","boxShadow","chipRoot","clickable","categorical","categoricalFocus","categoricalDisabled","disabledDeleteIcon","hasDeleteAction","getOnDeleteCallback","hasClickAction"],"mappings":";;;;;;;;;;;;;;AAqDA,MAAMA,WAAWA,CAACC,aAAaC,MAAMC,WAAW;AACxCC,QAAAA,uBAAuBC,YAAAA,MAAMF,OAAOG;AAC1C,QAAMC,0BAA0BJ,OAAOK;AAEnCC,MAA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,QACvD,CAACL,QAAQqD,mBAAmB,GAAG/D,SAAS,iBAAiBe;AAAAA,MAAAA,CAC1D;AAAA,MACDD,OAAOJ,QAAQI;AAAAA,MACfG,YAAYW,GAAGlB,QAAQO,YAAY;AAAA,QACjC,CAACP,QAAQsD,kBAAkB,GAAGjD;AAAAA,MAAAA,CAC/B;AAAA,IACH;AAAA,IACAE,YAAagD,MAAAA,gBAAgB/C,QAAQ,KAAKD,cAAec,cAAc;AAAA,IACvEb,UAAUgD,MAAAA,oBAAoBnD,UAAUG,QAAQ;AAAA,IAChDC,SAASJ,WAAWqB,SAAYjB;AAAAA,IAChCC,MAAMA,SAAS+C,MAAehD,eAAAA,OAAO,IAAI,WAAWiB;AAAAA,IACpDH,UAAUgC,MAAAA,gBAAgB/C,QAAQ,IAAIkB,SAAY;AAAA,IAAE,GAChDb;AAAAA,EAAAA,CACL;AAEL;;;"}
|
|
1
|
+
{"version":3,"file":"Tag.cjs","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { CSSProperties, useState } from \"react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport Chip, { ChipProps as MuiChipProps } from \"@mui/material/Chip\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport {\n HvSemanticColorKeys,\n HvCategoricalColorKeys,\n} from \"@core/types/tokens\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { CloseXS } from \"@hitachivantara/uikit-react-icons\";\nimport { staticClasses, useClasses } from \"./Tag.styles\";\nimport { getOnDeleteCallback, hasDeleteAction, hasClickAction } from \"./utils\";\n\nexport { staticClasses as tagClasses };\n\nexport type HvTagClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagProps\n extends Omit<MuiChipProps, \"color\" | \"classes\">,\n HvBaseProps<HTMLDivElement, \"children\"> {\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** The label of the tag element. */\n label?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** The type of the tag element. A tag can be of semantic or categoric type. */\n type?: \"semantic\" | \"categorical\";\n /** Background color to be applied to the tag */\n color?: HvSemanticColorKeys | HvCategoricalColorKeys | string;\n /** Icon used to customize the delete icon in the Chip element */\n deleteIcon?: React.ReactElement;\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component, in order to render the delete icon\n * */\n onDelete?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Callback triggered when any item is clicked. */\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** The role of the element with an attributed event. */\n role?: string;\n /** Aria properties to apply to delete button in tag */\n deleteButtonArialLabel?: string; // TODO: fix typo \"ArialLabel\" in next version\n /** Props to apply to delete button */\n deleteButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagClasses;\n}\n\nconst getColor = (customColor, type, colors) => {\n const defaultSemanticColor = theme.colors.neutral_20;\n const defaultCategoricalColor = colors.cat1;\n\n let backgroundColor;\n\n if (type === \"semantic\") {\n backgroundColor =\n theme.colors[customColor] || customColor || defaultSemanticColor;\n }\n if (type === \"categorical\") {\n backgroundColor =\n colors[customColor] || customColor || defaultCategoricalColor;\n }\n return backgroundColor;\n};\n\n/**\n * A Tag is one word that describes a specific aspect of an asset. A single asset can have\n * multiple tags.\n * Use tags to highlight an item's status for quick recognition and navigation\n * Use color to indicate meanings that users can learn and recognize across products\n *\n * It leverages the Chip component from Material UI\n */\nexport const HvTag = (props: HvTagProps) => {\n const {\n classes: classesProp,\n className,\n style,\n label,\n disabled,\n type = \"semantic\",\n color,\n deleteIcon,\n onDelete,\n onClick,\n role,\n deleteButtonArialLabel = \"Delete tag\",\n deleteButtonProps = {},\n ...others\n } = useDefaultProps(\"HvTag\", props);\n const { activeTheme, selectedMode } = useTheme();\n const { classes, cx, css } = useClasses(classesProp);\n\n const getDeleteIcon = () => {\n const disabledSemanticColor =\n type === \"semantic\" ? \"secondary_60\" : \"base_dark\";\n const { tabIndex = 0 } = deleteButtonProps;\n\n const closeIconStyles = css({\n ...(disabled ? { cursor: \"not-allowed\" } : undefined),\n height: 16,\n \"& svg .color0\": {\n fill: theme.colors[disabled ? disabledSemanticColor : \"base_dark\"],\n },\n });\n return (\n <HvButton\n classes={{\n startIcon: classes.tagButton,\n focusVisible: classes.focusVisible,\n root: classes.button,\n }}\n aria-label={deleteButtonArialLabel}\n tabIndex={tabIndex}\n variant=\"secondaryGhost\"\n {...deleteButtonProps}\n >\n <CloseXS\n iconSize=\"XS\"\n className={closeIconStyles}\n color={disabled ? disabledSemanticColor : \"base_dark\"}\n />\n </HvButton>\n );\n };\n\n const inlineStyle = {\n ...style,\n };\n\n let categoricalBackgroundColor;\n\n if (type === \"semantic\") {\n inlineStyle.backgroundColor = getColor(color, type, {});\n } else if (type === \"categorical\") {\n categoricalBackgroundColor = getColor(\n color,\n type,\n activeTheme?.colors?.modes[selectedMode]\n );\n\n inlineStyle.backgroundColor = `${categoricalBackgroundColor}30`;\n }\n\n const [hover, setHover] = useState(false);\n\n return (\n <Chip\n label={label}\n className={cx(classes.root, className)}\n onMouseEnter={() => {\n setHover(!!onClick);\n }}\n onMouseLeave={() => {\n setHover(false);\n }}\n style={{\n ...(disabled ? null : inlineStyle),\n ...(hover && !disabled\n ? { boxShadow: `0 0 0 1pt ${categoricalBackgroundColor}` }\n : null),\n }}\n classes={{\n root: cx(classes.chipRoot, {\n [classes.disabled]: disabled,\n [classes.clickable]: !!onClick,\n [classes.categorical]: type === \"categorical\",\n [classes.categoricalFocus]: type === \"categorical\" && !disabled,\n [classes.categoricalDisabled]: type === \"categorical\" && disabled,\n }),\n label: classes.label,\n deleteIcon: cx(classes.deleteIcon, {\n [classes.disabledDeleteIcon]: disabled,\n }),\n }}\n deleteIcon={(hasDeleteAction(onDelete) && deleteIcon) || getDeleteIcon()}\n onDelete={getOnDeleteCallback(disabled, onDelete)}\n onClick={disabled ? undefined : onClick}\n role={role || (hasClickAction(onClick) ? \"button\" : undefined)}\n tabIndex={hasDeleteAction(onDelete) ? undefined : 0}\n {...others}\n />\n );\n};\n"],"names":["getColor","customColor","type","colors","defaultSemanticColor","theme","neutral_20","defaultCategoricalColor","cat1","backgroundColor","HvTag","props","classes","classesProp","className","style","label","disabled","color","deleteIcon","onDelete","onClick","role","deleteButtonArialLabel","deleteButtonProps","others","useDefaultProps","activeTheme","selectedMode","useTheme","cx","css","useClasses","getDeleteIcon","disabledSemanticColor","tabIndex","closeIconStyles","cursor","undefined","height","fill","HvButton","startIcon","tagButton","focusVisible","root","button","variant","children","CloseXS","iconSize","inlineStyle","categoricalBackgroundColor","modes","hover","setHover","useState","Chip","onMouseEnter","onMouseLeave","boxShadow","chipRoot","clickable","categorical","categoricalFocus","categoricalDisabled","disabledDeleteIcon","hasDeleteAction","getOnDeleteCallback","hasClickAction"],"mappings":";;;;;;;;;;;;;;AAqDA,MAAMA,WAAWA,CAACC,aAAaC,MAAMC,WAAW;AACxCC,QAAAA,uBAAuBC,YAAAA,MAAMF,OAAOG;AAC1C,QAAMC,0BAA0BJ,OAAOK;AAEnCC,MAAAA;AAEJ,MAAIP,SAAS,YAAY;AACvBO,sBACEJ,YAAMF,MAAAA,OAAOF,WAAW,KAAKA,eAAeG;AAAAA,EAChD;AACA,MAAIF,SAAS,eAAe;AAExBC,sBAAAA,OAAOF,WAAW,KAAKA,eAAeM;AAAAA,EAC1C;AACOE,SAAAA;AACT;AAUaC,MAAAA,QAAQA,CAACC,UAAsB;;AACpC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAf,OAAO;AAAA,IACPgB;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,yBAAyB;AAAA,IACzBC,oBAAoB,CAAC;AAAA,IACrB,GAAGC;AAAA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/C,QAAQ,IAAIkB,SAAY;AAAA,IAAE,GAChDb;AAAAA,EAAAA,CACL;AAEL;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.styles.cjs","sources":["../../../../src/components/Tooltip/Tooltip.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { tooltipClasses as MuitooltipClasses } from \"@mui/material\";\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTooltip\", {\n root: {},\n tooltip: {},\n tooltipMulti: {},\n popper: {},\n title: {},\n valuesContainer: {},\n values: {},\n color: {},\n separatorColor: {},\n separator: {},\n valueWrapper: {},\n});\n\nexport const popperSx = (useSingle: boolean) => {\n return {\n [`& .${MuitooltipClasses.popper}`]: {\n opacity: 1,\n },\n [`& .${MuitooltipClasses.tooltip}`]: {\n ...theme.typography.body,\n display: \"flex\",\n width: \"fit-content\",\n maxWidth: 532,\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n padding: 0,\n ...(useSingle && {\n padding: \"15px 20px\",\n borderRadius: theme.tooltip.borderRadius,\n }),\n\n \"& p\": {\n display: \"-webkit-box\",\n width: \"fit-content\",\n boxOrient: \"vertical\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n ...(useSingle && { wordBreak: \"break-word\" }),\n },\n },\n [`& .${staticClasses.title}`]: {\n padding: \"15px 20px\",\n borderBottom: `3px solid ${theme.colors.atmo2}`,\n },\n [`& .${staticClasses.valuesContainer}`]: {\n padding: theme.space.sm,\n },\n [`& .${staticClasses.values}`]: {\n display: \"flex\",\n justifyContent: \"space-between\",\n paddingBottom: \"10px\",\n \"&:last-child\": {\n paddingBottom: 0,\n },\n },\n [`& .${staticClasses.color}`]: {\n width: theme.space.xs,\n },\n [`& .${staticClasses.separator}`]: {\n width: theme.space.xs,\n },\n [`& .${staticClasses.separatorColor}`]: {\n width: \"5px\",\n },\n [`& .${staticClasses.valueWrapper}`]: {\n padding: theme.space.sm,\n },\n };\n};\n"],"names":["staticClasses","useClasses","createClasses","root","tooltip","tooltipMulti","popper","title","valuesContainer","values","color","separatorColor","separator","valueWrapper","popperSx","useSingle","MuitooltipClasses","opacity","
|
|
1
|
+
{"version":3,"file":"Tooltip.styles.cjs","sources":["../../../../src/components/Tooltip/Tooltip.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { tooltipClasses as MuitooltipClasses } from \"@mui/material\";\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTooltip\", {\n root: {},\n tooltip: {},\n tooltipMulti: {},\n popper: {},\n title: {},\n valuesContainer: {},\n values: {},\n color: {},\n separatorColor: {},\n separator: {},\n valueWrapper: {},\n});\n\nexport const popperSx = (useSingle: boolean) => {\n return {\n [`& .${MuitooltipClasses.popper}`]: {\n opacity: 1,\n },\n [`& .${MuitooltipClasses.tooltip}`]: {\n fontFamily: theme.fontFamily.body,\n ...theme.typography.body,\n display: \"flex\",\n width: \"fit-content\",\n maxWidth: 532,\n backgroundColor: theme.colors.atmo1,\n boxShadow: theme.colors.shadow,\n padding: 0,\n ...(useSingle && {\n padding: \"15px 20px\",\n borderRadius: theme.tooltip.borderRadius,\n }),\n\n \"& p\": {\n display: \"-webkit-box\",\n width: \"fit-content\",\n boxOrient: \"vertical\",\n textOverflow: \"ellipsis\",\n overflow: \"hidden\",\n ...(useSingle && { wordBreak: \"break-word\" }),\n },\n },\n [`& .${staticClasses.title}`]: {\n padding: \"15px 20px\",\n borderBottom: `3px solid ${theme.colors.atmo2}`,\n },\n [`& .${staticClasses.valuesContainer}`]: {\n padding: theme.space.sm,\n },\n [`& .${staticClasses.values}`]: {\n display: \"flex\",\n justifyContent: \"space-between\",\n paddingBottom: \"10px\",\n \"&:last-child\": {\n paddingBottom: 0,\n },\n },\n [`& .${staticClasses.color}`]: {\n width: theme.space.xs,\n },\n [`& .${staticClasses.separator}`]: {\n width: theme.space.xs,\n },\n [`& .${staticClasses.separatorColor}`]: {\n width: \"5px\",\n },\n [`& .${staticClasses.valueWrapper}`]: {\n padding: theme.space.sm,\n },\n };\n};\n"],"names":["staticClasses","useClasses","createClasses","root","tooltip","tooltipMulti","popper","title","valuesContainer","values","color","separatorColor","separator","valueWrapper","popperSx","useSingle","MuitooltipClasses","opacity","fontFamily","theme","body","typography","display","width","maxWidth","backgroundColor","colors","atmo1","boxShadow","shadow","padding","borderRadius","boxOrient","textOverflow","overflow","wordBreak","borderBottom","atmo2","space","sm","justifyContent","paddingBottom","xs"],"mappings":";;;;;AAIa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,aAAa;AAAA,EACtEC,MAAM,CAAC;AAAA,EACPC,SAAS,CAAC;AAAA,EACVC,cAAc,CAAC;AAAA,EACfC,QAAQ,CAAC;AAAA,EACTC,OAAO,CAAC;AAAA,EACRC,iBAAiB,CAAC;AAAA,EAClBC,QAAQ,CAAC;AAAA,EACTC,OAAO,CAAC;AAAA,EACRC,gBAAgB,CAAC;AAAA,EACjBC,WAAW,CAAC;AAAA,EACZC,cAAc,CAAC;AACjB,CAAC;AAEYC,MAAAA,WAAWA,CAACC,cAAuB;AACvC,SAAA;AAAA,IACL,CAAE,MAAKC,wBAAkBV,QAAQ,GAAG;AAAA,MAClCW,SAAS;AAAA,IACX;AAAA,IACA,CAAE,MAAKD,wBAAkBZ,SAAS,GAAG;AAAA,MACnCc,YAAYC,YAAAA,MAAMD,WAAWE;AAAAA,MAC7B,GAAGD,YAAAA,MAAME,WAAWD;AAAAA,MACpBE,SAAS;AAAA,MACTC,OAAO;AAAA,MACPC,UAAU;AAAA,MACVC,iBAAiBN,YAAAA,MAAMO,OAAOC;AAAAA,MAC9BC,WAAWT,YAAAA,MAAMO,OAAOG;AAAAA,MACxBC,SAAS;AAAA,MACT,GAAIf,aAAa;AAAA,QACfe,SAAS;AAAA,QACTC,cAAcZ,YAAAA,MAAMf,QAAQ2B;AAAAA,MAC9B;AAAA,MAEA,OAAO;AAAA,QACLT,SAAS;AAAA,QACTC,OAAO;AAAA,QACPS,WAAW;AAAA,QACXC,cAAc;AAAA,QACdC,UAAU;AAAA,QACV,GAAInB,aAAa;AAAA,UAAEoB,WAAW;AAAA,QAAa;AAAA,MAC7C;AAAA,IACF;AAAA,IACA,CAAE,MAAKnC,cAAcO,OAAO,GAAG;AAAA,MAC7BuB,SAAS;AAAA,MACTM,cAAe,aAAYjB,YAAAA,MAAMO,OAAOW;AAAAA,IAC1C;AAAA,IACA,CAAE,MAAKrC,cAAcQ,iBAAiB,GAAG;AAAA,MACvCsB,SAASX,YAAAA,MAAMmB,MAAMC;AAAAA,IACvB;AAAA,IACA,CAAE,MAAKvC,cAAcS,QAAQ,GAAG;AAAA,MAC9Ba,SAAS;AAAA,MACTkB,gBAAgB;AAAA,MAChBC,eAAe;AAAA,MACf,gBAAgB;AAAA,QACdA,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,IACA,CAAE,MAAKzC,cAAcU,OAAO,GAAG;AAAA,MAC7Ba,OAAOJ,YAAAA,MAAMmB,MAAMI;AAAAA,IACrB;AAAA,IACA,CAAE,MAAK1C,cAAcY,WAAW,GAAG;AAAA,MACjCW,OAAOJ,YAAAA,MAAMmB,MAAMI;AAAAA,IACrB;AAAA,IACA,CAAE,MAAK1C,cAAcW,gBAAgB,GAAG;AAAA,MACtCY,OAAO;AAAA,IACT;AAAA,IACA,CAAE,MAAKvB,cAAca,cAAc,GAAG;AAAA,MACpCiB,SAASX,YAAAA,MAAMmB,MAAMC;AAAAA,IACvB;AAAA,EAAA;AAEJ;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
1
2
|
import { useDefaultProps } from "../../hooks/useDefaultProps.js";
|
|
2
3
|
import { User } from "@hitachivantara/uikit-react-icons";
|
|
3
4
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
@@ -8,7 +9,7 @@ import { useClasses } from "./Avatar.styles.js";
|
|
|
8
9
|
import { staticClasses } from "./Avatar.styles.js";
|
|
9
10
|
import { jsx, jsxs } from "@emotion/react/jsx-runtime";
|
|
10
11
|
const getColor = (color, defaultColor) => theme.colors[color] || color || defaultColor;
|
|
11
|
-
const HvAvatar = (props) => {
|
|
12
|
+
const HvAvatar = forwardRef((props, ref) => {
|
|
12
13
|
const {
|
|
13
14
|
className,
|
|
14
15
|
style,
|
|
@@ -74,6 +75,7 @@ const HvAvatar = (props) => {
|
|
|
74
75
|
}
|
|
75
76
|
const badgeColor = getColor(badge || "", theme.colors.positive);
|
|
76
77
|
return /* @__PURE__ */ jsx("div", {
|
|
78
|
+
ref,
|
|
77
79
|
className: classes.container,
|
|
78
80
|
...others,
|
|
79
81
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -95,7 +97,7 @@ const HvAvatar = (props) => {
|
|
|
95
97
|
})]
|
|
96
98
|
})
|
|
97
99
|
});
|
|
98
|
-
};
|
|
100
|
+
});
|
|
99
101
|
export {
|
|
100
102
|
HvAvatar,
|
|
101
103
|
staticClasses as avatarClasses
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { CSSProperties, HTMLAttributes } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { User } from \"@hitachivantara/uikit-react-icons\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport MuiAvatar, { AvatarProps as MuiAvatarProps } from \"@mui/material/Avatar\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useImageLoaded } from \"@core/hooks/useImageLoaded\";\nimport { decreaseSize } from \"@core/utils/sizes\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Avatar.styles\";\n\nexport { staticClasses as avatarClasses };\n\nexport type HvAvatarClasses = ExtractNames<typeof useClasses>;\n\nexport type HvAvatarVariant = \"circular\" | \"square\";\n\nexport type HvAvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface HvAvatarProps extends HvBaseProps {\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** The component used for the root node. Either a string to use a DOM element or a component. */\n component?: React.ElementType;\n /** Sets one of the standard sizes of the icons */\n size?: HvAvatarSize;\n /**\n * A string representing the foreground color of the avatar's\n * letters or the generic User icon fallback.\n * You can use either an HEX or color name from the palette.\n */\n color?: string;\n /** A String representing the background color of the avatar. You can use either an HEX or color name from the palette. */\n backgroundColor?: string;\n /** The `src` attribute for the `img` element. */\n src?: string;\n /** The `srcSet` attribute for the `img` element. Use this attribute for responsive image display. */\n srcSet?: string;\n /** The `sizes` attribute for the `img` element. */\n sizes?: string;\n /** Used in combination with `src` or `srcSet` to provide an alt attribute for the rendered `img` element. */\n alt?: string;\n /**\n * Attributes applied to the `img` element if the component is used to display an image.\n * It can be used to listen for the loading error event.\n */\n imgProps?: HTMLAttributes<HTMLImageElement>;\n /** A string representing the type of avatar to display, circular or square. */\n variant?: HvAvatarVariant;\n /** A string representing the color of the avatar border that represents its status. */\n status?: string;\n /** A string representing the color of the avatar badge. */\n badge?: string;\n /** Attributes applied to the avatar element. */\n avatarProps?: MuiAvatarProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvAvatarClasses;\n}\n\n/**\n * Get a color from the theme palette\n * @param {object} theme The theme object\n * @param {string} color A color to use if none is found on the theme palette\n * @param {string} defaultColor The fallback color to use\n */\nconst getColor = (color: string, defaultColor: string): string =>\n theme.colors[color] || color || defaultColor;\n\n/**\n * Avatars can be used to represent a user or a brand.\n * They can show an image, an icon or the initial letters of a name, for example.\n */\nexport const HvAvatar = (props
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { CSSProperties, HTMLAttributes, forwardRef } from \"react\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\n\nimport { User } from \"@hitachivantara/uikit-react-icons\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport MuiAvatar, { AvatarProps as MuiAvatarProps } from \"@mui/material/Avatar\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useImageLoaded } from \"@core/hooks/useImageLoaded\";\nimport { decreaseSize } from \"@core/utils/sizes\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Avatar.styles\";\n\nexport { staticClasses as avatarClasses };\n\nexport type HvAvatarClasses = ExtractNames<typeof useClasses>;\n\nexport type HvAvatarVariant = \"circular\" | \"square\";\n\nexport type HvAvatarSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface HvAvatarProps extends HvBaseProps {\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** The component used for the root node. Either a string to use a DOM element or a component. */\n component?: React.ElementType;\n /** Sets one of the standard sizes of the icons */\n size?: HvAvatarSize;\n /**\n * A string representing the foreground color of the avatar's\n * letters or the generic User icon fallback.\n * You can use either an HEX or color name from the palette.\n */\n color?: string;\n /** A String representing the background color of the avatar. You can use either an HEX or color name from the palette. */\n backgroundColor?: string;\n /** The `src` attribute for the `img` element. */\n src?: string;\n /** The `srcSet` attribute for the `img` element. Use this attribute for responsive image display. */\n srcSet?: string;\n /** The `sizes` attribute for the `img` element. */\n sizes?: string;\n /** Used in combination with `src` or `srcSet` to provide an alt attribute for the rendered `img` element. */\n alt?: string;\n /**\n * Attributes applied to the `img` element if the component is used to display an image.\n * It can be used to listen for the loading error event.\n */\n imgProps?: HTMLAttributes<HTMLImageElement>;\n /** A string representing the type of avatar to display, circular or square. */\n variant?: HvAvatarVariant;\n /** A string representing the color of the avatar border that represents its status. */\n status?: string;\n /** A string representing the color of the avatar badge. */\n badge?: string;\n /** Attributes applied to the avatar element. */\n avatarProps?: MuiAvatarProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvAvatarClasses;\n}\n\n/**\n * Get a color from the theme palette\n * @param {object} theme The theme object\n * @param {string} color A color to use if none is found on the theme palette\n * @param {string} defaultColor The fallback color to use\n */\nconst getColor = (color: string, defaultColor: string): string =>\n theme.colors[color] || color || defaultColor;\n\n/**\n * Avatars can be used to represent a user or a brand.\n * They can show an image, an icon or the initial letters of a name, for example.\n */\nexport const HvAvatar = forwardRef<any, HvAvatarProps>((props, ref) => {\n const {\n className,\n style,\n classes: classesProp,\n children: childrenProp,\n component = \"div\",\n size = \"sm\",\n backgroundColor = \"secondary\",\n color = \"atmo1\",\n src,\n srcSet,\n sizes,\n alt,\n imgProps,\n status,\n badge,\n variant = \"circular\",\n avatarProps,\n ...others\n } = useDefaultProps(\"HvAvatar\", props);\n const { classes, cx } = useClasses(classesProp);\n\n let children: React.ReactNode;\n\n // Use a hook instead of onError on the img element to support server-side rendering.\n const imageLoaded = useImageLoaded(src, srcSet);\n const hasImg = src || srcSet;\n const hasImgNotFailing = hasImg && imageLoaded !== \"error\";\n\n if (hasImgNotFailing) {\n children = (\n <img\n alt={alt}\n src={src}\n srcSet={srcSet}\n sizes={sizes}\n className={classes.img}\n {...imgProps}\n />\n );\n } else if (childrenProp != null) {\n children = childrenProp;\n } else if (hasImg && alt) {\n [children] = alt;\n } else {\n children = (\n <User\n color={color}\n iconSize={decreaseSize(size)}\n className={classes.fallback}\n />\n );\n }\n\n const inlineStyle: CSSProperties = {\n ...style,\n };\n\n if (component != null && typeof component !== \"string\") {\n // override border-radius with custom components\n inlineStyle.borderRadius = \"50%\";\n }\n\n if (!hasImgNotFailing) {\n inlineStyle.backgroundColor = getColor(\n backgroundColor,\n theme.colors.secondary\n );\n inlineStyle.color = getColor(color, theme.colors.atmo1);\n }\n\n const statusInlineStyle: CSSProperties = {};\n if (status) {\n // set the status border. we're using the boxShadow property to set the border\n // to be inside the container and not on its edge.\n const statusColor = getColor(status, theme.colors.positive);\n statusInlineStyle.boxShadow = `inset 0px 0px 0px 2px ${statusColor}`;\n }\n\n const badgeColor = getColor(badge || \"\", theme.colors.positive);\n\n return (\n <div ref={ref} className={classes.container} {...others}>\n <div\n className={cx(classes.status, classes[variant], classes[size])}\n style={statusInlineStyle}\n >\n {badge && (\n <div\n className={classes.badge}\n style={{ backgroundColor: badgeColor }}\n />\n )}\n <MuiAvatar\n component={component}\n // Consider not using the root and className classes in this component\n className={cx(classes.root, classes.avatar, classes[size], className)}\n style={inlineStyle}\n variant={variant}\n size={size}\n {...avatarProps}\n >\n {children}\n </MuiAvatar>\n </div>\n </div>\n );\n});\n"],"names":["getColor","color","defaultColor","theme","colors","HvAvatar","forwardRef","props","ref","className","style","classes","classesProp","children","childrenProp","component","size","backgroundColor","src","srcSet","sizes","alt","imgProps","status","badge","variant","avatarProps","others","useDefaultProps","cx","useClasses","imageLoaded","useImageLoaded","hasImg","hasImgNotFailing","img","User","iconSize","decreaseSize","fallback","inlineStyle","borderRadius","secondary","atmo1","statusInlineStyle","statusColor","positive","boxShadow","badgeColor","container","_jsx","MuiAvatar","root","avatar"],"mappings":";;;;;;;;;;AAqEA,MAAMA,WAAWA,CAACC,OAAeC,iBAC/BC,MAAMC,OAAOH,KAAK,KAAKA,SAASC;AAM3B,MAAMG,WAAWC,WAA+B,CAACC,OAAOC,QAAQ;AAC/D,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC,UAAUC;AAAAA,IACVC,YAAY;AAAA,IACZC,OAAO;AAAA,IACPC,kBAAkB;AAAA,IAClBhB,QAAQ;AAAA,IACRiB;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,UAAU;AAAA,IACVC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,YAAYrB,KAAK;AAC/B,QAAA;AAAA,IAAEI;AAAAA,IAASkB;AAAAA,EAAAA,IAAOC,WAAWlB,WAAW;AAE1CC,MAAAA;AAGEkB,QAAAA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IAAI,CAAC;AAAA,MAC7DN,OAAOkC;AAAAA,MAAkB/B,UAAA,CAExBW,SACC0B,oBAAA,OAAA;AAAA,QACEzC,WAAWE,QAAQa;AAAAA,QACnBd,OAAO;AAAA,UAAEO,iBAAiB+B;AAAAA,QAAW;AAAA,MAAA,CACtC,GAEHE,oBAACC,WAAS;AAAA,QACRpC;AAAAA,QAEAN,WAAWoB,GAAGlB,QAAQyC,MAAMzC,QAAQ0C,QAAQ1C,QAAQK,IAAI,GAAGP,SAAS;AAAA,QACpEC,OAAO8B;AAAAA,QACPf;AAAAA,QACAT;AAAAA,QAAW,GACPU;AAAAA,QAAWb;AAAAA,MAAAA,CAGN,CAAC;AAAA,IAAA,CACT;AAAA,EAAA,CACF;AAET,CAAC;"}
|
|
@@ -173,8 +173,7 @@ const HvBaseDropdown = (props) => {
|
|
|
173
173
|
const headerComponent = (() => {
|
|
174
174
|
if (component) {
|
|
175
175
|
return React__default.cloneElement(component, {
|
|
176
|
-
ref: handleDropdownHeaderRef
|
|
177
|
-
"aria-controls": isOpen ? setId(elementId, "children-container") : void 0
|
|
176
|
+
ref: handleDropdownHeaderRef
|
|
178
177
|
});
|
|
179
178
|
}
|
|
180
179
|
const ExpanderComponent = isOpen ? DropUpXS : DropDownXS;
|
|
@@ -191,7 +190,6 @@ const HvBaseDropdown = (props) => {
|
|
|
191
190
|
style: disabled || readOnly ? {
|
|
192
191
|
pointerEvents: "none"
|
|
193
192
|
} : void 0,
|
|
194
|
-
"aria-controls": isOpen ? setId(elementId, "children-container") : void 0,
|
|
195
193
|
"aria-label": others["aria-label"] ?? void 0,
|
|
196
194
|
"aria-labelledby": others["aria-labelledby"] ?? void 0,
|
|
197
195
|
"aria-required": required ?? void 0,
|
|
@@ -290,6 +288,7 @@ const HvBaseDropdown = (props) => {
|
|
|
290
288
|
role: ariaRole,
|
|
291
289
|
"aria-expanded": ariaExpanded,
|
|
292
290
|
"aria-owns": isOpen ? setId(elementId, "children-container") : void 0,
|
|
291
|
+
"aria-controls": isOpen ? setId(elementId, "children-container") : void 0,
|
|
293
292
|
"aria-required": required ?? void 0,
|
|
294
293
|
"aria-readonly": readOnly ?? void 0,
|
|
295
294
|
className: cx(classes.anchor, {
|