@hitachivantara/uikit-react-core 4.0.1-next.3 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Controls/Controls.d.ts +2 -10
- package/dist/Controls/RightControl/RightControl.d.ts +1 -1
- package/dist/Provider/Provider.d.ts +5 -18
- package/dist/Provider/Provider.js +25 -38
- package/dist/Provider/Provider.js.map +1 -1
- package/dist/SimpleGrid/SimpleGrid.d.ts +7 -8
- package/dist/Table/TableBody/TableBody.d.ts +4 -0
- package/dist/Tag/Tag.js +1 -13
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tag/styles.js +5 -3
- package/dist/Tag/styles.js.map +1 -1
- package/dist/legacy/Controls/Controls.d.ts +2 -10
- package/dist/legacy/Controls/RightControl/RightControl.d.ts +1 -1
- package/dist/legacy/Provider/Provider.d.ts +5 -18
- package/dist/legacy/Provider/Provider.js +29 -40
- package/dist/legacy/Provider/Provider.js.map +1 -1
- package/dist/legacy/SimpleGrid/SimpleGrid.d.ts +7 -8
- package/dist/legacy/Table/TableBody/TableBody.d.ts +4 -0
- package/dist/legacy/Tag/Tag.js +3 -15
- package/dist/legacy/Tag/Tag.js.map +1 -1
- package/dist/legacy/Tag/styles.js +5 -3
- package/dist/legacy/Tag/styles.js.map +1 -1
- package/dist/legacy/theme/index.d.ts +2 -1
- package/dist/modern/Controls/Controls.d.ts +2 -10
- package/dist/modern/Controls/RightControl/RightControl.d.ts +1 -1
- package/dist/modern/Provider/Provider.d.ts +5 -18
- package/dist/modern/Provider/Provider.js +28 -38
- package/dist/modern/Provider/Provider.js.map +1 -1
- package/dist/modern/SimpleGrid/SimpleGrid.d.ts +7 -8
- package/dist/modern/Table/TableBody/TableBody.d.ts +4 -0
- package/dist/modern/Tag/Tag.js +3 -15
- package/dist/modern/Tag/Tag.js.map +1 -1
- package/dist/modern/Tag/styles.js +5 -3
- package/dist/modern/Tag/styles.js.map +1 -1
- package/dist/modern/theme/index.d.ts +2 -1
- package/dist/theme/index.d.ts +2 -1
- package/package.json +4 -4
|
@@ -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?:
|
|
24
|
+
callbacks?: Pick<HvTableInstance, "setSortBy" | "setGlobalFilter">;
|
|
33
25
|
/**
|
|
34
26
|
* Views configuration required for the view buttons
|
|
35
27
|
*/
|
|
@@ -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
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
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/
|
|
65
|
+
* @see https://lumada-design.github.io/uikit/master/?path=/docs/theme-css-baseline--page
|
|
79
66
|
*/
|
|
80
|
-
|
|
67
|
+
cssBaseline?: "global" | "scoped" | "none";
|
|
81
68
|
}
|
|
82
69
|
|
|
83
70
|
export default function HvProvider(props: HvProviderProps): JSX.Element | null;
|
|
@@ -53,13 +53,12 @@ var _context = _interopRequireDefault(require("./context"));
|
|
|
53
53
|
|
|
54
54
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
55
55
|
|
|
56
|
-
var _HvCssBaseline;
|
|
56
|
+
var _HvCssBaseline, _HvScopedCssBaseline;
|
|
57
57
|
|
|
58
58
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
59
59
|
|
|
60
60
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
61
61
|
|
|
62
|
-
var warnedOnce = false;
|
|
63
62
|
/**
|
|
64
63
|
* Augments the target theme with the differences found in the source theme.
|
|
65
64
|
*
|
|
@@ -67,7 +66,6 @@ var warnedOnce = false;
|
|
|
67
66
|
* @param {Object} InputSourceTheme - A material UI Theme to apply on top.
|
|
68
67
|
* @returns {Object} - A new modified material UI theme.
|
|
69
68
|
*/
|
|
70
|
-
|
|
71
69
|
var applyCustomTheme = function applyCustomTheme(InputTargetTheme, InputSourceTheme) {
|
|
72
70
|
var muiDefaultTheme = (0, _material.createTheme)();
|
|
73
71
|
var targetTheme = (0, _cloneDeep.default)(InputTargetTheme);
|
|
@@ -124,31 +122,21 @@ var HvProvider = function HvProvider(_ref) {
|
|
|
124
122
|
locale = _ref$locale === void 0 ? "en-US" : _ref$locale,
|
|
125
123
|
generateClassNameProp = _ref.generateClassName,
|
|
126
124
|
generateClassNameOptions = _ref.generateClassNameOptions,
|
|
127
|
-
_ref$injectStylesFirs = _ref.injectStylesFirst,
|
|
128
|
-
injectStylesFirst = _ref$injectStylesFirs === void 0 ? true : _ref$injectStylesFirs,
|
|
129
125
|
_ref$disableStylesGen = _ref.disableStylesGeneration,
|
|
130
126
|
disableStylesGeneration = _ref$disableStylesGen === void 0 ? false : _ref$disableStylesGen,
|
|
131
|
-
_ref$
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (process.env.NODE_ENV !== "production") {
|
|
135
|
-
if (!warnedOnce && !disableCssBaseline) {
|
|
136
|
-
warnedOnce = true; // eslint-disable-next-line no-console
|
|
137
|
-
|
|
138
|
-
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");
|
|
139
|
-
}
|
|
140
|
-
}
|
|
127
|
+
_ref$cssBaseline = _ref.cssBaseline,
|
|
128
|
+
cssBaseline = _ref$cssBaseline === void 0 ? "global" : _ref$cssBaseline;
|
|
141
129
|
|
|
142
130
|
var _useState = (0, _react.useState)(locale),
|
|
143
131
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
144
132
|
localeSetting = _useState2[0],
|
|
145
|
-
|
|
133
|
+
setLocaleSetting = _useState2[1];
|
|
146
134
|
|
|
147
135
|
(0, _react.useEffect)(function () {
|
|
148
136
|
var _navigator;
|
|
149
137
|
|
|
150
138
|
// ssr - only runs at the rendering phase, so it won't run on the server
|
|
151
|
-
|
|
139
|
+
setLocaleSetting(locale || ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.language));
|
|
152
140
|
}, [locale]);
|
|
153
141
|
var rawUiKitTheme = (0, _theme.getTheme)(uiKitTheme);
|
|
154
142
|
var customTheme = applyCustomTheme((0, _theme.themeBuilder)(rawUiKitTheme), theme);
|
|
@@ -159,14 +147,27 @@ var HvProvider = function HvProvider(_ref) {
|
|
|
159
147
|
locale: localeSetting
|
|
160
148
|
};
|
|
161
149
|
}, [changeTheme, localeSetting]);
|
|
150
|
+
|
|
151
|
+
var renderCssBaseline = function renderCssBaseline() {
|
|
152
|
+
if (cssBaseline === "global") {
|
|
153
|
+
return _HvCssBaseline || (_HvCssBaseline = /*#__PURE__*/(0, _jsxRuntime.jsx)(_theme.HvCssBaseline, {}));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (cssBaseline === "scoped") {
|
|
157
|
+
return _HvScopedCssBaseline || (_HvScopedCssBaseline = /*#__PURE__*/(0, _jsxRuntime.jsx)(_theme.HvScopedCssBaseline, {}));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return null;
|
|
161
|
+
};
|
|
162
|
+
|
|
162
163
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles2.StyledEngineProvider, {
|
|
163
|
-
injectFirst:
|
|
164
|
+
injectFirst: true,
|
|
164
165
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StylesProvider, {
|
|
165
166
|
generateClassName: generateClassName,
|
|
166
167
|
disableGeneration: disableStylesGeneration,
|
|
167
168
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ThemeProvider, {
|
|
168
169
|
theme: customTheme,
|
|
169
|
-
children: [
|
|
170
|
+
children: [renderCssBaseline(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.default.Provider, {
|
|
170
171
|
value: pConfig,
|
|
171
172
|
children: children
|
|
172
173
|
})]
|
|
@@ -237,33 +238,19 @@ process.env.NODE_ENV !== "production" ? HvProvider.propTypes = {
|
|
|
237
238
|
seed: _propTypes.default.string
|
|
238
239
|
}),
|
|
239
240
|
|
|
240
|
-
/**
|
|
241
|
-
* Injects the generated stylesheets at the top of the `<head>` element of the page.
|
|
242
|
-
* This can ease the override of UI Kit components styles.
|
|
243
|
-
*
|
|
244
|
-
* By default, the styles are injected last in the `<head>` element of the page.
|
|
245
|
-
*/
|
|
246
|
-
injectStylesFirst: _propTypes.default.bool,
|
|
247
|
-
|
|
248
241
|
/**
|
|
249
242
|
* Disables the generation of the styles.
|
|
250
243
|
*/
|
|
251
244
|
disableStylesGeneration: _propTypes.default.bool,
|
|
252
245
|
|
|
253
246
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* The application using UI Kit should be responsible for adding the baseline css styles, by
|
|
259
|
-
* either using the `<HvCssBaseline />` component, using the `<HvScopedCssBaseline />` component,
|
|
260
|
-
* or ensuring that the necessary base styles are applied.
|
|
261
|
-
*
|
|
262
|
-
* Defaults to `false`. Will be removed in the next major release.
|
|
247
|
+
* By default the baseline styles are applied globally to the application.
|
|
248
|
+
* If you need to scope the CSS to avoid styling conflicts, you can set this prop to `"scoped"`.
|
|
249
|
+
* If you are providing the baseline styles, you can set this prop to false.
|
|
263
250
|
*
|
|
264
|
-
* @see https://lumada-design.github.io/uikit/master/?path=/docs/
|
|
251
|
+
* @see https://lumada-design.github.io/uikit/master/?path=/docs/theme-css-baseline--page
|
|
265
252
|
*/
|
|
266
|
-
|
|
253
|
+
cssBaseline: _propTypes.default.oneOf(["global", "scoped", "none"])
|
|
267
254
|
} : void 0;
|
|
268
255
|
var _default = HvProvider;
|
|
269
256
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","names":["warnedOnce","applyCustomTheme","InputTargetTheme","InputSourceTheme","muiDefaultTheme","createTheme","targetTheme","cloneDeep","sourceTheme","deleteDifference","isEmpty","diff","observableDiff","difference","partialCustomTheme","set","path","rhs","kind","merge","HvProvider","children","uiKitTheme","theme","changeTheme","locale","generateClassNameProp","generateClassName","generateClassNameOptions","injectStylesFirst","disableStylesGeneration","disableCssBaseline","process","env","NODE_ENV","console","warn","useState","localeSetting","setLocaleStting","useEffect","navigator","language","rawUiKitTheme","getTheme","customTheme","themeBuilder","createGenerateClassName","pConfig","useMemo","propTypes","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;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAEA,IAAIA,UAAU,GAAG,KAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,gBA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AoFezC,U"}
|
|
1
|
+
{"version":3,"file":"Provider.js","names":["applyCustomTheme","InputTargetTheme","InputSourceTheme","muiDefaultTheme","createTheme","targetTheme","cloneDeep","sourceTheme","deleteDifference","isEmpty","diff","observableDiff","difference","partialCustomTheme","set","path","rhs","kind","merge","HvProvider","children","uiKitTheme","theme","changeTheme","locale","generateClassNameProp","generateClassName","generateClassNameOptions","disableStylesGeneration","cssBaseline","useState","localeSetting","setLocaleSetting","useEffect","navigator","language","rawUiKitTheme","getTheme","customTheme","themeBuilder","createGenerateClassName","pConfig","useMemo","renderCssBaseline","propTypes","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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AAUG,KAAV,CAAgB,CAAC,QAAD,EAAW,QAAX,EAAqB,MAArB,CAAhB;AAnEQ,CAAvB;eAsEe7B,U"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
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?:
|
|
6
|
+
spacing?: Spacing;
|
|
9
7
|
};
|
|
10
8
|
|
|
11
|
-
export interface SimpleGridProps
|
|
12
|
-
|
|
9
|
+
export interface SimpleGridProps {
|
|
10
|
+
children?: JSX.Element | JSX.Element[];
|
|
11
|
+
spacing?: Spacing;
|
|
13
12
|
cols?: number;
|
|
14
|
-
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;
|
package/dist/Tag/Tag.js
CHANGED
|
@@ -95,8 +95,6 @@ var getColor = function getColor(theme, customColor, type) {
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
var HvTag = function HvTag(props) {
|
|
98
|
-
var _HvTypography;
|
|
99
|
-
|
|
100
98
|
var classes = props.classes,
|
|
101
99
|
style = props.style,
|
|
102
100
|
className = props.className,
|
|
@@ -158,18 +156,8 @@ var HvTag = function HvTag(props) {
|
|
|
158
156
|
hover = _useState2[0],
|
|
159
157
|
setHover = _useState2[1];
|
|
160
158
|
|
|
161
|
-
var chipLabel = (0, _react.useMemo)(function () {
|
|
162
|
-
if (typeof label === "string") {
|
|
163
|
-
return _HvTypography || (_HvTypography = /*#__PURE__*/(0, _jsxRuntime.jsx)(_.HvTypography, {
|
|
164
|
-
variant: "normalText",
|
|
165
|
-
children: label
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return label;
|
|
170
|
-
}, [label]);
|
|
171
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, _objectSpread({
|
|
172
|
-
label:
|
|
160
|
+
label: label,
|
|
173
161
|
className: (0, _clsx.default)(classes.root, className),
|
|
174
162
|
onMouseEnter: function onMouseEnter() {
|
|
175
163
|
setHover(!!onClick);
|
package/dist/Tag/Tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","names":["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","useTheme","inlineStyle","categoricalBackgroundColor","fade","useState","hover","setHover","chipLabel","useMemo","clsx","root","boxShadow","chipRoot","clickable","categoricalDisabled","categoricalFocus","disabledDeleteIcon","hasDeleteAction","getOnDeleteCallback","hasClickAction","propTypes","PropTypes","shape","string","titleOverflow","semanticTextColor","categoricalTextColor","deletable","isRequired","instanceOf","Object","node","bool","oneOf","func","withStyles","styles","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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HhB;AACF;AACA;EACEjD,IAAI,EAAEoC,kBAAA,CAAUE,MA9HA;;EA+HhB;AACF;AACA;EACErC,sBAAsB,EAAEmC,kBAAA,CAAUE,MAlIlB;;EAmIhB;AACF;AACA;EACEpC,iBAAiB,EAAEkC,kBAAA,CAAUQ,UAAV,CAAqBC,MAArB;AAtIH,CAAlB;;eAyIe,IAAAK,kBAAA,EAAWC,gBAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAsC/D,KAAtC,C"}
|
|
1
|
+
{"version":3,"file":"Tag.js","names":["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","useTheme","inlineStyle","categoricalBackgroundColor","fade","useState","hover","setHover","clsx","root","boxShadow","chipRoot","clickable","categoricalDisabled","categoricalFocus","disabledDeleteIcon","hasDeleteAction","getOnDeleteCallback","hasClickAction","propTypes","PropTypes","shape","string","titleOverflow","semanticTextColor","categoricalTextColor","deletable","isRequired","instanceOf","Object","node","bool","oneOf","func","withStyles","styles","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;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAQC,WAAR,EAAqBC,IAArB,EAA8B;EAC7C,IAAMC,oBAAoB,GAAGH,KAAK,CAACI,EAAN,CAASC,OAAT,CAAiBC,QAAjB,CAA0BC,KAAvD;EACA,IAAMC,uBAAuB,GAAGR,KAAK,CAACI,EAAN,CAASK,GAAT,CAAaJ,OAAb,CAAqBK,WAArB,CAAiCC,KAAjE;EAEA,IAAIC,eAAJ;;EAEA,IAAIV,IAAI,KAAK,UAAb,EAAyB;IACvBU,eAAe,GAAGZ,KA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yC,kBAAA,CAAUE,MAnFL;;EAqFhB;AACF;AACA;AACA;EACE1C,KAAK,EAAEwC,kBAAA,CAAUU,IAzFD;;EA2FhB;AACF;AACA;EACEjD,QAAQ,EAAEuC,kBAAA,CAAUW,IA9FJ;;EAgGhB;AACF;AACA;AACA;AACA;EACEnE,IAAI,EAAEwD,kBAAA,CAAUY,KAAV,CAAgB,CAAC,UAAD,EAAa,aAAb,CAAhB,CArGU;;EAuGhB;AACF;AACA;EACElD,KAAK,EAAEsC,kBAAA,CAAUE,MA1GD;;EA2GhB;AACF;AACA;EACEvC,UAAU,EAAEqC,kBAAA,CAAUU,IA9GN;;EAgHhB;AACF;AACA;AACA;AACA;EACE9C,QAAQ,EAAEoC,kBAAA,CAAUa,IArHJ;;EAsHhB;AACF;AACA;EACEhD,OAAO,EAAEmC,kBAAA,CAAUa,IAzHH;;EA2HhB;AACF;AACA;EACE/C,IAAI,EAAEkC,kBAAA,CAAUE,MA9HA;;EA+HhB;AACF;AACA;EACEnC,sBAAsB,EAAEiC,kBAAA,CAAUE,MAlIlB;;EAmIhB;AACF;AACA;EACElC,iBAAiB,EAAEgC,kBAAA,CAAUQ,UAAV,CAAqBC,MAArB;AAtIH,CAAlB;;eAyIe,IAAAK,kBAAA,EAAWC,gBAAX,EAAmB;EAAEC,IAAI,EAAE;AAAR,CAAnB,EAAsC7D,KAAtC,C"}
|
package/dist/Tag/styles.js
CHANGED
|
@@ -46,13 +46,15 @@ var styles = function styles(theme) {
|
|
|
46
46
|
primaryButton: {
|
|
47
47
|
background: "transparent"
|
|
48
48
|
},
|
|
49
|
-
label: {
|
|
49
|
+
label: _objectSpread(_objectSpread({
|
|
50
50
|
paddingLeft: theme.hv.spacing.xs,
|
|
51
|
-
paddingRight: theme.hv.spacing.xs
|
|
51
|
+
paddingRight: theme.hv.spacing.xs
|
|
52
|
+
}, theme.hv.typography.normalText), {}, {
|
|
53
|
+
color: theme.palette.base2,
|
|
52
54
|
"& p": {
|
|
53
55
|
color: theme.hv.palette.base.base2
|
|
54
56
|
}
|
|
55
|
-
},
|
|
57
|
+
}),
|
|
56
58
|
tagButton: {
|
|
57
59
|
width: 16,
|
|
58
60
|
height: 16,
|
package/dist/Tag/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles","theme","root","chipRoot","height","borderRadius","maxWidth","backgroundColor","fade","palette","base1","focusVisible","primaryButton","background","label","paddingLeft","hv","spacing","xs","paddingRight","
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","theme","root","chipRoot","height","borderRadius","maxWidth","backgroundColor","fade","palette","base1","focusVisible","primaryButton","background","label","paddingLeft","hv","spacing","xs","paddingRight","typography","normalText","color","base2","base","tagButton","width","minWidth","minHeight","padding","margin","deleteIcon","marginRight","outlineStyles","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.base2,\n },\n categoricalTextColor: {\n color: theme.hv.palette.accent.acce1,\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;EAAA,OAAY;IACzBC,IAAI,EAAE,EADmB;IAGzBC,QAAQ,EAAE;MACRC,MAAM,EAAE,EADA;MAERC,YAAY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CAA4Bc;MADrB,CAHG;MAMnB,WAAW;QACT5C,eAAe,EAAEN,KAAK,CAACe,EAAN,CAASP,OAAT,CAAiB4B,UAAjB,CAA4BC;MADpC,CANQ;MASnB,WAAW;QACTJ,OAAO,EAAE;MADA;IATQ,CAxGI;IAsHzBmB,iBAAiB,EAAE;MACjB/B,KAAK,EAAErB,KAAK,CAACe,EAAN,CAASP,OAAT,CAAiBe,IAAjB,CAAsBD;IADZ,CAtHM;IAyHzB+B,oBAAoB,EAAE;MACpBhC,KAAK,EAAErB,KAAK,CAACe,EAAN,CAASP,OAAT,CAAiBqC,MAAjB,CAAwBC;IADX;EAzHG,CAAZ;AAAA,CAAf;;eA8He/C,M"}
|
|
@@ -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?:
|
|
24
|
+
callbacks?: Pick<HvTableInstance, "setSortBy" | "setGlobalFilter">;
|
|
33
25
|
/**
|
|
34
26
|
* Views configuration required for the view buttons
|
|
35
27
|
*/
|
|
@@ -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
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
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/
|
|
65
|
+
* @see https://lumada-design.github.io/uikit/master/?path=/docs/theme-css-baseline--page
|
|
79
66
|
*/
|
|
80
|
-
|
|
67
|
+
cssBaseline?: "global" | "scoped" | "none";
|
|
81
68
|
}
|
|
82
69
|
|
|
83
70
|
export default function HvProvider(props: HvProviderProps): JSX.Element | null;
|