@hitachivantara/uikit-react-core 5.3.0 → 5.4.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/components/Dialog/Dialog.cjs +1 -1
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.styles.cjs +3 -3
- package/dist/cjs/components/Dialog/Dialog.styles.cjs.map +1 -1
- package/dist/cjs/components/InlineEditor/InlineEditor.cjs +122 -0
- package/dist/cjs/components/InlineEditor/InlineEditor.cjs.map +1 -0
- package/dist/cjs/components/InlineEditor/InlineEditor.styles.cjs +74 -0
- package/dist/cjs/components/InlineEditor/InlineEditor.styles.cjs.map +1 -0
- package/dist/cjs/components/InlineEditor/inlineEditorClasses.cjs +8 -0
- package/dist/cjs/components/InlineEditor/inlineEditorClasses.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.cjs +51 -0
- package/dist/cjs/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.cjs +54 -0
- package/dist/cjs/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Horizontal/HorizontalScrollListItem/horizontalScrollListItemClasses.cjs +8 -0
- package/dist/cjs/components/ScrollTo/Horizontal/HorizontalScrollListItem/horizontalScrollListItemClasses.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs +126 -0
- package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.styles.cjs +46 -0
- package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.styles.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Horizontal/scrollToHorizontalClasses.cjs +8 -0
- package/dist/cjs/components/ScrollTo/Horizontal/scrollToHorizontalClasses.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs +90 -0
- package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.styles.cjs +43 -0
- package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.styles.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.cjs +71 -0
- package/dist/cjs/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.cjs +54 -0
- package/dist/cjs/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Vertical/VerticalScrollListItem/verticalScrollListItemClasses.cjs +8 -0
- package/dist/cjs/components/ScrollTo/Vertical/VerticalScrollListItem/verticalScrollListItemClasses.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/Vertical/scrollToVerticalClasses.cjs +8 -0
- package/dist/cjs/components/ScrollTo/Vertical/scrollToVerticalClasses.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/useScrollTo.cjs +103 -0
- package/dist/cjs/components/ScrollTo/useScrollTo.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/utils.cjs +76 -0
- package/dist/cjs/components/ScrollTo/utils.cjs.map +1 -0
- package/dist/cjs/components/ScrollTo/withTooltip.cjs +20 -0
- package/dist/cjs/components/ScrollTo/withTooltip.cjs.map +1 -0
- package/dist/cjs/hocs/withTooltip.cjs +4 -4
- package/dist/cjs/hocs/withTooltip.cjs.map +1 -1
- package/dist/cjs/index.cjs +19 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/utils/theme.cjs +9 -0
- package/dist/cjs/utils/theme.cjs.map +1 -1
- package/dist/cjs/utils/wrapperTooltip.cjs +1 -1
- package/dist/cjs/utils/wrapperTooltip.cjs.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +2 -2
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.styles.js +3 -3
- package/dist/esm/components/Dialog/Dialog.styles.js.map +1 -1
- package/dist/esm/components/InlineEditor/InlineEditor.js +122 -0
- package/dist/esm/components/InlineEditor/InlineEditor.js.map +1 -0
- package/dist/esm/components/InlineEditor/InlineEditor.styles.js +74 -0
- package/dist/esm/components/InlineEditor/InlineEditor.styles.js.map +1 -0
- package/dist/esm/components/InlineEditor/inlineEditorClasses.js +8 -0
- package/dist/esm/components/InlineEditor/inlineEditorClasses.js.map +1 -0
- package/dist/esm/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.js +51 -0
- package/dist/esm/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.js.map +1 -0
- package/dist/esm/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js +54 -0
- package/dist/esm/components/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js.map +1 -0
- package/dist/esm/components/ScrollTo/Horizontal/HorizontalScrollListItem/horizontalScrollListItemClasses.js +8 -0
- package/dist/esm/components/ScrollTo/Horizontal/HorizontalScrollListItem/horizontalScrollListItemClasses.js.map +1 -0
- package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js +126 -0
- package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -0
- package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.styles.js +46 -0
- package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.styles.js.map +1 -0
- package/dist/esm/components/ScrollTo/Horizontal/scrollToHorizontalClasses.js +8 -0
- package/dist/esm/components/ScrollTo/Horizontal/scrollToHorizontalClasses.js.map +1 -0
- package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js +90 -0
- package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js.map +1 -0
- package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.styles.js +43 -0
- package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.styles.js.map +1 -0
- package/dist/esm/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.js +71 -0
- package/dist/esm/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.js.map +1 -0
- package/dist/esm/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.js +54 -0
- package/dist/esm/components/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.js.map +1 -0
- package/dist/esm/components/ScrollTo/Vertical/VerticalScrollListItem/verticalScrollListItemClasses.js +8 -0
- package/dist/esm/components/ScrollTo/Vertical/VerticalScrollListItem/verticalScrollListItemClasses.js.map +1 -0
- package/dist/esm/components/ScrollTo/Vertical/scrollToVerticalClasses.js +8 -0
- package/dist/esm/components/ScrollTo/Vertical/scrollToVerticalClasses.js.map +1 -0
- package/dist/esm/components/ScrollTo/useScrollTo.js +103 -0
- package/dist/esm/components/ScrollTo/useScrollTo.js.map +1 -0
- package/dist/esm/components/ScrollTo/utils.js +76 -0
- package/dist/esm/components/ScrollTo/utils.js.map +1 -0
- package/dist/esm/components/ScrollTo/withTooltip.js +20 -0
- package/dist/esm/components/ScrollTo/withTooltip.js.map +1 -0
- package/dist/esm/hocs/withTooltip.js +4 -4
- package/dist/esm/hocs/withTooltip.js.map +1 -1
- package/dist/esm/index.js +38 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/theme.js +9 -0
- package/dist/esm/utils/theme.js.map +1 -1
- package/dist/esm/utils/wrapperTooltip.js +2 -2
- package/dist/esm/utils/wrapperTooltip.js.map +1 -1
- package/dist/types/index.d.ts +193 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTooltip.js","sources":["../../../src/hocs/withTooltip.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"withTooltip.js","sources":["../../../src/hocs/withTooltip.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport {\n HvTypography,\n HvTooltip,\n HvTooltipPlacementType,\n HvTooltipProps,\n} from \"@core/components\";\nimport { HvBaseProps } from \"@core/types\";\n\nconst styles: { truncate: React.CSSProperties } = {\n truncate: {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n },\n};\n\nconst withTooltip =\n (\n Component: React.FunctionComponent,\n // eslint-disable-next-line @typescript-eslint/default-param-last\n label = \"\",\n placement: HvTooltipPlacementType,\n hideTooltip?: (event: React.MouseEvent<HTMLDivElement>) => boolean,\n tooltipProps?: HvTooltipProps,\n tooltipContainerProps?: HvBaseProps\n ) =>\n (props) => {\n const [isHoverDisabled, setIsHoverDisabled] = useState<boolean | undefined>(\n false\n );\n const [open, setOpen] = useState<boolean>(false);\n\n const title = <HvTypography>{label}</HvTypography>;\n\n const handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n const isHidden = hideTooltip?.(event);\n setIsHoverDisabled(isHidden);\n setOpen(!isHidden);\n };\n\n const handleMouseLeave = () => {\n setIsHoverDisabled(false);\n setOpen(false);\n };\n\n return (\n <HvTooltip\n style={{ ...styles.truncate }}\n disableHoverListener={isHoverDisabled}\n disableFocusListener\n disableTouchListener\n title={title}\n open={open}\n placement={placement}\n {...tooltipProps}\n >\n <div\n {...tooltipContainerProps}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n <Component {...props} />\n </div>\n </HvTooltip>\n );\n };\n\nexport default withTooltip;\n"],"names":["styles","truncate","overflow","textOverflow","whiteSpace","withTooltip","Component","label","placement","hideTooltip","tooltipProps","tooltipContainerProps","props","isHoverDisabled","setIsHoverDisabled","useState","open","setOpen","title","HvTypography","children","handleMouseEnter","event","isHidden","handleMouseLeave","HvTooltip","style","disableHoverListener","disableFocusListener","disableTouchListener","onMouseEnter","onMouseLeave"],"mappings":";;;;AASA,MAAMA,SAA4C;AAAA,EAChDC,UAAU;AAAA,IACRC,UAAU;AAAA,IACVC,cAAc;AAAA,IACdC,YAAY;AAAA,EACd;AACF;AAEA,MAAMC,cACJA,CACEC,WAEAC,QAAQ,IACRC,WACAC,aACAC,cACAC,0BAEDC,CAAU,UAAA;AACT,QAAM,CAACC,iBAAiBC,kBAAkB,IAAIC,SAC5C,KAAK;AAEP,QAAM,CAACC,MAAMC,OAAO,IAAIF,SAAkB,KAAK;AAEzCG,QAAAA,4BAASC,cAAY;AAAA,IAAAC,UAAEb;AAAAA,EAAAA,CAAqB;AAE5Cc,QAAAA,mBAAmBA,CAACC,UAA4C;AAC9DC,UAAAA,WAAWd,2CAAca;AAC/BR,uBAAmBS,QAAQ;AAC3BN,YAAQ,CAACM,QAAQ;AAAA,EAAA;AAGnB,QAAMC,mBAAmBA,MAAM;AAC7BV,uBAAmB,KAAK;AACxBG,YAAQ,KAAK;AAAA,EAAA;AAGf,6BACGQ,WAAS;AAAA,IACRC,OAAO;AAAA,MAAE,GAAG1B,OAAOC;AAAAA,IAAS;AAAA,IAC5B0B,sBAAsBd;AAAAA,IACtBe,sBAAoB;AAAA,IACpBC,sBAAoB;AAAA,IACpBX;AAAAA,IACAF;AAAAA,IACAR;AAAAA,IAAqB,GACjBE;AAAAA,IAAYU,8BAEhB,OAAA;AAAA,MAAA,GACMT;AAAAA,MACJmB,cAAcT;AAAAA,MACdU,cAAcP;AAAAA,MAAiBJ,8BAE9Bd,WAAS;AAAA,QAAA,GAAKM;AAAAA,MAAAA,CAAK;AAAA,IAAA,CAAI;AAAA,EAAA,CAEhB;AAEhB;AAEF,MAAA,kBAAeP;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -231,8 +231,17 @@ import { HvSlider } from "./components/Slider/Slider.js";
|
|
|
231
231
|
import { default as default120 } from "./components/FilterGroup/filterGroupClasses.js";
|
|
232
232
|
import { HvFilterGroup } from "./components/FilterGroup/FilterGroup.js";
|
|
233
233
|
import { HvDatePicker } from "./components/DatePicker/DatePicker.js";
|
|
234
|
-
import { default as default121 } from "./
|
|
235
|
-
import { default as default122 } from "./
|
|
234
|
+
import { default as default121 } from "./components/ScrollTo/Vertical/scrollToVerticalClasses.js";
|
|
235
|
+
import { default as default122 } from "./components/ScrollTo/Vertical/VerticalScrollListItem/verticalScrollListItemClasses.js";
|
|
236
|
+
import { HvScrollToVertical } from "./components/ScrollTo/Vertical/ScrollToVertical.js";
|
|
237
|
+
import { default as default123 } from "./components/ScrollTo/Horizontal/scrollToHorizontalClasses.js";
|
|
238
|
+
import { default as default124 } from "./components/ScrollTo/Horizontal/HorizontalScrollListItem/horizontalScrollListItemClasses.js";
|
|
239
|
+
import { HvScrollToHorizontal } from "./components/ScrollTo/Horizontal/ScrollToHorizontal.js";
|
|
240
|
+
import { useScrollTo } from "./components/ScrollTo/useScrollTo.js";
|
|
241
|
+
import { default as default125 } from "./components/InlineEditor/inlineEditorClasses.js";
|
|
242
|
+
import { HvInlineEditor } from "./components/InlineEditor/InlineEditor.js";
|
|
243
|
+
import { default as default126 } from "./hooks/useUniqueId.js";
|
|
244
|
+
import { default as default127 } from "./hooks/useIsMounted.js";
|
|
236
245
|
import { useClickOutside } from "./hooks/useClickOutside.js";
|
|
237
246
|
import { useControlled } from "./hooks/useControlled.js";
|
|
238
247
|
import { useImageLoaded } from "./hooks/useImageLoaded.js";
|
|
@@ -244,23 +253,23 @@ import { useEnhancedEffect } from "./hooks/useEnhancedEffect.js";
|
|
|
244
253
|
import { HvProvider } from "./providers/Provider.js";
|
|
245
254
|
import { HvThemeContext } from "@hitachivantara/uikit-react-shared";
|
|
246
255
|
import { HvThemeProvider } from "./providers/ThemeProvider.js";
|
|
247
|
-
import { default as
|
|
248
|
-
import { default as
|
|
249
|
-
import { default as
|
|
250
|
-
import { default as
|
|
251
|
-
import { default as
|
|
256
|
+
import { default as default128 } from "./utils/iconVariant.js";
|
|
257
|
+
import { default as default129 } from "./utils/hexToRgbA.js";
|
|
258
|
+
import { default as default130 } from "./utils/browser.js";
|
|
259
|
+
import { default as default131 } from "./utils/multiSelectionEventHandler.js";
|
|
260
|
+
import { default as default132 } from "./utils/getComponentName.js";
|
|
252
261
|
import { outlineStyles } from "./utils/focusUtils.js";
|
|
253
262
|
import { keyboardCodes } from "./utils/keyboardUtils/keyboardCodes.js";
|
|
254
263
|
import { getKeyCodeFromEvent, isKeycode, isKeypress } from "./utils/keyboardUtils/keyCheck.js";
|
|
255
264
|
import { decreaseSize, increaseSize } from "./utils/sizes.js";
|
|
256
|
-
import { createTheme, processThemes, setElementAttrs } from "./utils/theme.js";
|
|
265
|
+
import { createTheme, getVarValue, processThemes, setElementAttrs } from "./utils/theme.js";
|
|
257
266
|
import { setId, setUid } from "./utils/setId.js";
|
|
258
267
|
import { getClasses } from "./utils/classes.js";
|
|
259
268
|
import { getFirstAndLastFocus, getFocusableList, getPrevNextFocus } from "./utils/focusableElementFinder.js";
|
|
260
269
|
import { wrapperTooltip } from "./utils/wrapperTooltip.js";
|
|
261
270
|
import { useSavedState } from "./utils/useSavedState.js";
|
|
262
|
-
import { default as
|
|
263
|
-
import { default as
|
|
271
|
+
import { default as default133 } from "./hocs/withTooltip.js";
|
|
272
|
+
import { default as default134 } from "./hocs/withId.js";
|
|
264
273
|
export {
|
|
265
274
|
CellWithCheckBox,
|
|
266
275
|
CellWithExpandButton,
|
|
@@ -330,6 +339,7 @@ export {
|
|
|
330
339
|
HvMenuItem as HvHeaderMenuItem,
|
|
331
340
|
HvHeaderNavigation,
|
|
332
341
|
HvInfoMessage,
|
|
342
|
+
HvInlineEditor,
|
|
333
343
|
HvInput,
|
|
334
344
|
HvKpi,
|
|
335
345
|
HvLabel,
|
|
@@ -350,6 +360,8 @@ export {
|
|
|
350
360
|
HvRadio,
|
|
351
361
|
HvRadioGroup,
|
|
352
362
|
HvRightControl,
|
|
363
|
+
HvScrollToHorizontal,
|
|
364
|
+
HvScrollToVertical,
|
|
353
365
|
HvSelectionList,
|
|
354
366
|
HvSimpleGrid,
|
|
355
367
|
HvSlider,
|
|
@@ -447,7 +459,7 @@ export {
|
|
|
447
459
|
default36 as footerClasses,
|
|
448
460
|
default13 as formElementClasses,
|
|
449
461
|
getClasses,
|
|
450
|
-
|
|
462
|
+
default132 as getComponentName,
|
|
451
463
|
getFirstAndLastFocus,
|
|
452
464
|
getFocusableList,
|
|
453
465
|
getHeaderFooterPropsHook,
|
|
@@ -458,13 +470,15 @@ export {
|
|
|
458
470
|
getPrevNextFocus,
|
|
459
471
|
getSelectorIcons,
|
|
460
472
|
getTableHeadPropsHook,
|
|
473
|
+
getVarValue,
|
|
461
474
|
default83 as globalActionsClasses,
|
|
462
475
|
default37 as gridClasses,
|
|
463
476
|
default39 as headerActionsClasses,
|
|
464
477
|
default40 as headerBrandClasses,
|
|
465
478
|
default38 as headerClasses,
|
|
466
479
|
default41 as headerNavigationClasses,
|
|
467
|
-
|
|
480
|
+
default129 as hexToRgbA,
|
|
481
|
+
default124 as horizontalScrollListItemClasses,
|
|
468
482
|
hvDateColumn,
|
|
469
483
|
hvDropdownColumn,
|
|
470
484
|
hvExpandColumn,
|
|
@@ -476,11 +490,12 @@ export {
|
|
|
476
490
|
hvSwitchColumn,
|
|
477
491
|
hvTagColumn,
|
|
478
492
|
hvTextColumn,
|
|
479
|
-
|
|
493
|
+
default128 as iconVariant,
|
|
480
494
|
increaseSize,
|
|
481
495
|
default15 as infoMessageClasses,
|
|
496
|
+
default125 as inlineEditorClasses,
|
|
482
497
|
default60 as inputClasses,
|
|
483
|
-
|
|
498
|
+
default130 as isBrowser,
|
|
484
499
|
isInvalid,
|
|
485
500
|
isKeycode,
|
|
486
501
|
isKeypress,
|
|
@@ -496,7 +511,7 @@ export {
|
|
|
496
511
|
default44 as loadingClasses,
|
|
497
512
|
default105 as loginClasses,
|
|
498
513
|
default45 as multiButtonClasses,
|
|
499
|
-
|
|
514
|
+
default131 as multiSelectionEventHandler,
|
|
500
515
|
normalizeProgressBar,
|
|
501
516
|
outlineStyles,
|
|
502
517
|
default53 as overflowTooltipClasses,
|
|
@@ -509,6 +524,8 @@ export {
|
|
|
509
524
|
default67 as radioGroupClasses,
|
|
510
525
|
reducer,
|
|
511
526
|
default108 as rightControlClasses,
|
|
527
|
+
default123 as scrollToHorizontalClasses,
|
|
528
|
+
default121 as scrollToVerticalClasses,
|
|
512
529
|
default17 as selectionListClasses,
|
|
513
530
|
setElementAttrs,
|
|
514
531
|
setId,
|
|
@@ -558,20 +575,22 @@ export {
|
|
|
558
575
|
default92 as useHvTableStyles,
|
|
559
576
|
useImageLoaded,
|
|
560
577
|
useInstance,
|
|
561
|
-
|
|
578
|
+
default127 as useIsMounted,
|
|
562
579
|
useLabels,
|
|
563
580
|
useSavedState,
|
|
581
|
+
useScrollTo,
|
|
564
582
|
useSelectionPath,
|
|
565
583
|
useTheme,
|
|
566
|
-
|
|
584
|
+
default126 as useUniqueId,
|
|
567
585
|
useWidth,
|
|
568
586
|
default111 as verticalNavigationClasses,
|
|
569
587
|
default112 as verticalNavigationHeaderClasses,
|
|
570
588
|
default116 as verticalNavigationSliderClasses,
|
|
571
589
|
default115 as verticalNavigationTreeClasses,
|
|
590
|
+
default122 as verticalScrollListItemClasses,
|
|
572
591
|
default16 as warningTextClasses,
|
|
573
|
-
|
|
574
|
-
|
|
592
|
+
default134 as withId,
|
|
593
|
+
default133 as withTooltip,
|
|
575
594
|
wrapperTooltip
|
|
576
595
|
};
|
|
577
596
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/utils/theme.js
CHANGED
|
@@ -89,8 +89,17 @@ const processThemes = (themesList) => {
|
|
|
89
89
|
return [themes.ds5];
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
+
const getVarValue = (cssVar) => {
|
|
93
|
+
const tempEl = document.createElement("div");
|
|
94
|
+
tempEl.style.setProperty("--temp", cssVar);
|
|
95
|
+
document.body.appendChild(tempEl);
|
|
96
|
+
const computedValue = getComputedStyle(tempEl).getPropertyValue("--temp").trim();
|
|
97
|
+
document.body.removeChild(tempEl);
|
|
98
|
+
return computedValue;
|
|
99
|
+
};
|
|
92
100
|
export {
|
|
93
101
|
createTheme,
|
|
102
|
+
getVarValue,
|
|
94
103
|
processThemes,
|
|
95
104
|
setElementAttrs
|
|
96
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sources":["../../../src/utils/theme.ts"],"sourcesContent":["/*eslint import/namespace: [2, { allowComputed: true }]*/\nimport { CSSProperties } from \"react\";\nimport {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n theme,\n} from \"@hitachivantara/uikit-styles\";\nimport { HvTheme, HvCreateThemeProps } from \"@core/types\";\n\n/**\n * Sets the element style properties.\n */\nconst setElementStyle = (element: HTMLElement, style: CSSProperties) => {\n for (const property in style) {\n element.style[property] = style[property];\n }\n};\n\n/**\n * Sets the element attributes and style for a theme and color mode.\n */\nexport const setElementAttrs = (\n themeName: string,\n modeName: string,\n colorScheme: string,\n themeRootId?: string\n) => {\n const element = themeRootId\n ? document.getElementById(themeRootId)\n : document.body;\n\n if (element) {\n element.setAttribute(`data-theme`, themeName);\n element.setAttribute(`data-color-mode`, modeName);\n\n // Set default properties for all components to inherit\n setElementStyle(element, {\n colorScheme: colorScheme,\n backgroundColor: theme.colors.backgroundColor,\n accentColor: theme.colors.secondary,\n color: theme.colors.secondary,\n fontSize: theme.typography.body.fontSize,\n fontWeight: theme.typography.body.fontWeight,\n lineHeight: theme.typography.body.lineHeight,\n letterSpacing: theme.typography.body.letterSpacing,\n fontFamily: theme.fontFamily.body,\n });\n }\n};\n\n/**\n * Applies customizations to a theme.\n */\nconst applyThemeCustomizations = (obj: object, customizations: object) => {\n const isObject = (val: any) =>\n val && typeof val === \"object\" && !Array.isArray(val);\n\n // Customized theme\n const customizedTheme = { ...obj };\n\n // Add new values to the theme or replace values\n Object.keys(customizations).forEach((key) => {\n if (customizedTheme[key]) {\n if (isObject(customizedTheme[key]) && isObject(customizations[key])) {\n customizedTheme[key] = applyThemeCustomizations(\n customizedTheme[key],\n customizations[key]\n );\n } else if (typeof customizedTheme[key] == typeof customizations[key]) {\n customizedTheme[key] = customizations[key];\n }\n } else {\n customizedTheme[key] = customizations[key];\n }\n });\n\n return customizedTheme;\n};\n\n/**\n * Creates a customized theme based on the base theme and customizations given.\n * For the color modes, the colors that are not defined will be replaced by the values from the dawn mode of the base theme.\n */\nexport const createTheme = (\n props: HvCreateThemeProps\n): HvTheme | HvThemeStructure => {\n const {\n name,\n base = \"ds5\",\n inheritColorModes = true,\n ...customizations\n } = props;\n\n // Apply customizations to the base theme\n const customizedTheme: HvTheme | HvThemeStructure = customizations\n ? (applyThemeCustomizations(themes[base], customizations) as HvTheme)\n : { ...themes[base] };\n\n // Set theme name\n customizedTheme.name = name.trim();\n\n // Fill new color modes with missing colors\n if (customizations) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!themes[base].colors.modes[mode]) {\n customizedTheme.colors.modes[mode] = {\n ...themes[base].colors.modes.dawn,\n ...(customizedTheme.colors.modes[mode] as Partial<\n HvThemeColorModeStructure & { [key: string]: string }\n >),\n };\n }\n });\n }\n\n // If the flag `inheritColorModes` is false and customizations were given for the color modes,\n // we're removing any color modes that might have been inherited\n if (!inheritColorModes && customizations.colors?.modes) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!Object.keys(customizations.colors?.modes || {}).includes(mode)) {\n delete customizedTheme.colors.modes[mode];\n }\n });\n }\n\n // Created theme\n return customizedTheme;\n};\n\n/**\n * Process the themes provided to the HvProvider:\n * - Cleans themes with the same name\n * - Returns the default if the list is empty (ds5)\n */\nexport const processThemes = (\n themesList?: (HvTheme | HvThemeStructure)[]\n): (HvTheme | HvThemeStructure)[] => {\n if (themesList && Array.isArray(themesList) && themesList.length > 0) {\n const list: (HvTheme | HvThemeStructure)[] = [];\n\n themesList.map((thm) => {\n const i: number = list.findIndex(\n (t) => t.name.trim() === thm.name.trim()\n );\n\n if (i !== -1) {\n list.splice(i, 1);\n list.push(thm);\n } else {\n list.push(thm);\n }\n });\n\n // Cleaned themes\n return list;\n } else {\n // DS5\n return [themes.ds5];\n }\n};\n"],"names":["setElementStyle","element","style","property","setElementAttrs","themeName","modeName","colorScheme","themeRootId","document","getElementById","body","setAttribute","backgroundColor","theme","colors","accentColor","secondary","color","fontSize","typography","fontWeight","lineHeight","letterSpacing","fontFamily","applyThemeCustomizations","obj","customizations","isObject","val","Array","isArray","customizedTheme","Object","keys","forEach","key","createTheme","props","name","base","inheritColorModes","themes","trim","modes","mode","dawn","includes","processThemes","themesList","length","list","map","thm","i","findIndex","t","splice","push","ds5"],"mappings":";AAaA,MAAMA,kBAAkBA,CAACC,SAAsBC,UAAyB;AACtE,aAAWC,YAAYD,OAAO;AAC5BD,YAAQC,MAAMC,QAAQ,IAAID,MAAMC,QAAQ;AAAA,EAC1C;AACF;AAKO,MAAMC,kBAAkBA,CAC7BC,WACAC,UACAC,aACAC,gBACG;AACH,QAAMP,UAAUO,cACZC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MAAAA,IAAId,KAAKI,KAAM,CAAA;AAG1C,UAAIW,MAAM,IAAI;AACPG,aAAAA,OAAOH,GAAG,CAAC;AAChBH,aAAKO,KAAKL,GAAG;AAAA,MAAA,OACR;AACLF,aAAKO,KAAKL,GAAG;AAAA,MACf;AAAA,IAAA,CACD;AAGMF,WAAAA;AAAAA,EAAAA,OACF;AAEE,WAAA,CAACT,OAAOiB,GAAG;AAAA,EACpB;AACF;"}
|
|
1
|
+
{"version":3,"file":"theme.js","sources":["../../../src/utils/theme.ts"],"sourcesContent":["/*eslint import/namespace: [2, { allowComputed: true }]*/\nimport { CSSProperties } from \"react\";\nimport {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n theme,\n} from \"@hitachivantara/uikit-styles\";\nimport { HvTheme, HvCreateThemeProps } from \"@core/types\";\n\n/**\n * Sets the element style properties.\n */\nconst setElementStyle = (element: HTMLElement, style: CSSProperties) => {\n for (const property in style) {\n element.style[property] = style[property];\n }\n};\n\n/**\n * Sets the element attributes and style for a theme and color mode.\n */\nexport const setElementAttrs = (\n themeName: string,\n modeName: string,\n colorScheme: string,\n themeRootId?: string\n) => {\n const element = themeRootId\n ? document.getElementById(themeRootId)\n : document.body;\n\n if (element) {\n element.setAttribute(`data-theme`, themeName);\n element.setAttribute(`data-color-mode`, modeName);\n\n // Set default properties for all components to inherit\n setElementStyle(element, {\n colorScheme: colorScheme,\n backgroundColor: theme.colors.backgroundColor,\n accentColor: theme.colors.secondary,\n color: theme.colors.secondary,\n fontSize: theme.typography.body.fontSize,\n fontWeight: theme.typography.body.fontWeight,\n lineHeight: theme.typography.body.lineHeight,\n letterSpacing: theme.typography.body.letterSpacing,\n fontFamily: theme.fontFamily.body,\n });\n }\n};\n\n/**\n * Applies customizations to a theme.\n */\nconst applyThemeCustomizations = (obj: object, customizations: object) => {\n const isObject = (val: any) =>\n val && typeof val === \"object\" && !Array.isArray(val);\n\n // Customized theme\n const customizedTheme = { ...obj };\n\n // Add new values to the theme or replace values\n Object.keys(customizations).forEach((key) => {\n if (customizedTheme[key]) {\n if (isObject(customizedTheme[key]) && isObject(customizations[key])) {\n customizedTheme[key] = applyThemeCustomizations(\n customizedTheme[key],\n customizations[key]\n );\n } else if (typeof customizedTheme[key] == typeof customizations[key]) {\n customizedTheme[key] = customizations[key];\n }\n } else {\n customizedTheme[key] = customizations[key];\n }\n });\n\n return customizedTheme;\n};\n\n/**\n * Creates a customized theme based on the base theme and customizations given.\n * For the color modes, the colors that are not defined will be replaced by the values from the dawn mode of the base theme.\n */\nexport const createTheme = (\n props: HvCreateThemeProps\n): HvTheme | HvThemeStructure => {\n const {\n name,\n base = \"ds5\",\n inheritColorModes = true,\n ...customizations\n } = props;\n\n // Apply customizations to the base theme\n const customizedTheme: HvTheme | HvThemeStructure = customizations\n ? (applyThemeCustomizations(themes[base], customizations) as HvTheme)\n : { ...themes[base] };\n\n // Set theme name\n customizedTheme.name = name.trim();\n\n // Fill new color modes with missing colors\n if (customizations) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!themes[base].colors.modes[mode]) {\n customizedTheme.colors.modes[mode] = {\n ...themes[base].colors.modes.dawn,\n ...(customizedTheme.colors.modes[mode] as Partial<\n HvThemeColorModeStructure & { [key: string]: string }\n >),\n };\n }\n });\n }\n\n // If the flag `inheritColorModes` is false and customizations were given for the color modes,\n // we're removing any color modes that might have been inherited\n if (!inheritColorModes && customizations.colors?.modes) {\n Object.keys(customizedTheme.colors.modes).forEach((mode) => {\n if (!Object.keys(customizations.colors?.modes || {}).includes(mode)) {\n delete customizedTheme.colors.modes[mode];\n }\n });\n }\n\n // Created theme\n return customizedTheme;\n};\n\n/**\n * Process the themes provided to the HvProvider:\n * - Cleans themes with the same name\n * - Returns the default if the list is empty (ds5)\n */\nexport const processThemes = (\n themesList?: (HvTheme | HvThemeStructure)[]\n): (HvTheme | HvThemeStructure)[] => {\n if (themesList && Array.isArray(themesList) && themesList.length > 0) {\n const list: (HvTheme | HvThemeStructure)[] = [];\n\n themesList.map((thm) => {\n const i: number = list.findIndex(\n (t) => t.name.trim() === thm.name.trim()\n );\n\n if (i !== -1) {\n list.splice(i, 1);\n list.push(thm);\n } else {\n list.push(thm);\n }\n });\n\n // Cleaned themes\n return list;\n } else {\n // DS5\n return [themes.ds5];\n }\n};\n\n/**\n * Returns the computed value of a theme CSS var\n */\nexport const getVarValue = (cssVar: string): string => {\n const tempEl = document.createElement(\"div\");\n tempEl.style.setProperty(\"--temp\", cssVar);\n document.body.appendChild(tempEl);\n const computedValue = getComputedStyle(tempEl)\n .getPropertyValue(\"--temp\")\n .trim();\n document.body.removeChild(tempEl);\n return computedValue;\n};\n"],"names":["setElementStyle","element","style","property","setElementAttrs","themeName","modeName","colorScheme","themeRootId","document","getElementById","body","setAttribute","backgroundColor","theme","colors","accentColor","secondary","color","fontSize","typography","fontWeight","lineHeight","letterSpacing","fontFamily","applyThemeCustomizations","obj","customizations","isObject","val","Array","isArray","customizedTheme","Object","keys","forEach","key","createTheme","props","name","base","inheritColorModes","themes","trim","modes","mode","dawn","includes","processThemes","themesList","length","list","map","thm","i","findIndex","t","splice","push","ds5","getVarValue","cssVar","tempEl","createElement","setProperty","appendChild","computedValue","getComputedStyle","getPropertyValue","removeChild"],"mappings":";AAaA,MAAMA,kBAAkBA,CAACC,SAAsBC,UAAyB;AACtE,aAAWC,YAAYD,OAAO;AAC5BD,YAAQC,MAAMC,QAAQ,IAAID,MAAMC,QAAQ;AAAA,EAC1C;AACF;AAKO,MAAMC,kBAAkBA,CAC7BC,WACAC,UACAC,aACAC,gBACG;AACH,QAAMP,UAAUO,cACZC,SAASC,eAAeF,WAAW,IACnCC,SAASE;AAEb,MAAIV,SAAS;AACHW,YAAAA,aAAc,cAAaP,SAAS;AACpCO,YAAAA,aAAc,mBAAkBN,QAAQ;AAGhDN,oBAAgBC,SAAS;AAAA,MACvBM;AAAAA,MACAM,iBAAiBC,MAAMC,OAAOF;AAAAA,MAC9BG,aAAaF,MAAMC,OAAOE;AAAAA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,OAAOiB,GAAG;AAAA,EACpB;AACF;AAKaC,MAAAA,cAAcA,CAACC,WAA2B;AAC/CC,QAAAA,SAASrD,SAASsD,cAAc,KAAK;AACpC7D,SAAAA,MAAM8D,YAAY,UAAUH,MAAM;AAChClD,WAAAA,KAAKsD,YAAYH,MAAM;AAChC,QAAMI,gBAAgBC,iBAAiBL,MAAM,EAC1CM,iBAAiB,QAAQ,EACzBzB;AACMhC,WAAAA,KAAK0D,YAAYP,MAAM;AACzBI,SAAAA;AACT;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import withTooltipUtil from "../hocs/withTooltip.js";
|
|
2
2
|
const hideTooltip = (evt) => {
|
|
3
3
|
const isOverFlow = evt.target.children.length > 1 ? Array.of(...evt.target.children).some((child) => child.scrollWidth > child.clientWidth) : evt.target.scrollWidth > evt.target.clientWidth;
|
|
4
4
|
return !isOverFlow;
|
|
5
5
|
};
|
|
6
6
|
const wrapperTooltip = (hasTooltips, Component, label) => {
|
|
7
7
|
const ComponentFunction = () => Component;
|
|
8
|
-
return hasTooltips ?
|
|
8
|
+
return hasTooltips ? withTooltipUtil(ComponentFunction, label, "top", hideTooltip) : ComponentFunction;
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
11
|
wrapperTooltip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapperTooltip.js","sources":["../../../src/utils/wrapperTooltip.tsx"],"sourcesContent":["import { withTooltip } from \"@core/hocs\";\n\nconst hideTooltip = (evt) => {\n const isOverFlow =\n evt.target.children.length > 1\n ? Array.of(...evt.target.children).some(\n (child) => child.scrollWidth > child.clientWidth\n )\n : evt.target.scrollWidth > evt.target.clientWidth;\n\n return !isOverFlow;\n};\n\nexport const wrapperTooltip = (hasTooltips, Component, label) => {\n const ComponentFunction = () => Component;\n return hasTooltips\n ? withTooltip(ComponentFunction, label, \"top\", hideTooltip
|
|
1
|
+
{"version":3,"file":"wrapperTooltip.js","sources":["../../../src/utils/wrapperTooltip.tsx"],"sourcesContent":["import { withTooltip } from \"@core/hocs\";\n\nconst hideTooltip = (evt) => {\n const isOverFlow =\n evt.target.children.length > 1\n ? Array.of(...evt.target.children).some(\n (child) => child.scrollWidth > child.clientWidth\n )\n : evt.target.scrollWidth > evt.target.clientWidth;\n\n return !isOverFlow;\n};\n\nexport const wrapperTooltip = (hasTooltips, Component, label) => {\n const ComponentFunction = () => Component;\n return hasTooltips\n ? withTooltip(ComponentFunction, label, \"top\", hideTooltip)\n : ComponentFunction;\n};\n"],"names":["hideTooltip","evt","isOverFlow","target","children","length","Array","of","some","child","scrollWidth","clientWidth","wrapperTooltip","hasTooltips","Component","label","ComponentFunction","withTooltip"],"mappings":";AAEA,MAAMA,cAAeC,CAAQ,QAAA;AACrBC,QAAAA,aACJD,IAAIE,OAAOC,SAASC,SAAS,IACzBC,MAAMC,GAAG,GAAGN,IAAIE,OAAOC,QAAQ,EAAEI,KAC9BC,CAAAA,UAAUA,MAAMC,cAAcD,MAAME,WAAW,IAElDV,IAAIE,OAAOO,cAAcT,IAAIE,OAAOQ;AAE1C,SAAO,CAACT;AACV;AAEO,MAAMU,iBAAiBA,CAACC,aAAaC,WAAWC,UAAU;AAC/D,QAAMC,oBAAoBA,MAAMF;AAChC,SAAOD,cACHI,gBAAYD,mBAAmBD,OAAO,OAAOf,WAAW,IACxDgB;AACN;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -394,6 +394,11 @@ export declare const getTableHeadPropsHook: (props: any, { instance }: {
|
|
|
394
394
|
instance: any;
|
|
395
395
|
}) => any[];
|
|
396
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Returns the computed value of a theme CSS var
|
|
399
|
+
*/
|
|
400
|
+
export declare const getVarValue: (cssVar: string) => string;
|
|
401
|
+
|
|
397
402
|
export declare const globalActionsClasses: HvGlobalActionsClasses;
|
|
398
403
|
|
|
399
404
|
export declare const gridClasses: HvGridClasses;
|
|
@@ -408,6 +413,8 @@ export declare const headerNavigationClasses: HvHeaderNavigationClasses;
|
|
|
408
413
|
|
|
409
414
|
export declare const hexToRgbA: (hex: any, factor?: number) => string;
|
|
410
415
|
|
|
416
|
+
export declare const horizontalScrollListItemClasses: HvHorizontalScrollListItemClasses;
|
|
417
|
+
|
|
411
418
|
export declare type HvAccentColorKeys = "primary" | "primary_80" | "primary_20" | "brand" | "secondary" | "secondary_60" | "secondary_80";
|
|
412
419
|
|
|
413
420
|
export declare type HvAccentColors = Record<HvAccentColorKeys, string>;
|
|
@@ -3672,6 +3679,13 @@ export declare interface HvHooks<D extends object = Record<string, unknown>, H e
|
|
|
3672
3679
|
useFinalInstance: Array<(instance: HvTableInstance<D, H>) => void>;
|
|
3673
3680
|
}
|
|
3674
3681
|
|
|
3682
|
+
export declare interface HvHorizontalScrollListItemClasses {
|
|
3683
|
+
root?: string;
|
|
3684
|
+
selected?: string;
|
|
3685
|
+
button?: string;
|
|
3686
|
+
text?: string;
|
|
3687
|
+
}
|
|
3688
|
+
|
|
3675
3689
|
/**
|
|
3676
3690
|
* Provides the user with additional descriptive text for the form element.
|
|
3677
3691
|
*/
|
|
@@ -3692,6 +3706,46 @@ export declare interface HvInfoMessageProps extends HvBaseProps {
|
|
|
3692
3706
|
classes?: HvInfoMessageClasses;
|
|
3693
3707
|
}
|
|
3694
3708
|
|
|
3709
|
+
/**
|
|
3710
|
+
* An Inline Editor allows the user to edit a record without making a major switch
|
|
3711
|
+
* between viewing and editing, making it an efficient method of updating a record.
|
|
3712
|
+
*/
|
|
3713
|
+
export declare const HvInlineEditor: ({ className, classes, value: valueProp, defaultValue, showIcon, component: InputComponent, variant, placeholder, onBlur, onChange, onKeyDown, buttonProps, typographyProps, ...others }: HvInlineEditorProps) => JSX_2.Element;
|
|
3714
|
+
|
|
3715
|
+
export declare interface HvInlineEditorClasses {
|
|
3716
|
+
root?: string;
|
|
3717
|
+
button?: string;
|
|
3718
|
+
largeText?: string;
|
|
3719
|
+
text?: string;
|
|
3720
|
+
textEmpty?: string;
|
|
3721
|
+
icon?: string;
|
|
3722
|
+
iconVisible?: string;
|
|
3723
|
+
inputRoot?: string;
|
|
3724
|
+
input?: string;
|
|
3725
|
+
inputBorderContainer?: string;
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
export declare interface HvInlineEditorProps extends Omit<HvBaseProps<HTMLDivElement>, "onBlur" | "onChange"> {
|
|
3729
|
+
/** The value of the form element. */
|
|
3730
|
+
value?: string;
|
|
3731
|
+
/** Whether the Edit icon should always be visible */
|
|
3732
|
+
showIcon?: boolean;
|
|
3733
|
+
/** Component to use as the input. The component "inherit" from `HvBaseInput` (such as `HvInput` or `HvTextArea`) */
|
|
3734
|
+
component?: React_2.ElementType;
|
|
3735
|
+
/** Variant of the HvTypography to display */
|
|
3736
|
+
variant?: HvTypographyVariants;
|
|
3737
|
+
/** Called when the input is blurred. */
|
|
3738
|
+
onBlur?: (event: React_2.FocusEvent<HTMLTextAreaElement | HTMLInputElement>, value: string) => void;
|
|
3739
|
+
/** Called when the input value changes. */
|
|
3740
|
+
onChange?: (event: React_2.SyntheticEvent, value: string) => void;
|
|
3741
|
+
/** Props passed to the HvButton component */
|
|
3742
|
+
buttonProps?: HvButtonProps;
|
|
3743
|
+
/** Props passed to the HvTypography text component */
|
|
3744
|
+
typographyProps?: HvTypographyProps;
|
|
3745
|
+
/** A Jss Object used to override or extend the styles applied to the empty state component. */
|
|
3746
|
+
classes?: HvInlineEditorClasses;
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3695
3749
|
/**
|
|
3696
3750
|
* A text input box is a graphical control element intended to enable the user to input text information to be used by the software.
|
|
3697
3751
|
*/
|
|
@@ -4857,6 +4911,127 @@ declare type HvRowPropGetter<D extends object = Record<string, unknown>, H exten
|
|
|
4857
4911
|
row: HvRowInstance<D, H>;
|
|
4858
4912
|
}>;
|
|
4859
4913
|
|
|
4914
|
+
/**
|
|
4915
|
+
* The horizontal scroll to element can be used to quickly navigate in a page.
|
|
4916
|
+
*/
|
|
4917
|
+
export declare const HvScrollToHorizontal: ({ id, defaultSelectedIndex, scrollElementId, href, onChange, onClick, onEnter, className, classes, options, offset, position, tooltipPosition, ...others }: HvScrollToHorizontalProps) => JSX_2.Element;
|
|
4918
|
+
|
|
4919
|
+
export declare interface HvScrollToHorizontalClasses {
|
|
4920
|
+
root?: string;
|
|
4921
|
+
positionSticky?: string;
|
|
4922
|
+
positionFixed?: string;
|
|
4923
|
+
notSelectedRoot?: string;
|
|
4924
|
+
notSelected?: string;
|
|
4925
|
+
selected?: string;
|
|
4926
|
+
}
|
|
4927
|
+
|
|
4928
|
+
export declare interface HvScrollToHorizontalOption {
|
|
4929
|
+
key?: string;
|
|
4930
|
+
label: string;
|
|
4931
|
+
value: string;
|
|
4932
|
+
offset?: number;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
export declare type HvScrollToHorizontalPositions = "sticky" | "fixed" | "relative";
|
|
4936
|
+
|
|
4937
|
+
export declare interface HvScrollToHorizontalProps extends HvBaseProps<HTMLOListElement, {
|
|
4938
|
+
onChange: any;
|
|
4939
|
+
onClick: any;
|
|
4940
|
+
}> {
|
|
4941
|
+
/** An Array of Objects with Label and Value. Label is the displayed Element and Value is the local navigation location applied */
|
|
4942
|
+
options: HvScrollToHorizontalOption[];
|
|
4943
|
+
/** True if the href location link should be applied. It will create an a element around every list item */
|
|
4944
|
+
href?: boolean;
|
|
4945
|
+
/** Default selected index passed from the parent. */
|
|
4946
|
+
defaultSelectedIndex?: number;
|
|
4947
|
+
/**
|
|
4948
|
+
* The Id of the scrollable container containing displayed elements.
|
|
4949
|
+
*
|
|
4950
|
+
* Defaults to `window` if unspecified.
|
|
4951
|
+
*/
|
|
4952
|
+
scrollElementId?: string;
|
|
4953
|
+
/**
|
|
4954
|
+
* Defines the offset from the top of each element for getting an optimal viewing region in the container.
|
|
4955
|
+
* This allows to exclude regions of the container that are obscured by other content (such as fixed-positioned toolbars or titles)
|
|
4956
|
+
* or to put more breathing room between the targeted element and the edges of the container.
|
|
4957
|
+
*
|
|
4958
|
+
* Each element can also have a specific offset via the options property.
|
|
4959
|
+
*/
|
|
4960
|
+
offset?: number;
|
|
4961
|
+
/** Position of the Horizontal scroll to. */
|
|
4962
|
+
position?: HvScrollToHorizontalPositions;
|
|
4963
|
+
/** Position of tooltip identifying the current item. */
|
|
4964
|
+
tooltipPosition?: HvScrollToTooltipPositions;
|
|
4965
|
+
/** A function called each time the selected index changes. */
|
|
4966
|
+
onChange?: (event: Event | React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, index: number) => void;
|
|
4967
|
+
/** A function called each time an user clicks on a tab element. */
|
|
4968
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>, index: number) => void;
|
|
4969
|
+
/** A function called each time an user press enter on a tab element. */
|
|
4970
|
+
onEnter?: (event: React.KeyboardEvent<HTMLDivElement>, index: number) => void;
|
|
4971
|
+
/** A Jss Object used to override or extend the styles applied. */
|
|
4972
|
+
classes?: HvScrollToHorizontalClasses;
|
|
4973
|
+
}
|
|
4974
|
+
|
|
4975
|
+
export declare type HvScrollToTooltipPositions = "left" | "right" | "top" | "bottom";
|
|
4976
|
+
|
|
4977
|
+
/**
|
|
4978
|
+
* The vertical scroll to element can be used to quickly navigate in a page.
|
|
4979
|
+
*/
|
|
4980
|
+
export declare const HvScrollToVertical: ({ id, defaultSelectedIndex, scrollElementId, href, onChange, onClick, onEnter, className, classes, options, offset, position, tooltipPosition, ...others }: HvScrollToVerticalProps) => JSX_2.Element;
|
|
4981
|
+
|
|
4982
|
+
export declare interface HvScrollToVerticalClasses {
|
|
4983
|
+
root?: string;
|
|
4984
|
+
positionAbsolute?: string;
|
|
4985
|
+
positionFixed?: string;
|
|
4986
|
+
}
|
|
4987
|
+
|
|
4988
|
+
export declare interface HvScrollToVerticalOption {
|
|
4989
|
+
key?: string;
|
|
4990
|
+
label: string;
|
|
4991
|
+
value: string;
|
|
4992
|
+
offset?: number;
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
export declare type HvScrollToVerticalPositions = "absolute" | "fixed" | "relative";
|
|
4996
|
+
|
|
4997
|
+
export declare interface HvScrollToVerticalProps extends HvBaseProps<HTMLOListElement, {
|
|
4998
|
+
onChange: any;
|
|
4999
|
+
onClick: any;
|
|
5000
|
+
}> {
|
|
5001
|
+
/** An Array of Objects with Label and Value. Label is the displayed Element and Value is the local navigation location applied */
|
|
5002
|
+
options: HvScrollToVerticalOption[];
|
|
5003
|
+
/** True if the href location link should be applied. It will create an a element around every list item */
|
|
5004
|
+
href?: boolean;
|
|
5005
|
+
/** Default selected index passed from the parent. */
|
|
5006
|
+
defaultSelectedIndex?: number;
|
|
5007
|
+
/**
|
|
5008
|
+
* The Id of the scrollable container containing displayed elements.
|
|
5009
|
+
*
|
|
5010
|
+
* Defaults to `window` if unspecified.
|
|
5011
|
+
*/
|
|
5012
|
+
scrollElementId?: string;
|
|
5013
|
+
/**
|
|
5014
|
+
* Defines the offset from the top of each element for getting an optimal viewing region in the container.
|
|
5015
|
+
* This allows to exclude regions of the container that are obscured by other content (such as fixed-positioned toolbars or titles)
|
|
5016
|
+
* or to put more breathing room between the targeted element and the edges of the container.
|
|
5017
|
+
*
|
|
5018
|
+
* Each element can also have a specific offset via the options property.
|
|
5019
|
+
*/
|
|
5020
|
+
offset?: number;
|
|
5021
|
+
/** Position of the Vertical scroll to. */
|
|
5022
|
+
position?: HvScrollToVerticalPositions;
|
|
5023
|
+
/** Position of tooltip identifying the current item. */
|
|
5024
|
+
tooltipPosition?: HvScrollToTooltipPositions;
|
|
5025
|
+
/** A function called each time the selected index changes. */
|
|
5026
|
+
onChange?: (event: Event | React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, index: number) => void;
|
|
5027
|
+
/** A function called each time an user clicks on a tab element. */
|
|
5028
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>, index: number) => void;
|
|
5029
|
+
/** A function called each time an user press enter on a tab element. */
|
|
5030
|
+
onEnter?: (event: React.KeyboardEvent<HTMLDivElement>, index: number) => void;
|
|
5031
|
+
/** A Jss Object used to override or extend the styles applied. */
|
|
5032
|
+
classes?: HvScrollToVerticalClasses;
|
|
5033
|
+
}
|
|
5034
|
+
|
|
4860
5035
|
/**
|
|
4861
5036
|
* Allows the user to select one or more items from a list of choices.
|
|
4862
5037
|
*
|
|
@@ -7008,6 +7183,13 @@ export declare interface HvVerticalNavigationTreeViewProps {
|
|
|
7008
7183
|
children?: React.ReactNode;
|
|
7009
7184
|
}
|
|
7010
7185
|
|
|
7186
|
+
export declare interface HvVerticalScrollListItemClasses {
|
|
7187
|
+
root?: string;
|
|
7188
|
+
notSelected?: string;
|
|
7189
|
+
button?: string;
|
|
7190
|
+
text?: string;
|
|
7191
|
+
}
|
|
7192
|
+
|
|
7011
7193
|
/**
|
|
7012
7194
|
* Provides the user with a descriptive text, signaling an error, for when the form element is in an invalid state.
|
|
7013
7195
|
*/
|
|
@@ -7050,6 +7232,8 @@ export declare const increaseSize: (size: string) => "S" | "M" | "L" | "XL";
|
|
|
7050
7232
|
|
|
7051
7233
|
export declare const infoMessageClasses: HvInfoMessageClasses;
|
|
7052
7234
|
|
|
7235
|
+
export declare const inlineEditorClasses: HvInlineEditorClasses;
|
|
7236
|
+
|
|
7053
7237
|
export declare const inputClasses: HvInputClasses;
|
|
7054
7238
|
|
|
7055
7239
|
export declare const isBrowser: (browsers: any) => boolean | null;
|
|
@@ -7304,6 +7488,10 @@ export declare function reducer(state: any, action: any, previousState: any, ins
|
|
|
7304
7488
|
|
|
7305
7489
|
export declare const rightControlClasses: HvRightControlClasses;
|
|
7306
7490
|
|
|
7491
|
+
export declare const scrollToHorizontalClasses: HvScrollToHorizontalClasses;
|
|
7492
|
+
|
|
7493
|
+
export declare const scrollToVerticalClasses: HvScrollToVerticalClasses;
|
|
7494
|
+
|
|
7307
7495
|
export declare const selectionListClasses: HvSelectionListClasses;
|
|
7308
7496
|
|
|
7309
7497
|
/**
|
|
@@ -7668,6 +7856,8 @@ export declare type UseRowSelectionProps = (<D extends object = Record<string, u
|
|
|
7668
7856
|
|
|
7669
7857
|
export declare function useSavedState<T>(defaultState: T): [T | undefined, (v?: T, s?: boolean) => void, () => void, T | undefined, T];
|
|
7670
7858
|
|
|
7859
|
+
export declare const useScrollTo: (selectedIndexProp?: number, scrollElementId?: string | undefined, href?: boolean, offset?: number, options?: HvScrollToVerticalOption[], onChange?: ((event: Event | React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, index: number) => void) | undefined, direction?: "column" | "row") => [number, (event: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>, id: string, index: number, wrappedOnChange?: ((index: number) => void) | undefined) => void];
|
|
7860
|
+
|
|
7671
7861
|
export declare const useSelectionPath: (data: any, selectedId: any) => string[];
|
|
7672
7862
|
|
|
7673
7863
|
export declare type UseTableStylesProps = (<D extends object = Record<string, unknown>>(hooks: Hooks<D>) => void) & {
|
|
@@ -7709,6 +7899,8 @@ export declare const verticalNavigationSliderClasses: HvVerticalNavigationSlider
|
|
|
7709
7899
|
|
|
7710
7900
|
export declare const verticalNavigationTreeClasses: HvVerticalNavigationTreeClasses;
|
|
7711
7901
|
|
|
7902
|
+
export declare const verticalScrollListItemClasses: HvVerticalScrollListItemClasses;
|
|
7903
|
+
|
|
7712
7904
|
export declare type VisibilitySelectorActions = "previous_month" | "next_month" | "previous_year" | "next_year" | "month" | "month_year";
|
|
7713
7905
|
|
|
7714
7906
|
export declare const warningTextClasses: HvWarningTextClasses;
|
|
@@ -7722,7 +7914,7 @@ declare interface WithIdProps extends HvExtraProps {
|
|
|
7722
7914
|
id?: string;
|
|
7723
7915
|
}
|
|
7724
7916
|
|
|
7725
|
-
export declare const withTooltip: (Component:
|
|
7917
|
+
export declare const withTooltip: (Component: React.FunctionComponent, label: string | undefined, placement: HvTooltipPlacementType, hideTooltip?: ((event: React.MouseEvent<HTMLDivElement>) => boolean) | undefined, tooltipProps?: HvTooltipProps, tooltipContainerProps?: HvBaseProps) => (props: any) => JSX_2.Element;
|
|
7726
7918
|
|
|
7727
7919
|
export declare const wrapperTooltip: (hasTooltips: any, Component: any, label: any) => ((props: any) => JSX_2.Element) | (() => any);
|
|
7728
7920
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@emotion/cache": "^11.10.5",
|
|
33
|
-
"@hitachivantara/uikit-react-icons": "^5.1.
|
|
34
|
-
"@hitachivantara/uikit-react-shared": "^5.0.
|
|
35
|
-
"@hitachivantara/uikit-styles": "^5.
|
|
33
|
+
"@hitachivantara/uikit-react-icons": "^5.1.3",
|
|
34
|
+
"@hitachivantara/uikit-react-shared": "^5.0.7",
|
|
35
|
+
"@hitachivantara/uikit-styles": "^5.4.0",
|
|
36
36
|
"@popperjs/core": "^2.11.6",
|
|
37
37
|
"@types/react-table": "^7.7.14",
|
|
38
38
|
"attr-accept": "^2.2.2",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"access": "public",
|
|
57
57
|
"directory": "package"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "6a771d68070e4bfb03ca573900704d35934c0573",
|
|
60
60
|
"main": "dist/cjs/index.cjs",
|
|
61
61
|
"exports": {
|
|
62
62
|
".": {
|