@hitachivantara/uikit-react-core 5.82.1 → 5.82.3
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 +11 -12
- package/dist/cjs/BaseInput/validations.cjs +3 -3
- package/dist/cjs/Calendar/Calendar.cjs +14 -15
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.cjs +8 -10
- package/dist/cjs/CheckBox/CheckBox.cjs +10 -10
- package/dist/cjs/CheckBoxGroup/CheckBoxGroup.cjs +8 -8
- package/dist/cjs/ColorPicker/ColorPicker.cjs +6 -9
- package/dist/cjs/DatePicker/DatePicker.cjs +15 -15
- package/dist/cjs/Dropdown/Dropdown.cjs +9 -9
- package/dist/cjs/FileUploader/DropZone/DropZone.cjs +2 -2
- package/dist/cjs/FilterGroup/FilterGroup.cjs +6 -6
- package/dist/cjs/{Forms → FormElement}/Adornment/Adornment.cjs +9 -10
- package/dist/cjs/{Forms → FormElement}/CharCounter/CharCounter.cjs +15 -15
- package/dist/cjs/FormElement/FormElement.cjs +35 -0
- package/dist/cjs/{Forms → FormElement}/InfoMessage/InfoMessage.cjs +8 -8
- package/dist/cjs/{Forms → FormElement}/Label/Label.cjs +13 -13
- package/dist/cjs/{Forms → FormElement}/Suggestions/Suggestions.cjs +6 -6
- package/dist/cjs/{Forms → FormElement}/WarningText/WarningText.cjs +5 -5
- package/dist/cjs/FormElement/context.cjs +11 -0
- package/dist/cjs/{Forms/FormElement/utils/FormUtils.cjs → FormElement/utils.cjs} +19 -11
- package/dist/cjs/Input/Input.cjs +17 -17
- package/dist/cjs/Input/Input.styles.cjs +2 -2
- package/dist/cjs/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.cjs +1 -1
- package/dist/cjs/Radio/Radio.cjs +10 -13
- package/dist/cjs/RadioGroup/RadioGroup.cjs +7 -7
- package/dist/cjs/Select/Select.cjs +4 -4
- package/dist/cjs/SelectionList/SelectionList.cjs +7 -7
- package/dist/cjs/Slider/Slider.cjs +10 -10
- package/dist/cjs/Slider/utils.cjs +7 -7
- package/dist/cjs/Switch/Switch.cjs +9 -12
- package/dist/cjs/TagsInput/TagsInput.cjs +17 -17
- package/dist/cjs/TagsInput/TagsInput.styles.cjs +1 -1
- package/dist/cjs/TextArea/TextArea.cjs +17 -17
- package/dist/cjs/TimePicker/TimePicker.cjs +7 -7
- package/dist/cjs/index.cjs +15 -36
- package/dist/esm/BaseInput/BaseInput.js +5 -6
- package/dist/esm/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/BaseInput/validations.js +3 -3
- package/dist/esm/BaseInput/validations.js.map +1 -1
- package/dist/esm/Calendar/Calendar.js +13 -14
- package/dist/esm/Calendar/Calendar.js.map +1 -1
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js +6 -8
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/esm/Calendar/CalendarNavigation/MonthSelector/MonthSelector.js.map +1 -1
- package/dist/esm/CheckBox/CheckBox.js +9 -9
- package/dist/esm/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js +8 -8
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/dist/esm/ColorPicker/ColorPicker.js +6 -9
- package/dist/esm/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/DatePicker/DatePicker.js +9 -9
- package/dist/esm/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.js +8 -8
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/FileUploader/DropZone/DropZone.js +2 -2
- package/dist/esm/FileUploader/DropZone/DropZone.js.map +1 -1
- package/dist/esm/FilterGroup/FilterContent/FilterContent.js.map +1 -1
- package/dist/esm/FilterGroup/FilterGroup.js +6 -6
- package/dist/esm/FilterGroup/FilterGroup.js.map +1 -1
- package/dist/esm/{Forms → FormElement}/Adornment/Adornment.js +8 -9
- package/dist/esm/FormElement/Adornment/Adornment.js.map +1 -0
- package/dist/esm/FormElement/Adornment/Adornment.styles.js.map +1 -0
- package/dist/esm/{Forms → FormElement}/CharCounter/CharCounter.js +15 -15
- package/dist/esm/FormElement/CharCounter/CharCounter.js.map +1 -0
- package/dist/esm/FormElement/CharCounter/CharCounter.styles.js.map +1 -0
- package/dist/esm/FormElement/FormElement.js +36 -0
- package/dist/esm/FormElement/FormElement.js.map +1 -0
- package/dist/esm/FormElement/FormElement.styles.js.map +1 -0
- package/dist/esm/{Forms → FormElement}/InfoMessage/InfoMessage.js +8 -8
- package/dist/esm/FormElement/InfoMessage/InfoMessage.js.map +1 -0
- package/dist/esm/FormElement/InfoMessage/InfoMessage.styles.js.map +1 -0
- package/dist/esm/{Forms → FormElement}/Label/Label.js +12 -12
- package/dist/esm/FormElement/Label/Label.js.map +1 -0
- package/dist/esm/FormElement/Label/Label.styles.js.map +1 -0
- package/dist/esm/{Forms → FormElement}/Suggestions/Suggestions.js +6 -6
- package/dist/esm/FormElement/Suggestions/Suggestions.js.map +1 -0
- package/dist/esm/FormElement/Suggestions/Suggestions.styles.js.map +1 -0
- package/dist/esm/{Forms → FormElement}/WarningText/WarningText.js +5 -5
- package/dist/esm/FormElement/WarningText/WarningText.js.map +1 -0
- package/dist/esm/FormElement/WarningText/WarningText.styles.js.map +1 -0
- package/dist/esm/FormElement/context.js +11 -0
- package/dist/esm/FormElement/context.js.map +1 -0
- package/dist/esm/{Forms/FormElement/utils/FormUtils.js → FormElement/utils.js} +21 -11
- package/dist/esm/FormElement/utils.js.map +1 -0
- package/dist/esm/Input/Input.js +21 -21
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/Input/Input.styles.js +2 -2
- package/dist/esm/Input/Input.styles.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.js +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Value/TextValue/TextValue.js.map +1 -1
- package/dist/esm/Radio/Radio.js +9 -12
- package/dist/esm/Radio/Radio.js.map +1 -1
- package/dist/esm/RadioGroup/RadioGroup.js +7 -7
- package/dist/esm/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/Select/Select.js +4 -4
- package/dist/esm/Select/Select.js.map +1 -1
- package/dist/esm/SelectionList/SelectionList.js +7 -7
- package/dist/esm/SelectionList/SelectionList.js.map +1 -1
- package/dist/esm/Slider/Slider.js +10 -10
- package/dist/esm/Slider/Slider.js.map +1 -1
- package/dist/esm/Slider/SliderInput/SliderInput.js.map +1 -1
- package/dist/esm/Slider/utils.js +7 -7
- package/dist/esm/Slider/utils.js.map +1 -1
- package/dist/esm/Switch/Switch.js +8 -11
- package/dist/esm/Switch/Switch.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.js +19 -19
- package/dist/esm/TagsInput/TagsInput.js.map +1 -1
- package/dist/esm/TagsInput/TagsInput.styles.js +1 -1
- package/dist/esm/TagsInput/TagsInput.styles.js.map +1 -1
- package/dist/esm/TextArea/TextArea.js +19 -19
- package/dist/esm/TextArea/TextArea.js.map +1 -1
- package/dist/esm/TimePicker/TimePicker.js +7 -7
- package/dist/esm/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/index.js +14 -35
- package/dist/esm/index.js.map +1 -1
- package/dist/types/index.d.ts +66 -143
- package/package.json +2 -2
- package/dist/cjs/Forms/FormElement/FormElement.cjs +0 -44
- package/dist/cjs/Forms/FormElement/context/FormElementContext.cjs +0 -12
- package/dist/cjs/Forms/FormElement/context/FormElementDescriptorsContext.cjs +0 -12
- package/dist/cjs/Forms/FormElement/context/FormElementValueContext.cjs +0 -12
- package/dist/cjs/Forms/FormElement/validationStates.cjs +0 -12
- package/dist/esm/Forms/Adornment/Adornment.js.map +0 -1
- package/dist/esm/Forms/Adornment/Adornment.styles.js.map +0 -1
- package/dist/esm/Forms/CharCounter/CharCounter.js.map +0 -1
- package/dist/esm/Forms/CharCounter/CharCounter.styles.js.map +0 -1
- package/dist/esm/Forms/FormElement/FormElement.js +0 -45
- package/dist/esm/Forms/FormElement/FormElement.js.map +0 -1
- package/dist/esm/Forms/FormElement/FormElement.styles.js.map +0 -1
- package/dist/esm/Forms/FormElement/context/FormElementContext.js +0 -10
- package/dist/esm/Forms/FormElement/context/FormElementContext.js.map +0 -1
- package/dist/esm/Forms/FormElement/context/FormElementDescriptorsContext.js +0 -10
- package/dist/esm/Forms/FormElement/context/FormElementDescriptorsContext.js.map +0 -1
- package/dist/esm/Forms/FormElement/context/FormElementValueContext.js +0 -10
- package/dist/esm/Forms/FormElement/context/FormElementValueContext.js.map +0 -1
- package/dist/esm/Forms/FormElement/utils/FormUtils.js.map +0 -1
- package/dist/esm/Forms/FormElement/validationStates.js +0 -12
- package/dist/esm/Forms/FormElement/validationStates.js.map +0 -1
- package/dist/esm/Forms/InfoMessage/InfoMessage.js.map +0 -1
- package/dist/esm/Forms/InfoMessage/InfoMessage.styles.js.map +0 -1
- package/dist/esm/Forms/Label/Label.js.map +0 -1
- package/dist/esm/Forms/Label/Label.styles.js.map +0 -1
- package/dist/esm/Forms/Suggestions/Suggestions.js.map +0 -1
- package/dist/esm/Forms/Suggestions/Suggestions.styles.js.map +0 -1
- package/dist/esm/Forms/WarningText/WarningText.js.map +0 -1
- package/dist/esm/Forms/WarningText/WarningText.styles.js.map +0 -1
- /package/dist/cjs/{Forms → FormElement}/Adornment/Adornment.styles.cjs +0 -0
- /package/dist/cjs/{Forms → FormElement}/CharCounter/CharCounter.styles.cjs +0 -0
- /package/dist/cjs/{Forms/FormElement → FormElement}/FormElement.styles.cjs +0 -0
- /package/dist/cjs/{Forms → FormElement}/InfoMessage/InfoMessage.styles.cjs +0 -0
- /package/dist/cjs/{Forms → FormElement}/Label/Label.styles.cjs +0 -0
- /package/dist/cjs/{Forms → FormElement}/Suggestions/Suggestions.styles.cjs +0 -0
- /package/dist/cjs/{Forms → FormElement}/WarningText/WarningText.styles.cjs +0 -0
- /package/dist/esm/{Forms → FormElement}/Adornment/Adornment.styles.js +0 -0
- /package/dist/esm/{Forms → FormElement}/CharCounter/CharCounter.styles.js +0 -0
- /package/dist/esm/{Forms/FormElement → FormElement}/FormElement.styles.js +0 -0
- /package/dist/esm/{Forms → FormElement}/InfoMessage/InfoMessage.styles.js +0 -0
- /package/dist/esm/{Forms → FormElement}/Label/Label.styles.js +0 -0
- /package/dist/esm/{Forms → FormElement}/Suggestions/Suggestions.styles.js +0 -0
- /package/dist/esm/{Forms → FormElement}/WarningText/WarningText.styles.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker.js","sources":["../../../src/TimePicker/TimePicker.tsx"],"sourcesContent":["import { forwardRef, useMemo, useRef, useState } from \"react\";\nimport { Time } from \"@internationalized/date\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport { useTimeField } from \"@react-aria/datepicker\";\nimport {\n useTimeFieldState,\n type TimeFieldStateOptions,\n} from \"@react-stately/datepicker\";\nimport { Time as TimeIcon } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseDropdown, HvBaseDropdownProps } from \"../BaseDropdown\";\nimport {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"../Forms\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\nimport { Placeholder, PlaceholderProps } from \"./Placeholder\";\nimport { staticClasses, useClasses } from \"./TimePicker.styles\";\nimport { Unit } from \"./Unit\";\n\nconst toTime = (value?: HvTimePickerValue | null) => {\n if (!value) return value;\n const { hours, minutes, seconds } = value;\n return new Time(hours, minutes, seconds);\n};\n\nexport { staticClasses as timePickerClasses };\n\nexport type TimeFormat = \"12\" | \"24\";\n\nexport type HvTimePickerClasses = ExtractNames<typeof useClasses>;\n\nexport type HvTimePickerClassKey =\n | \"root\"\n | \"input\"\n | \"label\"\n | \"placeholder\"\n | \"timePopperContainer\"\n | \"separator\"\n | \"periodContainer\"\n | \"formElementRoot\"\n | \"dropdownPlaceholder\"\n | \"iconBaseRoot\"\n | \"error\"\n | \"labelContainer\"\n | \"description\"\n | \"dropdownHeaderInvalid\"\n | \"dropdownPlaceholderDisabled\"\n | \"dropdownHeaderOpen\";\n\nexport type HvTimePickerValue = {\n hours: number;\n minutes: number;\n seconds: number;\n};\n\nexport interface HvTimePickerProps\n extends Omit<\n HvFormElementProps,\n \"classes\" | \"value\" | \"defaultValue\" | \"onChange\"\n > {\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTimePickerClasses;\n /** Current value of the element when _controlled_. Follows the 24-hour format. */\n value?: HvTimePickerValue | null;\n /** Initial value of the element when _uncontrolled_. Follows the 24-hour format. */\n defaultValue?: HvTimePickerValue | null;\n /** The placeholder value when no time is selected. */\n placeholder?: string;\n /** The placeholder of the hours input. */\n hoursPlaceholder?: string;\n /** The placeholder of the minutes input. */\n minutesPlaceholder?: string;\n /** The placeholder of the seconds input. */\n secondsPlaceholder?: string;\n /**\n * Whether the time picker should show the AM/PM 12-hour clock or the 24-hour one.\n * If undefined, the component will use a format according to the passed locale.\n */\n timeFormat?: TimeFormat;\n /** Whether to visually show the seconds control */\n showSeconds?: boolean;\n /** Locale that will provide the time format(12 or 24 hour format). It is \"overwritten\" by `showAmPm` */\n locale?: string;\n /** Whether the dropdown is expandable. */\n disableExpand?: boolean;\n /**\n * Callback function to be triggered when the input value is changed.\n * It is invoked with a `{hours, minutes, seconds}` object, always in the 24h format\n */\n onChange?: (value: HvTimePickerValue) => void;\n /** Callback called when dropdown changes the expanded state. */\n onToggle?: (event: Event, isOpen: boolean) => void;\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Sets if the calendar container should follow the date picker input out of the screen or stay visible. */\n escapeWithReference?: boolean;\n /** Extra properties to be passed to the TimePicker's dropdown. */\n dropdownProps?: Partial<HvBaseDropdownProps>;\n}\n\n/**\n * A Time Picker allows the user to choose a specific time or a time range.\n */\nexport const HvTimePicker = forwardRef<HTMLDivElement, HvTimePickerProps>(\n function HvTimePicker(props, ref) {\n const {\n classes: classesProp,\n className,\n\n id: idProp,\n name,\n required = false,\n disabled = false,\n readOnly = false,\n label,\n\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n placeholder,\n hoursPlaceholder = \"hh\",\n minutesPlaceholder = \"mm\",\n secondsPlaceholder = \"ss\",\n\n value: valueProp,\n defaultValue: defaultValueProp,\n\n timeFormat,\n showSeconds,\n disableExpand,\n locale = \"en\",\n\n onToggle,\n onChange,\n\n // misc properties:\n disablePortal = true,\n escapeWithReference = true,\n dropdownProps = {},\n ...others\n } = useDefaultProps(\"HvTimePicker\", props);\n\n const id = useUniqueId(idProp);\n\n const { classes, cx } = useClasses(classesProp);\n\n const timeFieldRef = useRef<HTMLDivElement>(null);\n\n const { ref: refProp, ...otherDropdownProps } = dropdownProps;\n const dropdownForkedRef = useForkRef(ref, refProp);\n\n const stateProps: TimeFieldStateOptions = {\n value: toTime(valueProp),\n defaultValue: toTime(defaultValueProp),\n label,\n locale,\n isRequired: required,\n isReadOnly: readOnly,\n isDisabled: disabled,\n granularity: showSeconds === false ? \"minute\" : \"second\",\n hourCycle: timeFormat === \"12\" ? 12 : 24,\n onChange: (value) => {\n const { hour: hours, minute: minutes, second: seconds } = value;\n onChange?.({ hours, minutes, seconds });\n },\n };\n const state = useTimeFieldState(stateProps);\n const { labelProps, fieldProps, descriptionProps } = useTimeField(\n {\n ...stateProps,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n },\n state,\n timeFieldRef,\n );\n\n const [open, setOpen] = useState(false);\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n const [validationState] = useControlled<HvFormStatus>(status, \"standBy\");\n\n const placeholders: PlaceholderProps[\"placeholders\"] = useMemo(\n () => ({\n hour: hoursPlaceholder,\n minute: minutesPlaceholder,\n second: secondsPlaceholder,\n }),\n [hoursPlaceholder, minutesPlaceholder, secondsPlaceholder],\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const isStateInvalid = validationState === \"invalid\";\n const errorMessageId = isStateInvalid\n ? canShowError\n ? setId(id, \"error\")\n : ariaErrorMessage\n : undefined;\n\n return (\n <HvFormElement\n name={name}\n required={required}\n disabled={disabled}\n status={validationState}\n className={cx(classes.root, className)}\n {...others}\n >\n {(label || description) && (\n <div className={classes.labelContainer}>\n {label && (\n <HvLabel\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n {description && (\n <HvInfoMessage\n className={classes.description}\n {...descriptionProps}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n <HvBaseDropdown\n ref={dropdownForkedRef}\n role=\"combobox\"\n variableWidth\n disabled={disabled}\n readOnly={readOnly}\n placeholder={\n placeholder && !state.value ? (\n placeholder\n ) : (\n <Placeholder\n ref={timeFieldRef}\n name={name}\n state={state}\n placeholders={placeholders}\n className={cx(classes.placeholder, {\n [classes.placeholderDisabled]: disabled,\n })}\n {...fieldProps}\n />\n )\n }\n classes={{\n header: cx(classes.dropdownHeader, {\n [classes.dropdownHeaderInvalid]: isStateInvalid,\n }),\n panel: classes.dropdownPanel,\n headerOpen: classes.dropdownHeaderOpen,\n }}\n placement=\"right\"\n adornment={\n <TimeIcon\n color={disabled ? \"secondary_60\" : undefined}\n className={classes.icon}\n />\n }\n expanded={open}\n onToggle={(evt, newOpen) => {\n if (disableExpand) return;\n setOpen(newOpen);\n onToggle?.(evt, newOpen);\n }}\n onContainerCreation={(containerRef) => {\n containerRef?.getElementsByTagName(\"input\")[0]?.focus();\n }}\n aria-haspopup=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={fieldProps[\"aria-labelledby\"]}\n aria-describedby={fieldProps[\"aria-describedby\"]}\n aria-invalid={isStateInvalid ? true : undefined}\n aria-errormessage={errorMessageId}\n disablePortal={disablePortal}\n popperProps={{\n modifiers: [\n { name: \"preventOverflow\", enabled: escapeWithReference },\n ],\n }}\n {...otherDropdownProps}\n >\n <div ref={timeFieldRef} className={classes.timePopperContainer}>\n {state.segments.map((segment, i) => (\n <Unit\n key={i}\n state={state}\n segment={segment}\n placeholder={placeholders[segment.type]}\n onAdd={() => state.increment(segment.type)}\n onSub={() => state.decrement(segment.type)}\n onChange={(evt, val) => {\n state.setSegment(segment.type, Number(val));\n }}\n />\n ))}\n </div>\n </HvBaseDropdown>\n\n {canShowError && (\n <HvWarningText\n id={setId(id, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["Time","HvTimePicker","TimeIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAS,CAAC,UAAqC;AAC/C,MAAA,CAAC,MAAc,QAAA;AACnB,QAAM,EAAE,OAAO,SAAS,QAAY,IAAA;AACpC,SAAO,IAAIA,OAAK,OAAO,SAAS,OAAO;AACzC;AAgFO,MAAM,eAAe;AAAA,EAC1B,SAASC,cAAa,OAAO,KAAK;AAC1B,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MAEA,IAAI;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,MACX,WAAW;AAAA,MACX,WAAW;AAAA,MACX;AAAA,MAEA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,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QAAQ,MAAM,OAAO,GAAG,CAAC;AAAA,kBAAA;AAAA,gBAC5C;AAAA,gBARK;AAAA,cAAA,CAUR,EACH,CAAA;AAAA,YAAA;AAAA,UACF;AAAA,UAEC,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI,MAAM,IAAI,OAAO;AAAA,cACrB,eAAa;AAAA,cACb,WAAW,QAAQ;AAAA,cAElB,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"TimePicker.js","sources":["../../../src/TimePicker/TimePicker.tsx"],"sourcesContent":["import { forwardRef, useMemo, useRef, useState } from \"react\";\nimport { Time } from \"@internationalized/date\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport { useTimeField } from \"@react-aria/datepicker\";\nimport {\n useTimeFieldState,\n type TimeFieldStateOptions,\n} from \"@react-stately/datepicker\";\nimport { Time as TimeIcon } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseDropdown, HvBaseDropdownProps } from \"../BaseDropdown\";\nimport {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\nimport { Placeholder, PlaceholderProps } from \"./Placeholder\";\nimport { staticClasses, useClasses } from \"./TimePicker.styles\";\nimport { Unit } from \"./Unit\";\n\nconst toTime = (value?: HvTimePickerValue | null) => {\n if (!value) return value;\n const { hours, minutes, seconds } = value;\n return new Time(hours, minutes, seconds);\n};\n\nexport { staticClasses as timePickerClasses };\n\nexport type TimeFormat = \"12\" | \"24\";\n\nexport type HvTimePickerClasses = ExtractNames<typeof useClasses>;\n\nexport type HvTimePickerClassKey =\n | \"root\"\n | \"input\"\n | \"label\"\n | \"placeholder\"\n | \"timePopperContainer\"\n | \"separator\"\n | \"periodContainer\"\n | \"formElementRoot\"\n | \"dropdownPlaceholder\"\n | \"iconBaseRoot\"\n | \"error\"\n | \"labelContainer\"\n | \"description\"\n | \"dropdownHeaderInvalid\"\n | \"dropdownPlaceholderDisabled\"\n | \"dropdownHeaderOpen\";\n\nexport type HvTimePickerValue = {\n hours: number;\n minutes: number;\n seconds: number;\n};\n\nexport interface HvTimePickerProps\n extends Omit<\n HvFormElementProps,\n \"classes\" | \"value\" | \"defaultValue\" | \"onChange\"\n > {\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTimePickerClasses;\n /** Current value of the element when _controlled_. Follows the 24-hour format. */\n value?: HvTimePickerValue | null;\n /** Initial value of the element when _uncontrolled_. Follows the 24-hour format. */\n defaultValue?: HvTimePickerValue | null;\n /** The placeholder value when no time is selected. */\n placeholder?: string;\n /** The placeholder of the hours input. */\n hoursPlaceholder?: string;\n /** The placeholder of the minutes input. */\n minutesPlaceholder?: string;\n /** The placeholder of the seconds input. */\n secondsPlaceholder?: string;\n /**\n * Whether the time picker should show the AM/PM 12-hour clock or the 24-hour one.\n * If undefined, the component will use a format according to the passed locale.\n */\n timeFormat?: TimeFormat;\n /** Whether to visually show the seconds control */\n showSeconds?: boolean;\n /** Locale that will provide the time format(12 or 24 hour format). It is \"overwritten\" by `showAmPm` */\n locale?: string;\n /** Whether the dropdown is expandable. */\n disableExpand?: boolean;\n /**\n * Callback function to be triggered when the input value is changed.\n * It is invoked with a `{hours, minutes, seconds}` object, always in the 24h format\n */\n onChange?: (value: HvTimePickerValue) => void;\n /** Callback called when dropdown changes the expanded state. */\n onToggle?: (event: Event, isOpen: boolean) => void;\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Sets if the calendar container should follow the date picker input out of the screen or stay visible. */\n escapeWithReference?: boolean;\n /** Extra properties to be passed to the TimePicker's dropdown. */\n dropdownProps?: Partial<HvBaseDropdownProps>;\n}\n\n/**\n * A Time Picker allows the user to choose a specific time or a time range.\n */\nexport const HvTimePicker = forwardRef<HTMLDivElement, HvTimePickerProps>(\n function HvTimePicker(props, ref) {\n const {\n classes: classesProp,\n className,\n\n id: idProp,\n name,\n required,\n disabled,\n readOnly,\n label,\n\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n placeholder,\n hoursPlaceholder = \"hh\",\n minutesPlaceholder = \"mm\",\n secondsPlaceholder = \"ss\",\n\n value: valueProp,\n defaultValue: defaultValueProp,\n\n timeFormat,\n showSeconds,\n disableExpand,\n locale = \"en\",\n\n onToggle,\n onChange,\n\n // misc properties:\n disablePortal = true,\n escapeWithReference = true,\n dropdownProps = {},\n ...others\n } = useDefaultProps(\"HvTimePicker\", props);\n\n const id = useUniqueId(idProp);\n\n const { classes, cx } = useClasses(classesProp);\n\n const timeFieldRef = useRef<HTMLDivElement>(null);\n\n const { ref: refProp, ...otherDropdownProps } = dropdownProps;\n const dropdownForkedRef = useForkRef(ref, refProp);\n\n const stateProps: TimeFieldStateOptions = {\n value: toTime(valueProp),\n defaultValue: toTime(defaultValueProp),\n label,\n locale,\n isRequired: required,\n isReadOnly: readOnly,\n isDisabled: disabled,\n granularity: showSeconds === false ? \"minute\" : \"second\",\n hourCycle: timeFormat === \"12\" ? 12 : 24,\n onChange: (value) => {\n const { hour: hours, minute: minutes, second: seconds } = value;\n onChange?.({ hours, minutes, seconds });\n },\n };\n const state = useTimeFieldState(stateProps);\n const { labelProps, fieldProps, descriptionProps } = useTimeField(\n {\n ...stateProps,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n },\n state,\n timeFieldRef,\n );\n\n const [open, setOpen] = useState(false);\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n const [validationState] = useControlled<HvFormStatus>(status, \"standBy\");\n\n const placeholders: PlaceholderProps[\"placeholders\"] = useMemo(\n () => ({\n hour: hoursPlaceholder,\n minute: minutesPlaceholder,\n second: secondsPlaceholder,\n }),\n [hoursPlaceholder, minutesPlaceholder, secondsPlaceholder],\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const isStateInvalid = validationState === \"invalid\";\n const errorMessageId = isStateInvalid\n ? canShowError\n ? setId(id, \"error\")\n : ariaErrorMessage\n : undefined;\n\n return (\n <HvFormElement\n name={name}\n required={required}\n disabled={disabled}\n status={validationState}\n className={cx(classes.root, className)}\n {...others}\n >\n {(label || description) && (\n <div className={classes.labelContainer}>\n {label && (\n <HvLabel\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n {description && (\n <HvInfoMessage\n className={classes.description}\n {...descriptionProps}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n <HvBaseDropdown\n ref={dropdownForkedRef}\n role=\"combobox\"\n variableWidth\n disabled={disabled}\n readOnly={readOnly}\n placeholder={\n placeholder && !state.value ? (\n placeholder\n ) : (\n <Placeholder\n ref={timeFieldRef}\n name={name}\n state={state}\n placeholders={placeholders}\n className={cx(classes.placeholder, {\n [classes.placeholderDisabled]: disabled,\n })}\n {...fieldProps}\n />\n )\n }\n classes={{\n header: cx(classes.dropdownHeader, {\n [classes.dropdownHeaderInvalid]: isStateInvalid,\n }),\n panel: classes.dropdownPanel,\n headerOpen: classes.dropdownHeaderOpen,\n }}\n placement=\"right\"\n adornment={\n <TimeIcon\n color={disabled ? \"secondary_60\" : undefined}\n className={classes.icon}\n />\n }\n expanded={open}\n onToggle={(evt, newOpen) => {\n if (disableExpand) return;\n setOpen(newOpen);\n onToggle?.(evt, newOpen);\n }}\n onContainerCreation={(containerRef) => {\n containerRef?.getElementsByTagName(\"input\")[0]?.focus();\n }}\n aria-haspopup=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={fieldProps[\"aria-labelledby\"]}\n aria-describedby={fieldProps[\"aria-describedby\"]}\n aria-invalid={isStateInvalid ? true : undefined}\n aria-errormessage={errorMessageId}\n disablePortal={disablePortal}\n popperProps={{\n modifiers: [\n { name: \"preventOverflow\", enabled: escapeWithReference },\n ],\n }}\n {...otherDropdownProps}\n >\n <div ref={timeFieldRef} className={classes.timePopperContainer}>\n {state.segments.map((segment, i) => (\n <Unit\n key={i}\n state={state}\n segment={segment}\n placeholder={placeholders[segment.type]}\n onAdd={() => state.increment(segment.type)}\n onSub={() => state.decrement(segment.type)}\n onChange={(evt, val) => {\n state.setSegment(segment.type, Number(val));\n }}\n />\n ))}\n </div>\n </HvBaseDropdown>\n\n {canShowError && (\n <HvWarningText\n id={setId(id, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["Time","HvTimePicker","TimeIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAS,CAAC,UAAqC;AAC/C,MAAA,CAAC,MAAc,QAAA;AACnB,QAAM,EAAE,OAAO,SAAS,QAAY,IAAA;AACpC,SAAO,IAAIA,OAAK,OAAO,SAAS,OAAO;AACzC;AAgFO,MAAM,eAAe;AAAA,EAC1B,SAASC,cAAa,OAAO,KAAK;AAC1B,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MAEA,IAAI;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MAErB;AAAA,MACA,mBAAmB;AAAA,MACnB,qBAAqB;AAAA,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AAAA,cAAA,CAUR,EACH,CAAA;AAAA,YAAA;AAAA,UACF;AAAA,UAEC,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI,MAAM,IAAI,OAAO;AAAA,cACrB,eAAa;AAAA,cACb,WAAW,QAAQ;AAAA,cAElB,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ds3, ds5, pentahoPlus, theme, themes } from "@hitachivantara/uikit-styles";
|
|
2
2
|
import { createClasses, useCss, useDefaultProps, useTheme } from "@hitachivantara/uikit-react-utils";
|
|
3
|
+
import { HvFormElement } from "./FormElement/FormElement.js";
|
|
3
4
|
import { useClickOutside } from "./hooks/useClickOutside.js";
|
|
4
5
|
import { useComputation } from "./hooks/useComputation.js";
|
|
5
6
|
import { useControlled } from "./hooks/useControlled.js";
|
|
@@ -55,31 +56,25 @@ import { staticClasses as staticClasses4 } from "./ListContainer/ListContainer.s
|
|
|
55
56
|
import { HvListContainer } from "./ListContainer/ListContainer.js";
|
|
56
57
|
import { staticClasses as staticClasses5 } from "./ListContainer/ListItem/ListItem.styles.js";
|
|
57
58
|
import { HvListItem } from "./ListContainer/ListItem/ListItem.js";
|
|
58
|
-
import { staticClasses as staticClasses6 } from "./
|
|
59
|
-
import { HvCharCounter } from "./
|
|
60
|
-
import { staticClasses as staticClasses7 } from "./
|
|
61
|
-
import { HvAdornment } from "./
|
|
62
|
-
import { staticClasses as staticClasses8 } from "./
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import { staticClasses as staticClasses9 } from "./Forms/Label/Label.styles.js";
|
|
70
|
-
import { HvLabel } from "./Forms/Label/Label.js";
|
|
71
|
-
import { staticClasses as staticClasses10 } from "./Forms/InfoMessage/InfoMessage.styles.js";
|
|
72
|
-
import { HvInfoMessage } from "./Forms/InfoMessage/InfoMessage.js";
|
|
73
|
-
import { staticClasses as staticClasses11 } from "./Forms/WarningText/WarningText.styles.js";
|
|
74
|
-
import { HvWarningText } from "./Forms/WarningText/WarningText.js";
|
|
59
|
+
import { staticClasses as staticClasses6 } from "./FormElement/CharCounter/CharCounter.styles.js";
|
|
60
|
+
import { HvCharCounter } from "./FormElement/CharCounter/CharCounter.js";
|
|
61
|
+
import { staticClasses as staticClasses7 } from "./FormElement/Adornment/Adornment.styles.js";
|
|
62
|
+
import { HvAdornment } from "./FormElement/Adornment/Adornment.js";
|
|
63
|
+
import { staticClasses as staticClasses8 } from "./FormElement/FormElement.styles.js";
|
|
64
|
+
import { staticClasses as staticClasses9 } from "./FormElement/Label/Label.styles.js";
|
|
65
|
+
import { HvLabel } from "./FormElement/Label/Label.js";
|
|
66
|
+
import { staticClasses as staticClasses10 } from "./FormElement/InfoMessage/InfoMessage.styles.js";
|
|
67
|
+
import { HvInfoMessage } from "./FormElement/InfoMessage/InfoMessage.js";
|
|
68
|
+
import { staticClasses as staticClasses11 } from "./FormElement/WarningText/WarningText.styles.js";
|
|
69
|
+
import { HvWarningText } from "./FormElement/WarningText/WarningText.js";
|
|
75
70
|
import { staticClasses as staticClasses12 } from "./Select/Select.styles.js";
|
|
76
71
|
import { HvSelect } from "./Select/Select.js";
|
|
77
72
|
import { HvOption, optionClasses } from "./Select/Option.js";
|
|
78
73
|
import { HvOptionGroup, optionGroupClasses } from "./Select/OptionGroup.js";
|
|
79
74
|
import { staticClasses as staticClasses13 } from "./SelectionList/SelectionList.styles.js";
|
|
80
75
|
import { HvSelectionList } from "./SelectionList/SelectionList.js";
|
|
81
|
-
import { staticClasses as staticClasses14 } from "./
|
|
82
|
-
import { HvSuggestions } from "./
|
|
76
|
+
import { staticClasses as staticClasses14 } from "./FormElement/Suggestions/Suggestions.styles.js";
|
|
77
|
+
import { HvSuggestions } from "./FormElement/Suggestions/Suggestions.js";
|
|
83
78
|
import { staticClasses as staticClasses15 } from "./BaseInput/BaseInput.styles.js";
|
|
84
79
|
import { HvBaseInput } from "./BaseInput/BaseInput.js";
|
|
85
80
|
import { staticClasses as staticClasses16 } from "./BaseDropdown/BaseDropdown.styles.js";
|
|
@@ -372,15 +367,6 @@ export {
|
|
|
372
367
|
HvFocus,
|
|
373
368
|
HvFooter,
|
|
374
369
|
HvFormElement,
|
|
375
|
-
HvFormElementContext,
|
|
376
|
-
HvFormElementContextConsumer,
|
|
377
|
-
HvFormElementContextProvider,
|
|
378
|
-
HvFormElementDescriptorsContext,
|
|
379
|
-
HvFormElementDescriptorsContextConsumer,
|
|
380
|
-
HvFormElementDescriptorsContextProvider,
|
|
381
|
-
HvFormElementValueContext,
|
|
382
|
-
HvFormElementValueContextConsumer,
|
|
383
|
-
HvFormElementValueContextProvider,
|
|
384
370
|
HvGlobalActions,
|
|
385
371
|
HvGrid,
|
|
386
372
|
HvHeader,
|
|
@@ -483,8 +469,6 @@ export {
|
|
|
483
469
|
staticClasses28 as baseRadioClasses,
|
|
484
470
|
staticClasses29 as baseSwitchClasses,
|
|
485
471
|
staticClasses30 as breadCrumbClasses,
|
|
486
|
-
buildAriaPropsFromContext,
|
|
487
|
-
buildFormElementPropsFromContext,
|
|
488
472
|
staticClasses31 as bulkActionsClasses,
|
|
489
473
|
staticClasses2 as buttonBaseClasses,
|
|
490
474
|
staticClasses32 as buttonClasses,
|
|
@@ -527,7 +511,6 @@ export {
|
|
|
527
511
|
staticClasses58 as fileClasses,
|
|
528
512
|
staticClasses57 as fileUploaderPreviewClasses,
|
|
529
513
|
staticClasses59 as filterGroupClasses,
|
|
530
|
-
findDescriptors,
|
|
531
514
|
fixedForwardRef,
|
|
532
515
|
staticClasses3 as focusClasses,
|
|
533
516
|
staticClasses60 as footerClasses,
|
|
@@ -538,8 +521,6 @@ export {
|
|
|
538
521
|
getFocusableList,
|
|
539
522
|
getHeaderFooterPropsHook,
|
|
540
523
|
getHeaderGroupPropsHook,
|
|
541
|
-
getIdReferenceFor,
|
|
542
|
-
getIdReferenceListFor,
|
|
543
524
|
getPrevNextFocus,
|
|
544
525
|
getSelectorIcons,
|
|
545
526
|
getTableHeadPropsHook,
|
|
@@ -572,10 +553,8 @@ export {
|
|
|
572
553
|
staticClasses67 as inlineEditorClasses,
|
|
573
554
|
staticClasses68 as inputClasses,
|
|
574
555
|
isBrowser,
|
|
575
|
-
isInvalid,
|
|
576
556
|
isKey,
|
|
577
557
|
isOneOfKeys,
|
|
578
|
-
isValid,
|
|
579
558
|
staticClasses69 as kpiClasses,
|
|
580
559
|
staticClasses9 as labelClasses,
|
|
581
560
|
staticClasses45 as leftControlClasses,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ import { ContainerProps } from '@mui/material/Container';
|
|
|
17
17
|
import { Context } from 'react';
|
|
18
18
|
import { createClasses } from '@hitachivantara/uikit-react-utils';
|
|
19
19
|
import { CSSProperties } from 'react';
|
|
20
|
-
import { default as default_2 } from 'react';
|
|
21
|
-
import { default as default_3 } from '
|
|
20
|
+
import { default as default_2 } from 'embla-carousel-react';
|
|
21
|
+
import { default as default_3 } from 'react';
|
|
22
22
|
import { defaultCacheKey } from '@hitachivantara/uikit-react-shared';
|
|
23
23
|
import { defaultEmotionCache } from '@hitachivantara/uikit-react-shared';
|
|
24
24
|
import { DialogActionsProps } from '@mui/material/DialogActions';
|
|
@@ -412,16 +412,6 @@ export declare interface Breakpoint {
|
|
|
412
412
|
spacing?: HvBreakpoints;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
export declare const buildAriaPropsFromContext: (props: InputBaseComponentProps, context: HvFormElementDescriptorsContextValue, isInvalid: boolean, inputId?: string) => default_2.AriaAttributes;
|
|
416
|
-
|
|
417
|
-
export declare const buildFormElementPropsFromContext: (name?: string, disabled?: boolean, readOnly?: boolean, required?: boolean, context?: HvFormElementContextValue) => {
|
|
418
|
-
name: string | undefined;
|
|
419
|
-
disabled: boolean | undefined;
|
|
420
|
-
readOnly: boolean | undefined;
|
|
421
|
-
required: boolean | undefined;
|
|
422
|
-
status: string | undefined;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
415
|
export declare const bulkActionsClasses: {
|
|
426
416
|
root: string;
|
|
427
417
|
semantic: string;
|
|
@@ -781,11 +771,6 @@ export declare const defaultGetToggleRowSelectedProps: (props: any, meta: any) =
|
|
|
781
771
|
declare interface DefaultTreeViewPluginParameters<Multiple extends boolean | undefined> extends UseTreeViewNodesParameters, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewContextValueBuilderParameters {
|
|
782
772
|
}
|
|
783
773
|
|
|
784
|
-
declare interface Descriptor {
|
|
785
|
-
id?: string;
|
|
786
|
-
htmlFor?: string;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
774
|
export declare const dialogActionClasses: {
|
|
790
775
|
root: string;
|
|
791
776
|
fullscreen: string;
|
|
@@ -915,31 +900,6 @@ export declare const filterGroupClasses: {
|
|
|
915
900
|
error: string;
|
|
916
901
|
};
|
|
917
902
|
|
|
918
|
-
/**
|
|
919
|
-
* Scans the element's children looking for the children IDs that match the different form element types.
|
|
920
|
-
* This function will produce an object that has a key for each provided name
|
|
921
|
-
* Inside each key there will be an array with each id of the found descriptor.
|
|
922
|
-
*
|
|
923
|
-
* @param {Array} children - The children inside the form element to scan.
|
|
924
|
-
* @param {Object} descriptors - Initial descriptors map (used for recursion).
|
|
925
|
-
*
|
|
926
|
-
*/
|
|
927
|
-
export declare const findDescriptors: (children: default_2.ReactNode, descriptors?: {
|
|
928
|
-
input: Descriptor[];
|
|
929
|
-
label: Descriptor[];
|
|
930
|
-
description: Descriptor[];
|
|
931
|
-
controlled: Descriptor[];
|
|
932
|
-
errormessage: Descriptor[];
|
|
933
|
-
HvCalendarHeader?: Descriptor[];
|
|
934
|
-
}) => {
|
|
935
|
-
input: Descriptor[];
|
|
936
|
-
label: Descriptor[];
|
|
937
|
-
description: Descriptor[];
|
|
938
|
-
controlled: Descriptor[];
|
|
939
|
-
errormessage: Descriptor[];
|
|
940
|
-
HvCalendarHeader?: Descriptor[] | undefined;
|
|
941
|
-
};
|
|
942
|
-
|
|
943
903
|
declare type FixComponentProps<T> = T extends any ? T : never;
|
|
944
904
|
|
|
945
905
|
/** React.forwardRef with fixed type declarations */
|
|
@@ -999,10 +959,6 @@ export declare const getHeaderFooterPropsHook: (props: any, { column }: any) =>
|
|
|
999
959
|
|
|
1000
960
|
export declare const getHeaderGroupPropsHook: (props: any, { instance }: any) => any[];
|
|
1001
961
|
|
|
1002
|
-
export declare const getIdReferenceFor: (formElementType: string, descriptors: any, filterFor?: null) => any;
|
|
1003
|
-
|
|
1004
|
-
export declare const getIdReferenceListFor: (formElementType: string, descriptors: any, filterFor?: string | null) => any;
|
|
1005
|
-
|
|
1006
962
|
/** Auxiliary function to find adjacent nodes to focus. */
|
|
1007
963
|
export declare const getPrevNextFocus: (nodeId?: string) => {
|
|
1008
964
|
nextFocus: any;
|
|
@@ -2398,7 +2354,7 @@ export declare interface HvCarouselProps extends HvBaseProps<HTMLDivElement, "ti
|
|
|
2398
2354
|
/** Thumbnails position. */
|
|
2399
2355
|
thumbnailsPosition?: "top" | "bottom";
|
|
2400
2356
|
/** Carousel configuration options. @see https://www.embla-carousel.com/api/options/ */
|
|
2401
|
-
carouselOptions?: Parameters<typeof
|
|
2357
|
+
carouselOptions?: Parameters<typeof default_2>[0];
|
|
2402
2358
|
/** Function that renders the thumbnail. */
|
|
2403
2359
|
renderThumbnail?: (index: number) => React.ReactNode;
|
|
2404
2360
|
/** The callback fired when the active slide changes. */
|
|
@@ -2978,7 +2934,7 @@ export declare interface HvDialogProps extends Omit<DialogProps, "fullScreen" |
|
|
|
2978
2934
|
/** Current state of the Dialog. */
|
|
2979
2935
|
open?: boolean;
|
|
2980
2936
|
/** Callback fired when the component requests to be closed. */
|
|
2981
|
-
onClose?: (event:
|
|
2937
|
+
onClose?: (event: default_3.MouseEvent<HTMLButtonElement> | {}, reason?: "escapeKeyDown" | "backdropClick") => void;
|
|
2982
2938
|
/** @inheritdoc */
|
|
2983
2939
|
maxWidth?: DialogProps["maxWidth"];
|
|
2984
2940
|
/** @inheritdoc */
|
|
@@ -3419,19 +3375,19 @@ declare interface HvDropZoneLabels {
|
|
|
3419
3375
|
/**
|
|
3420
3376
|
* Empty states communicate that there’s no information, data or values to display in a given context.
|
|
3421
3377
|
*/
|
|
3422
|
-
export declare const HvEmptyState:
|
|
3378
|
+
export declare const HvEmptyState: default_3.ForwardRefExoticComponent<HvEmptyStateProps & default_3.RefAttributes<HTMLDivElement>>;
|
|
3423
3379
|
|
|
3424
3380
|
export declare type HvEmptyStateClasses = ExtractNames<typeof useClasses_68>;
|
|
3425
3381
|
|
|
3426
3382
|
export declare interface HvEmptyStateProps extends HvBaseProps<HTMLDivElement, "title"> {
|
|
3427
3383
|
/** Icon to be presented. */
|
|
3428
|
-
icon:
|
|
3384
|
+
icon: default_3.ReactNode;
|
|
3429
3385
|
/** The title to be shown. */
|
|
3430
|
-
title?:
|
|
3386
|
+
title?: default_3.ReactNode;
|
|
3431
3387
|
/** The message to be shown. */
|
|
3432
|
-
message?:
|
|
3388
|
+
message?: default_3.ReactNode;
|
|
3433
3389
|
/** The action message to be shown. */
|
|
3434
|
-
action?:
|
|
3390
|
+
action?: default_3.ReactNode;
|
|
3435
3391
|
/** A Jss Object used to override or extend the styles applied to the empty state component. */
|
|
3436
3392
|
classes?: HvEmptyStateClasses;
|
|
3437
3393
|
}
|
|
@@ -3761,6 +3717,12 @@ declare type HvFooterProps_2<D extends object = Record<string, unknown>> = HvTab
|
|
|
3761
3717
|
column: HvColumnInstance<D>;
|
|
3762
3718
|
};
|
|
3763
3719
|
|
|
3720
|
+
/**
|
|
3721
|
+
* Provides form-related context (ie. required/disabled/readOnly) for building form components,
|
|
3722
|
+
* analogous to MUI's [`FormControl`](https://mui.com/material-ui/api/form-control/) component.
|
|
3723
|
+
*
|
|
3724
|
+
* It is used internally to build UI Kit's form components (eg. `HvInput`, `HvDatePicker`), and can be used to build custom form components.
|
|
3725
|
+
*/
|
|
3764
3726
|
export declare const HvFormElement: {
|
|
3765
3727
|
(props: HvFormElementProps): JSX_3.Element;
|
|
3766
3728
|
formElementType: string;
|
|
@@ -3768,40 +3730,33 @@ export declare const HvFormElement: {
|
|
|
3768
3730
|
|
|
3769
3731
|
export declare type HvFormElementClasses = ExtractNames<typeof useClasses_8>;
|
|
3770
3732
|
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
export declare const HvFormElementContextProvider: default_2.Provider<HvFormElementContextValue>;
|
|
3776
|
-
|
|
3777
|
-
export declare interface HvFormElementContextValue {
|
|
3778
|
-
elementId?: string;
|
|
3779
|
-
elementDisabled?: boolean;
|
|
3780
|
-
elementRequired?: boolean;
|
|
3781
|
-
elementStatus?: string;
|
|
3782
|
-
elementReadOnly?: boolean;
|
|
3783
|
-
elementName?: string;
|
|
3784
|
-
}
|
|
3785
|
-
|
|
3786
|
-
export declare const HvFormElementDescriptorsContext: default_2.Context<HvFormElementDescriptorsContextValue>;
|
|
3787
|
-
|
|
3788
|
-
export declare const HvFormElementDescriptorsContextConsumer: default_2.Consumer<HvFormElementDescriptorsContextValue>;
|
|
3789
|
-
|
|
3790
|
-
export declare const HvFormElementDescriptorsContextProvider: default_2.Provider<HvFormElementDescriptorsContextValue>;
|
|
3791
|
-
|
|
3792
|
-
export declare interface HvFormElementDescriptorsContextValue {
|
|
3793
|
-
input?: any;
|
|
3794
|
-
label?: any;
|
|
3795
|
-
descriptors?: any;
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
export declare interface HvFormElementProps extends HvBaseProps<HTMLDivElement, "onChange" | "onToggle"> {
|
|
3733
|
+
declare interface HvFormElementContextValue {
|
|
3734
|
+
/** id to be applied to the form element root node. */
|
|
3735
|
+
id?: string;
|
|
3799
3736
|
/**
|
|
3800
3737
|
* Name of the form element.
|
|
3801
3738
|
*
|
|
3802
3739
|
* Part of a name/value pair, should be the name property of the underling native input.
|
|
3803
3740
|
*/
|
|
3804
3741
|
name?: string;
|
|
3742
|
+
/**
|
|
3743
|
+
* The status of the form element.
|
|
3744
|
+
*
|
|
3745
|
+
* Valid is correct, invalid is incorrect and standBy means no validations have run.
|
|
3746
|
+
*
|
|
3747
|
+
* When uncontrolled and unspecified it will default to "standBy" and change to either "valid"
|
|
3748
|
+
* or "invalid" after any change to the state.
|
|
3749
|
+
*/
|
|
3750
|
+
status?: HvFormStatus;
|
|
3751
|
+
/** Whether the form element is disabled. */
|
|
3752
|
+
disabled?: boolean;
|
|
3753
|
+
/** Indicates that user input is required on the form element. */
|
|
3754
|
+
required?: boolean;
|
|
3755
|
+
/** Indicates that the form element is not editable. */
|
|
3756
|
+
readOnly?: boolean;
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
export declare interface HvFormElementProps extends HvFormElementContextValue, HvBaseProps<HTMLDivElement, "onChange" | "onToggle"> {
|
|
3805
3760
|
/**
|
|
3806
3761
|
* Current value of the form element.
|
|
3807
3762
|
*
|
|
@@ -3817,21 +3772,6 @@ export declare interface HvFormElementProps extends HvBaseProps<HTMLDivElement,
|
|
|
3817
3772
|
label?: React.ReactNode;
|
|
3818
3773
|
/** Provide additional descriptive text for the form element. */
|
|
3819
3774
|
description?: React.ReactNode;
|
|
3820
|
-
/** Whether the form element is disabled. */
|
|
3821
|
-
disabled?: boolean;
|
|
3822
|
-
/** Indicates that the form element is not editable. */
|
|
3823
|
-
readOnly?: boolean;
|
|
3824
|
-
/** Indicates that user input is required on the form element. */
|
|
3825
|
-
required?: boolean;
|
|
3826
|
-
/**
|
|
3827
|
-
* The status of the form element.
|
|
3828
|
-
*
|
|
3829
|
-
* Valid is correct, invalid is incorrect and standBy means no validations have run.
|
|
3830
|
-
*
|
|
3831
|
-
* When uncontrolled and unspecified it will default to "standBy" and change to either "valid"
|
|
3832
|
-
* or "invalid" after any change to the state.
|
|
3833
|
-
*/
|
|
3834
|
-
status?: HvFormStatus;
|
|
3835
3775
|
/** The error message to show when `status` is "invalid". */
|
|
3836
3776
|
statusMessage?: string;
|
|
3837
3777
|
/** The callback fired when the value changes. */
|
|
@@ -3840,19 +3780,13 @@ export declare interface HvFormElementProps extends HvBaseProps<HTMLDivElement,
|
|
|
3840
3780
|
classes?: HvFormElementClasses;
|
|
3841
3781
|
}
|
|
3842
3782
|
|
|
3843
|
-
export declare const HvFormElementValueContext: default_2.Context<undefined>;
|
|
3844
|
-
|
|
3845
|
-
export declare const HvFormElementValueContextConsumer: default_2.Consumer<undefined>;
|
|
3846
|
-
|
|
3847
|
-
export declare const HvFormElementValueContextProvider: default_2.Provider<undefined>;
|
|
3848
|
-
|
|
3849
3783
|
export declare type HvFormStatus = "standBy" | "valid" | "invalid" | "empty";
|
|
3850
3784
|
|
|
3851
3785
|
/**
|
|
3852
3786
|
* Global Actions are actions that affect the entire page they live in.
|
|
3853
3787
|
* They should persist while scrolling down the screen.
|
|
3854
3788
|
*/
|
|
3855
|
-
export declare const HvGlobalActions:
|
|
3789
|
+
export declare const HvGlobalActions: default_3.ForwardRefExoticComponent<HvGlobalActionsProps & default_3.RefAttributes<HTMLDivElement>>;
|
|
3856
3790
|
|
|
3857
3791
|
export declare type HvGlobalActionsClasses = ExtractNames<typeof useClasses_74>;
|
|
3858
3792
|
|
|
@@ -3862,11 +3796,11 @@ export declare type HvGlobalActionsPosition = "sticky" | "fixed" | "relative";
|
|
|
3862
3796
|
|
|
3863
3797
|
export declare interface HvGlobalActionsProps extends HvBaseProps<HTMLDivElement, "title"> {
|
|
3864
3798
|
/** Text to display in the component. */
|
|
3865
|
-
title?:
|
|
3799
|
+
title?: default_3.ReactNode;
|
|
3866
3800
|
/** Denotes if this is a global or section component. */
|
|
3867
3801
|
variant?: HvGlobalActionsVariant;
|
|
3868
3802
|
/** User can pass in a fully customized button or false for when the back button should not be rendered. */
|
|
3869
|
-
backButton?:
|
|
3803
|
+
backButton?: default_3.ReactNode;
|
|
3870
3804
|
/** Heading Level to apply to Title Area. */
|
|
3871
3805
|
headingLevel?: HvGlobalActionsHeadingLevel;
|
|
3872
3806
|
/**
|
|
@@ -4173,7 +4107,7 @@ export declare interface HvInfoMessageProps extends HvTypographyProps<"label"> {
|
|
|
4173
4107
|
* An Inline Editor allows the user to edit a record without making a major switch
|
|
4174
4108
|
* between viewing and editing, making it an efficient method of updating a record.
|
|
4175
4109
|
*/
|
|
4176
|
-
export declare const HvInlineEditor: <C extends
|
|
4110
|
+
export declare const HvInlineEditor: <C extends default_3.ElementType<any, keyof default_3.JSX.IntrinsicElements> = default_3.ForwardRefExoticComponent<HvInputProps & default_3.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>>(props: {
|
|
4177
4111
|
/** The value of the form element. */
|
|
4178
4112
|
value?: string | undefined;
|
|
4179
4113
|
/** The default value of the form element. */
|
|
@@ -4183,11 +4117,11 @@ export declare const HvInlineEditor: <C extends default_2.ElementType<any, keyof
|
|
|
4183
4117
|
/** Variant of the HvTypography to display */
|
|
4184
4118
|
variant?: "display" | "title1" | "title2" | "title3" | "title4" | "label" | "body" | "captionLabel" | "caption1" | "caption2" | undefined;
|
|
4185
4119
|
/** Called when the input is blurred. */
|
|
4186
|
-
onBlur?: ((event:
|
|
4120
|
+
onBlur?: ((event: default_3.FocusEvent<HTMLTextAreaElement | HTMLInputElement>, value: string) => void) | undefined;
|
|
4187
4121
|
/** Called when the input value changes. */
|
|
4188
|
-
onChange?: ((event:
|
|
4122
|
+
onChange?: ((event: default_3.SyntheticEvent, value: string) => void) | undefined;
|
|
4189
4123
|
/** Called when there's a keydown event on the input. */
|
|
4190
|
-
onKeyDown?: ((event:
|
|
4124
|
+
onKeyDown?: ((event: default_3.KeyboardEvent<HTMLTextAreaElement | HTMLInputElement> | default_3.MouseEvent, value: string) => void) | undefined;
|
|
4191
4125
|
/** Props passed to the HvButton component */
|
|
4192
4126
|
buttonProps?: HvButtonProps | undefined;
|
|
4193
4127
|
/** Props passed to the HvTypography text component */
|
|
@@ -4212,14 +4146,14 @@ export declare const HvInlineEditor: <C extends default_2.ElementType<any, keyof
|
|
|
4212
4146
|
} & {
|
|
4213
4147
|
component?: C | undefined;
|
|
4214
4148
|
} & {
|
|
4215
|
-
children?:
|
|
4216
|
-
} & (Omit<
|
|
4149
|
+
children?: default_3.ReactNode;
|
|
4150
|
+
} & (Omit<default_3.PropsWithoutRef<default_3.ComponentProps<C>>, "value" | "classes" | "placeholder" | "disabled" | "variant" | "component" | "onBlur" | "onChange" | "onKeyDown" | "defaultValue" | "showIcon" | "buttonProps" | "typographyProps"> extends infer T ? T extends Omit<default_3.PropsWithoutRef<default_3.ComponentProps<C>>, "value" | "classes" | "placeholder" | "disabled" | "variant" | "component" | "onBlur" | "onChange" | "onKeyDown" | "defaultValue" | "showIcon" | "buttonProps" | "typographyProps"> ? T extends any ? T : never : never : never) & {
|
|
4217
4151
|
ref?: PolymorphicRef<C> | undefined;
|
|
4218
|
-
} &
|
|
4152
|
+
} & default_3.RefAttributes<unknown>) => default_3.ReactElement<any, string | default_3.JSXElementConstructor<any>> | null;
|
|
4219
4153
|
|
|
4220
4154
|
export declare type HvInlineEditorClasses = ExtractNames<typeof useClasses_82>;
|
|
4221
4155
|
|
|
4222
|
-
export declare type HvInlineEditorProps<C extends
|
|
4156
|
+
export declare type HvInlineEditorProps<C extends default_3.ElementType = typeof HvInput> = PolymorphicComponentRef<C, {
|
|
4223
4157
|
/** The value of the form element. */
|
|
4224
4158
|
value?: string;
|
|
4225
4159
|
/** The default value of the form element. */
|
|
@@ -4229,11 +4163,11 @@ export declare type HvInlineEditorProps<C extends default_2.ElementType = typeof
|
|
|
4229
4163
|
/** Variant of the HvTypography to display */
|
|
4230
4164
|
variant?: HvTypographyVariants;
|
|
4231
4165
|
/** Called when the input is blurred. */
|
|
4232
|
-
onBlur?: (event:
|
|
4166
|
+
onBlur?: (event: default_3.FocusEvent<HTMLTextAreaElement | HTMLInputElement>, value: string) => void;
|
|
4233
4167
|
/** Called when the input value changes. */
|
|
4234
|
-
onChange?: (event:
|
|
4168
|
+
onChange?: (event: default_3.SyntheticEvent, value: string) => void;
|
|
4235
4169
|
/** Called when there's a keydown event on the input. */
|
|
4236
|
-
onKeyDown?: (event:
|
|
4170
|
+
onKeyDown?: (event: default_3.KeyboardEvent<HTMLTextAreaElement | HTMLInputElement> | default_3.MouseEvent, value: string) => void;
|
|
4237
4171
|
/** Props passed to the HvButton component */
|
|
4238
4172
|
buttonProps?: HvButtonProps;
|
|
4239
4173
|
/** Props passed to the HvTypography text component */
|
|
@@ -4374,19 +4308,8 @@ export declare interface HvInputSuggestion {
|
|
|
4374
4308
|
value?: string;
|
|
4375
4309
|
}
|
|
4376
4310
|
|
|
4377
|
-
declare
|
|
4378
|
-
|
|
4379
|
-
badInput?: boolean;
|
|
4380
|
-
customError?: boolean;
|
|
4381
|
-
patternMismatch?: boolean;
|
|
4382
|
-
rangeOverflow?: boolean;
|
|
4383
|
-
rangeUnderflow?: boolean;
|
|
4384
|
-
stepMismatch?: boolean;
|
|
4385
|
-
tooLong?: boolean;
|
|
4386
|
-
tooShort?: boolean;
|
|
4387
|
-
typeMismatch?: boolean;
|
|
4388
|
-
valueMissing?: boolean;
|
|
4389
|
-
};
|
|
4311
|
+
declare interface HvInputValidity extends Partial<Mutable<ValidityState>> {
|
|
4312
|
+
}
|
|
4390
4313
|
|
|
4391
4314
|
export declare interface HvKnobProperty {
|
|
4392
4315
|
color?: string;
|
|
@@ -4811,7 +4734,7 @@ export declare interface HvOverflowTooltipProps extends HvBaseProps {
|
|
|
4811
4734
|
* Pagination is the process of dividing a document into discrete pages. It relates to how users interact
|
|
4812
4735
|
* with structured content on a website or application.
|
|
4813
4736
|
*/
|
|
4814
|
-
export declare const HvPagination:
|
|
4737
|
+
export declare const HvPagination: default_3.ForwardRefExoticComponent<HvPaginationProps & default_3.RefAttributes<HTMLDivElement>>;
|
|
4815
4738
|
|
|
4816
4739
|
export declare type HvPaginationClasses = ExtractNames<typeof useClasses_47>;
|
|
4817
4740
|
|
|
@@ -4843,9 +4766,9 @@ export declare interface HvPaginationProps extends HvBaseProps {
|
|
|
4843
4766
|
/** An object containing all the labels for the component. */
|
|
4844
4767
|
labels?: HvPaginationLabels;
|
|
4845
4768
|
/** Other props to show page component. */
|
|
4846
|
-
showPageProps?:
|
|
4769
|
+
showPageProps?: default_3.HTMLAttributes<HTMLDivElement>;
|
|
4847
4770
|
/** Other props to pagination component. */
|
|
4848
|
-
navigationProps?:
|
|
4771
|
+
navigationProps?: default_3.HTMLAttributes<HTMLDivElement>;
|
|
4849
4772
|
/** Extra properties passed to the input component representing the current pages. */
|
|
4850
4773
|
currentPageInputProps?: HvInputProps;
|
|
4851
4774
|
/** A Jss Object used to override or extend the styles applied to the component. */
|
|
@@ -6626,7 +6549,7 @@ export declare interface HvTagProps extends Omit<ChipProps, "color" | "classes"
|
|
|
6626
6549
|
/**
|
|
6627
6550
|
* A tags input is a single or multiline control that allows the input of tags.
|
|
6628
6551
|
*/
|
|
6629
|
-
export declare const HvTagsInput:
|
|
6552
|
+
export declare const HvTagsInput: default_3.ForwardRefExoticComponent<HvTagsInputProps & default_3.RefAttributes<HTMLUListElement>>;
|
|
6630
6553
|
|
|
6631
6554
|
export declare type HvTagsInputClasses = ExtractNames<typeof useClasses_114>;
|
|
6632
6555
|
|
|
@@ -6636,15 +6559,15 @@ export declare interface HvTagsInputProps extends Omit<HvInputProps, "onChange"
|
|
|
6636
6559
|
/** When uncontrolled, defines the initial input value. */
|
|
6637
6560
|
defaultValue?: string[] | HvTagProps[];
|
|
6638
6561
|
/** The function that will be executed onChange. */
|
|
6639
|
-
onChange?: (event:
|
|
6562
|
+
onChange?: (event: default_3.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement> | default_3.MouseEvent | default_3.KeyboardEvent<HTMLUListElement> | default_3.FocusEvent<HTMLDivElement>, value: HvTagProps[]) => void;
|
|
6640
6563
|
/** The function that will be executed when the element is focused. */
|
|
6641
|
-
onFocus?: (event:
|
|
6564
|
+
onFocus?: (event: default_3.FocusEvent<HTMLDivElement>, value: string) => void;
|
|
6642
6565
|
/** The function that will be executed when the element is blurred. */
|
|
6643
|
-
onBlur?: (event:
|
|
6566
|
+
onBlur?: (event: default_3.FocusEvent<HTMLDivElement>, value: string) => void;
|
|
6644
6567
|
/** The function that will be executed when a tag is deleted. */
|
|
6645
|
-
onDelete?: (event:
|
|
6568
|
+
onDelete?: (event: default_3.KeyboardEvent<HTMLUListElement> | default_3.MouseEvent<HTMLElement>, value: HvTagProps, index: number) => void;
|
|
6646
6569
|
/** The function that will be executed when a tag is added. */
|
|
6647
|
-
onAdd?: (event:
|
|
6570
|
+
onAdd?: (event: default_3.KeyboardEvent<HTMLInputElement | HTMLTextAreaElement> | default_3.MouseEvent | default_3.KeyboardEvent<HTMLUListElement> | default_3.FocusEvent<HTMLDivElement>, value: HvTagProps, index: number) => void;
|
|
6648
6571
|
/** If `true` the character counter isn't shown even if maxTagsQuantity is set. */
|
|
6649
6572
|
hideCounter?: boolean;
|
|
6650
6573
|
/** Text between the current char counter and max value. */
|
|
@@ -7583,15 +7506,11 @@ declare type InputElement = HTMLInputElement | HTMLTextAreaElement;
|
|
|
7583
7506
|
|
|
7584
7507
|
export declare const isBrowser: (browsers: string | string[]) => boolean | null;
|
|
7585
7508
|
|
|
7586
|
-
export declare const isInvalid: (compareState: HvFormStatus) => boolean;
|
|
7587
|
-
|
|
7588
7509
|
/** Check whether a keyboard `event` is pressing the `keyCode` key. */
|
|
7589
7510
|
export declare const isKey: (event: any, keyCode: Key) => boolean;
|
|
7590
7511
|
|
|
7591
7512
|
export declare const isOneOfKeys: (event: any, keys: Key[]) => boolean;
|
|
7592
7513
|
|
|
7593
|
-
export declare const isValid: (compareState: HvFormStatus) => boolean;
|
|
7594
|
-
|
|
7595
7514
|
declare type Key = keyof typeof keyboardCodes;
|
|
7596
7515
|
|
|
7597
7516
|
/** Map of keys to key `code` @see https://mdn.io/event/code */
|
|
@@ -7717,6 +7636,10 @@ export declare const multiButtonClasses: {
|
|
|
7717
7636
|
|
|
7718
7637
|
export declare const multiSelectionEventHandler: (evt: any, index: number, selectionAnchor: any, allValues: any[], selectedState: boolean[], selectionCheck: any) => any[];
|
|
7719
7638
|
|
|
7639
|
+
declare type Mutable<T> = {
|
|
7640
|
+
-readonly [P in keyof T]: T[P];
|
|
7641
|
+
};
|
|
7642
|
+
|
|
7720
7643
|
export declare type NavigationData<T extends React.ElementType = "a"> = React.ComponentProps<T> & Record<string, any> & {
|
|
7721
7644
|
/** The id to be applied to the root element. */
|
|
7722
7645
|
id: string;
|
|
@@ -10641,7 +10564,7 @@ export declare const useImageLoaded: (src?: string, srcSet?: string) => string |
|
|
|
10641
10564
|
|
|
10642
10565
|
export declare function useInstance(instance: any): void;
|
|
10643
10566
|
|
|
10644
|
-
export declare const useIsMounted: () =>
|
|
10567
|
+
export declare const useIsMounted: () => default_3.MutableRefObject<boolean>;
|
|
10645
10568
|
|
|
10646
10569
|
export declare function useLabels<T>(defaultLabels: T, labels?: DeepPartial<T>): T;
|
|
10647
10570
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.82.
|
|
3
|
+
"version": "5.82.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"access": "public",
|
|
63
63
|
"directory": "package"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "8c8ff8da3d880c63a34299c6d4593b1865dc60f0",
|
|
66
66
|
"exports": {
|
|
67
67
|
".": {
|
|
68
68
|
"types": "./dist/types/index.d.ts",
|