@hitachivantara/uikit-react-core 4.0.1-next.2 → 4.0.1-next.5

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.
Files changed (49) hide show
  1. package/dist/Controls/Controls.d.ts +2 -10
  2. package/dist/Controls/RightControl/RightControl.d.ts +1 -1
  3. package/dist/Provider/Provider.d.ts +5 -18
  4. package/dist/Provider/Provider.js +25 -38
  5. package/dist/Provider/Provider.js.map +1 -1
  6. package/dist/SimpleGrid/SimpleGrid.d.ts +7 -8
  7. package/dist/Table/TableBody/TableBody.d.ts +4 -0
  8. package/dist/Table/renderers/index.js +50 -0
  9. package/dist/Table/renderers/index.js.map +1 -1
  10. package/dist/Table/renderers/renderers.js +9 -15
  11. package/dist/Table/renderers/renderers.js.map +1 -1
  12. package/dist/Tag/Tag.js +1 -13
  13. package/dist/Tag/Tag.js.map +1 -1
  14. package/dist/Tag/styles.js +5 -3
  15. package/dist/Tag/styles.js.map +1 -1
  16. package/dist/legacy/Controls/Controls.d.ts +2 -10
  17. package/dist/legacy/Controls/RightControl/RightControl.d.ts +1 -1
  18. package/dist/legacy/Provider/Provider.d.ts +5 -18
  19. package/dist/legacy/Provider/Provider.js +29 -40
  20. package/dist/legacy/Provider/Provider.js.map +1 -1
  21. package/dist/legacy/SimpleGrid/SimpleGrid.d.ts +7 -8
  22. package/dist/legacy/Table/TableBody/TableBody.d.ts +4 -0
  23. package/dist/legacy/Table/renderers/index.js +1 -0
  24. package/dist/legacy/Table/renderers/index.js.map +1 -1
  25. package/dist/legacy/Table/renderers/renderers.js +6 -6
  26. package/dist/legacy/Table/renderers/renderers.js.map +1 -1
  27. package/dist/legacy/Tag/Tag.js +3 -15
  28. package/dist/legacy/Tag/Tag.js.map +1 -1
  29. package/dist/legacy/Tag/styles.js +5 -3
  30. package/dist/legacy/Tag/styles.js.map +1 -1
  31. package/dist/legacy/theme/index.d.ts +2 -1
  32. package/dist/modern/Controls/Controls.d.ts +2 -10
  33. package/dist/modern/Controls/RightControl/RightControl.d.ts +1 -1
  34. package/dist/modern/Provider/Provider.d.ts +5 -18
  35. package/dist/modern/Provider/Provider.js +28 -38
  36. package/dist/modern/Provider/Provider.js.map +1 -1
  37. package/dist/modern/SimpleGrid/SimpleGrid.d.ts +7 -8
  38. package/dist/modern/Table/TableBody/TableBody.d.ts +4 -0
  39. package/dist/modern/Table/renderers/index.js +1 -0
  40. package/dist/modern/Table/renderers/index.js.map +1 -1
  41. package/dist/modern/Table/renderers/renderers.js +6 -6
  42. package/dist/modern/Table/renderers/renderers.js.map +1 -1
  43. package/dist/modern/Tag/Tag.js +3 -15
  44. package/dist/modern/Tag/Tag.js.map +1 -1
  45. package/dist/modern/Tag/styles.js +5 -3
  46. package/dist/modern/Tag/styles.js.map +1 -1
  47. package/dist/modern/theme/index.d.ts +2 -1
  48. package/dist/theme/index.d.ts +2 -1
  49. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","names":["fade","outlineStyles","styles","theme","root","chipRoot","height","borderRadius","maxWidth","backgroundColor","palette","base1","focusVisible","primaryButton","background","label","paddingLeft","hv","spacing","xs","paddingRight","color","base","base2","tagButton","width","minWidth","minHeight","padding","margin","deleteIcon","marginRight","outline","boxShadow","disabledDeleteIcon","atmosphere","atmo3","outlineOffset","titleOverflow","whiteSpace","overflow","textOverflow","categorical","cursor","accent","acce1","clickable","categoricalFocus","disabled","atmo5","categoricalDisabled","semanticTextColor","categoricalTextColor"],"sources":["../../../src/Tag/styles.js"],"sourcesContent":["import fade from \"../utils/hexToRgbA\";\nimport { outlineStyles } from \"../Focus/styles\";\n\nconst styles = (theme) => ({\n root: {},\n\n chipRoot: {\n height: 16,\n borderRadius: 0,\n maxWidth: 180,\n \"& $focusVisible\": {\n backgroundColor: fade(theme.palette.base1, 0.3),\n },\n },\n\n focusVisible: {},\n\n primaryButton: {\n background: \"transparent\",\n },\n\n label: {\n paddingLeft: theme.hv.spacing.xs,\n paddingRight: theme.hv.spacing.xs,\n \"& p\": {\n color: theme.hv.palette.base.base2,\n },\n },\n\n tagButton: {\n width: 16,\n height: 16,\n minWidth: 16,\n minHeight: 16,\n padding: 0,\n margin: 0,\n },\n\n deleteIcon: {\n marginRight: 0,\n width: 16,\n height: 16,\n minWidth: 16,\n minHeight: 16,\n padding: 0,\n \"&:hover\": {\n backgroundColor: fade(theme.palette.base1, 0.3),\n },\n \"&:focus\": {\n ...outlineStyles,\n borderRadius: 0,\n },\n \"&:focus:not(:focus-visible)\": {\n outline: \"0 !important\",\n boxShadow: \"none !important\",\n },\n },\n disabledDeleteIcon: {\n \"&:hover\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n },\n \"&:focus\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n outline: \"none\",\n boxShadow: \"none\",\n outlineOffset: 0,\n },\n },\n titleOverflow: {\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n categorical: {\n borderRadius: 8,\n \"&$clickable\": {\n cursor: \"pointer\",\n },\n \"&:hover\": {\n borderRadius: 8,\n },\n \"& $label > p\": {\n color: theme.hv.palette.accent.acce1,\n },\n \"&:focus:not(:focus-visible)\": {\n outline: \"0 !important\",\n boxShadow: \"none !important\",\n },\n },\n clickable: {},\n\n categoricalFocus: {\n \"&:focus\": {\n ...outlineStyles,\n },\n },\n\n disabled: {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n cursor: \"not-allowed\",\n \"& $label > p\": {\n color: theme.hv.palette.atmosphere.atmo5,\n },\n },\n\n categoricalDisabled: {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n cursor: \"not-allowed\",\n \"& $label > p\": {\n color: theme.hv.palette.atmosphere.atmo5,\n },\n \"&:hover\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n },\n \"&:focus\": {\n outline: \"none\",\n },\n },\n\n semanticTextColor: {\n color: theme.hv.palette.base.base2,\n },\n categoricalTextColor: {\n color: theme.hv.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AAjB,CAA4BC,KAD1B;MAEnBO,MAAM,EAAE,aAFW;MAGnB,gBAAgB;QACdtB,KAAK,EAAElB,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiByB,UAAjB,CAA4Bc;MADrB,CAHG;MAMnB,WAAW;QACTxC,eAAe,EAAEN,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiByB,UAAjB,CAA4BC;MADpC,CANQ;MASnB,WAAW;QACTJ,OAAO,EAAE;MADA;IATQ,CAtGI;IAoHzBmB,iBAAiB,EAAE;MACjB9B,KAAK,EAAElB,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiBY,IAAjB,CAAsBC;IADZ,CApHM;IAuHzB6B,oBAAoB,EAAE;MACpB/B,KAAK,EAAElB,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiBkC,MAAjB,CAAwBC;IADX;EAvHG,CAAZ;AAAA,CAAf;;AA4HA,eAAe3C,MAAf"}
1
+ {"version":3,"file":"styles.js","names":["fade","outlineStyles","styles","theme","root","chipRoot","height","borderRadius","maxWidth","backgroundColor","palette","base1","focusVisible","primaryButton","background","label","paddingLeft","hv","spacing","xs","paddingRight","typography","normalText","color","base2","base","tagButton","width","minWidth","minHeight","padding","margin","deleteIcon","marginRight","outline","boxShadow","disabledDeleteIcon","atmosphere","atmo3","outlineOffset","titleOverflow","whiteSpace","overflow","textOverflow","categorical","cursor","accent","acce1","clickable","categoricalFocus","disabled","atmo5","categoricalDisabled","semanticTextColor","categoricalTextColor"],"sources":["../../../src/Tag/styles.js"],"sourcesContent":["import fade from \"../utils/hexToRgbA\";\nimport { outlineStyles } from \"../Focus/styles\";\n\nconst styles = (theme) => ({\n root: {},\n\n chipRoot: {\n height: 16,\n borderRadius: 0,\n maxWidth: 180,\n \"& $focusVisible\": {\n backgroundColor: fade(theme.palette.base1, 0.3),\n },\n },\n\n focusVisible: {},\n\n primaryButton: {\n background: \"transparent\",\n },\n\n label: {\n paddingLeft: theme.hv.spacing.xs,\n paddingRight: theme.hv.spacing.xs,\n ...theme.hv.typography.normalText,\n color: theme.palette.base2,\n \"& p\": {\n color: theme.hv.palette.base.base2,\n },\n },\n\n tagButton: {\n width: 16,\n height: 16,\n minWidth: 16,\n minHeight: 16,\n padding: 0,\n margin: 0,\n },\n\n deleteIcon: {\n marginRight: 0,\n width: 16,\n height: 16,\n minWidth: 16,\n minHeight: 16,\n padding: 0,\n \"&:hover\": {\n backgroundColor: fade(theme.palette.base1, 0.3),\n },\n \"&:focus\": {\n ...outlineStyles,\n borderRadius: 0,\n },\n \"&:focus:not(:focus-visible)\": {\n outline: \"0 !important\",\n boxShadow: \"none !important\",\n },\n },\n disabledDeleteIcon: {\n \"&:hover\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n },\n \"&:focus\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n outline: \"none\",\n boxShadow: \"none\",\n outlineOffset: 0,\n },\n },\n titleOverflow: {\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n },\n categorical: {\n borderRadius: 8,\n \"&$clickable\": {\n cursor: \"pointer\",\n },\n \"&:hover\": {\n borderRadius: 8,\n },\n \"& $label > p\": {\n color: theme.hv.palette.accent.acce1,\n },\n \"&:focus:not(:focus-visible)\": {\n outline: \"0 !important\",\n boxShadow: \"none !important\",\n },\n },\n clickable: {},\n\n categoricalFocus: {\n \"&:focus\": {\n ...outlineStyles,\n },\n },\n\n disabled: {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n cursor: \"not-allowed\",\n \"& $label > p\": {\n color: theme.hv.palette.atmosphere.atmo5,\n },\n },\n\n categoricalDisabled: {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n cursor: \"not-allowed\",\n \"& $label > p\": {\n color: theme.hv.palette.atmosphere.atmo5,\n },\n \"&:hover\": {\n backgroundColor: theme.hv.palette.atmosphere.atmo3,\n },\n \"&:focus\": {\n outline: \"none\",\n },\n },\n\n semanticTextColor: {\n color: theme.hv.palette.base.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AAN,CAASP,OAAT,CAAiB2B,UAAjB,CAA4Bc;MADrB;IAHR,CAhGe;IAwGzBC,mBAAmB,EAAE;MACnB3C,eAAe,EAAEN,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiB2B,UAAjB,CAA4BC,KAD1B;MAEnBO,MAAM,EAAE,aAFW;MAGnB,gBAAgB;QACdtB,KAAK,EAAEpB,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiB2B,UAAjB,CAA4Bc;MADrB,CAHG;MAMnB,WAAW;QACT1C,eAAe,EAAEN,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiB2B,UAAjB,CAA4BC;MADpC,CANQ;MASnB,WAAW;QACTJ,OAAO,EAAE;MADA;IATQ,CAxGI;IAsHzBmB,iBAAiB,EAAE;MACjB9B,KAAK,EAAEpB,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiBe,IAAjB,CAAsBD;IADZ,CAtHM;IAyHzB8B,oBAAoB,EAAE;MACpB/B,KAAK,EAAEpB,KAAK,CAACc,EAAN,CAASP,OAAT,CAAiBoC,MAAjB,CAAwBC;IADX;EAzHG,CAAZ;AAAA,CAAf;;AA8HA,eAAe7C,MAAf"}
@@ -139,8 +139,9 @@ export interface HvTheme {
139
139
  type: string;
140
140
  name: string;
141
141
  palette: HvThemePalette;
142
- typography: HvThemeTypography;
142
+ shadows: string[];
143
143
  spacing: HvThemeSpacing;
144
+ typography: HvThemeTypography;
144
145
  viz: HvThemeVizPalette;
145
146
  }
146
147
 
@@ -1,22 +1,14 @@
1
1
  import { StandardProps } from "@mui/material";
2
+ import { HvTableInstance } from "../Table";
2
3
 
3
4
  export type HvControlsClassKey = "root" | "rightSection" | "leftSection";
4
5
 
5
- export interface HvControlsSortValue {
6
- id: string;
7
- desc: string;
8
- }
9
6
  export interface HvControlsViewConfiguration extends Record<string, unknown> {
10
7
  id: string;
11
8
  label: string;
12
9
  icon: React.ReactNode;
13
10
  }
14
11
 
15
- export interface HvControlsCallbacks extends Record<string, unknown> {
16
- setSortBy?: (v: HvControlsSortValue[]) => void;
17
- setGlobalFilter?: (v: string) => void;
18
- }
19
-
20
12
  export interface HvControlsProps
21
13
  extends StandardProps<React.HTMLAttributes<HTMLDivElement>, HvControlsClassKey> {
22
14
  /** Children to be rendered. */
@@ -29,7 +21,7 @@ export interface HvControlsProps
29
21
  * An instance of useHvTable or useTable used to manage the data
30
22
  * if this is not provided data sorting and search must be handled externally
31
23
  */
32
- callbacks?: HvControlsCallbacks;
24
+ callbacks?: Pick<HvTableInstance, "setSortBy" | "setGlobalFilter">;
33
25
  /**
34
26
  * Views configuration required for the view buttons
35
27
  */
@@ -10,7 +10,7 @@ export interface HvControlsViewConfiguration extends Record<string, unknown> {
10
10
  }
11
11
 
12
12
  export interface RightListControls extends ListValueProp {
13
- accesor: string;
13
+ accessor: string;
14
14
  desc: boolean;
15
15
  }
16
16
 
@@ -52,32 +52,19 @@ export interface HvProviderProps {
52
52
  * Ignored if a custom `generateClassName` is provided.
53
53
  */
54
54
  generateClassNameOptions?: GenerateClassNameOptions;
55
- /**
56
- * Injects the generated stylesheets at the top of the `<head>` element of the page.
57
- * This can ease the override of UI Kit components styles.
58
- *
59
- * By default, the styles are injected last in the `<head>` element of the page.
60
- */
61
- injectStylesFirst?: boolean;
62
55
  /**
63
56
  * Disables the generation of the styles.
64
57
  */
65
58
  disableStylesGeneration?: boolean;
66
59
 
67
60
  /**
68
- * Disables the generation of the baseline css styles.
69
- *
70
- * This will be the default behavior in the future.
71
- *
72
- * The application using UI Kit should be responsible for adding the baseline css styles, by
73
- * either using the `<HvCssBaseline />` component, using the `<HvScopedCssBaseline />` component,
74
- * or ensuring that the necessary base styles are applied.
75
- *
76
- * Defaults to `false`. Will be removed in the next major release.
61
+ * By default the baseline styles are applied globally to the application.
62
+ * If you need to scope the CSS to avoid styling conflicts, you can set this prop to `"scoped"`.
63
+ * If you are providing the baseline styles, you can set this prop to false.
77
64
  *
78
- * @see https://lumada-design.github.io/uikit/master/?path=/docs/foundation-css-baseline--main
65
+ * @see https://lumada-design.github.io/uikit/master/?path=/docs/theme-css-baseline--page
79
66
  */
80
- disableCssBaseline?: boolean;
67
+ cssBaseline?: "global" | "scoped" | "none";
81
68
  }
82
69
 
83
70
  export default function HvProvider(props: HvProviderProps): JSX.Element | null;
@@ -1,4 +1,4 @@
1
- var _HvCssBaseline;
1
+ var _HvCssBaseline, _HvScopedCssBaseline;
2
2
 
3
3
  import "core-js/modules/web.dom-collections.iterator.js";
4
4
  import React, { useState, useEffect, useMemo } from "react";
@@ -13,11 +13,8 @@ import "focus-visible";
13
13
  import { createTheme, ThemeProvider } from "@mui/material";
14
14
  import { StylesProvider } from "@mui/styles";
15
15
  import { StyledEngineProvider } from "@mui/material/styles";
16
- import { themeBuilder, createGenerateClassName, HvCssBaseline, getTheme } from "../theme";
16
+ import { themeBuilder, createGenerateClassName, HvCssBaseline, getTheme, HvScopedCssBaseline } from "../theme";
17
17
  import ConfigContext from "./context";
18
- import { jsx as _jsx } from "react/jsx-runtime";
19
- import { jsxs as _jsxs } from "react/jsx-runtime";
20
- let warnedOnce = false;
21
18
  /**
22
19
  * Augments the target theme with the differences found in the source theme.
23
20
  *
@@ -26,6 +23,9 @@ let warnedOnce = false;
26
23
  * @returns {Object} - A new modified material UI theme.
27
24
  */
28
25
 
26
+ import { jsx as _jsx } from "react/jsx-runtime";
27
+ import { jsxs as _jsxs } from "react/jsx-runtime";
28
+
29
29
  const applyCustomTheme = (InputTargetTheme, InputSourceTheme) => {
30
30
  const muiDefaultTheme = createTheme();
31
31
  const targetTheme = cloneDeep(InputTargetTheme);
@@ -77,24 +77,15 @@ const HvProvider = ({
77
77
  locale = "en-US",
78
78
  generateClassName: generateClassNameProp,
79
79
  generateClassNameOptions,
80
- injectStylesFirst = true,
81
80
  disableStylesGeneration = false,
82
- disableCssBaseline = false
81
+ cssBaseline = "global"
83
82
  }) => {
84
- if (process.env.NODE_ENV !== "production") {
85
- if (!warnedOnce && !disableCssBaseline) {
86
- warnedOnce = true; // eslint-disable-next-line no-console
87
-
88
- console.warn("UI Kit HvProvider's automatic definition of a css styles baseline will be removed in the next major version.\n" + "You can use the `disableCssBaseline` property to disable it already.\n" + "See https://lumada-design.github.io/uikit/master/?path=/docs/foundation-css-baseline--main");
89
- }
90
- }
91
-
92
- const [localeSetting, setLocaleStting] = useState(locale);
83
+ const [localeSetting, setLocaleSetting] = useState(locale);
93
84
  useEffect(() => {
94
85
  var _navigator;
95
86
 
96
87
  // ssr - only runs at the rendering phase, so it won't run on the server
97
- setLocaleStting(locale || ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.language));
88
+ setLocaleSetting(locale || ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.language));
98
89
  }, [locale]);
99
90
  const rawUiKitTheme = getTheme(uiKitTheme);
100
91
  const customTheme = applyCustomTheme(themeBuilder(rawUiKitTheme), theme);
@@ -103,14 +94,27 @@ const HvProvider = ({
103
94
  changeTheme,
104
95
  locale: localeSetting
105
96
  }), [changeTheme, localeSetting]);
97
+
98
+ const renderCssBaseline = () => {
99
+ if (cssBaseline === "global") {
100
+ return _HvCssBaseline || (_HvCssBaseline = /*#__PURE__*/_jsx(HvCssBaseline, {}));
101
+ }
102
+
103
+ if (cssBaseline === "scoped") {
104
+ return _HvScopedCssBaseline || (_HvScopedCssBaseline = /*#__PURE__*/_jsx(HvScopedCssBaseline, {}));
105
+ }
106
+
107
+ return null;
108
+ };
109
+
106
110
  return /*#__PURE__*/_jsx(StyledEngineProvider, {
107
- injectFirst: injectStylesFirst,
111
+ injectFirst: true,
108
112
  children: /*#__PURE__*/_jsx(StylesProvider, {
109
113
  generateClassName: generateClassName,
110
114
  disableGeneration: disableStylesGeneration,
111
115
  children: /*#__PURE__*/_jsxs(ThemeProvider, {
112
116
  theme: customTheme,
113
- children: [!disableCssBaseline && (_HvCssBaseline || (_HvCssBaseline = /*#__PURE__*/_jsx(HvCssBaseline, {}))), /*#__PURE__*/_jsx(ConfigContext.Provider, {
117
+ children: [renderCssBaseline(), /*#__PURE__*/_jsx(ConfigContext.Provider, {
114
118
  value: pConfig,
115
119
  children: children
116
120
  })]
@@ -181,33 +185,19 @@ process.env.NODE_ENV !== "production" ? HvProvider.propTypes = {
181
185
  seed: PropTypes.string
182
186
  }),
183
187
 
184
- /**
185
- * Injects the generated stylesheets at the top of the `<head>` element of the page.
186
- * This can ease the override of UI Kit components styles.
187
- *
188
- * By default, the styles are injected last in the `<head>` element of the page.
189
- */
190
- injectStylesFirst: PropTypes.bool,
191
-
192
188
  /**
193
189
  * Disables the generation of the styles.
194
190
  */
195
191
  disableStylesGeneration: PropTypes.bool,
196
192
 
197
193
  /**
198
- * Disables the generation of the baseline css styles.
199
- *
200
- * This will be the default behavior in the future.
201
- *
202
- * The application using UI Kit should be responsible for adding the baseline css styles, by
203
- * either using the `<HvCssBaseline />` component, using the `<HvScopedCssBaseline />` component,
204
- * or ensuring that the necessary base styles are applied.
205
- *
206
- * Defaults to `false`. Will be removed in the next major release.
194
+ * By default the baseline styles are applied globally to the application.
195
+ * If you need to scope the CSS to avoid styling conflicts, you can set this prop to `"scoped"`.
196
+ * If you are providing the baseline styles, you can set this prop to false.
207
197
  *
208
- * @see https://lumada-design.github.io/uikit/master/?path=/docs/foundation-css-baseline--main
198
+ * @see https://lumada-design.github.io/uikit/master/?path=/docs/theme-css-baseline--page
209
199
  */
210
- disableCssBaseline: PropTypes.bool
200
+ cssBaseline: PropTypes.oneOf(["global", "scoped", "none"])
211
201
  } : void 0;
212
202
  export default HvProvider;
213
203
  //# sourceMappingURL=Provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Provider.js","names":["React","useState","useEffect","useMemo","PropTypes","set","merge","isEmpty","cloneDeep","diff","createTheme","ThemeProvider","StylesProvider","StyledEngineProvider","themeBuilder","createGenerateClassName","HvCssBaseline","getTheme","ConfigContext","warnedOnce","applyCustomTheme","InputTargetTheme","InputSourceTheme","muiDefaultTheme","targetTheme","sourceTheme","deleteDifference","observableDiff","difference","partialCustomTheme","path","rhs","kind","HvProvider","children","uiKitTheme","theme","changeTheme","locale","generateClassName","generateClassNameProp","generateClassNameOptions","injectStylesFirst","disableStylesGeneration","disableCssBaseline","process","env","NODE_ENV","console","warn","localeSetting","setLocaleStting","navigator","language","rawUiKitTheme","customTheme","pConfig","propTypes","node","isRequired","oneOf","instanceOf","Object","func","string","shape","disableGlobal","bool","productionPrefix","seed"],"sources":["../../../src/Provider/Provider.js"],"sourcesContent":["import React, { useState, useEffect, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport set from \"lodash/set\";\nimport merge from \"lodash/merge\";\nimport isEmpty from \"lodash/isEmpty\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport diff from \"deep-diff\";\n\nimport \"focus-within-polyfill\";\nimport \"focus-visible\";\n\nimport { createTheme, ThemeProvider } from \"@mui/material\";\nimport { StylesProvider } from \"@mui/styles\";\nimport { StyledEngineProvider } from \"@mui/material/styles\";\nimport { themeBuilder, createGenerateClassName, HvCssBaseline, getTheme } from \"../theme\";\n\nimport ConfigContext from \"./context\";\n\nlet warnedOnce = false;\n\n/**\n * Augments the target theme with the differences found in the source theme.\n *\n * @param {Object} InputTargetTheme - A material UI Theme to be changed.\n * @param {Object} InputSourceTheme - A material UI Theme to apply on top.\n * @returns {Object} - A new modified material UI theme.\n */\nconst applyCustomTheme = (InputTargetTheme, InputSourceTheme) => {\n const muiDefaultTheme = createTheme();\n const targetTheme = cloneDeep(InputTargetTheme);\n const sourceTheme = cloneDeep(InputSourceTheme);\n const deleteDifference = \"D\";\n if (!isEmpty(targetTheme) && !isEmpty(sourceTheme)) {\n diff.observableDiff(muiDefaultTheme, sourceTheme, (difference) => {\n const partialCustomTheme = set({}, difference.path, difference.rhs);\n if (difference.kind !== deleteDifference) {\n // Do not include the differences of type \"delete\"\n merge(targetTheme, partialCustomTheme);\n }\n });\n return targetTheme;\n }\n return targetTheme;\n};\n\n/**\n * This component makes cross-component properties, like the active `theme` and `locale`,\n * available down the React tree thanks to React context.\n *\n * This component should preferably be used at **the root of your component tree** and\n * be unique in the App in most cases.\n *\n * ```jsx\n * <HvProvider>\n * <MyApp />\n * <HvProvider/>\n * ```\n *\n * If several `HvProvider`'s are used, either nested or in parallel, the `generateClassNameOptions`\n * must be tweaked to avoid CSS classnames collision. Or a custom JSS's class name generator can\n * be provided via the `generateClassName` property.\n *\n * **UI Kit components will not work at all if the `HvProvider` is not configured correctly**,\n * as they will not be able to access the properties of the active theme..\n *\n */\nconst HvProvider = ({\n children,\n\n uiKitTheme = \"dawn\",\n theme = null,\n changeTheme = () => {},\n\n locale = \"en-US\",\n\n generateClassName: generateClassNameProp,\n generateClassNameOptions,\n injectStylesFirst = true,\n disableStylesGeneration = false,\n\n disableCssBaseline = false,\n}) => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!warnedOnce && !disableCssBaseline) {\n warnedOnce = true;\n // eslint-disable-next-line no-console\n console.warn(\n \"UI Kit HvProvider's automatic definition of a css styles baseline will be removed in the next major version.\\n\" +\n \"You can use the `disableCssBaseline` property to disable it already.\\n\" +\n \"See https://lumada-design.github.io/uikit/master/?path=/docs/foundation-css-baseline--main\"\n );\n }\n }\n\n const [localeSetting, setLocaleStting] = useState(locale);\n\n useEffect(() => {\n // ssr - only runs at the rendering phase, so it won't run on the server\n setLocaleStting(locale || navigator?.language);\n }, [locale]);\n\n const rawUiKitTheme = getTheme(uiKitTheme);\n const customTheme = applyCustomTheme(themeBuilder(rawUiKitTheme), theme);\n\n const generateClassName =\n generateClassNameProp || createGenerateClassName(generateClassNameOptions);\n\n const pConfig = useMemo(\n () => ({ changeTheme, locale: localeSetting }),\n [changeTheme, localeSetting]\n );\n\n return (\n <StyledEngineProvider injectFirst={injectStylesFirst}>\n <StylesProvider\n generateClassName={generateClassName}\n disableGeneration={disableStylesGeneration}\n >\n <ThemeProvider theme={customTheme}>\n {!disableCssBaseline && <HvCssBaseline />}\n <ConfigContext.Provider value={pConfig}>{children}</ConfigContext.Provider>\n </ThemeProvider>\n </StylesProvider>\n </StyledEngineProvider>\n );\n};\n\nHvProvider.propTypes = {\n /**\n * Your component tree.\n */\n children: PropTypes.node.isRequired,\n\n /**\n * The Design System base theme in use. Defaults to `\"dawn\"`.\n */\n uiKitTheme: PropTypes.oneOf([\"dawn\", \"wicked\"]),\n /**\n * The UI Kit theme object to be applied on top of the base theme.\n */\n theme: PropTypes.instanceOf(Object),\n /**\n * Function stored in the provider's context to allow runtime switching of the active theme.\n * The implementation is up to each App.\n */\n changeTheme: PropTypes.func,\n\n /**\n * The locale to be used.\n * Defaults to the browser's configured locale or \"en-US\" if not available.\n */\n locale: PropTypes.string,\n\n /**\n * Custom JSS's class name generator.\n */\n generateClassName: PropTypes.func,\n /**\n * Built-in JSS's class name generator options.\n * Ignored if a custom `generateClassName` is provided.\n *\n * `disableGlobal`: Disable the generation of deterministic class names. Defaults to `false`.\n *\n * `productionPrefix`: The string used to prefix the class names in production. Defaults to `\"jss-uikit\"`.\n *\n * `seed`: The string used to uniquely identify the generator. Defaults to `\"\"`.\n * It can be used to avoid class name collisions when using multiple generators in the same document.\n */\n generateClassNameOptions: PropTypes.shape({\n /**\n * Disable the generation of deterministic class names. Defaults to `false`.\n */\n disableGlobal: PropTypes.bool,\n /**\n * The string used to prefix the class names in production. Defaults to `\"jss-uikit\"`.\n */\n productionPrefix: PropTypes.string,\n /**\n * The string used to uniquely identify the generator. Defaults to `\"\"`.\n * It can be used to avoid class name collisions when using multiple generators in the same document.\n */\n seed: PropTypes.string,\n }),\n /**\n * Injects the generated stylesheets at the top of the `<head>` element of the page.\n * This can ease the override of UI Kit components styles.\n *\n * By default, the styles are injected last in the `<head>` element of the page.\n */\n injectStylesFirst: PropTypes.bool,\n /**\n * Disables the generation of the styles.\n */\n disableStylesGeneration: PropTypes.bool,\n\n /**\n * Disables the generation of the baseline css styles.\n *\n * This will be the default behavior in the future.\n *\n * The application using UI Kit should be responsible for adding the baseline css styles, by\n * either using the `<HvCssBaseline />` component, using the `<HvScopedCssBaseline />` component,\n * or ensuring that the necessary base styles are applied.\n *\n * Defaults to `false`. Will be removed in the next major release.\n *\n * @see https://lumada-design.github.io/uikit/master/?path=/docs/foundation-css-baseline--main\n */\n disableCssBaseline: PropTypes.bool,\n};\n\nexport default HvProvider;\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,OAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,GAAP,MAAgB,YAAhB;AACA,OAAOC,KAAP,MAAkB,cAAlB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AACA,OAAOC,IAAP,MAAiB,WAAjB;AAEA,OAAO,uBAAP;AACA,OAAO,eAAP;AAEA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,eAA3C;AACA,SAASC,cAAT,QAA+B,aAA/B;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SAASC,YAAT,EAAuBC,uBAAvB,EAAgDC,aAAhD,EAA+DC,QAA/D,QAA+E,UAA/E;AAEA,OAAOC,aAAP,MAA0B,WAA1B;;;AAEA,IAAIC,UAAU,GAAG,KAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAG,CAACC,gBAAD,EAAmBC,gBAAnB,KAAwC;EAC/D,MAAMC,eAAe,GAAGb,WAAW,EAAnC;EACA,MAAMc,WAAW,GAAGhB,SAAS,CAACa,gBAAD,CAA7B;EACA,MAAMI,WAAW,GAAGjB,SAAS,CAACc,gBAAD,CAA7B;EACA,MAAMI,gBAAgB,GAAG,GAAzB;;EACA,IAAI,CAACnB,OAAO,CAACiB,WAAD,CAAR,IAAyB,CAACjB,OAAO,CAACkB,WAAD,CAArC,EAAoD;IAClDhB,IAAI,CAACkB,cAAL,CAAoBJ,eAApB,EAAqCE,WAArC,EAAmDG,UAAD,IAAgB;MAChE,MAAMC,kBAAkB,G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;IACxC;AACJ;AACA;IACIC,aAAa,EAAE9D,SAAS,CAAC+D,IAJe;;IAKxC;AACJ;AACA;IACIC,gBAAgB,EAAEhE,SAAS,CAAC4D,MARY;;IASxC;AACJ;AACA;AACA;IACIK,IAAI,EAAEjE,SAAS,CAAC4D;EAbwB,CAAhB,CAzCL;;EAwDrB;AACF;AACA;AACA;AACA;AACA;EACEtB,iBAAiB,EAAEtC,SAAS,CAAC+D,IA9DR;;EA+DrB;AACF;AACA;EACExB,uBAAuB,EAAEvC,SAAS,CAAC+D,IAlEd;;EAoErB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEvB,kBAAkB,EAAExC,SAAS,CAAC+D;AAjFT,CAAvB;AAoFA,eAAelC,UAAf"}
1
+ {"version":3,"file":"Provider.js","names":["React","useState","useEffect","useMemo","PropTypes","set","merge","isEmpty","cloneDeep","diff","createTheme","ThemeProvider","StylesProvider","StyledEngineProvider","themeBuilder","createGenerateClassName","HvCssBaseline","getTheme","HvScopedCssBaseline","ConfigContext","applyCustomTheme","InputTargetTheme","InputSourceTheme","muiDefaultTheme","targetTheme","sourceTheme","deleteDifference","observableDiff","difference","partialCustomTheme","path","rhs","kind","HvProvider","children","uiKitTheme","theme","changeTheme","locale","generateClassName","generateClassNameProp","generateClassNameOptions","disableStylesGeneration","cssBaseline","localeSetting","setLocaleSetting","navigator","language","rawUiKitTheme","customTheme","pConfig","renderCssBaseline","propTypes","node","isRequired","oneOf","instanceOf","Object","func","string","shape","disableGlobal","bool","productionPrefix","seed"],"sources":["../../../src/Provider/Provider.js"],"sourcesContent":["import React, { useState, useEffect, useMemo } from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport set from \"lodash/set\";\nimport merge from \"lodash/merge\";\nimport isEmpty from \"lodash/isEmpty\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport diff from \"deep-diff\";\n\nimport \"focus-within-polyfill\";\nimport \"focus-visible\";\n\nimport { createTheme, ThemeProvider } from \"@mui/material\";\nimport { StylesProvider } from \"@mui/styles\";\nimport { StyledEngineProvider } from \"@mui/material/styles\";\nimport {\n themeBuilder,\n createGenerateClassName,\n HvCssBaseline,\n getTheme,\n HvScopedCssBaseline,\n} from \"../theme\";\n\nimport ConfigContext from \"./context\";\n\n/**\n * Augments the target theme with the differences found in the source theme.\n *\n * @param {Object} InputTargetTheme - A material UI Theme to be changed.\n * @param {Object} InputSourceTheme - A material UI Theme to apply on top.\n * @returns {Object} - A new modified material UI theme.\n */\nconst applyCustomTheme = (InputTargetTheme, InputSourceTheme) => {\n const muiDefaultTheme = createTheme();\n const targetTheme = cloneDeep(InputTargetTheme);\n const sourceTheme = cloneDeep(InputSourceTheme);\n const deleteDifference = \"D\";\n if (!isEmpty(targetTheme) && !isEmpty(sourceTheme)) {\n diff.observableDiff(muiDefaultTheme, sourceTheme, (difference) => {\n const partialCustomTheme = set({}, difference.path, difference.rhs);\n if (difference.kind !== deleteDifference) {\n // Do not include the differences of type \"delete\"\n merge(targetTheme, partialCustomTheme);\n }\n });\n return targetTheme;\n }\n return targetTheme;\n};\n\n/**\n * This component makes cross-component properties, like the active `theme` and `locale`,\n * available down the React tree thanks to React context.\n *\n * This component should preferably be used at **the root of your component tree** and\n * be unique in the App in most cases.\n *\n * ```jsx\n * <HvProvider>\n * <MyApp />\n * <HvProvider/>\n * ```\n *\n * If several `HvProvider`'s are used, either nested or in parallel, the `generateClassNameOptions`\n * must be tweaked to avoid CSS classnames collision. Or a custom JSS's class name generator can\n * be provided via the `generateClassName` property.\n *\n * **UI Kit components will not work at all if the `HvProvider` is not configured correctly**,\n * as they will not be able to access the properties of the active theme..\n *\n */\nconst HvProvider = ({\n children,\n\n uiKitTheme = \"dawn\",\n theme = null,\n changeTheme = () => {},\n\n locale = \"en-US\",\n\n generateClassName: generateClassNameProp,\n generateClassNameOptions,\n disableStylesGeneration = false,\n\n cssBaseline = \"global\",\n}) => {\n const [localeSetting, setLocaleSetting] = useState(locale);\n\n useEffect(() => {\n // ssr - only runs at the rendering phase, so it won't run on the server\n setLocaleSetting(locale || navigator?.language);\n }, [locale]);\n\n const rawUiKitTheme = getTheme(uiKitTheme);\n const customTheme = applyCustomTheme(themeBuilder(rawUiKitTheme), theme);\n\n const generateClassName =\n generateClassNameProp || createGenerateClassName(generateClassNameOptions);\n\n const pConfig = useMemo(\n () => ({ changeTheme, locale: localeSetting }),\n [changeTheme, localeSetting]\n );\n\n const renderCssBaseline = () => {\n if (cssBaseline === \"global\") {\n return <HvCssBaseline />;\n }\n if (cssBaseline === \"scoped\") {\n return <HvScopedCssBaseline />;\n }\n return null;\n };\n\n return (\n <StyledEngineProvider injectFirst>\n <StylesProvider\n generateClassName={generateClassName}\n disableGeneration={disableStylesGeneration}\n >\n <ThemeProvider theme={customTheme}>\n {renderCssBaseline()}\n <ConfigContext.Provider value={pConfig}>{children}</ConfigContext.Provider>\n </ThemeProvider>\n </StylesProvider>\n </StyledEngineProvider>\n );\n};\n\nHvProvider.propTypes = {\n /**\n * Your component tree.\n */\n children: PropTypes.node.isRequired,\n\n /**\n * The Design System base theme in use. Defaults to `\"dawn\"`.\n */\n uiKitTheme: PropTypes.oneOf([\"dawn\", \"wicked\"]),\n /**\n * The UI Kit theme object to be applied on top of the base theme.\n */\n theme: PropTypes.instanceOf(Object),\n /**\n * Function stored in the provider's context to allow runtime switching of the active theme.\n * The implementation is up to each App.\n */\n changeTheme: PropTypes.func,\n\n /**\n * The locale to be used.\n * Defaults to the browser's configured locale or \"en-US\" if not available.\n */\n locale: PropTypes.string,\n\n /**\n * Custom JSS's class name generator.\n */\n generateClassName: PropTypes.func,\n /**\n * Built-in JSS's class name generator options.\n * Ignored if a custom `generateClassName` is provided.\n *\n * `disableGlobal`: Disable the generation of deterministic class names. Defaults to `false`.\n *\n * `productionPrefix`: The string used to prefix the class names in production. Defaults to `\"jss-uikit\"`.\n *\n * `seed`: The string used to uniquely identify the generator. Defaults to `\"\"`.\n * It can be used to avoid class name collisions when using multiple generators in the same document.\n */\n generateClassNameOptions: PropTypes.shape({\n /**\n * Disable the generation of deterministic class names. Defaults to `false`.\n */\n disableGlobal: PropTypes.bool,\n /**\n * The string used to prefix the class names in production. Defaults to `\"jss-uikit\"`.\n */\n productionPrefix: PropTypes.string,\n /**\n * The string used to uniquely identify the generator. Defaults to `\"\"`.\n * It can be used to avoid class name collisions when using multiple generators in the same document.\n */\n seed: PropTypes.string,\n }),\n /**\n * Disables the generation of the styles.\n */\n disableStylesGeneration: PropTypes.bool,\n /**\n * By default the baseline styles are applied globally to the application.\n * If you need to scope the CSS to avoid styling conflicts, you can set this prop to `\"scoped\"`.\n * If you are providing the baseline styles, you can set this prop to false.\n *\n * @see https://lumada-design.github.io/uikit/master/?path=/docs/theme-css-baseline--page\n */\n cssBaseline: PropTypes.oneOf([\"global\", \"scoped\", \"none\"]),\n};\n\nexport default HvProvider;\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,EAA0BC,SAA1B,EAAqCC,OAArC,QAAoD,OAApD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,GAAP,MAAgB,YAAhB;AACA,OAAOC,KAAP,MAAkB,cAAlB;AACA,OAAOC,OAAP,MAAoB,gBAApB;AACA,OAAOC,SAAP,MAAsB,kBAAtB;AACA,OAAOC,IAAP,MAAiB,WAAjB;AAEA,OAAO,uBAAP;AACA,OAAO,eAAP;AAEA,SAASC,WAAT,EAAsBC,aAAtB,QAA2C,eAA3C;AACA,SAASC,cAAT,QAA+B,aAA/B;AACA,SAASC,oBAAT,QAAqC,sBAArC;AACA,SACEC,YADF,EAEEC,uBAFF,EAGEC,aAHF,EAIEC,QAJF,EAKEC,mBALF,QAMO,UANP;AAQA,OAAOC,aAAP,MAA0B,WAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACA,MAAMC,gBAAgB,GAAG,CAACC,gBAAD,EAAmBC,gBAAnB,KAAwC;EAC/D,MAAMC,eAAe,GAAGb,WAAW,EAA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C,SAAS,CAACsD,IAlBF;;EAoBrB;AACF;AACA;AACA;EACEpB,MAAM,EAAElC,SAAS,CAACuD,MAxBG;;EA0BrB;AACF;AACA;EACEpB,iBAAiB,EAAEnC,SAAS,CAACsD,IA7BR;;EA8BrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEjB,wBAAwB,EAAErC,SAAS,CAACwD,KAAV,CAAgB;IACxC;AACJ;AACA;IACIC,aAAa,EAAEzD,SAAS,CAAC0D,IAJe;;IAKxC;AACJ;AACA;IACIC,gBAAgB,EAAE3D,SAAS,CAACuD,MARY;;IASxC;AACJ;AACA;AACA;IACIK,IAAI,EAAE5D,SAAS,CAACuD;EAbwB,CAAhB,CAzCL;;EAwDrB;AACF;AACA;EACEjB,uBAAuB,EAAEtC,SAAS,CAAC0D,IA3Dd;;EA4DrB;AACF;AACA;AACA;AACA;AACA;AACA;EACEnB,WAAW,EAAEvC,SAAS,CAACmD,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,EAAqB,MAArB,CAAhB;AAnEQ,CAAvB;AAsEA,eAAetB,UAAf"}
@@ -1,17 +1,16 @@
1
- import { FunctionComponent } from "react";
2
-
3
- export type GridSpacing = "xs" | "sm" | "md" | "lg";
4
- export type Breakpoints = {
1
+ export type Spacing = "xs" | "sm" | "md" | "lg";
2
+ export type Breakpoint = {
5
3
  cols?: number;
6
4
  maxWidth?: number;
7
5
  minWidth?: number;
8
- spacing?: GridSpacing;
6
+ spacing?: Spacing;
9
7
  };
10
8
 
11
- export interface SimpleGridProps extends FunctionComponent {
12
- spacing?: GridSpacing;
9
+ export interface SimpleGridProps {
10
+ children?: JSX.Element | JSX.Element[];
11
+ spacing?: Spacing;
13
12
  cols?: number;
14
- breakpoints?: Breakpoints;
13
+ breakpoints?: Breakpoint[];
15
14
  }
16
15
 
17
16
  export default function HvSimpleGrid(props: SimpleGridProps): JSX.Element | null;
@@ -9,6 +9,10 @@ export interface HvTableBodyProps
9
9
  * Defaults to `thead`.
10
10
  */
11
11
  component?: React.ElementType<React.HTMLAttributes<HTMLElement>>;
12
+ /**
13
+ * Sets whether or not there should be arrow navigation between the table rows
14
+ */
15
+ withNavigation?: boolean;
12
16
  }
13
17
 
14
18
  export default function HvTableBody(props: HvTableBodyProps): JSX.Element | null;
@@ -1,3 +1,4 @@
1
+ export { hvTextColumn, hvNumberColumn, hvDateColumn, hvExpandColumn, hvTagColumn, hvSwitchColumn, hvDropdownColumn, hvProgressColumn } from "./renderers";
1
2
  export { default as HvDateColumnCell } from "./DateColumnCell";
2
3
  export { default as HvDropdownColumnCell } from "./DropdownColumnCell";
3
4
  export { default as HvProgressColumnCell, normalizeProgressBar } from "./ProgressColumnCell";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","HvDateColumnCell","HvDropdownColumnCell","HvProgressColumnCell","normalizeProgressBar","HvSwitchColumnCell"],"sources":["../../../../src/Table/renderers/index.js"],"sourcesContent":["export { default as HvDateColumnCell } from \"./DateColumnCell\";\nexport { default as HvDropdownColumnCell } from \"./DropdownColumnCell\";\nexport { default as HvProgressColumnCell, normalizeProgressBar } from \"./ProgressColumnCell\";\nexport { default as HvSwitchColumnCell } from \"./SwitchColumnCell\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,gBAApB,QAA4C,kBAA5C;AACA,SAASD,OAAO,IAAIE,oBAApB,QAAgD,sBAAhD;AACA,SAASF,OAAO,IAAIG,oBAApB,EAA0CC,oBAA1C,QAAsE,sBAAtE;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,oBAA9C"}
1
+ {"version":3,"file":"index.js","names":["hvTextColumn","hvNumberColumn","hvDateColumn","hvExpandColumn","hvTagColumn","hvSwitchColumn","hvDropdownColumn","hvProgressColumn","default","HvDateColumnCell","HvDropdownColumnCell","HvProgressColumnCell","normalizeProgressBar","HvSwitchColumnCell"],"sources":["../../../../src/Table/renderers/index.js"],"sourcesContent":["export {\n hvTextColumn,\n hvNumberColumn,\n hvDateColumn,\n hvExpandColumn,\n hvTagColumn,\n hvSwitchColumn,\n hvDropdownColumn,\n hvProgressColumn,\n} from \"./renderers\";\nexport { default as HvDateColumnCell } from \"./DateColumnCell\";\nexport { default as HvDropdownColumnCell } from \"./DropdownColumnCell\";\nexport { default as HvProgressColumnCell, normalizeProgressBar } from \"./ProgressColumnCell\";\nexport { default as HvSwitchColumnCell } from \"./SwitchColumnCell\";\n"],"mappings":"AAAA,SACEA,YADF,EAEEC,cAFF,EAGEC,YAHF,EAIEC,cAJF,EAKEC,WALF,EAMEC,cANF,EAOEC,gBAPF,EAQEC,gBARF,QASO,aATP;AAUA,SAASC,OAAO,IAAIC,gBAApB,QAA4C,kBAA5C;AACA,SAASD,OAAO,IAAIE,oBAApB,QAAgD,sBAAhD;AACA,SAASF,OAAO,IAAIG,oBAApB,EAA0CC,oBAA1C,QAAsE,sBAAtE;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,oBAA9C"}
@@ -21,15 +21,15 @@ import { hvStringFallback, hvNumberFallback } from "../utils";
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
22
  import { Fragment as _Fragment } from "react/jsx-runtime";
23
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
- export const hvTextColumn = col => {
24
+ export function hvTextColumn(col) {
25
25
  return _objectSpread({
26
26
  Cell: cellProps => /*#__PURE__*/_jsx(HvOverflowTooltip, {
27
27
  data: hvStringFallback(cellProps === null || cellProps === void 0 ? void 0 : cellProps.value)
28
28
  }),
29
29
  sortType: "alphanumeric"
30
30
  }, col);
31
- };
32
- export const hvNumberColumn = col => {
31
+ }
32
+ export function hvNumberColumn(col) {
33
33
  return _objectSpread({
34
34
  Cell: ({
35
35
  value
@@ -37,8 +37,8 @@ export const hvNumberColumn = col => {
37
37
  align: "right",
38
38
  sortType: "number"
39
39
  }, col);
40
- };
41
- export const hvDateColumn = (col, dateFormat) => {
40
+ }
41
+ export function hvDateColumn(col, dateFormat) {
42
42
  return _objectSpread({
43
43
  Cell: cellProps => /*#__PURE__*/_jsx(DateColumnCell, {
44
44
  date: cellProps === null || cellProps === void 0 ? void 0 : cellProps.value,
@@ -47,7 +47,7 @@ export const hvDateColumn = (col, dateFormat) => {
47
47
  sortType: "alphanumeric",
48
48
  sortDescFirst: true
49
49
  }, col);
50
- };
50
+ }
51
51
  export function hvExpandColumn(col, expandRowButtonAriaLabel, collapseRowButtonAriaLabel, getCanRowExpand) {
52
52
  return _objectSpread({
53
53
  Cell: cellProps => {
@@ -1 +1 @@
1
- {"version":3,"file":"renderers.js","names":["React","DropDownXS","DropRightXS","HvButton","HvTag","HvTypography","HvOverflowTooltip","setId","DateColumnCell","SwitchColumnCell","ProgressColumnCell","DropdownColumnCell","hvStringFallback","hvNumberFallback","hvTextColumn","col","Cell","cellProps","value","sortType","hvNumberColumn","align","hvDateColumn","dateFormat","sortDescFirst","hvExpandColumn","expandRowButtonAriaLabel","collapseRowButtonAriaLabel","getCanRowExpand","row","onClick","getToggleRowExpandedProps","hasContent","isExpanded","position","left","top","cellStyle","hvTagColumn","valueDataKey","colorDataKey","textColorDataKey","fromRowData","tagProps","name","color","textColor","original","paddingTop","paddingBottom","hvSwitchColumn","switchLabel","falseLabel","trueLabel","switchProps","id","hvDropdownColumn","placeholder","disabledPlaceholder","onChange","column","dsbld","length","val","hvProgressColumn","getPartial","getTotal","partial","total"],"sources":["../../../../src/Table/renderers/renderers.js"],"sourcesContent":["import React from \"react\";\nimport { DropDownXS, DropRightXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport HvButton from \"../../Button\";\nimport HvTag from \"../../Tag\";\nimport HvTypography from \"../../Typography\";\nimport HvOverflowTooltip from \"../../OverflowTooltip\";\nimport { setId } from \"../../utils\";\n\nimport DateColumnCell from \"./DateColumnCell\";\nimport SwitchColumnCell from \"./SwitchColumnCell\";\nimport ProgressColumnCell from \"./ProgressColumnCell\";\nimport DropdownColumnCell from \"./DropdownColumnCell\";\nimport { hvStringFallback, hvNumberFallback } from \"../utils\";\n\nexport const hvTextColumn = (col) => {\n return {\n Cell: (cellProps) => <HvOverflowTooltip data={hvStringFallback(cellProps?.value)} />,\n sortType: \"alphanumeric\",\n ...col,\n };\n};\n\nexport const hvNumberColumn = (col) => {\n return {\n Cell: ({ value }) => hvNumberFallback(value),\n align: \"right\",\n sortType: \"number\",\n ...col,\n };\n};\n\nexport const hvDateColumn = (col, dateFormat) => {\n return {\n Cell: (cellProps) => <DateColumnCell date={cellProps?.value} dateFormat={dateFormat} />,\n sortType: \"alphanumeric\",\n sortDescFirst: true,\n ...col,\n };\n};\n\nexport function hvExpandColumn(\n col,\n expandRowButtonAriaLabel,\n collapseRowButtonAriaLabel,\n getCanRowExpand\n) {\n return {\n Cell: (cellProps) => {\n const { value, row } = cellProps;\n const { onClick } = row.getToggleRowExpandedProps();\n\n const hasContent = getCanRowExpand?.(row) ?? true;\n\n return (\n <>\n {hasContent && (\n <HvButton\n icon\n category=\"ghost\"\n aria-label={row.isExpanded ? collapseRowButtonAriaLabel : expandRowButtonAriaLabel}\n aria-expanded={row.isExpanded}\n onClick={onClick}\n style={{ position: \"absolute\", left: 0, top: 0 }}\n >\n {row.isExpanded ? <DropDownXS /> : <DropRightXS />}\n </HvButton>\n )}\n\n <HvOverflowTooltip data={hvStringFallback(value)} />\n </>\n );\n },\n sortType: \"alphanumeric\",\n cellStyle: {\n position: \"relative\",\n },\n ...col,\n };\n}\n\nexport function hvTagColumn(\n col,\n valueDataKey,\n colorDataKey,\n textColorDataKey,\n fromRowData = false,\n tagProps\n) {\n return {\n Cell: (cellProps) => {\n const { value, row } = cellProps;\n if (!value) {\n return \"—\";\n }\n\n const {\n [valueDataKey]: name,\n [colorDataKey]: color,\n [textColorDataKey]: textColor,\n } = fromRowData ? row.original : value;\n\n return (\n <HvTag\n label={<HvTypography variant=\"normalText\">{name}</HvTypography>}\n type=\"semantic\"\n color={color}\n style={textColor != null ? { color: textColor } : {}}\n tabIndex={-1}\n {...tagProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvSwitchColumn(col, switchLabel, falseLabel, trueLabel, switchProps) {\n return {\n Cell: (cellProps) => {\n const { value, row } = cellProps;\n return (\n <SwitchColumnCell\n checked={value}\n value={row.id}\n switchLabel={switchLabel}\n falseLabel={falseLabel}\n trueLabel={trueLabel}\n switchProps={switchProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvDropdownColumn(col, id, placeholder, disabledPlaceholder, onChange) {\n return {\n Cell: (cellProps) => {\n const { value, row, column } = cellProps;\n const dsbld = value.length < 1;\n return (\n <DropdownColumnCell\n values={value}\n placeholder={dsbld ? disabledPlaceholder : placeholder}\n onChange={(val) => onChange?.(row.id, val)}\n disabled={dsbld}\n dropdownProps={{\n \"aria-labelledby\": setId(id, column.id),\n }}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvProgressColumn(col, getPartial, getTotal, color) {\n return {\n Cell: (cellProps) => {\n const { row } = cellProps;\n const partial = getPartial?.(row);\n const total = getTotal?.(row);\n\n if (total) {\n return <ProgressColumnCell partial={partial} total={total} color={color} />;\n }\n\n return \"—\";\n },\n\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,mCAAxC;AAEA,OAAOC,QAAP,MAAqB,cAArB;AACA,OAAOC,KAAP,MAAkB,WAAlB;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,KAAT,QAAsB,aAAtB;AAEA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,kBAAP,MAA+B,sBAA/B;AACA,OA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KAAK,CAACgD,EAAD,EAAKK,MAAM,CAACL,EAAZ;QADX;MALjB,EADF;IAWD,CAfH;IAgBElB,SAAS,EAAE;MACTW,UAAU,EAAE,CADH;MAETC,aAAa,EAAE;IAFN;EAhBb,GAoBKlC,GApBL;AAsBD;AAED,OAAO,SAASiD,gBAAT,CAA0BjD,GAA1B,EAA+BkD,UAA/B,EAA2CC,QAA3C,EAAqDrB,KAArD,EAA4D;EACjE;IACE7B,IAAI,EAAGC,SAAD,IAAe;MACnB,MAAM;QAAEY;MAAF,IAAUZ,SAAhB;MACA,MAAMkD,OAAO,GAAGF,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAGpC,GAAH,CAA1B;MACA,MAAMuC,KAAK,GAAGF,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAGrC,GAAH,CAAtB;;MAEA,IAAIuC,KAAJ,EAAW;QACT,oBAAO,KAAC,kBAAD;UAAoB,OAAO,EAAED,OAA7B;UAAsC,KAAK,EAAEC,KAA7C;UAAoD,KAAK,EAAEvB;QAA3D,EAAP;MACD;;MAED,OAAO,GAAP;IACD,CAXH;IAaER,SAAS,EAAE;MACTW,UAAU,EAAE,CADH;MAETC,aAAa,EAAE;IAFN;EAbb,GAiBKlC,GAjBL;AAmBD"}
1
+ {"version":3,"file":"renderers.js","names":["React","DropDownXS","DropRightXS","HvButton","HvTag","HvTypography","HvOverflowTooltip","setId","DateColumnCell","SwitchColumnCell","ProgressColumnCell","DropdownColumnCell","hvStringFallback","hvNumberFallback","hvTextColumn","col","Cell","cellProps","value","sortType","hvNumberColumn","align","hvDateColumn","dateFormat","sortDescFirst","hvExpandColumn","expandRowButtonAriaLabel","collapseRowButtonAriaLabel","getCanRowExpand","row","onClick","getToggleRowExpandedProps","hasContent","isExpanded","position","left","top","cellStyle","hvTagColumn","valueDataKey","colorDataKey","textColorDataKey","fromRowData","tagProps","name","color","textColor","original","paddingTop","paddingBottom","hvSwitchColumn","switchLabel","falseLabel","trueLabel","switchProps","id","hvDropdownColumn","placeholder","disabledPlaceholder","onChange","column","dsbld","length","val","hvProgressColumn","getPartial","getTotal","partial","total"],"sources":["../../../../src/Table/renderers/renderers.js"],"sourcesContent":["import React from \"react\";\nimport { DropDownXS, DropRightXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport HvButton from \"../../Button\";\nimport HvTag from \"../../Tag\";\nimport HvTypography from \"../../Typography\";\nimport HvOverflowTooltip from \"../../OverflowTooltip\";\nimport { setId } from \"../../utils\";\n\nimport DateColumnCell from \"./DateColumnCell\";\nimport SwitchColumnCell from \"./SwitchColumnCell\";\nimport ProgressColumnCell from \"./ProgressColumnCell\";\nimport DropdownColumnCell from \"./DropdownColumnCell\";\nimport { hvStringFallback, hvNumberFallback } from \"../utils\";\n\nexport function hvTextColumn(col) {\n return {\n Cell: (cellProps) => <HvOverflowTooltip data={hvStringFallback(cellProps?.value)} />,\n sortType: \"alphanumeric\",\n ...col,\n };\n}\n\nexport function hvNumberColumn(col) {\n return {\n Cell: ({ value }) => hvNumberFallback(value),\n align: \"right\",\n sortType: \"number\",\n ...col,\n };\n}\n\nexport function hvDateColumn(col, dateFormat) {\n return {\n Cell: (cellProps) => <DateColumnCell date={cellProps?.value} dateFormat={dateFormat} />,\n sortType: \"alphanumeric\",\n sortDescFirst: true,\n ...col,\n };\n}\n\nexport function hvExpandColumn(\n col,\n expandRowButtonAriaLabel,\n collapseRowButtonAriaLabel,\n getCanRowExpand\n) {\n return {\n Cell: (cellProps) => {\n const { value, row } = cellProps;\n const { onClick } = row.getToggleRowExpandedProps();\n\n const hasContent = getCanRowExpand?.(row) ?? true;\n\n return (\n <>\n {hasContent && (\n <HvButton\n icon\n category=\"ghost\"\n aria-label={row.isExpanded ? collapseRowButtonAriaLabel : expandRowButtonAriaLabel}\n aria-expanded={row.isExpanded}\n onClick={onClick}\n style={{ position: \"absolute\", left: 0, top: 0 }}\n >\n {row.isExpanded ? <DropDownXS /> : <DropRightXS />}\n </HvButton>\n )}\n\n <HvOverflowTooltip data={hvStringFallback(value)} />\n </>\n );\n },\n sortType: \"alphanumeric\",\n cellStyle: {\n position: \"relative\",\n },\n ...col,\n };\n}\n\nexport function hvTagColumn(\n col,\n valueDataKey,\n colorDataKey,\n textColorDataKey,\n fromRowData = false,\n tagProps\n) {\n return {\n Cell: (cellProps) => {\n const { value, row } = cellProps;\n if (!value) {\n return \"—\";\n }\n\n const {\n [valueDataKey]: name,\n [colorDataKey]: color,\n [textColorDataKey]: textColor,\n } = fromRowData ? row.original : value;\n\n return (\n <HvTag\n label={<HvTypography variant=\"normalText\">{name}</HvTypography>}\n type=\"semantic\"\n color={color}\n style={textColor != null ? { color: textColor } : {}}\n tabIndex={-1}\n {...tagProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvSwitchColumn(col, switchLabel, falseLabel, trueLabel, switchProps) {\n return {\n Cell: (cellProps) => {\n const { value, row } = cellProps;\n return (\n <SwitchColumnCell\n checked={value}\n value={row.id}\n switchLabel={switchLabel}\n falseLabel={falseLabel}\n trueLabel={trueLabel}\n switchProps={switchProps}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvDropdownColumn(col, id, placeholder, disabledPlaceholder, onChange) {\n return {\n Cell: (cellProps) => {\n const { value, row, column } = cellProps;\n const dsbld = value.length < 1;\n return (\n <DropdownColumnCell\n values={value}\n placeholder={dsbld ? disabledPlaceholder : placeholder}\n onChange={(val) => onChange?.(row.id, val)}\n disabled={dsbld}\n dropdownProps={{\n \"aria-labelledby\": setId(id, column.id),\n }}\n />\n );\n },\n cellStyle: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n ...col,\n };\n}\n\nexport function hvProgressColumn(col, getPartial, getTotal, color) {\n return {\n Cell: (cellProps) => {\n const { row } = cellProps;\n const partial = getPartial?.(row);\n const total = getTotal?.(row);\n\n if (total) {\n return <ProgressColumnCell partial={partial} total={total}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"}
@@ -7,14 +7,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
7
7
 
8
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
9
 
10
- import React, { useMemo, useState } from "react";
10
+ import React, { useState } from "react";
11
11
  import { Chip } from "@mui/material";
12
12
  import { withStyles, useTheme } from "@mui/styles";
13
13
  import PropTypes from "prop-types";
14
14
  import clsx from "clsx";
15
15
  import { CloseXS } from "@hitachivantara/uikit-react-icons";
16
16
  import fade from "../utils/hexToRgbA";
17
- import { HvButton, HvTypography } from "..";
17
+ import { HvButton } from "..";
18
18
  import styles from "./styles";
19
19
  import { getOnDeleteCallback, hasDeleteAction, hasClickAction } from "./utils";
20
20
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -45,8 +45,6 @@ const getColor = (theme, customColor, type) => {
45
45
 
46
46
 
47
47
  const HvTag = props => {
48
- var _HvTypography;
49
-
50
48
  const {
51
49
  classes,
52
50
  style,
@@ -104,18 +102,8 @@ const HvTag = props => {
104
102
  }
105
103
 
106
104
  const [hover, setHover] = useState(false);
107
- const chipLabel = useMemo(() => {
108
- if (typeof label === "string") {
109
- return _HvTypography || (_HvTypography = /*#__PURE__*/_jsx(HvTypography, {
110
- variant: "normalText",
111
- children: label
112
- }));
113
- }
114
-
115
- return label;
116
- }, [label]);
117
105
  return /*#__PURE__*/_jsx(Chip, _objectSpread({
118
- label: chipLabel,
106
+ label: label,
119
107
  className: clsx(classes.root, className),
120
108
  onMouseEnter: () => {
121
109
  setHover(!!onClick);
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","names":["React","useMemo","useState","Chip","withStyles","useTheme","PropTypes","clsx","CloseXS","fade","HvButton","HvTypography","styles","getOnDeleteCallback","hasDeleteAction","hasClickAction","getColor","theme","customColor","type","defaultSemanticColor","hv","palette","semantic","sema7","defaultCategoricalColor","viz","categorical","cviz1","backgroundColor","HvTag","props","classes","style","className","label","disabled","color","deleteIcon","onDelete","onClick","role","deleteButtonArialLabel","deleteButtonProps","others","getDeleteIcon","disabledSemanticColor","tabIndex","startIcon","tagButton","focusVisible","primary","primaryButton","cursor","undefined","height","inlineStyle","categoricalBackgroundColor","hover","setHover","chipLabel","root","boxShadow","chipRoot","clickable","categoricalDisabled","categoricalFocus","disabledDeleteIcon","propTypes","shape","string","titleOverflow","semanticTextColor","categoricalTextColor","deletable","isRequired","instanceOf","Object","node","bool","oneOf","func","name"],"sources":["../../../src/Tag/Tag.js"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport { Chip } from \"@mui/material\";\nimport { withStyles, useTheme } from \"@mui/styles\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { CloseXS } from \"@hitachivantara/uikit-react-icons\";\n\nimport fade from \"../utils/hexToRgbA\";\nimport { HvButton, HvTypography } from \"..\";\nimport styles from \"./styles\";\nimport { getOnDeleteCallback, hasDeleteAction, hasClickAction } from \"./utils\";\n\nconst getColor = (theme, customColor, type) => {\n const defaultSemanticColor = theme.hv.palette.semantic.sema7;\n const defaultCategoricalColor = theme.hv.viz.palette.categorical.cviz1;\n\n let backgroundColor;\n\n if (type === \"semantic\") {\n backgroundColor = theme.palette[customColor] || customColor || defaultSemanticColor;\n }\n if (type === \"categorical\") {\n backgroundColor =\n theme.hv.viz.palette.categorical[customColor] || customColor || defaultCategoricalColor;\n }\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 */\nconst HvTag = (props) => {\n const {\n classes,\n style,\n className,\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 } = props;\n\n const getDeleteIcon = () => {\n const disabledSemanticColor = type === \"semantic\" ? \"atmo5\" : \"base2\";\n const { tabIndex = 0 } = deleteButtonProps;\n\n return (\n <HvButton\n classes={{\n startIcon: classes.tagButton,\n focusVisible: classes.focusVisible,\n primary: classes.primaryButton,\n }}\n aria-label={deleteButtonArialLabel}\n tabIndex={tabIndex}\n {...deleteButtonProps}\n >\n <CloseXS\n iconSize=\"XS\"\n style={{\n ...(disabled ? { cursor: \"not-allowed\" } : undefined),\n height: 16,\n }}\n color={disabled ? disabledSemanticColor : \"base2\"}\n />\n </HvButton>\n );\n };\n\n const theme = useTheme();\n\n const inlineStyle = {\n ...style,\n };\n\n let categoricalBackgroundColor;\n\n if (type === \"semantic\") {\n inlineStyle.backgroundColor = getColor(theme, color, type);\n } else if (type === \"categorical\") {\n categoricalBackgroundColor = getColor(theme, color, type);\n\n inlineStyle.backgroundColor = fade(categoricalBackgroundColor, 0.3);\n }\n\n const [hover, setHover] = useState(false);\n\n const chipLabel = useMemo(() => {\n if (typeof label === \"string\") {\n return <HvTypography variant=\"normalText\">{label}</HvTypography>;\n }\n\n return label;\n }, [label]);\n\n return (\n <Chip\n label={chipLabel}\n className={clsx(classes.root, className)}\n onMouseEnter={() => {\n setHover(!!onClick);\n }}\n onMouseLeave={() => {\n setHover(false);\n }}\n style={{\n ...(disabled ? null : inlineStyle),\n ...(hover && !disabled ? { boxShadow: `0 0 0 1pt ${categoricalBackgroundColor}` } : null),\n }}\n classes={{\n root: clsx(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: clsx(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\nHvTag.propTypes = {\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n chipRoot: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n label: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n tagButton: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n deleteIcon: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n disabledDeleteIcon: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n titleOverflow: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categorical: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categoricalDisabled: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n disabled: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n semanticTextColor: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categoricalTextColor: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n deletable: PropTypes.string,\n /**\n * Styles applied to the component if has onClick.\n */\n clickable: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n focusVisible: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n primaryButton: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categoricalFocus: PropTypes.string,\n }).isRequired,\n\n /**\n * Inline styles to be applied to the root element.\n */\n style: PropTypes.instanceOf(Object),\n\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n\n /**\n * The label of the tag element.\n *\n */\n label: PropTypes.node,\n\n /**\n * Indicates that the form element is disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * The type of the tag element.\n *\n * A tag can be of semantic or categoric type\n */\n type: PropTypes.oneOf([\"semantic\", \"categorical\"]),\n\n /**\n * Background color to be applied to the tag\n */\n color: PropTypes.string,\n /**\n * Icon used to customize the delete icon in the Chip element\n */\n deleteIcon: PropTypes.node,\n\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component,\n * in order to render the delete icon\n */\n onDelete: PropTypes.func,\n /**\n * Callback triggered when any item is clicked.\n */\n onClick: PropTypes.func,\n\n /**\n * The role of the element with an attributed event.\n */\n role: PropTypes.string,\n /**\n * Aria properties to apply to delete button in tag\n */\n deleteButtonArialLabel: PropTypes.string,\n /**\n * Props to apply to delete button\n */\n deleteButtonProps: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvTag\" })(HvTag);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,OAAhB,EAAyBC,QAAzB,QAAyC,OAAzC;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,UAAT,EAAqBC,QAArB,QAAqC,aAArC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,OAAT,QAAwB,mCAAxB;AAEA,OAAOC,IAAP,MAAiB,oBAAjB;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,IAAvC;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,SAASC,mBAAT,EAA8BC,eAA9B,EAA+CC,cAA/C,QAAqE,SAArE;;;AAEA,MAAMC,QAAQ,GAAG,CAACC,KAAD,EAAQC,WAAR,EAAqBC,IAArB,KAA8B;EAC7C,MAAMC,oBAAoB,GAAGH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,QAAjB,CAA0BC,KAAvD;EACA,MAAMC,uBAAuB,GAAGR,KAAK,CAACI,EAAN,CAASK,GAAT,CAAaJ,OAAb,CAAqBK,WAArB,CAAiCC,KAA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UAAD,EAAa,aAAb,CAAhB,CArGU;;EAuGhB;AACF;AACA;EACE3C,KAAK,EAAE/B,SAAS,CAACgE,MA1GD;;EA2GhB;AACF;AACA;EACEhC,UAAU,EAAEhC,SAAS,CAACwE,IA9GN;;EAgHhB;AACF;AACA;AACA;AACA;EACEvC,QAAQ,EAAEjC,SAAS,CAAC2E,IArHJ;;EAsHhB;AACF;AACA;EACEzC,OAAO,EAAElC,SAAS,CAAC2E,IAzHH;;EA2HhB;AACF;AACA;EACExC,IAAI,EAAEnC,SAAS,CAACgE,MA9HA;;EA+HhB;AACF;AACA;EACE5B,sBAAsB,EAAEpC,SAAS,CAACgE,MAlIlB;;EAmIhB;AACF;AACA;EACE3B,iBAAiB,EAAErC,SAAS,CAACsE,UAAV,CAAqBC,MAArB;AAtIH,CAAlB;AAyIA,eAAezE,UAAU,CAACQ,MAAD,EAAS;EAAEsE,IAAI,EAAE;AAAR,CAAT,CAAV,CAAsCpD,KAAtC,CAAf"}
1
+ {"version":3,"file":"Tag.js","names":["React","useState","Chip","withStyles","useTheme","PropTypes","clsx","CloseXS","fade","HvButton","styles","getOnDeleteCallback","hasDeleteAction","hasClickAction","getColor","theme","customColor","type","defaultSemanticColor","hv","palette","semantic","sema7","defaultCategoricalColor","viz","categorical","cviz1","backgroundColor","HvTag","props","classes","style","className","label","disabled","color","deleteIcon","onDelete","onClick","role","deleteButtonArialLabel","deleteButtonProps","others","getDeleteIcon","disabledSemanticColor","tabIndex","startIcon","tagButton","focusVisible","primary","primaryButton","cursor","undefined","height","inlineStyle","categoricalBackgroundColor","hover","setHover","root","boxShadow","chipRoot","clickable","categoricalDisabled","categoricalFocus","disabledDeleteIcon","propTypes","shape","string","titleOverflow","semanticTextColor","categoricalTextColor","deletable","isRequired","instanceOf","Object","node","bool","oneOf","func","name"],"sources":["../../../src/Tag/Tag.js"],"sourcesContent":["import React, { useState } from \"react\";\nimport { Chip } from \"@mui/material\";\nimport { withStyles, useTheme } from \"@mui/styles\";\nimport PropTypes from \"prop-types\";\nimport clsx from \"clsx\";\nimport { CloseXS } from \"@hitachivantara/uikit-react-icons\";\nimport fade from \"../utils/hexToRgbA\";\nimport { HvButton } from \"..\";\nimport styles from \"./styles\";\nimport { getOnDeleteCallback, hasDeleteAction, hasClickAction } from \"./utils\";\n\nconst getColor = (theme, customColor, type) => {\n const defaultSemanticColor = theme.hv.palette.semantic.sema7;\n const defaultCategoricalColor = theme.hv.viz.palette.categorical.cviz1;\n\n let backgroundColor;\n\n if (type === \"semantic\") {\n backgroundColor = theme.palette[customColor] || customColor || defaultSemanticColor;\n }\n if (type === \"categorical\") {\n backgroundColor =\n theme.hv.viz.palette.categorical[customColor] || customColor || defaultCategoricalColor;\n }\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 */\nconst HvTag = (props) => {\n const {\n classes,\n style,\n className,\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 } = props;\n\n const getDeleteIcon = () => {\n const disabledSemanticColor = type === \"semantic\" ? \"atmo5\" : \"base2\";\n const { tabIndex = 0 } = deleteButtonProps;\n\n return (\n <HvButton\n classes={{\n startIcon: classes.tagButton,\n focusVisible: classes.focusVisible,\n primary: classes.primaryButton,\n }}\n aria-label={deleteButtonArialLabel}\n tabIndex={tabIndex}\n {...deleteButtonProps}\n >\n <CloseXS\n iconSize=\"XS\"\n style={{\n ...(disabled ? { cursor: \"not-allowed\" } : undefined),\n height: 16,\n }}\n color={disabled ? disabledSemanticColor : \"base2\"}\n />\n </HvButton>\n );\n };\n\n const theme = useTheme();\n\n const inlineStyle = {\n ...style,\n };\n\n let categoricalBackgroundColor;\n\n if (type === \"semantic\") {\n inlineStyle.backgroundColor = getColor(theme, color, type);\n } else if (type === \"categorical\") {\n categoricalBackgroundColor = getColor(theme, color, type);\n\n inlineStyle.backgroundColor = fade(categoricalBackgroundColor, 0.3);\n }\n\n const [hover, setHover] = useState(false);\n\n return (\n <Chip\n label={label}\n className={clsx(classes.root, className)}\n onMouseEnter={() => {\n setHover(!!onClick);\n }}\n onMouseLeave={() => {\n setHover(false);\n }}\n style={{\n ...(disabled ? null : inlineStyle),\n ...(hover && !disabled ? { boxShadow: `0 0 0 1pt ${categoricalBackgroundColor}` } : null),\n }}\n classes={{\n root: clsx(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: clsx(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\nHvTag.propTypes = {\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n chipRoot: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n label: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n tagButton: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n deleteIcon: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n disabledDeleteIcon: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n titleOverflow: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categorical: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categoricalDisabled: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n disabled: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n semanticTextColor: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categoricalTextColor: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n deletable: PropTypes.string,\n /**\n * Styles applied to the component if has onClick.\n */\n clickable: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n focusVisible: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n primaryButton: PropTypes.string,\n /**\n * Styles applied to the component.\n */\n categoricalFocus: PropTypes.string,\n }).isRequired,\n\n /**\n * Inline styles to be applied to the root element.\n */\n style: PropTypes.instanceOf(Object),\n\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n\n /**\n * The label of the tag element.\n *\n */\n label: PropTypes.node,\n\n /**\n * Indicates that the form element is disabled.\n */\n disabled: PropTypes.bool,\n\n /**\n * The type of the tag element.\n *\n * A tag can be of semantic or categoric type\n */\n type: PropTypes.oneOf([\"semantic\", \"categorical\"]),\n\n /**\n * Background color to be applied to the tag\n */\n color: PropTypes.string,\n /**\n * Icon used to customize the delete icon in the Chip element\n */\n deleteIcon: PropTypes.node,\n\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component,\n * in order to render the delete icon\n */\n onDelete: PropTypes.func,\n /**\n * Callback triggered when any item is clicked.\n */\n onClick: PropTypes.func,\n\n /**\n * The role of the element with an attributed event.\n */\n role: PropTypes.string,\n /**\n * Aria properties to apply to delete button in tag\n */\n deleteButtonArialLabel: PropTypes.string,\n /**\n * Props to apply to delete button\n */\n deleteButtonProps: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvTag\" })(HvTag);\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,UAAT,EAAqBC,QAArB,QAAqC,aAArC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,I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E1C,SAAS,EAAE3B,SAAS,CAAC8D,MAnFL;;EAqFhB;AACF;AACA;AACA;EACElC,KAAK,EAAE5B,SAAS,CAACsE,IAzFD;;EA2FhB;AACF;AACA;EACEzC,QAAQ,EAAE7B,SAAS,CAACuE,IA9FJ;;EAgGhB;AACF;AACA;AACA;AACA;EACE3D,IAAI,EAAEZ,SAAS,CAACwE,KAAV,CAAgB,CAAC,UAAD,EAAa,aAAb,CAAhB,CArGU;;EAuGhB;AACF;AACA;EACE1C,KAAK,EAAE9B,SAAS,CAAC8D,MA1GD;;EA2GhB;AACF;AACA;EACE/B,UAAU,EAAE/B,SAAS,CAACsE,IA9GN;;EAgHhB;AACF;AACA;AACA;AACA;EACEtC,QAAQ,EAAEhC,SAAS,CAACyE,IArHJ;;EAsHhB;AACF;AACA;EACExC,OAAO,EAAEjC,SAAS,CAACyE,IAzHH;;EA2HhB;AACF;AACA;EACEvC,IAAI,EAAElC,SAAS,CAAC8D,MA9HA;;EA+HhB;AACF;AACA;EACE3B,sBAAsB,EAAEnC,SAAS,CAAC8D,MAlIlB;;EAmIhB;AACF;AACA;EACE1B,iBAAiB,EAAEpC,SAAS,CAACoE,UAAV,CAAqBC,MAArB;AAtIH,CAAlB;AAyIA,eAAevE,UAAU,CAACO,MAAD,EAAS;EAAEqE,IAAI,EAAE;AAAR,CAAT,CAAV,CAAsCnD,KAAtC,CAAf"}
@@ -21,13 +21,15 @@ const styles = theme => ({
21
21
  primaryButton: {
22
22
  background: "transparent"
23
23
  },
24
- label: {
24
+ label: _objectSpread(_objectSpread({
25
25
  paddingLeft: theme.hv.spacing.xs,
26
- paddingRight: theme.hv.spacing.xs,
26
+ paddingRight: theme.hv.spacing.xs
27
+ }, theme.hv.typography.normalText), {}, {
28
+ color: theme.palette.base2,
27
29
  "& p": {
28
30
  color: theme.hv.palette.base.base2
29
31
  }
30
- },
32
+ }),
31
33
  tagButton: {
32
34
  width: 16,
33
35
  height: 16,