@hitachivantara/uikit-react-core 5.44.8 → 5.45.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.
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const reactTable = require("react-table");
4
- reactTable.useFilters.pluginName = "useHvFilters";
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: () => reactTable.useFilters
8
- });
4
+ const useHvFilters = reactTable.useFilters.bind({});
5
+ useHvFilters.pluginName = "useHvFilters";
6
+ const useHvFilters$1 = useHvFilters;
7
+ exports.default = useHvFilters$1;
9
8
  //# sourceMappingURL=useFilters.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFilters.cjs","sources":["../../../../src/Table/hooks/useFilters.ts"],"sourcesContent":["import { useFilters as useHvFilters, Hooks } from \"react-table\";\n\nexport type UseFiltersProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\n(useHvFilters.pluginName as string) = \"useHvFilters\";\n\nexport default useHvFilters as UseFiltersProps;\n"],"names":["useHvFilters"],"mappings":";;;AAQCA,WAAA,WAAa,aAAwB;;;;;"}
1
+ {"version":3,"file":"useFilters.cjs","sources":["../../../../src/Table/hooks/useFilters.ts"],"sourcesContent":["import { useFilters, Hooks } from \"react-table\";\n\nexport type UseFiltersProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useHvFilters = useFilters.bind({});\n(useHvFilters.pluginName as string) = \"useHvFilters\";\n\nexport default useHvFilters as UseFiltersProps;\n"],"names":["useFilters"],"mappings":";;;AAQA,MAAM,eAAeA,WAAA,WAAW,KAAK,CAAA,CAAE;AACtC,aAAa,aAAwB;AAEtC,MAAA,iBAAe;;"}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const reactTable = require("react-table");
4
- reactTable.useGlobalFilter.pluginName = "useHvGlobalFilter";
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: () => reactTable.useGlobalFilter
8
- });
4
+ const useHvGlobalFilter = reactTable.useGlobalFilter.bind({});
5
+ useHvGlobalFilter.pluginName = "useHvGlobalFilter";
6
+ const useHvGlobalFilter$1 = useHvGlobalFilter;
7
+ exports.default = useHvGlobalFilter$1;
9
8
  //# sourceMappingURL=useGlobalFilter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGlobalFilter.cjs","sources":["../../../../src/Table/hooks/useGlobalFilter.ts"],"sourcesContent":["import { useGlobalFilter as useHvGlobalFilter, Hooks } from \"react-table\";\n\nexport type UseGlobalFilterProps = (<\n D extends object = Record<string, unknown>\n>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\n(useHvGlobalFilter.pluginName as string) = \"useHvGlobalFilter\";\n\nexport default useHvGlobalFilter as UseGlobalFilterProps;\n"],"names":["useHvGlobalFilter"],"mappings":";;;AAUCA,WAAA,gBAAkB,aAAwB;;;;;"}
1
+ {"version":3,"file":"useGlobalFilter.cjs","sources":["../../../../src/Table/hooks/useGlobalFilter.ts"],"sourcesContent":["import { useGlobalFilter, Hooks } from \"react-table\";\n\nexport type UseGlobalFilterProps = (<\n D extends object = Record<string, unknown>\n>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useHvGlobalFilter = useGlobalFilter.bind({});\n(useHvGlobalFilter.pluginName as string) = \"useHvGlobalFilter\";\n\nexport default useHvGlobalFilter as UseGlobalFilterProps;\n"],"names":["useGlobalFilter"],"mappings":";;;AAUA,MAAM,oBAAoBA,WAAA,gBAAgB,KAAK,CAAA,CAAE;AAChD,kBAAkB,aAAwB;AAE3C,MAAA,sBAAe;;"}
@@ -34,8 +34,6 @@ const theme = require("./utils/theme.cjs");
34
34
  const useSavedState = require("./utils/useSavedState.cjs");
35
35
  const wrapperTooltip = require("./utils/wrapperTooltip.cjs");
36
36
  const useTable = require("./Table/hooks/useTable.cjs");
37
- require("./Table/hooks/useGlobalFilter.cjs");
38
- require("./Table/hooks/useFilters.cjs");
39
37
  const utils = require("./Typography/utils.cjs");
40
38
  const Typography_styles = require("./Typography/Typography.styles.cjs");
41
39
  const Typography = require("./Typography/Typography.cjs");
@@ -258,7 +256,8 @@ const useBulkActions = require("./Table/hooks/useBulkActions.cjs");
258
256
  const useRowExpand = require("./Table/hooks/useRowExpand.cjs");
259
257
  const useHeaderGroups = require("./Table/hooks/useHeaderGroups.cjs");
260
258
  const useResizeColumns = require("./Table/hooks/useResizeColumns.cjs");
261
- const reactTable = require("react-table");
259
+ const useGlobalFilter = require("./Table/hooks/useGlobalFilter.cjs");
260
+ const useFilters = require("./Table/hooks/useFilters.cjs");
262
261
  const renderers = require("./Table/renderers/renderers.cjs");
263
262
  const DateColumnCell = require("./Table/renderers/DateColumnCell/DateColumnCell.cjs");
264
263
  const DropdownColumnCell = require("./Table/renderers/DropdownColumnCell/DropdownColumnCell.cjs");
@@ -618,14 +617,8 @@ exports.CellWithExpandButton = useRowExpand.CellWithExpandButton;
618
617
  exports.useHvRowExpand = useRowExpand.default;
619
618
  exports.useHvHeaderGroups = useHeaderGroups.default;
620
619
  exports.useHvResizeColumns = useResizeColumns.default;
621
- Object.defineProperty(exports, "useHvFilters", {
622
- enumerable: true,
623
- get: () => reactTable.useFilters
624
- });
625
- Object.defineProperty(exports, "useHvGlobalFilter", {
626
- enumerable: true,
627
- get: () => reactTable.useGlobalFilter
628
- });
620
+ exports.useHvGlobalFilter = useGlobalFilter.default;
621
+ exports.useHvFilters = useFilters.default;
629
622
  exports.hvDateColumn = renderers.hvDateColumn;
630
623
  exports.hvDropdownColumn = renderers.hvDropdownColumn;
631
624
  exports.hvExpandColumn = renderers.hvExpandColumn;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,27 +2,13 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const uikitStyles = require("@hitachivantara/uikit-styles");
4
4
  const document$1 = require("./document.cjs");
5
- const setElementStyle = (element, style) => {
6
- Object.entries(style).forEach(([property, value]) => {
7
- element.style[property] = value;
8
- });
9
- };
10
5
  const setElementAttrs = (themeName, modeName, colorScheme, themeRootId) => {
11
6
  const element = themeRootId ? document.getElementById(themeRootId) : document.body;
12
7
  if (element) {
13
8
  element.setAttribute(`data-theme`, themeName);
14
9
  element.setAttribute(`data-color-mode`, modeName);
15
- setElementStyle(element, {
16
- colorScheme,
17
- backgroundColor: uikitStyles.theme.colors.backgroundColor,
18
- accentColor: uikitStyles.theme.colors.secondary,
19
- color: uikitStyles.theme.colors.secondary,
20
- fontSize: uikitStyles.theme.typography.body.fontSize,
21
- fontWeight: uikitStyles.theme.typography.body.fontWeight,
22
- lineHeight: uikitStyles.theme.typography.body.lineHeight,
23
- letterSpacing: uikitStyles.theme.typography.body.letterSpacing,
24
- fontFamily: uikitStyles.theme.fontFamily.body
25
- });
10
+ element.classList.add(`uikit-root-element`);
11
+ element.style.colorScheme = colorScheme;
26
12
  }
27
13
  };
28
14
  const applyThemeCustomizations = (obj, customizations) => {
@@ -1 +1 @@
1
- {"version":3,"file":"theme.cjs","sources":["../../../src/utils/theme.ts"],"sourcesContent":["import { CSSProperties } from \"react\";\n\nimport {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvTheme, HvCreateThemeProps } from \"../types/theme\";\n\nimport { getElementById } from \"./document\";\n\n/**\n * Sets the element style properties.\n */\nconst setElementStyle = (element: HTMLElement, style: CSSProperties) => {\n Object.entries(style).forEach(([property, value]) => {\n element.style[property] = value;\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,\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: any, customizations: any) => {\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 // Set theme base\n customizedTheme.base = base;\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.forEach((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 }\n // DS5\n return [themes.ds5];\n};\n\nexport const getVarValue = (cssVar: string, rootElementId?: string) => {\n const root = getElementById(rootElementId || \"hv-root\");\n if (!root) return undefined;\n\n return getComputedStyle(root)\n .getPropertyValue(cssVar.replace(\"var(\", \"\").replace(\")\", \"\"))\n .trim();\n};\n"],"names":["theme","themes","getElementById"],"mappings":";;;;AAgBA,MAAM,kBAAkB,CAAC,SAAsB,UAAyB;AAC/D,SAAA,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,UAAU,KAAK,MAAM;AAC3C,YAAA,MAAM,QAAQ,IAAI;AAAA,EAAA,CAC3B;AACH;AAKO,MAAM,kBAAkB,CAC7B,WACA,UACA,aACA,gBACG;AACH,QAAM,UAAU,cACZ,SAAS,eAAe,WAAW,IACnC,SAAS;AAEb,MAAI,SAAS;AACH,YAAA,aAAa,cAAc,SAAS;AACpC,YAAA,aAAa,mBAAmB,QAAQ;AAGhD,oBAAgB,SAAS;AAAA,MACvB;AAAA,MACA,iBAAiBA,YAAAA,MAAM,OAAO;AAAA,MAC9B,aAAaA,YAAAA,MAAM,OAAO;AAAA,MAC1B,OAAOA,YAAAA,MAAM,OAAO;AAAA,MACpB,UAAUA,YAAM,MAAA,WAAW,KAAK;AAAA,MAChC,YAAYA,YAAM,MAAA,WAAW,KAAK;AAAA,MAClC,YAAYA,YAAM,MAAA,WAAW,KAAK;AAAA,MAClC,eAAeA,YAAM,MAAA,WAAW,KAAK;AAAA,MACrC,YAAYA,YAAAA,MAAM,WAAW;AAAA,IAAA,CAC9B;AAAA,EACH;AACF;AAKA,MAAM,2BAA2B,CAAC,KAAU,mBAAwB;AAC5D,QAAA,WAAW,CAAC,QAChB,OAAO,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG;AAGhD,QAAA,kBAAkB,EAAE,GAAG;AAG7B,SAAO,KAAK,cAAc,EAAE,QAAQ,CAAC,QAAQ;AACvC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AAA,gBAAgB,OAAO,MAAM,IAAI;AAAA,MAC1C;AAAA,IAAA,CACD;AAAA,EACH;AAGO,SAAA;AACT;AAOa,MAAA,gBAAgB,CAC3B,eACmC;AACnC,MAAI,cAAc,MAAM,QAAQ,UAAU,KAAK,WAAW,SAAS,GAAG;AACpE,UAAM,OAAuC,CAAA;AAElC,eAAA,QAAQ,CAAC,QAAQ;AAC1B,YAAM,IAAY,KAAK;AAAA,QACrB,CAAC,MAAM,EAAE,KAAK,WAAW,IAAI,KAAK,KAAK;AAAA,MAAA;AAGzC,UAAI,MAAM,IAAI;AACP,aAAA,OAAO,GAAG,CAAC;AAChB,aAAK,KAAK,GAAG;AAAA,MAAA,OACR;AACL,aAAK,KAAK,GAAG;AAAA,MACf;AAAA,IAAA,CACD;AAGM,WAAA;AAAA,EACT;AAEO,SAAA,CAACA,YAAAA,OAAO,GAAG;AACpB;AAEa,MAAA,cAAc,CAAC,QAAgB,kBAA2B;AAC/D,QAAA,OAAOC,WAAAA,eAAe,iBAAiB,SAAS;AACtD,MAAI,CAAC;AAAa,WAAA;AAElB,SAAO,iBAAiB,IAAI,EACzB,iBAAiB,OAAO,QAAQ,QAAQ,EAAE,EAAE,QAAQ,KAAK,EAAE,CAAC,EAC5D,KAAK;AACV;;;;;"}
1
+ {"version":3,"file":"theme.cjs","sources":["../../../src/utils/theme.ts"],"sourcesContent":["import {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvTheme, HvCreateThemeProps } from \"../types/theme\";\n\nimport { getElementById } from \"./document\";\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 styles for child components to inherit\n element.classList.add(`uikit-root-element`);\n element.style.colorScheme = colorScheme;\n }\n};\n\n/**\n * Applies customizations to a theme.\n */\nconst applyThemeCustomizations = (obj: any, customizations: any) => {\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 // Set theme base\n customizedTheme.base = base;\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.forEach((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 }\n // DS5\n return [themes.ds5];\n};\n\nexport const getVarValue = (cssVar: string, rootElementId?: string) => {\n const root = getElementById(rootElementId || \"hv-root\");\n if (!root) return undefined;\n\n return getComputedStyle(root)\n .getPropertyValue(cssVar.replace(\"var(\", \"\").replace(\")\", \"\"))\n .trim();\n};\n"],"names":["themes","getElementById"],"mappings":";;;;AAaO,MAAM,kBAAkB,CAC7B,WACA,UACA,aACA,gBACG;AACH,QAAM,UAAU,cACZ,SAAS,eAAe,WAAW,IACnC,SAAS;AAEb,MAAI,SAAS;AACH,YAAA,aAAa,cAAc,SAAS;AACpC,YAAA,aAAa,mBAAmB,QAAQ;AAGxC,YAAA,UAAU,IAAI,oBAAoB;AAC1C,YAAQ,MAAM,cAAc;AAAA,EAC9B;AACF;AAKA,MAAM,2BAA2B,CAAC,KAAU,mBAAwB;AAC5D,QAAA,WAAW,CAAC,QAChB,OAAO,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG;AAGhD,QAAA,kBAAkB,EAAE,GAAG;AAG7B,SAAO,KAAK,cAAc,EAAE,QAAQ,CAAC,QAAQ;AACvC,QAAA,gBAAgB,GAAG,GAAG;AACpB,UAAA,SAAS,gBAAgB,GAAG,CAAC,KAAK,SAAS,eAAe,GAAG,CAAC,GAAG;AACnE,wBAAgB,GAAG,IAAI;AAAA,UACrB,gBAAgB,GAAG;AAAA,UACnB,eA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W,SAAS,GAAG;AACpE,UAAM,OAAuC,CAAA;AAElC,eAAA,QAAQ,CAAC,QAAQ;AAC1B,YAAM,IAAY,KAAK;AAAA,QACrB,CAAC,MAAM,EAAE,KAAK,WAAW,IAAI,KAAK,KAAK;AAAA,MAAA;AAGzC,UAAI,MAAM,IAAI;AACP,aAAA,OAAO,GAAG,CAAC;AAChB,aAAK,KAAK,GAAG;AAAA,MAAA,OACR;AACL,aAAK,KAAK,GAAG;AAAA,MACf;AAAA,IAAA,CACD;AAGM,WAAA;AAAA,EACT;AAEO,SAAA,CAACA,YAAAA,OAAO,GAAG;AACpB;AAEa,MAAA,cAAc,CAAC,QAAgB,kBAA2B;AAC/D,QAAA,OAAOC,WAAAA,eAAe,iBAAiB,SAAS;AACtD,MAAI,CAAC;AAAa,WAAA;AAElB,SAAO,iBAAiB,IAAI,EACzB,iBAAiB,OAAO,QAAQ,QAAQ,EAAE,EAAE,QAAQ,KAAK,EAAE,CAAC,EAC5D,KAAK;AACV;;;;;"}
@@ -1,7 +1,8 @@
1
1
  import { useFilters } from "react-table";
2
- import { useFilters as useFilters2 } from "react-table";
3
- useFilters.pluginName = "useHvFilters";
2
+ const useHvFilters = useFilters.bind({});
3
+ useHvFilters.pluginName = "useHvFilters";
4
+ const useHvFilters$1 = useHvFilters;
4
5
  export {
5
- useFilters2 as default
6
+ useHvFilters$1 as default
6
7
  };
7
8
  //# sourceMappingURL=useFilters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useFilters.js","sources":["../../../../src/Table/hooks/useFilters.ts"],"sourcesContent":["import { useFilters as useHvFilters, Hooks } from \"react-table\";\n\nexport type UseFiltersProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\n(useHvFilters.pluginName as string) = \"useHvFilters\";\n\nexport default useHvFilters as UseFiltersProps;\n"],"names":["useHvFilters"],"mappings":";;AAQCA,WAAa,aAAwB;"}
1
+ {"version":3,"file":"useFilters.js","sources":["../../../../src/Table/hooks/useFilters.ts"],"sourcesContent":["import { useFilters, Hooks } from \"react-table\";\n\nexport type UseFiltersProps = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useHvFilters = useFilters.bind({});\n(useHvFilters.pluginName as string) = \"useHvFilters\";\n\nexport default useHvFilters as UseFiltersProps;\n"],"names":[],"mappings":";AAQA,MAAM,eAAe,WAAW,KAAK,CAAA,CAAE;AACtC,aAAa,aAAwB;AAEtC,MAAA,iBAAe;"}
@@ -1,7 +1,8 @@
1
1
  import { useGlobalFilter } from "react-table";
2
- import { useGlobalFilter as useGlobalFilter2 } from "react-table";
3
- useGlobalFilter.pluginName = "useHvGlobalFilter";
2
+ const useHvGlobalFilter = useGlobalFilter.bind({});
3
+ useHvGlobalFilter.pluginName = "useHvGlobalFilter";
4
+ const useHvGlobalFilter$1 = useHvGlobalFilter;
4
5
  export {
5
- useGlobalFilter2 as default
6
+ useHvGlobalFilter$1 as default
6
7
  };
7
8
  //# sourceMappingURL=useGlobalFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGlobalFilter.js","sources":["../../../../src/Table/hooks/useGlobalFilter.ts"],"sourcesContent":["import { useGlobalFilter as useHvGlobalFilter, Hooks } from \"react-table\";\n\nexport type UseGlobalFilterProps = (<\n D extends object = Record<string, unknown>\n>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\n(useHvGlobalFilter.pluginName as string) = \"useHvGlobalFilter\";\n\nexport default useHvGlobalFilter as UseGlobalFilterProps;\n"],"names":["useHvGlobalFilter"],"mappings":";;AAUCA,gBAAkB,aAAwB;"}
1
+ {"version":3,"file":"useGlobalFilter.js","sources":["../../../../src/Table/hooks/useGlobalFilter.ts"],"sourcesContent":["import { useGlobalFilter, Hooks } from \"react-table\";\n\nexport type UseGlobalFilterProps = (<\n D extends object = Record<string, unknown>\n>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst useHvGlobalFilter = useGlobalFilter.bind({});\n(useHvGlobalFilter.pluginName as string) = \"useHvGlobalFilter\";\n\nexport default useHvGlobalFilter as UseGlobalFilterProps;\n"],"names":[],"mappings":";AAUA,MAAM,oBAAoB,gBAAgB,KAAK,CAAA,CAAE;AAChD,kBAAkB,aAAwB;AAE3C,MAAA,sBAAe;"}
package/dist/esm/index.js CHANGED
@@ -32,8 +32,6 @@ import { createTheme, getVarValue, processThemes, setElementAttrs } from "./util
32
32
  import { useSavedState } from "./utils/useSavedState.js";
33
33
  import { wrapperTooltip } from "./utils/wrapperTooltip.js";
34
34
  import { default as default2, default as default3 } from "./Table/hooks/useTable.js";
35
- import "./Table/hooks/useGlobalFilter.js";
36
- import "./Table/hooks/useFilters.js";
37
35
  import { typographyVariants } from "./Typography/utils.js";
38
36
  import { staticClasses } from "./Typography/Typography.styles.js";
39
37
  import { HvTypography } from "./Typography/Typography.js";
@@ -256,7 +254,8 @@ import { defaultgetHvBulkActionsProps, default as default9 } from "./Table/hooks
256
254
  import { CellWithExpandButton, default as default10 } from "./Table/hooks/useRowExpand.js";
257
255
  import { default as default11 } from "./Table/hooks/useHeaderGroups.js";
258
256
  import { default as default12 } from "./Table/hooks/useResizeColumns.js";
259
- import { useFilters, useGlobalFilter } from "react-table";
257
+ import { default as default13 } from "./Table/hooks/useGlobalFilter.js";
258
+ import { default as default14 } from "./Table/hooks/useFilters.js";
260
259
  import { hvDateColumn, hvDropdownColumn, hvExpandColumn, hvNumberColumn, hvProgressColumn, hvSwitchColumn, hvTagColumn, hvTextColumn } from "./Table/renderers/renderers.js";
261
260
  import { HvDateColumnCell } from "./Table/renderers/DateColumnCell/DateColumnCell.js";
262
261
  import { HvDropdownColumnCell } from "./Table/renderers/DropdownColumnCell/DropdownColumnCell.js";
@@ -633,8 +632,8 @@ export {
633
632
  useForkRef,
634
633
  default9 as useHvBulkActions,
635
634
  default2 as useHvData,
636
- useFilters as useHvFilters,
637
- useGlobalFilter as useHvGlobalFilter,
635
+ default14 as useHvFilters,
636
+ default13 as useHvGlobalFilter,
638
637
  default11 as useHvHeaderGroups,
639
638
  default7 as useHvPagination,
640
639
  default12 as useHvResizeColumns,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,26 +1,12 @@
1
- import { theme, themes } from "@hitachivantara/uikit-styles";
1
+ import { themes } from "@hitachivantara/uikit-styles";
2
2
  import { getElementById } from "./document.js";
3
- const setElementStyle = (element, style) => {
4
- Object.entries(style).forEach(([property, value]) => {
5
- element.style[property] = value;
6
- });
7
- };
8
3
  const setElementAttrs = (themeName, modeName, colorScheme, themeRootId) => {
9
4
  const element = themeRootId ? document.getElementById(themeRootId) : document.body;
10
5
  if (element) {
11
6
  element.setAttribute(`data-theme`, themeName);
12
7
  element.setAttribute(`data-color-mode`, modeName);
13
- setElementStyle(element, {
14
- colorScheme,
15
- backgroundColor: theme.colors.backgroundColor,
16
- accentColor: theme.colors.secondary,
17
- color: theme.colors.secondary,
18
- fontSize: theme.typography.body.fontSize,
19
- fontWeight: theme.typography.body.fontWeight,
20
- lineHeight: theme.typography.body.lineHeight,
21
- letterSpacing: theme.typography.body.letterSpacing,
22
- fontFamily: theme.fontFamily.body
23
- });
8
+ element.classList.add(`uikit-root-element`);
9
+ element.style.colorScheme = colorScheme;
24
10
  }
25
11
  };
26
12
  const applyThemeCustomizations = (obj, customizations) => {
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sources":["../../../src/utils/theme.ts"],"sourcesContent":["import { CSSProperties } from \"react\";\n\nimport {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n theme,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvTheme, HvCreateThemeProps } from \"../types/theme\";\n\nimport { getElementById } from \"./document\";\n\n/**\n * Sets the element style properties.\n */\nconst setElementStyle = (element: HTMLElement, style: CSSProperties) => {\n Object.entries(style).forEach(([property, value]) => {\n element.style[property] = value;\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,\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: any, customizations: any) => {\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 // Set theme base\n customizedTheme.base = base;\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.forEach((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 }\n // DS5\n return [themes.ds5];\n};\n\nexport const getVarValue = (cssVar: string, rootElementId?: string) => {\n const root = getElementById(rootElementId || \"hv-root\");\n if (!root) return undefined;\n\n return getComputedStyle(root)\n .getPropertyValue(cssVar.replace(\"var(\", \"\").replace(\")\", \"\"))\n .trim();\n};\n"],"names":[],"mappings":";;AAgBA,MAAM,kBAAkB,CAAC,SAAsB,UAAyB;AAC/D,SAAA,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,UAAU,KAAK,MAAM;AAC3C,YAAA,MAAM,QAAQ,IAAI;AAAA,EAAA,CAC3B;AACH;AAKO,MAAM,kBAAkB,CAC7B,WACA,UACA,aACA,gBACG;AACH,QAAM,UAAU,cACZ,SAAS,eAAe,WAAW,IACnC,SAAS;AAEb,MAAI,SAAS;AACH,YAAA,aAAa,cAAc,SAAS;AACpC,YAAA,aAAa,mBAAmB,QAAQ;AAGhD,oBAAgB,SAAS;AAAA,MACvB;AAAA,MACA,iBAAiB,MAAM,OAAO;AAAA,MAC9B,aAAa,MAAM,OAAO;AAAA,MAC1B,OAAO,MAAM,OAAO;AAAA,MACpB,UAAU,MAAM,WAAW,KAAK;AAAA,MAChC,YAAY,MAAM,WAAW,KAAK;AAAA,MAClC,YAAY,MAAM,WAAW,KAAK;AAAA,MAClC,eAAe,MAAM,WAAW,KAAK;AAAA,MACr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,QAAA;AAAA,MAIzC;AAAA,IAAA,CACD;AAAA,EACH;AAIA,MAAI,CAAC,qBAAqB,eAAe,QAAQ,OAAO;AACtD,WAAO,KAAK,gBAAgB,OAAO,KAAK,EAAE,QAAQ,CAAC,SAAS;AACtD,UAAA,CAAC,OAAO,KAAK,eAAe,QAAQ,SAAS,EAAE,EAAE,SAAS,IAAI,GAAG;AAC5D,eAAA,gBAAgB,OAAO,MAAM,IAAI;AAAA,MAC1C;AAAA,IAAA,CACD;AAAA,EACH;AAGO,SAAA;AACT;AAOa,MAAA,gBAAgB,CAC3B,eACmC;AACnC,MAAI,cAAc,MAAM,QAAQ,UAAU,KAAK,WAAW,SAAS,GAAG;AACpE,UAAM,OAAuC,CAAA;AAElC,eAAA,QAAQ,CAAC,QAAQ;AAC1B,YAAM,IAAY,KAAK;AAAA,QACrB,CAAC,MAAM,EAAE,KAAK,WAAW,IAAI,KAAK,KAAK;AAAA,MAAA;AAGzC,UAAI,MAAM,IAAI;AACP,aAAA,OAAO,GAAG,CAAC;AAChB,aAAK,KAAK,GAAG;AAAA,MAAA,OACR;AACL,aAAK,KAAK,GAAG;AAAA,MACf;AAAA,IAAA,CACD;AAGM,WAAA;AAAA,EACT;AAEO,SAAA,CAAC,OAAO,GAAG;AACpB;AAEa,MAAA,cAAc,CAAC,QAAgB,kBAA2B;AAC/D,QAAA,OAAO,eAAe,iBAAiB,SAAS;AACtD,MAAI,CAAC;AAAa,WAAA;AAElB,SAAO,iBAAiB,IAAI,EACzB,iBAAiB,OAAO,QAAQ,QAAQ,EAAE,EAAE,QAAQ,KAAK,EAAE,CAAC,EAC5D,KAAK;AACV;"}
1
+ {"version":3,"file":"theme.js","sources":["../../../src/utils/theme.ts"],"sourcesContent":["import {\n themes,\n HvThemeColorModeStructure,\n HvThemeStructure,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvTheme, HvCreateThemeProps } from \"../types/theme\";\n\nimport { getElementById } from \"./document\";\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 styles for child components to inherit\n element.classList.add(`uikit-root-element`);\n element.style.colorScheme = colorScheme;\n }\n};\n\n/**\n * Applies customizations to a theme.\n */\nconst applyThemeCustomizations = (obj: any, customizations: any) => {\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 // Set theme base\n customizedTheme.base = base;\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.forEach((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 }\n // DS5\n return [themes.ds5];\n};\n\nexport const getVarValue = (cssVar: string, rootElementId?: string) => {\n const root = getElementById(rootElementId || \"hv-root\");\n if (!root) return undefined;\n\n return getComputedStyle(root)\n .getPropertyValue(cssVar.replace(\"var(\", \"\").replace(\")\", \"\"))\n .trim();\n};\n"],"names":[],"mappings":";;AAaO,MAAM,kBAAkB,CAC7B,WACA,UACA,aACA,gBACG;AACH,QAAM,UAAU,cACZ,SAAS,eAAe,WAAW,IACnC,SAAS;AAEb,MAAI,SAAS;AACH,YAAA,aAAa,cAAc,SAAS;AACpC,YAAA,aAAa,mBAAmB,QAAQ;AAGxC,YAAA,UAAU,IAAI,oBAAoB;AAC1C,YAAQ,MAAM,cAAc;AAAA,EAC9B;AACF;AAKA,MAAM,2BAA2B,CAAC,KAAU,mBAAwB;AAC5D,QAAA,WAAW,CAAC,QAChB,OAAO,OAAO,QAAQ,YAAY,CAAC,MAAM,QAAQ,GAAG;AAGhD,QAAA,kBAAkB,EAAE,GAAG;AAG7B,SAAO,KA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AI,GAAG;AAC5D,eAAA,gBAAgB,OAAO,MAAM,IAAI;AAAA,MAC1C;AAAA,IAAA,CACD;AAAA,EACH;AAGO,SAAA;AACT;AAOa,MAAA,gBAAgB,CAC3B,eACmC;AACnC,MAAI,cAAc,MAAM,QAAQ,UAAU,KAAK,WAAW,SAAS,GAAG;AACpE,UAAM,OAAuC,CAAA;AAElC,eAAA,QAAQ,CAAC,QAAQ;AAC1B,YAAM,IAAY,KAAK;AAAA,QACrB,CAAC,MAAM,EAAE,KAAK,WAAW,IAAI,KAAK,KAAK;AAAA,MAAA;AAGzC,UAAI,MAAM,IAAI;AACP,aAAA,OAAO,GAAG,CAAC;AAChB,aAAK,KAAK,GAAG;AAAA,MAAA,OACR;AACL,aAAK,KAAK,GAAG;AAAA,MACf;AAAA,IAAA,CACD;AAGM,WAAA;AAAA,EACT;AAEO,SAAA,CAAC,OAAO,GAAG;AACpB;AAEa,MAAA,cAAc,CAAC,QAAgB,kBAA2B;AAC/D,QAAA,OAAO,eAAe,iBAAiB,SAAS;AACtD,MAAI,CAAC;AAAa,WAAA;AAElB,SAAO,iBAAiB,IAAI,EACzB,iBAAiB,OAAO,QAAQ,QAAQ,EAAE,EAAE,QAAQ,KAAK,EAAE,CAAC,EAC5D,KAAK;AACV;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "5.44.8",
3
+ "version": "5.45.0",
4
4
  "private": false,
5
5
  "author": "Hitachi Vantara UI Kit Team",
6
6
  "description": "Core React components for the NEXT Design System.",
@@ -33,9 +33,9 @@
33
33
  "@emotion/css": "^11.11.2",
34
34
  "@emotion/serialize": "^1.1.2",
35
35
  "@emotion/utils": "^1.2.1",
36
- "@hitachivantara/uikit-react-icons": "^5.8.1",
37
- "@hitachivantara/uikit-react-shared": "^5.1.26",
38
- "@hitachivantara/uikit-styles": "^5.17.2",
36
+ "@hitachivantara/uikit-react-icons": "^5.8.2",
37
+ "@hitachivantara/uikit-react-shared": "^5.1.27",
38
+ "@hitachivantara/uikit-styles": "^5.18.0",
39
39
  "@internationalized/date": "^3.2.0",
40
40
  "@mui/base": "^5.0.0-beta.4",
41
41
  "@popperjs/core": "^2.11.8",
@@ -63,7 +63,7 @@
63
63
  "access": "public",
64
64
  "directory": "package"
65
65
  },
66
- "gitHead": "d33d3ce2b7d3dc20aae056601bf88009b01c259c",
66
+ "gitHead": "8b3bfd1137cc8650dcd801f4910d0bdd285a0c3c",
67
67
  "main": "dist/cjs/index.cjs",
68
68
  "exports": {
69
69
  ".": {