@hitachivantara/uikit-react-core 5.82.4 → 5.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseInput/BaseInput.cjs +4 -7
- package/dist/cjs/ButtonBase/ButtonBase.styles.cjs +6 -5
- package/dist/cjs/Calendar/Calendar.cjs +2 -2
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.cjs +12 -28
- package/dist/cjs/Calendar/SingleCalendar/SingleCalendar.cjs +2 -1
- package/dist/cjs/Calendar/utils.cjs +53 -21
- package/dist/cjs/ColorPicker/ColorPicker.cjs +11 -9
- package/dist/cjs/ColorPicker/ColorPicker.styles.cjs +14 -7
- package/dist/cjs/ColorPicker/Fields/Fields.cjs +6 -3
- package/dist/cjs/DatePicker/DatePicker.cjs +1 -2
- package/dist/cjs/DatePicker/utils.cjs +2 -2
- package/dist/cjs/Input/Input.cjs +9 -8
- package/dist/cjs/Select/Option.cjs +1 -2
- package/dist/cjs/Select/Select.cjs +6 -1
- package/dist/cjs/Table/TableRow/TableRow.styles.cjs +20 -5
- package/dist/cjs/Table/hooks/{useBulkActions.cjs → useHvBulkActions.cjs} +6 -7
- package/dist/cjs/Table/hooks/{useFilters.cjs → useHvFilters.cjs} +2 -2
- package/dist/cjs/Table/hooks/{useGlobalFilter.cjs → useHvGlobalFilter.cjs} +2 -2
- package/dist/cjs/Table/hooks/{useHeaderGroups.cjs → useHvHeaderGroups.cjs} +4 -4
- package/dist/cjs/Table/hooks/{usePagination.cjs → useHvPagination.cjs} +4 -4
- package/dist/cjs/Table/hooks/{useResizeColumns.cjs → useHvResizeColumns.cjs} +4 -4
- package/dist/cjs/Table/hooks/{useRowExpand.cjs → useHvRowExpand.cjs} +6 -5
- package/dist/cjs/Table/hooks/{useRowSelection.cjs → useHvRowSelection.cjs} +4 -8
- package/dist/cjs/Table/hooks/{useRowState.cjs → useHvRowState.cjs} +2 -2
- package/dist/cjs/Table/hooks/{useSortBy.cjs → useHvSortBy.cjs} +4 -4
- package/dist/cjs/Table/hooks/{useSticky.cjs → useHvSticky.cjs} +4 -6
- package/dist/cjs/Table/hooks/{useTable.cjs → useHvTable.cjs} +6 -4
- package/dist/cjs/Table/hooks/{useTableStyles.cjs → useHvTableStyles.cjs} +4 -5
- package/dist/cjs/Table/renderers/{DateColumnCell/DateColumnCell.cjs → DateColumnCell.cjs} +1 -1
- package/dist/cjs/Table/renderers/DefaultCell.cjs +21 -0
- package/dist/cjs/Table/renderers/{DropdownColumnCell/DropdownColumnCell.cjs → DropdownColumnCell.cjs} +1 -1
- package/dist/cjs/Table/renderers/{ProgressColumnCell/ProgressColumnCell.cjs → ProgressColumnCell.cjs} +20 -2
- package/dist/cjs/Table/renderers/{SwitchColumnCell/SwitchColumnCell.cjs → SwitchColumnCell.cjs} +13 -4
- package/dist/cjs/Table/renderers/renderers.cjs +21 -8
- package/dist/cjs/Tag/Tag.cjs +67 -49
- package/dist/cjs/Tag/Tag.styles.cjs +50 -64
- package/dist/cjs/TagsInput/TagsInput.cjs +1 -4
- package/dist/cjs/TagsInput/TagsInput.styles.cjs +1 -4
- package/dist/cjs/TextArea/TextArea.cjs +4 -4
- package/dist/cjs/TimeAgo/TimeAgo.cjs +2 -1
- package/dist/cjs/TimePicker/TimePicker.cjs +2 -1
- package/dist/cjs/index.cjs +40 -50
- package/dist/cjs/utils/keyboardUtils.cjs +4 -0
- package/dist/esm/BaseInput/BaseInput.js +3 -6
- package/dist/esm/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/ButtonBase/ButtonBase.styles.js +6 -5
- package/dist/esm/ButtonBase/ButtonBase.styles.js.map +1 -1
- package/dist/esm/Calendar/Calendar.js +3 -3
- package/dist/esm/Calendar/Calendar.js.map +1 -1
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js +13 -24
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/esm/Calendar/SingleCalendar/SingleCalendar.js +3 -2
- package/dist/esm/Calendar/SingleCalendar/SingleCalendar.js.map +1 -1
- package/dist/esm/Calendar/utils.js +54 -20
- package/dist/esm/Calendar/utils.js.map +1 -1
- package/dist/esm/ColorPicker/ColorPicker.js +12 -10
- package/dist/esm/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/ColorPicker/ColorPicker.styles.js +14 -7
- package/dist/esm/ColorPicker/ColorPicker.styles.js.map +1 -1
- package/dist/esm/ColorPicker/Fields/Fields.js +6 -3
- package/dist/esm/ColorPicker/Fields/Fields.js.map +1 -1
- package/dist/esm/Controls/Controls.js.map +1 -1
- package/dist/esm/DatePicker/DatePicker.js +2 -3
- package/dist/esm/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/DatePicker/utils.js +2 -2
- package/dist/esm/DatePicker/utils.js.map +1 -1
- package/dist/esm/Input/Input.js +10 -9
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/Select/Option.js +1 -2
- package/dist/esm/Select/Option.js.map +1 -1
- package/dist/esm/Select/Select.js +6 -1
- package/dist/esm/Select/Select.js.map +1 -1
- package/dist/esm/Table/TableRow/TableRow.styles.js +16 -1
- package/dist/esm/Table/TableRow/TableRow.styles.js.map +1 -1
- package/dist/esm/Table/hooks/{useBulkActions.js → useHvBulkActions.js} +5 -6
- package/dist/esm/Table/hooks/useHvBulkActions.js.map +1 -0
- package/dist/esm/Table/hooks/{useFilters.js → useHvFilters.js} +1 -1
- package/dist/esm/Table/hooks/useHvFilters.js.map +1 -0
- package/dist/esm/Table/hooks/{useGlobalFilter.js → useHvGlobalFilter.js} +1 -1
- package/dist/esm/Table/hooks/useHvGlobalFilter.js.map +1 -0
- package/dist/esm/Table/hooks/{useHeaderGroups.js → useHvHeaderGroups.js} +3 -3
- package/dist/esm/Table/hooks/useHvHeaderGroups.js.map +1 -0
- package/dist/esm/Table/hooks/{usePagination.js → useHvPagination.js} +4 -4
- package/dist/esm/Table/hooks/useHvPagination.js.map +1 -0
- package/dist/esm/Table/hooks/{useResizeColumns.js → useHvResizeColumns.js} +3 -3
- package/dist/esm/Table/hooks/useHvResizeColumns.js.map +1 -0
- package/dist/esm/Table/hooks/{useRowExpand.js → useHvRowExpand.js} +5 -4
- package/dist/esm/Table/hooks/useHvRowExpand.js.map +1 -0
- package/dist/esm/Table/hooks/{useRowSelection.js → useHvRowSelection.js} +3 -7
- package/dist/esm/Table/hooks/useHvRowSelection.js.map +1 -0
- package/dist/esm/Table/hooks/{useRowState.js → useHvRowState.js} +1 -1
- package/dist/esm/Table/hooks/useHvRowState.js.map +1 -0
- package/dist/esm/Table/hooks/{useSortBy.js → useHvSortBy.js} +3 -3
- package/dist/esm/Table/hooks/useHvSortBy.js.map +1 -0
- package/dist/esm/Table/hooks/{useSticky.js → useHvSticky.js} +3 -5
- package/dist/esm/Table/hooks/useHvSticky.js.map +1 -0
- package/dist/esm/Table/hooks/{useTable.js → useHvTable.js} +5 -3
- package/dist/esm/Table/hooks/useHvTable.js.map +1 -0
- package/dist/esm/Table/hooks/{useTableStyles.js → useHvTableStyles.js} +3 -4
- package/dist/esm/Table/hooks/useHvTableStyles.js.map +1 -0
- package/dist/esm/Table/renderers/{DateColumnCell/DateColumnCell.js → DateColumnCell.js} +1 -1
- package/dist/esm/Table/renderers/DateColumnCell.js.map +1 -0
- package/dist/esm/Table/renderers/DefaultCell.js +21 -0
- package/dist/esm/Table/renderers/DefaultCell.js.map +1 -0
- package/dist/esm/Table/renderers/{DropdownColumnCell/DropdownColumnCell.js → DropdownColumnCell.js} +1 -1
- package/dist/esm/Table/renderers/DropdownColumnCell.js.map +1 -0
- package/dist/esm/Table/renderers/{ProgressColumnCell/ProgressColumnCell.js → ProgressColumnCell.js} +19 -1
- package/dist/esm/Table/renderers/ProgressColumnCell.js.map +1 -0
- package/dist/esm/Table/renderers/{SwitchColumnCell/SwitchColumnCell.js → SwitchColumnCell.js} +12 -3
- package/dist/esm/Table/renderers/SwitchColumnCell.js.map +1 -0
- package/dist/esm/Table/renderers/renderers.js +18 -5
- package/dist/esm/Table/renderers/renderers.js.map +1 -1
- package/dist/esm/Tag/Tag.js +71 -51
- package/dist/esm/Tag/Tag.js.map +1 -1
- package/dist/esm/Tag/Tag.styles.js +50 -64
- package/dist/esm/Tag/Tag.styles.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.js +1 -4
- package/dist/esm/TagsInput/TagsInput.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.styles.js +1 -4
- package/dist/esm/TagsInput/TagsInput.styles.js.map +1 -1
- package/dist/esm/TextArea/TextArea.js +4 -4
- package/dist/esm/TextArea/TextArea.js.map +1 -1
- package/dist/esm/TimeAgo/TimeAgo.js +2 -1
- package/dist/esm/TimeAgo/TimeAgo.js.map +1 -1
- package/dist/esm/TimePicker/TimePicker.js +2 -1
- package/dist/esm/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/index.js +34 -44
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/keyboardUtils.js +4 -0
- package/dist/esm/utils/keyboardUtils.js.map +1 -1
- package/dist/types/index.d.ts +367 -395
- package/package.json +6 -6
- package/dist/cjs/Table/renderers/ProgressColumnCell/ProgressColumnCell.styles.cjs +0 -26
- package/dist/cjs/Table/renderers/SwitchColumnCell/SwitchColumnCell.styles.cjs +0 -21
- package/dist/cjs/Table/utils/fallbacks.cjs +0 -16
- package/dist/cjs/Table/utils/utils.cjs +0 -19
- package/dist/esm/Table/hooks/useBulkActions.js.map +0 -1
- package/dist/esm/Table/hooks/useFilters.js.map +0 -1
- package/dist/esm/Table/hooks/useGlobalFilter.js.map +0 -1
- package/dist/esm/Table/hooks/useHeaderGroups.js.map +0 -1
- package/dist/esm/Table/hooks/usePagination.js.map +0 -1
- package/dist/esm/Table/hooks/useResizeColumns.js.map +0 -1
- package/dist/esm/Table/hooks/useRowExpand.js.map +0 -1
- package/dist/esm/Table/hooks/useRowSelection.js.map +0 -1
- package/dist/esm/Table/hooks/useRowState.js.map +0 -1
- package/dist/esm/Table/hooks/useSortBy.js.map +0 -1
- package/dist/esm/Table/hooks/useSticky.js.map +0 -1
- package/dist/esm/Table/hooks/useTable.js.map +0 -1
- package/dist/esm/Table/hooks/useTableStyles.js.map +0 -1
- package/dist/esm/Table/renderers/DateColumnCell/DateColumnCell.js.map +0 -1
- package/dist/esm/Table/renderers/DropdownColumnCell/DropdownColumnCell.js.map +0 -1
- package/dist/esm/Table/renderers/ProgressColumnCell/ProgressColumnCell.js.map +0 -1
- package/dist/esm/Table/renderers/ProgressColumnCell/ProgressColumnCell.styles.js +0 -26
- package/dist/esm/Table/renderers/ProgressColumnCell/ProgressColumnCell.styles.js.map +0 -1
- package/dist/esm/Table/renderers/SwitchColumnCell/SwitchColumnCell.js.map +0 -1
- package/dist/esm/Table/renderers/SwitchColumnCell/SwitchColumnCell.styles.js +0 -21
- package/dist/esm/Table/renderers/SwitchColumnCell/SwitchColumnCell.styles.js.map +0 -1
- package/dist/esm/Table/utils/fallbacks.js +0 -16
- package/dist/esm/Table/utils/fallbacks.js.map +0 -1
- package/dist/esm/Table/utils/utils.js +0 -19
- package/dist/esm/Table/utils/utils.js.map +0 -1
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const react = require("@emotion/react");
|
|
6
|
-
const
|
|
6
|
+
const MuiInputBase = require("@mui/material/InputBase");
|
|
7
7
|
const utils$1 = require("@mui/material/utils");
|
|
8
8
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
9
9
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
@@ -11,7 +11,7 @@ const BaseInput_styles = require("./BaseInput.styles.cjs");
|
|
|
11
11
|
const context = require("../FormElement/context.cjs");
|
|
12
12
|
const utils = require("../FormElement/utils.cjs");
|
|
13
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
|
-
const
|
|
14
|
+
const MuiInputBase__default = /* @__PURE__ */ _interopDefault(MuiInputBase);
|
|
15
15
|
const baseInputStyles = react.css({
|
|
16
16
|
"input:-webkit-autofill": {
|
|
17
17
|
WebkitBoxShadow: `0 0 0px 1000px ${uikitStyles.theme.colors.atmo1} inset`,
|
|
@@ -75,9 +75,6 @@ const HvBaseInput = React.forwardRef(function HvBaseInput2(props, ref) {
|
|
|
75
75
|
localInvalid,
|
|
76
76
|
id
|
|
77
77
|
);
|
|
78
|
-
const onChangeHandler = (event) => {
|
|
79
|
-
onChange?.(event, event.target.value);
|
|
80
|
-
};
|
|
81
78
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
82
79
|
/* @__PURE__ */ jsxRuntime.jsx(react.Global, { styles: baseInputStyles }),
|
|
83
80
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -91,7 +88,7 @@ const HvBaseInput = React.forwardRef(function HvBaseInput2(props, ref) {
|
|
|
91
88
|
}),
|
|
92
89
|
children: [
|
|
93
90
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
-
|
|
91
|
+
MuiInputBase__default.default,
|
|
95
92
|
{
|
|
96
93
|
id,
|
|
97
94
|
name: formElementProps.name,
|
|
@@ -101,7 +98,7 @@ const HvBaseInput = React.forwardRef(function HvBaseInput2(props, ref) {
|
|
|
101
98
|
placeholder,
|
|
102
99
|
readOnly: !!formElementProps.readOnly,
|
|
103
100
|
disabled: formElementProps.disabled,
|
|
104
|
-
onChange:
|
|
101
|
+
onChange: (event) => onChange?.(event, event.target.value),
|
|
105
102
|
className: cx({
|
|
106
103
|
[classes.inputRootInvalid]: localInvalid,
|
|
107
104
|
[classes.inputRootReadOnly]: formElementProps.readOnly
|
|
@@ -10,12 +10,13 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvButtonBas
|
|
|
10
10
|
background: "none",
|
|
11
11
|
padding: 0,
|
|
12
12
|
// Background color common for almost all variants
|
|
13
|
-
"
|
|
14
|
-
|
|
13
|
+
":where(:not($disabled))": {
|
|
14
|
+
":hover, :focus-visible": {
|
|
15
|
+
backgroundColor: uikitStyles.theme.colors.containerBackgroundHover
|
|
16
|
+
}
|
|
15
17
|
},
|
|
16
|
-
"
|
|
17
|
-
...focusUtils.outlineStyles
|
|
18
|
-
backgroundColor: uikitStyles.theme.colors.containerBackgroundHover
|
|
18
|
+
":focus-visible": {
|
|
19
|
+
...focusUtils.outlineStyles
|
|
19
20
|
},
|
|
20
21
|
// Default button - no size specified
|
|
21
22
|
fontFamily: uikitStyles.theme.fontFamily.body,
|
|
@@ -6,13 +6,13 @@ const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
|
6
6
|
const setId = require("../utils/setId.cjs");
|
|
7
7
|
const Calendar_styles = require("./Calendar.styles.cjs");
|
|
8
8
|
const utils = require("./utils.cjs");
|
|
9
|
-
const SingleCalendar = require("./SingleCalendar/SingleCalendar.cjs");
|
|
10
9
|
const context = require("../FormElement/context.cjs");
|
|
10
|
+
const SingleCalendar = require("./SingleCalendar/SingleCalendar.cjs");
|
|
11
11
|
const HvCalendar = (props) => {
|
|
12
12
|
const {
|
|
13
13
|
classes: classesProp,
|
|
14
14
|
id: idProp,
|
|
15
|
-
locale =
|
|
15
|
+
locale = utils.DEFAULT_LOCALE,
|
|
16
16
|
value: valueProp,
|
|
17
17
|
visibleMonth,
|
|
18
18
|
visibleYear,
|
|
@@ -2,31 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
|
-
const dayjs = require("dayjs");
|
|
6
|
-
const customParseFormat = require("dayjs/plugin/customParseFormat");
|
|
7
|
-
const localeData = require("dayjs/plugin/localeData");
|
|
8
|
-
const localizedFormat = require("dayjs/plugin/localizedFormat");
|
|
9
5
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
10
6
|
const keyboardUtils = require("../../utils/keyboardUtils.cjs");
|
|
11
7
|
const setId = require("../../utils/setId.cjs");
|
|
12
8
|
const utils = require("../utils.cjs");
|
|
13
9
|
const CalendarHeader_styles = require("./CalendarHeader.styles.cjs");
|
|
14
|
-
const context = require("../../FormElement/context.cjs");
|
|
15
10
|
const Input = require("../../Input/Input.cjs");
|
|
11
|
+
const context = require("../../FormElement/context.cjs");
|
|
16
12
|
const Typography = require("../../Typography/Typography.cjs");
|
|
17
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
18
|
-
const dayjs__default = /* @__PURE__ */ _interopDefault(dayjs);
|
|
19
|
-
const customParseFormat__default = /* @__PURE__ */ _interopDefault(customParseFormat);
|
|
20
|
-
const localeData__default = /* @__PURE__ */ _interopDefault(localeData);
|
|
21
|
-
const localizedFormat__default = /* @__PURE__ */ _interopDefault(localizedFormat);
|
|
22
|
-
dayjs__default.default.extend(localeData__default.default);
|
|
23
|
-
dayjs__default.default.extend(localizedFormat__default.default);
|
|
24
|
-
dayjs__default.default.extend(customParseFormat__default.default);
|
|
25
13
|
const HvCalendarHeader = (props) => {
|
|
26
14
|
const {
|
|
27
15
|
id: idProp,
|
|
28
|
-
value,
|
|
29
|
-
locale =
|
|
16
|
+
value: valueProp,
|
|
17
|
+
locale = utils.DEFAULT_LOCALE,
|
|
30
18
|
classes: classesProp,
|
|
31
19
|
onChange,
|
|
32
20
|
showEndDate,
|
|
@@ -36,23 +24,19 @@ const HvCalendarHeader = (props) => {
|
|
|
36
24
|
} = uikitReactUtils.useDefaultProps("HvCalendarHeader", props);
|
|
37
25
|
const { classes, cx } = CalendarHeader_styles.useClasses(classesProp);
|
|
38
26
|
const context$1 = React.useContext(context.HvFormElementContext);
|
|
39
|
-
const elementValue = React.useContext(context.HvFormElementValueContext);
|
|
40
27
|
const { label } = React.useContext(context.HvFormElementDescriptorsContext);
|
|
41
|
-
|
|
42
|
-
if (utils.isRange(localValue)) {
|
|
43
|
-
localValue = showEndDate ? localValue.endDate : localValue.startDate;
|
|
44
|
-
}
|
|
28
|
+
const localValue = utils.isRange(valueProp) ? showEndDate ? valueProp.endDate : valueProp.startDate : valueProp;
|
|
45
29
|
const [dateValue, setDateValue] = React.useState(localValue);
|
|
46
30
|
const [editedValue, setEditedValue] = React.useState(null);
|
|
47
31
|
const [displayValue, setDisplayValue] = React.useState("");
|
|
48
32
|
const [weekdayDisplay, setWeekdayDisplay] = React.useState("");
|
|
49
33
|
const id = idProp ?? setId.setId(context$1.id, "calendarHeader");
|
|
50
34
|
const inputValue = editedValue ?? displayValue;
|
|
51
|
-
const localeFormat =
|
|
35
|
+
const localeFormat = utils.getLocaleDateFormat(locale);
|
|
52
36
|
const [isValidValue, setIsValidValue] = React.useState(
|
|
53
|
-
inputValue.length === 0 ||
|
|
37
|
+
inputValue.length === 0 || inputValue && utils.isDate(new Date(inputValue))
|
|
54
38
|
);
|
|
55
|
-
const validateInput = (incomingValid) => incomingValid === void 0 ||
|
|
39
|
+
const validateInput = (incomingValid) => incomingValid === void 0 || utils.isDate(new Date(incomingValid));
|
|
56
40
|
React.useEffect(() => {
|
|
57
41
|
const valid = validateInput(localValue);
|
|
58
42
|
setIsValidValue(valid);
|
|
@@ -66,15 +50,15 @@ const HvCalendarHeader = (props) => {
|
|
|
66
50
|
const weekday = new Intl.DateTimeFormat(locale, {
|
|
67
51
|
weekday: "short"
|
|
68
52
|
}).format(utils.isDate(localValue) ? localValue : 0);
|
|
69
|
-
setDisplayValue(utils.
|
|
53
|
+
setDisplayValue(utils.getFormattedDate(localValue, locale));
|
|
70
54
|
setEditedValue(null);
|
|
71
55
|
setWeekdayDisplay(weekday);
|
|
72
56
|
}
|
|
73
57
|
}, [localValue, locale]);
|
|
74
58
|
const handleNewDate = (event, date) => {
|
|
75
|
-
const localeParsedDate =
|
|
76
|
-
const isValidInput =
|
|
77
|
-
const dateParsed = isValidInput ? localeParsedDate
|
|
59
|
+
const localeParsedDate = utils.parseDateString(date, locale);
|
|
60
|
+
const isValidInput = utils.isDate(localeParsedDate);
|
|
61
|
+
const dateParsed = isValidInput ? localeParsedDate : new Date(date);
|
|
78
62
|
if (!utils.isSameDay(dateParsed, dateValue)) {
|
|
79
63
|
setDateValue(dateParsed);
|
|
80
64
|
onChange?.(event, dateParsed);
|
|
@@ -101,7 +85,7 @@ const HvCalendarHeader = (props) => {
|
|
|
101
85
|
};
|
|
102
86
|
const onFocusHandler = (event) => {
|
|
103
87
|
if (!localValue) return;
|
|
104
|
-
const formattedDate = isValidValue && utils.isDate(localValue) ?
|
|
88
|
+
const formattedDate = isValidValue && utils.isDate(localValue) ? utils.getStringFromDate(localValue, locale) : editedValue;
|
|
105
89
|
setEditedValue(formattedDate);
|
|
106
90
|
onFocus?.(event, formattedDate);
|
|
107
91
|
};
|
|
@@ -17,7 +17,7 @@ const HvSingleCalendar = ({
|
|
|
17
17
|
classes: classesProp,
|
|
18
18
|
className,
|
|
19
19
|
id,
|
|
20
|
-
locale =
|
|
20
|
+
locale = utils.DEFAULT_LOCALE,
|
|
21
21
|
value,
|
|
22
22
|
visibleMonth,
|
|
23
23
|
visibleYear,
|
|
@@ -105,6 +105,7 @@ const HvSingleCalendar = ({
|
|
|
105
105
|
{
|
|
106
106
|
id: setId.setId(id, "header"),
|
|
107
107
|
locale,
|
|
108
|
+
value,
|
|
108
109
|
onChange: handleInputChange,
|
|
109
110
|
showEndDate: showEndDate && !isDateSelectionMode,
|
|
110
111
|
showDayOfWeek,
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const dayjs = require("dayjs");
|
|
4
3
|
const helpers = require("../utils/helpers.cjs");
|
|
5
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
-
const dayjs__default = /* @__PURE__ */ _interopDefault(dayjs);
|
|
7
4
|
const CALENDAR_WEEKS = 6;
|
|
5
|
+
const DEFAULT_LOCALE = "en";
|
|
8
6
|
const getMonthDays = (month, year) => new Date(year, month, 0).getDate();
|
|
9
7
|
const getMonthFirstWeekday = (month, year) => new Date(year, month - 1, 1).getDay();
|
|
10
8
|
const makeUTCDate = (year, monthIndex, day, hour = 1) => new Date(Date.UTC(year, monthIndex, day, hour));
|
|
@@ -18,6 +16,9 @@ const isSameDay = (date1, date2) => {
|
|
|
18
16
|
if (!(isDate(date1) && isDate(date2))) return false;
|
|
19
17
|
return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
|
|
20
18
|
};
|
|
19
|
+
const getDateISO = (date) => {
|
|
20
|
+
return new Date(date).toISOString().slice(0, 10);
|
|
21
|
+
};
|
|
21
22
|
const getPreviousMonth = (month, year) => {
|
|
22
23
|
const prevMonth = month > 1 ? month - 1 : 12;
|
|
23
24
|
const prevMonthYear = month > 1 ? year : year - 1;
|
|
@@ -45,7 +46,10 @@ const getWeekdayNamesList = (locale) => {
|
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
48
|
const getMonthName = (date, locale, representationValue = "long") => new Intl.DateTimeFormat(locale, { month: representationValue }).format(date);
|
|
48
|
-
const getFormattedDate = (date, locale
|
|
49
|
+
const getFormattedDate = (date, locale) => {
|
|
50
|
+
const formatter = new Intl.DateTimeFormat(locale, { dateStyle: "medium" });
|
|
51
|
+
return formatter.format(date);
|
|
52
|
+
};
|
|
49
53
|
const createDatesArray = (month, year) => {
|
|
50
54
|
const monthDays = getMonthDays(month, year);
|
|
51
55
|
const daysFromPrevMonth = getMonthFirstWeekday(month, year);
|
|
@@ -68,41 +72,68 @@ const createDatesArray = (month, year) => {
|
|
|
68
72
|
return [...prevMonthDates, ...currentMonthDates, ...nextMonthDates];
|
|
69
73
|
};
|
|
70
74
|
const isRange = (date) => date != null && typeof date === "object" && "startDate" in date;
|
|
71
|
-
const dateInProvidedValueRange = (date,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const convertedDate = dayjs__default.default(date).format("YYYY-MM-DD");
|
|
75
|
+
const dateInProvidedValueRange = (date, dateRange) => {
|
|
76
|
+
if (!isRange(dateRange) || !dateRange?.endDate) return false;
|
|
77
|
+
const { startDate, endDate } = dateRange;
|
|
78
|
+
const modStartDate = getDateISO(startDate);
|
|
79
|
+
const modEndDate = getDateISO(endDate);
|
|
80
|
+
const convertedDate = getDateISO(date ?? /* @__PURE__ */ new Date());
|
|
78
81
|
return convertedDate >= modStartDate && convertedDate <= modEndDate;
|
|
79
82
|
};
|
|
80
83
|
const checkIfDateIsDisabled = (date, minimumDate, maximumDate) => {
|
|
81
84
|
if (!minimumDate && !maximumDate) return false;
|
|
82
|
-
const modStartDate = minimumDate
|
|
83
|
-
const modEndDate = maximumDate
|
|
84
|
-
const convertedDate =
|
|
85
|
+
const modStartDate = minimumDate && getDateISO(minimumDate);
|
|
86
|
+
const modEndDate = maximumDate && getDateISO(maximumDate);
|
|
87
|
+
const convertedDate = getDateISO(date ?? /* @__PURE__ */ new Date());
|
|
85
88
|
return modStartDate !== void 0 && convertedDate < modStartDate || modEndDate !== void 0 && convertedDate > modEndDate;
|
|
86
89
|
};
|
|
87
|
-
|
|
90
|
+
function getEditableDateFormatter(locale) {
|
|
88
91
|
return new Intl.DateTimeFormat(locale, {
|
|
89
|
-
|
|
90
|
-
month: "
|
|
91
|
-
|
|
92
|
-
})
|
|
93
|
-
}
|
|
92
|
+
year: "numeric",
|
|
93
|
+
month: "2-digit",
|
|
94
|
+
day: "2-digit"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function getStringFromDate(date, locale) {
|
|
98
|
+
return getEditableDateFormatter(locale).format(date);
|
|
99
|
+
}
|
|
100
|
+
function parseDateString(dateString, locale) {
|
|
101
|
+
const dateParts = dateString.split(/\D+/).map(Number);
|
|
102
|
+
if (dateParts.length !== 3) return null;
|
|
103
|
+
if (!dateParts.every(Boolean)) return null;
|
|
104
|
+
const formatter = getEditableDateFormatter(locale);
|
|
105
|
+
const formatOrder = formatter.formatToParts(new Date(2020, 4, 4)).filter((part) => ["year", "month", "day"].includes(part.type)).map((part) => part.type);
|
|
106
|
+
const dateObject = { year: 2020, month: 4, day: 4 };
|
|
107
|
+
formatOrder.forEach((type, index) => {
|
|
108
|
+
dateObject[type] = dateParts[index];
|
|
109
|
+
});
|
|
110
|
+
return new Date(dateObject.year, dateObject.month - 1, dateObject.day);
|
|
111
|
+
}
|
|
112
|
+
function getLocaleDateFormat(locale) {
|
|
113
|
+
const formatter = getEditableDateFormatter(locale);
|
|
114
|
+
const getPartType = (part) => {
|
|
115
|
+
if (part.type === "year") return "YYYY";
|
|
116
|
+
if (part.type === "month") return "MM";
|
|
117
|
+
if (part.type === "day") return "DD";
|
|
118
|
+
return part.value;
|
|
119
|
+
};
|
|
120
|
+
return formatter.formatToParts(new Date(2020, 4, 4)).reduce((acc, part) => acc + getPartType(part), "");
|
|
121
|
+
}
|
|
94
122
|
exports.CALENDAR_WEEKS = CALENDAR_WEEKS;
|
|
123
|
+
exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
|
|
95
124
|
exports.checkIfDateIsDisabled = checkIfDateIsDisabled;
|
|
96
125
|
exports.createDatesArray = createDatesArray;
|
|
97
126
|
exports.dateInProvidedValueRange = dateInProvidedValueRange;
|
|
98
|
-
exports.
|
|
127
|
+
exports.getDateISO = getDateISO;
|
|
99
128
|
exports.getFormattedDate = getFormattedDate;
|
|
129
|
+
exports.getLocaleDateFormat = getLocaleDateFormat;
|
|
100
130
|
exports.getMonthDays = getMonthDays;
|
|
101
131
|
exports.getMonthFirstWeekday = getMonthFirstWeekday;
|
|
102
132
|
exports.getMonthName = getMonthName;
|
|
103
133
|
exports.getMonthNamesList = getMonthNamesList;
|
|
104
134
|
exports.getNextMonth = getNextMonth;
|
|
105
135
|
exports.getPreviousMonth = getPreviousMonth;
|
|
136
|
+
exports.getStringFromDate = getStringFromDate;
|
|
106
137
|
exports.getWeekdayNamesList = getWeekdayNamesList;
|
|
107
138
|
exports.isDate = isDate;
|
|
108
139
|
exports.isDateRangeProp = isDateRangeProp;
|
|
@@ -110,3 +141,4 @@ exports.isRange = isRange;
|
|
|
110
141
|
exports.isSameDay = isSameDay;
|
|
111
142
|
exports.isSameMonth = isSameMonth;
|
|
112
143
|
exports.makeUTCDate = makeUTCDate;
|
|
144
|
+
exports.parseDateString = parseDateString;
|
|
@@ -71,7 +71,7 @@ const HvColorPicker = React.forwardRef(
|
|
|
71
71
|
deleteSavedColorButtonArialLabel = "Delete saved color",
|
|
72
72
|
addSavedColorButtonAriaLabel = "Add current color to saved colors"
|
|
73
73
|
} = uikitReactUtils.useDefaultProps("HvColorPicker", props);
|
|
74
|
-
const { classes,
|
|
74
|
+
const { classes, cx } = ColorPicker_styles.useClasses(classesProp);
|
|
75
75
|
const labels = useLabels.useLabels(DEFAULT_LABELS, labelsProp);
|
|
76
76
|
const [isOpen, setIsOpen] = useControlled.useControlled(expanded, defaultExpanded);
|
|
77
77
|
const [color, setColor] = useControlled.useControlled(value, defaultValue);
|
|
@@ -154,22 +154,24 @@ const HvColorPicker = React.forwardRef(
|
|
|
154
154
|
onToggle: handleToggle,
|
|
155
155
|
onContainerCreation: setFocusToContent,
|
|
156
156
|
classes: {
|
|
157
|
-
root: cx({ [classes.dropdownRootIconOnly]: iconOnly })
|
|
158
|
-
selection: cx(iconOnly && css({ padding: 0 }))
|
|
157
|
+
root: cx({ [classes.dropdownRootIconOnly]: iconOnly })
|
|
159
158
|
},
|
|
160
159
|
adornment: iconOnly && color ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
-
|
|
160
|
+
"div",
|
|
162
161
|
{
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
style: { backgroundColor: color },
|
|
163
|
+
className: cx(
|
|
164
|
+
classes.headerColorIcon,
|
|
165
|
+
classes.headerColorIconOnly
|
|
166
|
+
)
|
|
165
167
|
}
|
|
166
168
|
) : dropdownIcon === "colorPicker" ? /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.ColorPicker, { className: classes.colorPickerIcon }) : void 0,
|
|
167
169
|
placeholder: iconOnly ? void 0 : color ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
168
170
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
169
|
-
|
|
171
|
+
"div",
|
|
170
172
|
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
style: { backgroundColor: color },
|
|
174
|
+
className: classes.headerColorIcon
|
|
173
175
|
}
|
|
174
176
|
),
|
|
175
177
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14,13 +14,15 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvColorPick
|
|
|
14
14
|
},
|
|
15
15
|
description: {},
|
|
16
16
|
headerColorValue: {
|
|
17
|
-
textTransform: "uppercase"
|
|
17
|
+
textTransform: "uppercase",
|
|
18
|
+
minWidth: "8ch",
|
|
19
|
+
fontVariant: "tabular-nums"
|
|
18
20
|
},
|
|
19
21
|
headerColorIcon: {
|
|
20
|
-
width:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
width: 16,
|
|
23
|
+
height: 16,
|
|
24
|
+
marginRight: 8,
|
|
25
|
+
flexShrink: 0
|
|
24
26
|
},
|
|
25
27
|
panel: {
|
|
26
28
|
width: "100%",
|
|
@@ -41,9 +43,14 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvColorPick
|
|
|
41
43
|
},
|
|
42
44
|
dropdownRootIconOnly: {
|
|
43
45
|
width: 32,
|
|
44
|
-
height: 32
|
|
46
|
+
height: 32,
|
|
47
|
+
"& .HvBaseDropdown-selection": {
|
|
48
|
+
padding: 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
headerColorIconOnly: {
|
|
52
|
+
margin: 8
|
|
45
53
|
},
|
|
46
|
-
headerColorIconOnly: {},
|
|
47
54
|
pickerFields: { paddingBottom: 20 }
|
|
48
55
|
});
|
|
49
56
|
exports.staticClasses = staticClasses;
|
|
@@ -114,9 +114,10 @@ const Fields = (props) => {
|
|
|
114
114
|
ref: redInputRef,
|
|
115
115
|
className: classes.single,
|
|
116
116
|
label: "R",
|
|
117
|
-
value:
|
|
117
|
+
value: internalRed,
|
|
118
118
|
onChange: (event, value) => onChangeRbg(event, value, "r"),
|
|
119
119
|
onBlur: () => setInternalRed(rgb?.r),
|
|
120
|
+
inputProps: { type: "number", min: 0, max: 255 },
|
|
120
121
|
disableClear: true
|
|
121
122
|
}
|
|
122
123
|
),
|
|
@@ -126,9 +127,10 @@ const Fields = (props) => {
|
|
|
126
127
|
ref: greenInputRef,
|
|
127
128
|
className: classes.single,
|
|
128
129
|
label: "G",
|
|
129
|
-
value:
|
|
130
|
+
value: internalGreen,
|
|
130
131
|
onChange: (event, value) => onChangeRbg(event, value, "g"),
|
|
131
132
|
onBlur: () => setInternalGreen(rgb?.g),
|
|
133
|
+
inputProps: { type: "number", min: 0, max: 255 },
|
|
132
134
|
disableClear: true
|
|
133
135
|
}
|
|
134
136
|
),
|
|
@@ -138,9 +140,10 @@ const Fields = (props) => {
|
|
|
138
140
|
ref: blueInputRef,
|
|
139
141
|
className: classes.single,
|
|
140
142
|
label: "B",
|
|
141
|
-
value:
|
|
143
|
+
value: internalBlue,
|
|
142
144
|
onChange: (event, value) => onChangeRbg(event, value, "b"),
|
|
143
145
|
onBlur: () => setInternalBlue(rgb?.b),
|
|
146
|
+
inputProps: { type: "number", min: 0, max: 255 },
|
|
144
147
|
disableClear: true
|
|
145
148
|
}
|
|
146
149
|
)
|
|
@@ -65,7 +65,7 @@ const HvDatePicker = React.forwardRef(
|
|
|
65
65
|
rangeMode = false,
|
|
66
66
|
startAdornment,
|
|
67
67
|
horizontalPlacement = "right",
|
|
68
|
-
locale
|
|
68
|
+
locale = utils$3.DEFAULT_LOCALE,
|
|
69
69
|
showActions,
|
|
70
70
|
showClear,
|
|
71
71
|
disablePortal = true,
|
|
@@ -82,7 +82,6 @@ const HvDatePicker = React.forwardRef(
|
|
|
82
82
|
"standBy"
|
|
83
83
|
);
|
|
84
84
|
const [validationMessage] = useControlled.useControlled(statusMessage, "Required");
|
|
85
|
-
const locale = localeProp || "en-US";
|
|
86
85
|
const [calendarOpen, setCalendarOpen] = useControlled.useControlled(
|
|
87
86
|
expanded,
|
|
88
87
|
Boolean(defaultExpanded)
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const utils = require("../Calendar/utils.cjs");
|
|
4
4
|
const validateDate = (date) => utils.isDate(date) && date || /* @__PURE__ */ new Date();
|
|
5
|
-
const getFormattedDateRange = (date, locale
|
|
5
|
+
const getFormattedDateRange = (date, locale) => {
|
|
6
6
|
const { startDate, endDate } = date;
|
|
7
7
|
const monthYear = `${utils.getMonthName(
|
|
8
8
|
startDate,
|
|
9
9
|
locale,
|
|
10
|
-
|
|
10
|
+
"short"
|
|
11
11
|
)} ${startDate.getFullYear()}`;
|
|
12
12
|
return `${startDate.getDate()} - ${endDate?.getDate()} ${monthYear}`;
|
|
13
13
|
};
|
package/dist/cjs/Input/Input.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const useControlled = require("../hooks/useControlled.cjs");
|
|
|
11
11
|
const useIsMounted = require("../hooks/useIsMounted.cjs");
|
|
12
12
|
const useLabels = require("../hooks/useLabels.cjs");
|
|
13
13
|
const useUniqueId = require("../hooks/useUniqueId.cjs");
|
|
14
|
+
const generic = require("../types/generic.cjs");
|
|
14
15
|
const keyboardUtils = require("../utils/keyboardUtils.cjs");
|
|
15
16
|
const setId = require("../utils/setId.cjs");
|
|
16
17
|
const Input_styles = require("./Input.styles.cjs");
|
|
@@ -46,7 +47,7 @@ const changeInputValue = (input, value = "") => {
|
|
|
46
47
|
setInputValue?.call(input, value);
|
|
47
48
|
input?.dispatchEvent(event);
|
|
48
49
|
};
|
|
49
|
-
const HvInput =
|
|
50
|
+
const HvInput = generic.fixedForwardRef(function HvInput2(props, ref) {
|
|
50
51
|
const {
|
|
51
52
|
classes: classesProp,
|
|
52
53
|
className,
|
|
@@ -123,7 +124,7 @@ const HvInput = React.forwardRef(function HvInput2(props, ref) {
|
|
|
123
124
|
const performValidation = React.useCallback(() => {
|
|
124
125
|
const inputValidity = validations.validateInput(
|
|
125
126
|
inputRef.current,
|
|
126
|
-
value,
|
|
127
|
+
String(value),
|
|
127
128
|
required,
|
|
128
129
|
minCharQuantity,
|
|
129
130
|
maxCharQuantity,
|
|
@@ -209,12 +210,12 @@ const HvInput = React.forwardRef(function HvInput2(props, ref) {
|
|
|
209
210
|
if (eventTargetIsInsideContainer(suggestionsRef.current, event)) return;
|
|
210
211
|
setFocused(false);
|
|
211
212
|
const inputValidity = performValidation();
|
|
212
|
-
onBlur?.(event, value, inputValidity);
|
|
213
|
+
onBlur?.(event, String(value), inputValidity);
|
|
213
214
|
};
|
|
214
215
|
const onFocusHandler = (event) => {
|
|
215
216
|
setFocused(true);
|
|
216
217
|
setValidationState(utils$1.validationStates.standBy);
|
|
217
|
-
onFocus?.(event, value);
|
|
218
|
+
onFocus?.(event, String(value));
|
|
218
219
|
};
|
|
219
220
|
const getSuggestions = (li) => {
|
|
220
221
|
const listEl = document.getElementById(
|
|
@@ -235,9 +236,9 @@ const HvInput = React.forwardRef(function HvInput2(props, ref) {
|
|
|
235
236
|
const li = getSuggestions(0);
|
|
236
237
|
li?.focus();
|
|
237
238
|
} else if (keyboardUtils.isKey(event, "Enter")) {
|
|
238
|
-
onEnter?.(event, value);
|
|
239
|
+
onEnter?.(event, String(value));
|
|
239
240
|
}
|
|
240
|
-
onKeyDown?.(event, value);
|
|
241
|
+
onKeyDown?.(event, String(value));
|
|
241
242
|
};
|
|
242
243
|
const onContainerBlurHandler = (event) => {
|
|
243
244
|
if (event.relatedTarget) {
|
|
@@ -290,7 +291,7 @@ const HvInput = React.forwardRef(function HvInput2(props, ref) {
|
|
|
290
291
|
]);
|
|
291
292
|
const handleSearch = React.useCallback(
|
|
292
293
|
(event) => {
|
|
293
|
-
onEnter?.(event, value);
|
|
294
|
+
onEnter?.(event, String(value));
|
|
294
295
|
},
|
|
295
296
|
[onEnter, value]
|
|
296
297
|
);
|
|
@@ -466,7 +467,7 @@ const HvInput = React.forwardRef(function HvInput2(props, ref) {
|
|
|
466
467
|
onFocus: (event) => {
|
|
467
468
|
inputProps.onFocus?.(event);
|
|
468
469
|
if (canShowSuggestions && suggestOnFocus) {
|
|
469
|
-
suggestionHandler(value);
|
|
470
|
+
suggestionHandler(String(value));
|
|
470
471
|
}
|
|
471
472
|
},
|
|
472
473
|
onClick: (event) => {
|
|
@@ -11,6 +11,7 @@ const useUniqueId = require("../hooks/useUniqueId.cjs");
|
|
|
11
11
|
const generic = require("../types/generic.cjs");
|
|
12
12
|
const document = require("../utils/document.cjs");
|
|
13
13
|
const setId = require("../utils/setId.cjs");
|
|
14
|
+
const Option = require("./Option.cjs");
|
|
14
15
|
const Select_styles = require("./Select.styles.cjs");
|
|
15
16
|
const FormElement = require("../FormElement/FormElement.cjs");
|
|
16
17
|
const Label = require("../FormElement/Label/Label.cjs");
|
|
@@ -27,9 +28,12 @@ function defaultRenderValue(options) {
|
|
|
27
28
|
return options?.label ?? null;
|
|
28
29
|
}
|
|
29
30
|
const mergeIds = (...ids) => clsx.clsx(ids) || void 0;
|
|
31
|
+
function renderOptions(options) {
|
|
32
|
+
return options?.map((option) => /* @__PURE__ */ jsxRuntime.jsx(Option.HvOption, { ...option, children: option.label }, option.value));
|
|
33
|
+
}
|
|
30
34
|
const HvSelect = generic.fixedForwardRef(function HvSelect2(props, ref) {
|
|
31
35
|
const {
|
|
32
|
-
children,
|
|
36
|
+
children: childrenProp,
|
|
33
37
|
classes: classesProp,
|
|
34
38
|
className,
|
|
35
39
|
id: idProp,
|
|
@@ -118,6 +122,7 @@ const HvSelect = generic.fixedForwardRef(function HvSelect2(props, ref) {
|
|
|
118
122
|
const canShowError = ariaErrorMessage == null && (status !== void 0 && statusMessage !== void 0 || status === void 0 && required);
|
|
119
123
|
const isInvalid = validationState === "invalid";
|
|
120
124
|
const actualValue = multiple ? value.map((v) => getOptionMetadata(v)).filter((v) => v !== void 0) : getOptionMetadata(value) ?? null;
|
|
125
|
+
const children = childrenProp ?? renderOptions(optionsProp);
|
|
121
126
|
const isOpen = open && !!children;
|
|
122
127
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
123
128
|
FormElement.HvFormElement,
|
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const uikitReactUtils = require("@hitachivantara/uikit-react-utils");
|
|
4
4
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
5
|
-
const
|
|
5
|
+
const getBorderStyles = (color, rowBorderRadius) => {
|
|
6
|
+
return {
|
|
7
|
+
"& td": {
|
|
8
|
+
borderTop: `1px solid ${color}`,
|
|
9
|
+
borderBottom: `1px solid ${color}`
|
|
10
|
+
},
|
|
11
|
+
"& td:first-of-type": {
|
|
12
|
+
borderLeft: `1px solid ${color}`,
|
|
13
|
+
borderRadius: `${rowBorderRadius} 0 0 ${rowBorderRadius}`
|
|
14
|
+
},
|
|
15
|
+
"& td:last-of-type": {
|
|
16
|
+
borderRight: `1px solid ${color}`,
|
|
17
|
+
borderRadius: `0 ${rowBorderRadius} ${rowBorderRadius} 0`
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
6
21
|
const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTableRow", {
|
|
7
22
|
/** Styles applied to the component root class. */
|
|
8
23
|
root: {
|
|
@@ -48,16 +63,16 @@ const { staticClasses, useClasses } = uikitReactUtils.createClasses("HvTableRow"
|
|
|
48
63
|
// only applied on custom `display`
|
|
49
64
|
marginBottom: uikitStyles.theme.space.xs,
|
|
50
65
|
borderRadius: uikitStyles.theme.radii.round,
|
|
51
|
-
...
|
|
66
|
+
...getBorderStyles(uikitStyles.theme.colors.atmo4, uikitStyles.theme.radii.round),
|
|
52
67
|
backgroundColor: uikitStyles.theme.colors.atmo1,
|
|
53
68
|
"&$selected": {
|
|
54
|
-
...
|
|
69
|
+
...getBorderStyles(uikitStyles.theme.colors.secondary, uikitStyles.theme.radii.round),
|
|
55
70
|
"&:hover": {
|
|
56
|
-
...
|
|
71
|
+
...getBorderStyles(uikitStyles.theme.colors.atmo4, uikitStyles.theme.radii.round)
|
|
57
72
|
}
|
|
58
73
|
},
|
|
59
74
|
"&:hover": {
|
|
60
|
-
...
|
|
75
|
+
...getBorderStyles(uikitStyles.theme.colors.atmo4, uikitStyles.theme.radii.round)
|
|
61
76
|
},
|
|
62
77
|
"&.HvIsFocused": {
|
|
63
78
|
borderRadius: uikitStyles.theme.radii.round
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
4
|
const reactTable = require("react-table");
|
|
5
5
|
const useInstanceHook = (instance) => {
|
|
@@ -64,7 +64,7 @@ const useInstanceHook = (instance) => {
|
|
|
64
64
|
subtractivePageBulkDeselection: !!instance.subtractivePageBulkDeselection
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
const
|
|
67
|
+
const defaultGetHvBulkActionsProps = (props, { instance }) => {
|
|
68
68
|
const {
|
|
69
69
|
rows,
|
|
70
70
|
initialRows,
|
|
@@ -86,10 +86,9 @@ const defaultgetHvBulkActionsProps = (props, { instance }) => {
|
|
|
86
86
|
};
|
|
87
87
|
return [props, nextProps];
|
|
88
88
|
};
|
|
89
|
-
const
|
|
90
|
-
hooks.getHvBulkActionsProps = [
|
|
89
|
+
const useHvBulkActions = (hooks) => {
|
|
90
|
+
hooks.getHvBulkActionsProps = [defaultGetHvBulkActionsProps];
|
|
91
91
|
hooks.useInstance.push(useInstanceHook);
|
|
92
92
|
};
|
|
93
|
-
|
|
94
|
-
exports.
|
|
95
|
-
exports.defaultgetHvBulkActionsProps = defaultgetHvBulkActionsProps;
|
|
93
|
+
useHvBulkActions.pluginName = "useHvBulkActions";
|
|
94
|
+
exports.useHvBulkActions = useHvBulkActions;
|