@hitachivantara/uikit-react-core 5.27.2 → 5.27.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/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/cjs/components/AppSwitcher/Action/Action.styles.cjs.map +1 -1
- package/dist/cjs/components/AppSwitcher/AppSwitcher.cjs.map +1 -1
- package/dist/cjs/components/AppSwitcher/AppSwitcher.styles.cjs.map +1 -1
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -1
- package/dist/cjs/components/Banner/Banner.styles.cjs.map +1 -1
- package/dist/cjs/components/BaseDropdown/BaseDropdown.cjs.map +1 -1
- package/dist/cjs/components/BaseDropdown/BaseDropdown.styles.cjs.map +1 -1
- package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
- package/dist/cjs/components/BaseInput/BaseInput.styles.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/BreadCrumb.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/BreadCrumb.styles.cjs.map +1 -1
- package/dist/cjs/components/BreadCrumb/Page/Page.styles.cjs.map +1 -1
- package/dist/cjs/components/BulkActions/BulkActions.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/Button/Button.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarHeader/CalendarHeader.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/CalendarWeekLabels/CalendarWeekLabels.cjs.map +1 -1
- package/dist/cjs/components/Calendar/SingleCalendar/CalendarCell.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/SingleCalendar/SingleCalendar.styles.cjs.map +1 -1
- package/dist/cjs/components/Calendar/utils.cjs.map +1 -1
- package/dist/cjs/components/Card/Card.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Content/Content.styles.cjs.map +1 -1
- package/dist/cjs/components/Card/Header/Header.styles.cjs.map +1 -1
- package/dist/cjs/components/Carousel/Carousel.cjs.map +1 -1
- package/dist/cjs/components/Carousel/CarouselControls.cjs.map +1 -1
- package/dist/cjs/components/Carousel/CarouselSlide/CarouselSlide.cjs.map +1 -1
- package/dist/cjs/components/Carousel/CarouselThumbnails.cjs.map +1 -1
- package/dist/cjs/components/CheckBox/CheckBox.styles.cjs.map +1 -1
- package/dist/cjs/components/CheckBoxGroup/CheckBoxGroup.cjs.map +1 -1
- package/dist/cjs/components/CheckBoxGroup/CheckBoxGroup.styles.cjs.map +1 -1
- package/dist/cjs/components/ColorPicker/Fields/Fields.cjs.map +1 -1
- package/dist/cjs/components/ColorPicker/PresetColors/PresetColors.cjs.map +1 -1
- package/dist/cjs/components/ColorPicker/SavedColors/SavedColors.cjs.map +1 -1
- package/dist/cjs/components/Container/Container.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/DatePicker.styles.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/utils.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Actions/Actions.styles.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Content/Content.styles.cjs.map +1 -1
- package/dist/cjs/components/Dialog/Title/Title.styles.cjs.map +1 -1
- package/dist/cjs/components/DropDownMenu/DropDownMenu.styles.cjs.map +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.cjs.map +1 -1
- package/dist/cjs/components/Dropdown/List/List.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/DropZone/DropZone.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/DropZone/DropZone.styles.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/File/File.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/File/File.styles.cjs.map +1 -1
- package/dist/cjs/components/FileUploader/FileList/FileList.styles.cjs.map +1 -1
- package/dist/cjs/components/FilterGroup/Counter/Counter.cjs.map +1 -1
- package/dist/cjs/components/FilterGroup/FilterContent/FilterContent.styles.cjs.map +1 -1
- package/dist/cjs/components/FilterGroup/RightPanel/RightPanel.cjs.map +1 -1
- package/dist/cjs/components/Footer/Footer.cjs.map +1 -1
- package/dist/cjs/components/Footer/Footer.styles.cjs.map +1 -1
- package/dist/cjs/components/Forms/CharCounter/CharCounter.cjs.map +1 -1
- package/dist/cjs/components/Forms/InfoMessage/InfoMessage.styles.cjs.map +1 -1
- package/dist/cjs/components/Forms/WarningText/WarningText.styles.cjs.map +1 -1
- package/dist/cjs/components/GlobalActions/GlobalActions.cjs.map +1 -1
- package/dist/cjs/components/GlobalActions/GlobalActions.styles.cjs.map +1 -1
- package/dist/cjs/components/Header/Actions/Actions.styles.cjs.map +1 -1
- package/dist/cjs/components/Header/Header.styles.cjs.map +1 -1
- package/dist/cjs/components/Header/Navigation/MenuBar/Bar.styles.cjs.map +1 -1
- package/dist/cjs/components/Header/Navigation/MenuItem/MenuItem.styles.cjs.map +1 -1
- package/dist/cjs/components/InlineEditor/InlineEditor.styles.cjs.map +1 -1
- package/dist/cjs/components/Input/Input.styles.cjs.map +1 -1
- package/dist/cjs/components/List/List.cjs.map +1 -1
- package/dist/cjs/components/ListContainer/ListItem/ListItem.styles.cjs.map +1 -1
- package/dist/cjs/components/Loading/Loading.cjs.map +1 -1
- package/dist/cjs/components/Loading/Loading.styles.cjs.map +1 -1
- package/dist/cjs/components/Login/Login.cjs.map +1 -1
- package/dist/cjs/components/MultiButton/MultiButton.styles.cjs.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.styles.cjs.map +1 -1
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/QueryBuilder.styles.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Rule.styles.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.styles.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Value/DateTimeValue/utils.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Value/NumericValue/Numeric.styles.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/Rule/Value/NumericValue/NumericValue.cjs.map +1 -1
- package/dist/cjs/components/QueryBuilder/RuleGroup/RuleGroup.cjs.map +1 -1
- package/dist/cjs/components/Radio/Radio.styles.cjs.map +1 -1
- package/dist/cjs/components/RadioGroup/RadioGroup.styles.cjs.map +1 -1
- package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.cjs.map +1 -1
- package/dist/cjs/components/ScrollTo/Horizontal/ScrollToHorizontal.styles.cjs.map +1 -1
- package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.cjs.map +1 -1
- package/dist/cjs/components/ScrollTo/Vertical/ScrollToVertical.styles.cjs.map +1 -1
- package/dist/cjs/components/ScrollTo/useScrollTo.cjs.map +1 -1
- package/dist/cjs/components/SelectionList/SelectionList.styles.cjs.map +1 -1
- package/dist/cjs/components/SimpleGrid/SimpleGrid.styles.cjs.map +1 -1
- package/dist/cjs/components/Slider/Slider.cjs.map +1 -1
- package/dist/cjs/components/Slider/Slider.styles.cjs.map +1 -1
- package/dist/cjs/components/Slider/SliderInput/SliderInput.cjs.map +1 -1
- package/dist/cjs/components/Slider/utils.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/Snackbar.styles.cjs.map +1 -1
- package/dist/cjs/components/Snackbar/SnackbarContent/SnackbarContent.styles.cjs.map +1 -1
- package/dist/cjs/components/Switch/Switch.styles.cjs.map +1 -1
- package/dist/cjs/components/Table/Table.styles.cjs.map +1 -1
- package/dist/cjs/components/Table/TableBody/TableBody.cjs.map +1 -1
- package/dist/cjs/components/Table/TableCell/TableCell.cjs.map +1 -1
- package/dist/cjs/components/Table/TableCell/TableCell.styles.cjs.map +1 -1
- package/dist/cjs/components/Table/TableHeader/TableHeader.cjs.map +1 -1
- package/dist/cjs/components/Table/TableHeader/TableHeader.styles.cjs.map +1 -1
- package/dist/cjs/components/Table/hooks/useHeaderGroups.cjs.map +1 -1
- package/dist/cjs/components/Table/hooks/useSticky.cjs.map +1 -1
- package/dist/cjs/components/Table/utils/utils.cjs.map +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -1
- package/dist/cjs/components/Tabs/Tabs.styles.cjs.map +1 -1
- package/dist/cjs/components/Tag/Tag.cjs.map +1 -1
- package/dist/cjs/components/TagsInput/TagsInput.cjs.map +1 -1
- package/dist/cjs/components/TagsInput/TagsInput.styles.cjs.map +1 -1
- package/dist/cjs/components/TimeAgo/formatUtils.cjs.map +1 -1
- package/dist/cjs/components/TimePicker/TimePicker.styles.cjs.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.styles.cjs.map +1 -1
- package/dist/cjs/components/Typography/utils.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/TreeView/TreeViewItem.cjs.map +1 -1
- package/dist/cjs/components/VerticalNavigation/VerticalNavigation.styles.cjs.map +1 -1
- package/dist/cjs/hooks/useControlled.cjs.map +1 -1
- package/dist/cjs/hooks/useCss.cjs.map +1 -1
- package/dist/cjs/utils/classes.cjs.map +1 -1
- package/dist/esm/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/components/AppSwitcher/Action/Action.styles.js.map +1 -1
- package/dist/esm/components/AppSwitcher/AppSwitcher.js.map +1 -1
- package/dist/esm/components/AppSwitcher/AppSwitcher.styles.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/Banner/Banner.styles.js.map +1 -1
- package/dist/esm/components/BaseDropdown/BaseDropdown.js.map +1 -1
- package/dist/esm/components/BaseDropdown/BaseDropdown.styles.js.map +1 -1
- package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/components/BaseInput/BaseInput.styles.js.map +1 -1
- package/dist/esm/components/BreadCrumb/BreadCrumb.js.map +1 -1
- package/dist/esm/components/BreadCrumb/BreadCrumb.styles.js.map +1 -1
- package/dist/esm/components/BreadCrumb/Page/Page.styles.js.map +1 -1
- package/dist/esm/components/BulkActions/BulkActions.js.map +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Button/Button.styles.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/dist/esm/components/Calendar/CalendarWeekLabels/CalendarWeekLabels.js.map +1 -1
- package/dist/esm/components/Calendar/SingleCalendar/CalendarCell.styles.js.map +1 -1
- package/dist/esm/components/Calendar/SingleCalendar/SingleCalendar.styles.js.map +1 -1
- package/dist/esm/components/Calendar/utils.js.map +1 -1
- package/dist/esm/components/Card/Card.styles.js.map +1 -1
- package/dist/esm/components/Card/Content/Content.styles.js.map +1 -1
- package/dist/esm/components/Card/Header/Header.styles.js.map +1 -1
- package/dist/esm/components/Carousel/Carousel.js.map +1 -1
- package/dist/esm/components/Carousel/CarouselControls.js.map +1 -1
- package/dist/esm/components/Carousel/CarouselSlide/CarouselSlide.js.map +1 -1
- package/dist/esm/components/Carousel/CarouselThumbnails.js.map +1 -1
- package/dist/esm/components/CheckBox/CheckBox.styles.js.map +1 -1
- package/dist/esm/components/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/dist/esm/components/CheckBoxGroup/CheckBoxGroup.styles.js.map +1 -1
- package/dist/esm/components/ColorPicker/Fields/Fields.js.map +1 -1
- package/dist/esm/components/ColorPicker/PresetColors/PresetColors.js.map +1 -1
- package/dist/esm/components/ColorPicker/SavedColors/SavedColors.js.map +1 -1
- package/dist/esm/components/Container/Container.js.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.styles.js.map +1 -1
- package/dist/esm/components/DatePicker/utils.js.map +1 -1
- package/dist/esm/components/Dialog/Actions/Actions.styles.js.map +1 -1
- package/dist/esm/components/Dialog/Content/Content.styles.js.map +1 -1
- package/dist/esm/components/Dialog/Title/Title.styles.js.map +1 -1
- package/dist/esm/components/DropDownMenu/DropDownMenu.styles.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Dropdown/List/List.js.map +1 -1
- package/dist/esm/components/FileUploader/DropZone/DropZone.js.map +1 -1
- package/dist/esm/components/FileUploader/DropZone/DropZone.styles.js.map +1 -1
- package/dist/esm/components/FileUploader/File/File.js.map +1 -1
- package/dist/esm/components/FileUploader/File/File.styles.js.map +1 -1
- package/dist/esm/components/FileUploader/FileList/FileList.styles.js.map +1 -1
- package/dist/esm/components/FilterGroup/Counter/Counter.js.map +1 -1
- package/dist/esm/components/FilterGroup/FilterContent/FilterContent.styles.js.map +1 -1
- package/dist/esm/components/FilterGroup/RightPanel/RightPanel.js.map +1 -1
- package/dist/esm/components/Footer/Footer.js.map +1 -1
- package/dist/esm/components/Footer/Footer.styles.js.map +1 -1
- package/dist/esm/components/Forms/CharCounter/CharCounter.js.map +1 -1
- package/dist/esm/components/Forms/InfoMessage/InfoMessage.styles.js.map +1 -1
- package/dist/esm/components/Forms/WarningText/WarningText.styles.js.map +1 -1
- package/dist/esm/components/GlobalActions/GlobalActions.js.map +1 -1
- package/dist/esm/components/GlobalActions/GlobalActions.styles.js.map +1 -1
- package/dist/esm/components/Header/Actions/Actions.styles.js.map +1 -1
- package/dist/esm/components/Header/Header.styles.js.map +1 -1
- package/dist/esm/components/Header/Navigation/MenuBar/Bar.styles.js.map +1 -1
- package/dist/esm/components/Header/Navigation/MenuItem/MenuItem.styles.js.map +1 -1
- package/dist/esm/components/InlineEditor/InlineEditor.styles.js.map +1 -1
- package/dist/esm/components/Input/Input.styles.js.map +1 -1
- package/dist/esm/components/List/List.js.map +1 -1
- package/dist/esm/components/ListContainer/ListItem/ListItem.styles.js.map +1 -1
- package/dist/esm/components/Loading/Loading.js.map +1 -1
- package/dist/esm/components/Loading/Loading.styles.js.map +1 -1
- package/dist/esm/components/Login/Login.js.map +1 -1
- package/dist/esm/components/MultiButton/MultiButton.styles.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.styles.js.map +1 -1
- package/dist/esm/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/esm/components/QueryBuilder/QueryBuilder.styles.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Rule.styles.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Value/DateTimeValue/DateTimeValue.styles.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Value/DateTimeValue/utils.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Value/NumericValue/Numeric.styles.js.map +1 -1
- package/dist/esm/components/QueryBuilder/Rule/Value/NumericValue/NumericValue.js.map +1 -1
- package/dist/esm/components/QueryBuilder/RuleGroup/RuleGroup.js.map +1 -1
- package/dist/esm/components/Radio/Radio.styles.js.map +1 -1
- package/dist/esm/components/RadioGroup/RadioGroup.styles.js.map +1 -1
- package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -1
- package/dist/esm/components/ScrollTo/Horizontal/ScrollToHorizontal.styles.js.map +1 -1
- package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.js.map +1 -1
- package/dist/esm/components/ScrollTo/Vertical/ScrollToVertical.styles.js.map +1 -1
- package/dist/esm/components/ScrollTo/useScrollTo.js.map +1 -1
- package/dist/esm/components/SelectionList/SelectionList.styles.js.map +1 -1
- package/dist/esm/components/SimpleGrid/SimpleGrid.styles.js.map +1 -1
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/components/Slider/Slider.styles.js.map +1 -1
- package/dist/esm/components/Slider/SliderInput/SliderInput.js.map +1 -1
- package/dist/esm/components/Slider/utils.js.map +1 -1
- package/dist/esm/components/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/components/Snackbar/Snackbar.styles.js.map +1 -1
- package/dist/esm/components/Snackbar/SnackbarContent/SnackbarContent.styles.js.map +1 -1
- package/dist/esm/components/Switch/Switch.styles.js.map +1 -1
- package/dist/esm/components/Table/Table.styles.js.map +1 -1
- package/dist/esm/components/Table/TableBody/TableBody.js.map +1 -1
- package/dist/esm/components/Table/TableCell/TableCell.js.map +1 -1
- package/dist/esm/components/Table/TableCell/TableCell.styles.js.map +1 -1
- package/dist/esm/components/Table/TableHeader/TableHeader.js.map +1 -1
- package/dist/esm/components/Table/TableHeader/TableHeader.styles.js.map +1 -1
- package/dist/esm/components/Table/hooks/useHeaderGroups.js.map +1 -1
- package/dist/esm/components/Table/hooks/useSticky.js.map +1 -1
- package/dist/esm/components/Table/utils/utils.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.styles.js.map +1 -1
- package/dist/esm/components/Tag/Tag.js.map +1 -1
- package/dist/esm/components/TagsInput/TagsInput.js.map +1 -1
- package/dist/esm/components/TagsInput/TagsInput.styles.js.map +1 -1
- package/dist/esm/components/TimeAgo/formatUtils.js.map +1 -1
- package/dist/esm/components/TimePicker/TimePicker.styles.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.styles.js.map +1 -1
- package/dist/esm/components/Typography/utils.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
- package/dist/esm/components/VerticalNavigation/VerticalNavigation.styles.js.map +1 -1
- package/dist/esm/hooks/useControlled.js.map +1 -1
- package/dist/esm/hooks/useCss.js.map +1 -1
- package/dist/esm/utils/classes.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.styles.cjs","sources":["../../../../../src/components/Table/TableCell/TableCell.styles.tsx"],"sourcesContent":["import { CSSProperties } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableCell\", {\n /** Styles applied to the component root class. */\n root: {\n verticalAlign: \"inherit\",\n textAlign: \"left\",\n padding: `${theme.table.cellPaddingTop} ${theme.space.xs} ${\n theme.table.cellPaddingBottom\n } ${theme.spacing(4)}`,\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n },\n /** Styles applied to the cell when it's in the table head. */\n head: {\n height: 52,\n verticalAlign: \"top\",\n\n backgroundColor: theme.colors.atmo1,\n borderTop: `1px solid ${theme.table.headerBorderTopColor}`,\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n ...(theme.typography.label as CSSProperties),\n },\n /** Styles applied to the cell when it's in the table body. */\n body: {\n minHeight: 32,\n \"td&\": {\n height: 32,\n },\n backgroundColor: \"inherit\",\n ...(theme.typography.body as CSSProperties),\n fontFamily: theme.fontFamily.body,\n },\n /** Styles applied to the cell when it's in the table footer. */\n footer: {},\n /** Styles applied to the cell when it's part of a sorted column. */\n sorted: {},\n /** Styles applied to the component root when it is left aligned */\n alignLeft: {\n textAlign: \"left\",\n },\n /** Styles applied to the component root when it is center aligned */\n alignCenter: {\n textAlign: \"center\",\n },\n /** Styles applied to the component root when it is right aligned */\n alignRight: {\n textAlign: \"right\",\n flexDirection: \"row-reverse\",\n },\n /** Styles applied to the component root when it is justified */\n alignJustify: {\n textAlign: \"justify\",\n },\n\n /** Styles applied to the component root when its variant is none */\n variantNone: {\n padding: 0,\n },\n /** Styles applied to the component root when its variant is checkbox */\n variantCheckbox: {\n boxSizing: \"content-box\",\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderRight: theme.table.cellBorder,\n },\n /** Styles applied to the component root when its variant is actions */\n variantActions: {\n boxSizing: \"content-box\",\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderLeft: theme.table.cellBorder,\n },\n /** Styles applied to the component root when its variant is expand */\n variantExpand: {\n paddingLeft: 0,\n paddingTop: 0,\n paddingBottom: 0,\n },\n /** Styles applied to the component root when its variant is list */\n variantList: {\n minHeight: 52,\n \"td&\": {\n height: 52,\n },\n padding: \"0, 0, 0, 32px\",\n border: 0,\n },\n /** Styles applied to the cell when its variant is list and the type is head. */\n variantListHead: {\n backgroundColor: \"inherit\",\n \"td&\": {\n height: 16,\n },\n },\n /** Styles applied to the cell when its variant is list and actions. */\n variantListactions: {\n verticalAlign: \"middle\",\n borderLeft: theme.table.cellListBorder,\n paddingLeft: \"0\",\n textAlign: \"center\",\n width: 130,\n maxWidth: 130,\n },\n /** Styles applied to the cell when its variant is list and checkbox. */\n variantListcheckbox: {\n borderRight: theme.table.cellListBorder,\n padding: 0,\n textAlign: \"center\",\n width: 34,\n maxWidth: 34,\n },\n /** Styles applied to the cell when it's part of a sticky column. */\n stickyColumn: {\n position: \"sticky\",\n zIndex: 2,\n background: theme.colors.atmo2,\n\n \"&$groupColumnMostRight+$stickyColumn\": {\n borderLeft: 0,\n },\n },\n /** Styles applied to the cell when it's part of the last sticky to the left column. */\n stickyColumnMostLeft: {\n borderRight: theme.table.cellBorder,\n },\n /** Styles applied to the cell when it's part of the first right sticky column. */\n stickyColumnLeastRight: {\n borderLeft: theme.table.cellBorder,\n },\n\n /** Styles applied to the cell when it's part of the first column in the group. */\n groupColumnMostLeft: {\n borderLeft: theme.table.cellBorder,\n\n \"&:first-of-type\": {\n borderLeft: 0,\n },\n },\n /** Styles applied to the cell when it's part of the last column in the group. */\n groupColumnMostRight: {\n borderRight: theme.table.cellBorder,\n\n // due to the \":has()\" selector not being supported in browsers,\n // this need to be managed with inline styles\n // To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)\n // \"&:last-child,&:has(+ $stickyColumnLeastRight)\": {\n \"&:last-child\": {\n borderRight: 0,\n },\n\n \"&+:not($stickyColumn)\": {\n borderLeft: 0,\n },\n },\n\n /** Styles applied to the cell when it's part of a resizable column. */\n resizable: {\n borderRight: theme.table.cellBorder,\n },\n /** Styles applied to the cell when it's part of a resizing column. */\n resizing: {\n borderRight: `solid 2px ${theme.colors.secondary}`,\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","verticalAlign","textAlign","padding","theme","table","cellPaddingTop","space","xs","cellPaddingBottom","spacing","borderBottom","colors","atmo4","head","height","backgroundColor","atmo1","borderTop","headerBorderTopColor","typography","label","body","minHeight","fontFamily","footer","sorted","alignLeft","alignCenter","alignRight","flexDirection","alignJustify","variantNone","variantCheckbox","boxSizing","width","maxWidth","borderRight","cellBorder","variantActions","borderLeft","variantExpand","paddingLeft","paddingTop","paddingBottom","variantList","border","variantListHead","variantListactions","cellListBorder","variantListcheckbox","stickyColumn","position","zIndex","background","atmo2","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","resizable","resizing","secondary"],"mappings":";;;;AAMa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,eAAe;AAAA;AAAA,EAExEC,MAAM;AAAA,IACJC,eAAe;AAAA,IACfC,WAAW;AAAA,IACXC,SAAU,GAAEC,kBAAMC,MAAMC,
|
|
1
|
+
{"version":3,"file":"TableCell.styles.cjs","sources":["../../../../../src/components/Table/TableCell/TableCell.styles.tsx"],"sourcesContent":["import { CSSProperties } from \"react\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableCell\", {\n /** Styles applied to the component root class. */\n root: {\n verticalAlign: \"inherit\",\n textAlign: \"left\",\n padding: `${theme.table.cellPaddingTop} ${theme.space.xs} ${\n theme.table.cellPaddingBottom\n } ${theme.spacing(4)}`,\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n },\n /** Styles applied to the cell when it's in the table head. */\n head: {\n height: 52,\n verticalAlign: \"top\",\n\n backgroundColor: theme.colors.atmo1,\n borderTop: `1px solid ${theme.table.headerBorderTopColor}`,\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n ...(theme.typography.label as CSSProperties),\n },\n /** Styles applied to the cell when it's in the table body. */\n body: {\n minHeight: 32,\n \"td&\": {\n height: 32,\n },\n backgroundColor: \"inherit\",\n ...(theme.typography.body as CSSProperties),\n fontFamily: theme.fontFamily.body,\n },\n /** Styles applied to the cell when it's in the table footer. */\n footer: {},\n /** Styles applied to the cell when it's part of a sorted column. */\n sorted: {},\n /** Styles applied to the component root when it is left aligned */\n alignLeft: {\n textAlign: \"left\",\n },\n /** Styles applied to the component root when it is center aligned */\n alignCenter: {\n textAlign: \"center\",\n },\n /** Styles applied to the component root when it is right aligned */\n alignRight: {\n textAlign: \"right\",\n flexDirection: \"row-reverse\",\n },\n /** Styles applied to the component root when it is justified */\n alignJustify: {\n textAlign: \"justify\",\n },\n\n /** Styles applied to the component root when its variant is none */\n variantNone: {\n padding: 0,\n },\n /** Styles applied to the component root when its variant is checkbox */\n variantCheckbox: {\n boxSizing: \"content-box\",\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderRight: theme.table.cellBorder,\n },\n /** Styles applied to the component root when its variant is actions */\n variantActions: {\n boxSizing: \"content-box\",\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderLeft: theme.table.cellBorder,\n },\n /** Styles applied to the component root when its variant is expand */\n variantExpand: {\n paddingLeft: 0,\n paddingTop: 0,\n paddingBottom: 0,\n },\n /** Styles applied to the component root when its variant is list */\n variantList: {\n minHeight: 52,\n \"td&\": {\n height: 52,\n },\n padding: \"0, 0, 0, 32px\",\n border: 0,\n },\n /** Styles applied to the cell when its variant is list and the type is head. */\n variantListHead: {\n backgroundColor: \"inherit\",\n \"td&\": {\n height: 16,\n },\n },\n /** Styles applied to the cell when its variant is list and actions. */\n variantListactions: {\n verticalAlign: \"middle\",\n borderLeft: theme.table.cellListBorder,\n paddingLeft: \"0\",\n textAlign: \"center\",\n width: 130,\n maxWidth: 130,\n },\n /** Styles applied to the cell when its variant is list and checkbox. */\n variantListcheckbox: {\n borderRight: theme.table.cellListBorder,\n padding: 0,\n textAlign: \"center\",\n width: 34,\n maxWidth: 34,\n },\n /** Styles applied to the cell when it's part of a sticky column. */\n stickyColumn: {\n position: \"sticky\",\n zIndex: 2,\n background: theme.colors.atmo2,\n\n \"&$groupColumnMostRight+$stickyColumn\": {\n borderLeft: 0,\n },\n },\n /** Styles applied to the cell when it's part of the last sticky to the left column. */\n stickyColumnMostLeft: {\n borderRight: theme.table.cellBorder,\n },\n /** Styles applied to the cell when it's part of the first right sticky column. */\n stickyColumnLeastRight: {\n borderLeft: theme.table.cellBorder,\n },\n\n /** Styles applied to the cell when it's part of the first column in the group. */\n groupColumnMostLeft: {\n borderLeft: theme.table.cellBorder,\n\n \"&:first-of-type\": {\n borderLeft: 0,\n },\n },\n /** Styles applied to the cell when it's part of the last column in the group. */\n groupColumnMostRight: {\n borderRight: theme.table.cellBorder,\n\n // due to the \":has()\" selector not being supported in browsers,\n // this need to be managed with inline styles\n // To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)\n // \"&:last-child,&:has(+ $stickyColumnLeastRight)\": {\n \"&:last-child\": {\n borderRight: 0,\n },\n\n \"&+:not($stickyColumn)\": {\n borderLeft: 0,\n },\n },\n\n /** Styles applied to the cell when it's part of a resizable column. */\n resizable: {\n borderRight: theme.table.cellBorder,\n },\n /** Styles applied to the cell when it's part of a resizing column. */\n resizing: {\n borderRight: `solid 2px ${theme.colors.secondary}`,\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","verticalAlign","textAlign","padding","theme","table","cellPaddingTop","space","xs","cellPaddingBottom","spacing","borderBottom","colors","atmo4","head","height","backgroundColor","atmo1","borderTop","headerBorderTopColor","typography","label","body","minHeight","fontFamily","footer","sorted","alignLeft","alignCenter","alignRight","flexDirection","alignJustify","variantNone","variantCheckbox","boxSizing","width","maxWidth","borderRight","cellBorder","variantActions","borderLeft","variantExpand","paddingLeft","paddingTop","paddingBottom","variantList","border","variantListHead","variantListactions","cellListBorder","variantListcheckbox","stickyColumn","position","zIndex","background","atmo2","stickyCol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AAAA;AAAA,EAEAgB,sBAAsB;AAAA,IACpBnB,aAAajC,YAAAA,MAAMC,MAAMiC;AAAAA,EAC3B;AAAA;AAAA,EAEAmB,wBAAwB;AAAA,IACtBjB,YAAYpC,YAAAA,MAAMC,MAAMiC;AAAAA,EAC1B;AAAA;AAAA,EAGAoB,qBAAqB;AAAA,IACnBlB,YAAYpC,YAAAA,MAAMC,MAAMiC;AAAAA,IAExB,mBAAmB;AAAA,MACjBE,YAAY;AAAA,IACd;AAAA,EACF;AAAA;AAAA,EAEAmB,sBAAsB;AAAA,IACpBtB,aAAajC,YAAAA,MAAMC,MAAMiC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,IAMzB,gBAAgB;AAAA,MACdD,aAAa;AAAA,IACf;AAAA,IAEA,yBAAyB;AAAA,MACvBG,YAAY;AAAA,IACd;AAAA,EACF;AAAA;AAAA,EAGAoB,WAAW;AAAA,IACTvB,aAAajC,YAAAA,MAAMC,MAAMiC;AAAAA,EAC3B;AAAA;AAAA,EAEAuB,UAAU;AAAA,IACRxB,aAAc,aAAYjC,YAAMQ,MAAAA,OAAOkD,SAAU;AAAA,EACnD;AACF,CAAC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.cjs","sources":["../../../../../src/components/Table/TableHeader/TableHeader.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n ThHTMLAttributes,\n useContext,\n useMemo,\n} from \"react\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { hexToRgb, alpha } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvTypography, HvTypographyProps } from \"@core/components/Typography\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { getSortIcon, isParagraph } from \"./utils\";\nimport { useClasses, staticClasses } from \"./TableHeader.styles\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\n\nexport { staticClasses as tableHeaderClasses };\n\nexport type HvTableHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeaderProps\n extends Omit<ThHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to th. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** The scope of cells that the header element relates to. */\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\";\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant;\n /** Specify the cell type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is sorted */\n sorted?: boolean;\n /** Whether or not the cell is sortable */\n sortable?: boolean;\n /** Set sort direction icon and aria-sort. */\n sortDirection?: \"ascending\" | \"descending\" | false;\n /** Extra props to be passed onto the text in the header. */\n headerTextProps?: HvTypographyProps;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** The resize props injected in the resize handler */\n resizerProps?: HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeaderClasses;\n /** Extra props to be passed onto the sort button in the header. */\n sortButtonProps?: HvButtonProps;\n}\n\nconst defaultComponent = \"th\";\n\n/**\n * `HvTableHeader` acts as a `th` element and inherits styles from its context\n */\nexport const HvTableHeader = forwardRef<HTMLElement, HvTableHeaderProps>(\n (\n {\n children,\n component,\n className,\n style,\n classes: classesProp,\n scope: scopeProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sortDirection = \"none\",\n sorted,\n sortable,\n headerTextProps,\n resizerProps = {},\n resizable = false,\n resizing = false,\n sortButtonProps,\n ...others\n },\n externalRef\n ) => {\n const { classes, cx, css } = useClasses(classesProp);\n\n const { colors } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n const isHeadCell = type === \"head\";\n\n const scope = scopeProp ?? isHeadCell ? \"col\" : \"row\";\n\n const Sort = useMemo(\n () => getSortIcon(sorted && sortDirection),\n [sorted, sortDirection]\n );\n\n const Component =\n component || tableContext?.components?.Th || defaultComponent;\n\n const role =\n Component === defaultComponent\n ? null\n : isHeadCell\n ? \"columnheader\"\n : \"rowheader\";\n const paragraph = isParagraph(children);\n\n return (\n <Component\n ref={externalRef}\n role={role}\n scope={scope}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: alpha(\n hexToRgb(colors?.atmo1 || theme.colors.atmo1),\n 0.4\n ),\n },\n }),\n {\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.sortable]: sortable,\n [classes.sorted]: sorted,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\n },\n className\n )}\n aria-sort={sortable ? sortDirection : undefined}\n {...others}\n >\n <div\n className={cx(classes.headerContent, {\n [classes[`alignFlex${capitalize(align)}`]]: align !== \"inherit\",\n })}\n >\n {isHeadCell && sortable && (\n <HvButton\n className={classes.sortButton}\n icon\n overrideIconColors={false}\n aria-label=\"Sort\"\n {...sortButtonProps}\n >\n <Sort className={classes.sortIcon} />\n </HvButton>\n )}\n <HvTypography\n component=\"div\"\n className={cx({\n [classes.headerText]: !paragraph,\n [classes.headerParagraph]: paragraph,\n [classes.sortableHeaderText]: sortable,\n })}\n variant=\"label\"\n {...headerTextProps}\n >\n {children}\n </HvTypography>\n {resizable && <div {...resizerProps} className={classes.resizer} />}\n </div>\n </Component>\n );\n }\n);\n"],"names":["defaultComponent","HvTableHeader","forwardRef","children","component","className","style","classes","classesProp","scope","scopeProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sortDirection","sorted","sortable","headerTextProps","resizerProps","resizable","resizing","sortButtonProps","others","externalRef","cx","css","useClasses","colors","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","isHeadCell","Sort","useMemo","getSortIcon","Component","components","Th","role","paragraph","isParagraph","ref","root","staticClasses","backgroundColor","alpha","hexToRgb","atmo1","theme","variantList","capitalize","undefined","headerContent","HvButton","sortButton","icon","overrideIconColors","sortIcon","_jsx","HvTypography","headerText","headerParagraph","sortableHeaderText","resizer"],"mappings":";;;;;;;;;;;;;;;;AA6EA,MAAMA,mBAAmB;AAKZC,MAAAA,gBAAgBC,iBAC3B,CACE;AAAA,EACEC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC,OAAOC;AAAAA,EACPC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,MAAMC;AAAAA,EACNC,eAAe;AAAA,EACfC,uBAAuB;AAAA,EACvBC,yBAAyB;AAAA,EACzBC,sBAAsB;AAAA,EAC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AkB,GAAGjD;AAAAA,QAAAA,CAC/B;AAAA,QACDV,SAAQ;AAAA,QAAO,GACXW;AAAAA,QAAepB;AAAAA,MAAAA,CAGP,GACbsB,aAAa0C,2BAAAA,IAAA,OAAA;AAAA,QAAA,GAAS3C;AAAAA,QAAcnB,WAAWE,QAAQiE;AAAAA,MAAAA,CAAU,CAAC;AAAA,IAAA,CAChE;AAAA,EAAA,CACI;AAEf,CACF;;;"}
|
|
1
|
+
{"version":3,"file":"TableHeader.cjs","sources":["../../../../../src/components/Table/TableHeader/TableHeader.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n ThHTMLAttributes,\n useContext,\n useMemo,\n} from \"react\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { hexToRgb, alpha } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvTypography, HvTypographyProps } from \"@core/components/Typography\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport TableContext from \"../TableContext\";\nimport TableSectionContext from \"../TableSectionContext\";\nimport { getSortIcon, isParagraph } from \"./utils\";\nimport { useClasses, staticClasses } from \"./TableHeader.styles\";\nimport {\n HvTableCellAlign,\n HvTableCellType,\n HvTableCellVariant,\n} from \"../Table\";\n\nexport { staticClasses as tableHeaderClasses };\n\nexport type HvTableHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTableHeaderProps\n extends Omit<ThHTMLAttributes<HTMLTableCellElement>, \"align\"> {\n /** The component used for the root node. Either a string to use a HTML element or a component. Defaults to th. */\n component?: React.ElementType;\n /** Content to be rendered */\n children?: React.ReactNode;\n /** The scope of cells that the header element relates to. */\n scope?: \"col\" | \"row\" | \"colgroup\" | \"rowgroup\";\n /** Set the text-align on the table cell content. */\n align?: HvTableCellAlign;\n /** Sets the cell's variant. */\n variant?: HvTableCellVariant;\n /** Specify the cell type. The prop defaults to the value inherited from the parent TableHead, TableBody, or TableFooter components. */\n type?: HvTableCellType;\n /** The cell is part of a sticky column. */\n stickyColumn?: boolean;\n /** The cell is part of the last sticky to the left column. */\n stickyColumnMostLeft?: boolean;\n /** The cell is part of the first sticky to the right column. */\n stickyColumnLeastRight?: boolean;\n /** The cell is part of the first column in the group. */\n groupColumnMostLeft?: boolean;\n /** The cell is part of the last column in the group. */\n groupColumnMostRight?: boolean;\n /** Whether or not the cell is sorted */\n sorted?: boolean;\n /** Whether or not the cell is sortable */\n sortable?: boolean;\n /** Set sort direction icon and aria-sort. */\n sortDirection?: \"ascending\" | \"descending\" | false;\n /** Extra props to be passed onto the text in the header. */\n headerTextProps?: HvTypographyProps;\n /** Whether or not the cell is resizable */\n resizable?: boolean;\n /** Whether or not the cell is being resized */\n resizing?: boolean;\n /** The resize props injected in the resize handler */\n resizerProps?: HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTableHeaderClasses;\n /** Extra props to be passed onto the sort button in the header. */\n sortButtonProps?: HvButtonProps;\n}\n\nconst defaultComponent = \"th\";\n\n/**\n * `HvTableHeader` acts as a `th` element and inherits styles from its context\n */\nexport const HvTableHeader = forwardRef<HTMLElement, HvTableHeaderProps>(\n (\n {\n children,\n component,\n className,\n style,\n classes: classesProp,\n scope: scopeProp,\n align = \"inherit\",\n variant = \"default\",\n type: typeProp,\n stickyColumn = false,\n stickyColumnMostLeft = false,\n stickyColumnLeastRight = false,\n groupColumnMostLeft = false,\n groupColumnMostRight = false,\n sortDirection = \"none\",\n sorted,\n sortable,\n headerTextProps,\n resizerProps = {},\n resizable = false,\n resizing = false,\n sortButtonProps,\n ...others\n },\n externalRef\n ) => {\n const { classes, cx, css } = useClasses(classesProp);\n\n const { colors } = useTheme();\n const tableContext = useContext(TableContext);\n const tableSectionContext = useContext(TableSectionContext);\n\n const type = typeProp || tableSectionContext?.type || \"body\";\n const isHeadCell = type === \"head\";\n\n const scope = scopeProp ?? isHeadCell ? \"col\" : \"row\";\n\n const Sort = useMemo(\n () => getSortIcon(sorted && sortDirection),\n [sorted, sortDirection]\n );\n\n const Component =\n component || tableContext?.components?.Th || defaultComponent;\n\n const role =\n Component === defaultComponent\n ? null\n : isHeadCell\n ? \"columnheader\"\n : \"rowheader\";\n const paragraph = isParagraph(children);\n\n return (\n <Component\n ref={externalRef}\n role={role}\n scope={scope}\n style={style}\n className={cx(\n classes.root,\n classes[type],\n type === \"body\" &&\n css({\n [`&.${staticClasses.sorted}`]: {\n backgroundColor: alpha(\n hexToRgb(colors?.atmo1 || theme.colors.atmo1),\n 0.4\n ),\n },\n }),\n {\n [classes.groupColumnMostLeft]: groupColumnMostLeft,\n [classes.groupColumnMostRight]: groupColumnMostRight,\n [classes.sortable]: sortable,\n [classes.sorted]: sorted,\n [classes.resizable]: resizable,\n [classes.resizing]: resizing,\n [classes.stickyColumn]: stickyColumn,\n [classes.stickyColumnMostLeft]: stickyColumnMostLeft,\n [classes.stickyColumnLeastRight]: stickyColumnLeastRight,\n [classes.variantList]: tableContext.variant === \"listrow\",\n [classes[`align${capitalize(align)}`]]: align !== \"inherit\",\n [classes[`variant${capitalize(variant)}`]]: variant !== \"default\",\n },\n className\n )}\n aria-sort={sortable ? sortDirection : undefined}\n {...others}\n >\n <div\n className={cx(classes.headerContent, {\n [classes[`alignFlex${capitalize(align)}`]]: align !== \"inherit\",\n })}\n >\n {isHeadCell && sortable && (\n <HvButton\n className={classes.sortButton}\n icon\n overrideIconColors={false}\n aria-label=\"Sort\"\n {...sortButtonProps}\n >\n <Sort className={classes.sortIcon} />\n </HvButton>\n )}\n <HvTypography\n component=\"div\"\n className={cx({\n [classes.headerText]: !paragraph,\n [classes.headerParagraph]: paragraph,\n [classes.sortableHeaderText]: sortable,\n })}\n variant=\"label\"\n {...headerTextProps}\n >\n {children}\n </HvTypography>\n {resizable && <div {...resizerProps} className={classes.resizer} />}\n </div>\n </Component>\n );\n }\n);\n"],"names":["defaultComponent","HvTableHeader","forwardRef","children","component","className","style","classes","classesProp","scope","scopeProp","align","variant","type","typeProp","stickyColumn","stickyColumnMostLeft","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","sortDirection","sorted","sortable","headerTextProps","resizerProps","resizable","resizing","sortButtonProps","others","externalRef","cx","css","useClasses","colors","useTheme","tableContext","useContext","TableContext","tableSectionContext","TableSectionContext","isHeadCell","Sort","useMemo","getSortIcon","Component","components","Th","role","paragraph","isParagraph","ref","root","staticClasses","backgroundColor","alpha","hexToRgb","atmo1","theme","variantList","capitalize","undefined","headerContent","HvButton","sortButton","icon","overrideIconColors","sortIcon","_jsx","HvTypography","headerText","headerParagraph","sortableHeaderText","resizer"],"mappings":";;;;;;;;;;;;;;;;AA6EA,MAAMA,mBAAmB;AAKZC,MAAAA,gBAAgBC,iBAC3B,CACE;AAAA,EACEC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAASC;AAAAA,EACTC,OAAOC;AAAAA,EACPC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,MAAMC;AAAAA,EACNC,eAAe;AAAA,EACfC,uBAAuB;AAAA,EACvBC,yBAAyB;AAAA,EACzBC,sBAAsB;AAAA,EACtBC,uBAAuB;AAAA,EACvBC,gBAAgB;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,eAAe,CAAC;AAAA,EAChBC,YAAY;AAAA,EACZC,WAAW;AAAA,EACXC;AAAAA,EACA,GAAGC;AACL,GACAC,gBACG;;AACG,QAAA;AAAA,IAAEtB;AAAAA,IAASuB;AAAAA,IAAIC;AAAAA,EAAAA,IAAQC,mBAAAA,WAAWxB,WAAW;AAE7C,QAAA;AAAA,IAAEyB;AAAAA,MAAWC,SAAS,SAAA;AACtBC,QAAAA,eAAeC,iBAAWC,aAAAA,OAAY;AACtCC,QAAAA,sBAAsBF,iBAAWG,oBAAAA,OAAmB;AAEpD1B,QAAAA,OAAOC,aAAYwB,2DAAqBzB,S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S,UAASoD,oBAAAA,QAAW/C,OAAO,CAAE,EAAC,CAAC,GAAGA,YAAY;AAAA,OAE1DP,SACF;AAAA,IACA,aAAWiB,WAAWF,gBAAgBwC;AAAAA,IAAU,GAC5ChC;AAAAA,IAAMzB,0CAEV,OAAA;AAAA,MACEE,WAAWyB,GAAGvB,QAAQsD,eAAe;AAAA,QACnC,CAACtD,QAAS,YAAWoD,oBAAAA,QAAWhD,KAAK,CAAE,EAAC,CAAC,GAAGA,UAAU;AAAA,MAAA,CACvD;AAAA,MAAER,WAEFqC,cAAclB,2CACZwC,OAAAA,UAAQ;AAAA,QACPzD,WAAWE,QAAQwD;AAAAA,QACnBC,MAAI;AAAA,QACJC,oBAAoB;AAAA,QACpB,cAAW;AAAA,QAAM,GACbtC;AAAAA,QAAexB,yCAElBsC,MAAI;AAAA,UAACpC,WAAWE,QAAQ2D;AAAAA,QAAAA,CAAW;AAAA,MAAA,CAC5B,GAEZC,2BAAAA,IAACC,yBAAY;AAAA,QACXhE,WAAU;AAAA,QACVC,WAAWyB,GAAG;AAAA,UACZ,CAACvB,QAAQ8D,UAAU,GAAG,CAACrB;AAAAA,UACvB,CAACzC,QAAQ+D,eAAe,GAAGtB;AAAAA,UAC3B,CAACzC,QAAQgE,kBAAkB,GAAGjD;AAAAA,QAAAA,CAC/B;AAAA,QACDV,SAAQ;AAAA,QAAO,GACXW;AAAAA,QAAepB;AAAAA,MAAAA,CAGP,GACbsB,aAAa0C,2BAAAA,IAAA,OAAA;AAAA,QAAA,GAAS3C;AAAAA,QAAcnB,WAAWE,QAAQiE;AAAAA,MAAAA,CAAU,CAAC;AAAA,IAAA,CAChE;AAAA,EAAA,CACI;AAEf,CACF;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.styles.cjs","sources":["../../../../../src/components/Table/TableHeader/TableHeader.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableHeader\", {\n root: {\n \"--first-row-cell-height\": \"52px\",\n \"--cell-height\": \"32px\",\n height: \"var(--cell-height)\",\n verticalAlign: \"inherit\",\n textAlign: \"left\",\n padding: theme.spacing(0, 1, 0, 4),\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n },\n head: {\n paddingTop: 8,\n verticalAlign: \"top\",\n ...theme.typography.label,\n transition: \"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms\",\n backgroundColor: theme.colors.atmo1,\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n\n \"*:first-of-type > &\": {\n height: \"var(--first-row-cell-height)\",\n borderTop: `1px solid ${theme.table.headerBorderTopColor}`,\n },\n\n \"&$variantList\": {\n backgroundColor: \"inherit\",\n borderBottom: 0,\n \"*:first-of-type > &\": {\n borderTop: 0,\n },\n },\n\n \"&$sortable\": {\n verticalAlign: \"initial\",\n paddingTop: 0,\n paddingLeft: 0,\n cursor: \"pointer\",\n\n \"&:hover\": {\n backgroundColor: theme.table.headerHoverColor,\n\n \"& $sortIcon\": {\n visibility: \"visible\",\n },\n },\n \"&:focus-within\": {\n backgroundColor: theme.table.headerHoverColor,\n\n \"& $sortIcon\": {\n visibility: \"visible\",\n },\n },\n },\n },\n body: {\n backgroundColor: \"inherit\",\n ...theme.typography.body,\n \"&$sortable:not($variantNone)\": {\n paddingLeft: 32,\n },\n },\n footer: {},\n stickyColumn: {\n position: \"sticky\",\n zIndex: 2,\n\n \"&$groupColumnMostRight+$stickyColumn\": {\n borderLeft: 0,\n },\n },\n stickyColumnMostLeft: { borderRight: `solid 1px ${theme.colors.atmo4}` },\n stickyColumnLeastRight: { borderLeft: `solid 1px ${theme.colors.atmo4}` },\n groupColumnMostLeft: { borderLeft: `solid 1px ${theme.colors.atmo4}` },\n groupColumnMostRight: {\n borderRight: `solid 1px ${theme.colors.atmo4}`,\n // due to the \":has()\" selector not being supported in browsers,\n // this need to be managed with inline styles\n // To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)\n // \"&:last-child,&:has(+ $stickyColumnLeastRight)\": {\n \"&:last-child\": {\n borderRight: 0,\n },\n \"&+:not($stickyColumn)\": {\n borderLeft: 0,\n },\n },\n headerContent: { display: \"flex\", alignItems: \"flex-start\", width: \"100%\" },\n headerText: { overflow: \"hidden\", textOverflow: \"ellipsis\" },\n headerParagraph: { overflow: \"hidden\", display: \"-webkit-box\" },\n sortableHeaderText: { paddingTop: \"8px\" },\n sorted: {\n \"& $sortIcon\": {\n visibility: \"visible\",\n },\n },\n sortable: {},\n sortButton: {\n \"$root$sortable &\": {\n boxShadow: \"none\",\n backgroundColor: \"transparent\",\n \"&:hover\": {\n backgroundColor: theme.table.sortButtonHoverColor,\n },\n },\n },\n sortIcon: { display: \"inline-flex\", visibility: \"hidden\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\", flexDirection: \"row-reverse\" },\n alignCenter: { textAlign: \"center\" },\n alignJustify: { textAlign: \"justify\" },\n alignFlexLeft: { justifyContent: \"flex-start\" },\n alignFlexRight: { justifyContent: \"flex-end\" },\n alignFlexCenter: { justifyContent: \"center\" },\n alignFlexJustify: { textAlign: \"justify\" },\n variantCheckbox: {\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderRight: `solid 1px ${theme.colors.atmo4}`,\n },\n variantExpand: {},\n variantActions: {\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderLeft: `solid 1px ${theme.colors.atmo4}`,\n },\n variantNone: { padding: 0 },\n variantList: {\n backgroundColor: \"inherit\",\n borderBottom: 0,\n height: 16,\n \":first-of-type > &\": {\n borderTop: 0,\n height: 16,\n },\n },\n resizable: { borderRight: `solid 1px ${theme.colors.atmo4}` },\n resizing: { borderRight: `solid 2px ${theme.colors.secondary}` },\n resizer: {\n display: \"inline-block\",\n width: 10,\n height: \"100%\",\n position: \"absolute\",\n right: 0,\n top: 0,\n transform: \"translateX(50%)\",\n zIndex: 1,\n touchAction: \"none\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","height","verticalAlign","textAlign","padding","theme","spacing","borderBottom","colors","atmo4","head","paddingTop","typography","label","transition","backgroundColor","atmo1","borderTop","table","headerBorderTopColor","paddingLeft","cursor","headerHoverColor","visibility","body","footer","stickyColumn","position","zIndex","borderLeft","stickyColumnMostLeft","borderRight","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","headerContent","display","alignItems","width","headerText","overflow","textOverflow","headerParagraph","sortableHeaderText","sorted","sortable","sortButton","boxShadow","sortButtonHoverColor","sortIcon","alignLeft","alignRight","flexDirection","alignCenter","alignJustify","alignFlexLeft","justifyContent","alignFlexRight","alignFlexCenter","alignFlexJustify","variantCheckbox","maxWidth","variantExpand","variantActions","variantNone","variantList","resizable","resizing","secondary","resizer","right","top","transform","touchAction"],"mappings":";;;;AAIa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,iBAAiB;AAAA,EAC1EC,MAAM;AAAA,IACJ,2BAA2B;AAAA,IAC3B,iBAAiB;AAAA,IACjBC,QAAQ;AAAA,IACRC,eAAe;AAAA,IACfC,WAAW;AAAA,IACXC,SAASC,YAAMC,MAAAA,QAAQ,GAAG,GAAG,GAAG,CAAC;AAAA,IACjCC,cAAe,aAAYF,
|
|
1
|
+
{"version":3,"file":"TableHeader.styles.cjs","sources":["../../../../../src/components/Table/TableHeader/TableHeader.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableHeader\", {\n root: {\n \"--first-row-cell-height\": \"52px\",\n \"--cell-height\": \"32px\",\n height: \"var(--cell-height)\",\n verticalAlign: \"inherit\",\n textAlign: \"left\",\n padding: theme.spacing(0, 1, 0, 4),\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n },\n head: {\n paddingTop: 8,\n verticalAlign: \"top\",\n ...theme.typography.label,\n transition: \"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms\",\n backgroundColor: theme.colors.atmo1,\n borderBottom: `1px solid ${theme.colors.atmo4}`,\n\n \"*:first-of-type > &\": {\n height: \"var(--first-row-cell-height)\",\n borderTop: `1px solid ${theme.table.headerBorderTopColor}`,\n },\n\n \"&$variantList\": {\n backgroundColor: \"inherit\",\n borderBottom: 0,\n \"*:first-of-type > &\": {\n borderTop: 0,\n },\n },\n\n \"&$sortable\": {\n verticalAlign: \"initial\",\n paddingTop: 0,\n paddingLeft: 0,\n cursor: \"pointer\",\n\n \"&:hover\": {\n backgroundColor: theme.table.headerHoverColor,\n\n \"& $sortIcon\": {\n visibility: \"visible\",\n },\n },\n \"&:focus-within\": {\n backgroundColor: theme.table.headerHoverColor,\n\n \"& $sortIcon\": {\n visibility: \"visible\",\n },\n },\n },\n },\n body: {\n backgroundColor: \"inherit\",\n ...theme.typography.body,\n \"&$sortable:not($variantNone)\": {\n paddingLeft: 32,\n },\n },\n footer: {},\n stickyColumn: {\n position: \"sticky\",\n zIndex: 2,\n\n \"&$groupColumnMostRight+$stickyColumn\": {\n borderLeft: 0,\n },\n },\n stickyColumnMostLeft: { borderRight: `solid 1px ${theme.colors.atmo4}` },\n stickyColumnLeastRight: { borderLeft: `solid 1px ${theme.colors.atmo4}` },\n groupColumnMostLeft: { borderLeft: `solid 1px ${theme.colors.atmo4}` },\n groupColumnMostRight: {\n borderRight: `solid 1px ${theme.colors.atmo4}`,\n // due to the \":has()\" selector not being supported in browsers,\n // this need to be managed with inline styles\n // To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)\n // \"&:last-child,&:has(+ $stickyColumnLeastRight)\": {\n \"&:last-child\": {\n borderRight: 0,\n },\n \"&+:not($stickyColumn)\": {\n borderLeft: 0,\n },\n },\n headerContent: { display: \"flex\", alignItems: \"flex-start\", width: \"100%\" },\n headerText: { overflow: \"hidden\", textOverflow: \"ellipsis\" },\n headerParagraph: { overflow: \"hidden\", display: \"-webkit-box\" },\n sortableHeaderText: { paddingTop: \"8px\" },\n sorted: {\n \"& $sortIcon\": {\n visibility: \"visible\",\n },\n },\n sortable: {},\n sortButton: {\n \"$root$sortable &\": {\n boxShadow: \"none\",\n backgroundColor: \"transparent\",\n \"&:hover\": {\n backgroundColor: theme.table.sortButtonHoverColor,\n },\n },\n },\n sortIcon: { display: \"inline-flex\", visibility: \"hidden\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\", flexDirection: \"row-reverse\" },\n alignCenter: { textAlign: \"center\" },\n alignJustify: { textAlign: \"justify\" },\n alignFlexLeft: { justifyContent: \"flex-start\" },\n alignFlexRight: { justifyContent: \"flex-end\" },\n alignFlexCenter: { justifyContent: \"center\" },\n alignFlexJustify: { textAlign: \"justify\" },\n variantCheckbox: {\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderRight: `solid 1px ${theme.colors.atmo4}`,\n },\n variantExpand: {},\n variantActions: {\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderLeft: `solid 1px ${theme.colors.atmo4}`,\n },\n variantNone: { padding: 0 },\n variantList: {\n backgroundColor: \"inherit\",\n borderBottom: 0,\n height: 16,\n \":first-of-type > &\": {\n borderTop: 0,\n height: 16,\n },\n },\n resizable: { borderRight: `solid 1px ${theme.colors.atmo4}` },\n resizing: { borderRight: `solid 2px ${theme.colors.secondary}` },\n resizer: {\n display: \"inline-block\",\n width: 10,\n height: \"100%\",\n position: \"absolute\",\n right: 0,\n top: 0,\n transform: \"translateX(50%)\",\n zIndex: 1,\n touchAction: \"none\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","height","verticalAlign","textAlign","padding","theme","spacing","borderBottom","colors","atmo4","head","paddingTop","typography","label","transition","backgroundColor","atmo1","borderTop","table","headerBorderTopColor","paddingLeft","cursor","headerHoverColor","visibility","body","footer","stickyColumn","position","zIndex","borderLeft","stickyColumnMostLeft","borderRight","stickyColumnLeastRight","groupColumnMostLeft","groupColumnMostRight","headerContent","display","alignItems","width","headerText","overflow","textOverflow","headerParagraph","sortableHeaderText","sorted","sortable","sortButton","boxShadow","sortButtonHoverColor","sortIcon","alignLeft","alignRight","flexDirection","alignCenter","alignJustify","alignFlexLeft","justifyContent","alignFlexRight","alignFlexCenter","alignFlexJustify","variantCheckbox","maxWidth","variantExpand","variantActions","variantNone","variantList","resizable","resizing","secondary","resizer","right","top","transform","touchAction"],"mappings":";;;;AAIa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,iBAAiB;AAAA,EAC1EC,MAAM;AAAA,IACJ,2BAA2B;AAAA,IAC3B,iBAAiB;AAAA,IACjBC,QAAQ;AAAA,IACRC,eAAe;AAAA,IACfC,WAAW;AAAA,IACXC,SAASC,YAAMC,MAAAA,QAAQ,GAAG,GAAG,GAAG,CAAC;AAAA,IACjCC,cAAe,aAAYF,YAAMG,MAAAA,OAAOC,KAAM;AAAA,EAChD;AAAA,EACAC,MAAM;AAAA,IACJC,YAAY;AAAA,IACZT,eAAe;AAAA,IACf,GAAGG,YAAAA,MAAMO,WAAWC;AAAAA,IACpBC,YAAY;AAAA,IACZC,iBAAiBV,YAAAA,MAAMG,OAAOQ;AAAAA,IAC9BT,cAAe,aAAYF,YAAMG,MAAAA,OAAOC,KAAM;AAAA,IAE9C,uBAAuB;AAAA,MACrBR,QAAQ;AAAA,MACRgB,WAAY,aAAYZ,YAAMa,MAAAA,MAAMC,oBAAqB;AAAA,IAC3D;AAAA,IAEA,iBAAiB;AAAA,MACfJ,iBAAiB;AAAA,MACjBR,cAAc;AAAA,MACd,uBAAuB;AAAA,QACrBU,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IAEA,cAAc;AAAA,MACZf,eAAe;AAAA,MACfS,YAAY;AAAA,MACZS,aAAa;AAAA,MACbC,QAAQ;AAAA,MAER,WAAW;AAAA,QACTN,iBAAiBV,YAAAA,MAAMa,MAAMI;AAAAA,QAE7B,eAAe;AAAA,UACbC,YAAY;AAAA,QACd;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QAAQ;AAAA,IACR,sBAAsB;AAAA,MACpBgB,WAAW;AAAA,MACXhB,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACAiE,WAAW;AAAA,IAAEnC,aAAc,aAAY1B,YAAMG,MAAAA,OAAOC,KAAM;AAAA,EAAE;AAAA,EAC5D0D,UAAU;AAAA,IAAEpC,aAAc,aAAY1B,YAAMG,MAAAA,OAAO4D,SAAU;AAAA,EAAE;AAAA,EAC/DC,SAAS;AAAA,IACPjC,SAAS;AAAA,IACTE,OAAO;AAAA,IACPrC,QAAQ;AAAA,IACR0B,UAAU;AAAA,IACV2C,OAAO;AAAA,IACPC,KAAK;AAAA,IACLC,WAAW;AAAA,IACX5C,QAAQ;AAAA,IACR6C,aAAa;AAAA,EACf;AACF,CAAC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHeaderGroups.cjs","sources":["../../../../../src/components/Table/hooks/useHeaderGroups.ts"],"sourcesContent":["import { Hooks } from \"react-table\";\nimport { CSSProperties } from \"react\";\n\n// #region ##### TYPES #####\n\nexport interface UseHvHeaderGroupsInstance {\n hasGroupedColumns?: boolean;\n}\n\n// props target: <table><thead><tr><th>\nexport interface UseHvHeaderGroupsColumnProps {\n style?: CSSProperties;\n groupColumnMostLeft?: boolean;\n groupColumnMostRight?: boolean;\n}\n\n// props target: <table><tbody><tr><td>\nexport interface UseHvHeaderGroupsCellProps {\n groupColumnMostLeft?: boolean;\n groupColumnMostRight?: boolean;\n}\n\nexport type UseHvHeaderGroupsProps = (<\n D extends object = Record<string, unknown>\n>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\n/**\n * Moving non grouped headers to the top level,\n * by placing them in the position of their top level placeholder.\n *\n * By default the header groups are built bottom top,\n * that results in non grouped headers to be placed\n * at the bottom row in the table head.\n *\n * @param {Array.<Object>} headerGroups - table header groups\n */\nconst replaceHeaderPlaceholders = (headerGroups) => {\n const [headerGroup] = headerGroups;\n\n const hasPlaceholderHeaders = headerGroup.headers.some(\n (h) => h.placeholderOf != null\n );\n if (!hasPlaceholderHeaders) {\n return; // no placeholder header found to replace\n }\n\n const maxDepth = headerGroups.length - 1;\n const leafGroup = headerGroups[maxDepth];\n\n headerGroup.headers.forEach((header, position) => {\n const { placeholderOf } = header;\n\n const isPlaceholderHeader = placeholderOf != null;\n if (isPlaceholderHeader) {\n // is placeholder header\n const leafIndex =\n leafGroup.headers\n .slice(position)\n .findIndex(({ id }) => id === placeholderOf.id) + position;\n\n // store leaf placeholder header\n header.variant = placeholderOf.variant;\n header.depth = maxDepth;\n leafGroup.headers[leafIndex] = header;\n\n // replace placeholder with leaf header\n placeholderOf.rowSpan = maxDepth + 1;\n headerGroup.headers[position] = placeholderOf;\n }\n });\n};\n\nconst getCellProps = (column, isHeaderCell = false) => ({\n groupColumnMostLeft: column.isGroupLeftColumn,\n groupColumnMostRight: column.isGroupRightColumn,\n rowSpan: isHeaderCell && column.rowSpan != null ? column.rowSpan : 1,\n});\n\n// props target: <table><thead><tr><th>\nconst getHeaderPropsHook = (props, { instance, column }) => {\n const nextProps: UseHvHeaderGroupsColumnProps = instance.hasGroupedColumns\n ? getCellProps(column, true)\n : {};\n\n if (instance.hasGroupedColumns) {\n const isPlaceholder = column.placeholderOf != null;\n\n nextProps.style = {\n display: isPlaceholder ? \"none\" : props.style?.display,\n };\n\n if (instance.hasStickyColumns) {\n if (isPlaceholder) {\n nextProps.style.visibility = \"hidden\";\n }\n\n if (column.rowSpan > 1) {\n // rowSpan doesn't work with flex, so we need to simulate it by adjusting the height value manually\n nextProps.style.height = `calc(var(--first-row-cell-height) + var(--cell-height) * ${\n column.rowSpan - 1\n })`;\n }\n }\n }\n\n return [props, nextProps];\n};\n\n// props target: <table><tbody><tr><td>\nconst getCellPropsHook = (props, { instance, cell }) => {\n const nextProps: UseHvHeaderGroupsCellProps = instance.hasGroupedColumns\n ? getCellProps(cell.column)\n : {};\n\n return [props, nextProps];\n};\n\nconst visibleColumnsHook = (visibleColumns, { instance }) => {\n const parentList = new Set();\n\n visibleColumns.forEach(({ parent }) => {\n if (parent != null && !parentList.has(parent)) {\n parentList.add(parent);\n }\n });\n\n const hasGroupedColumns = parentList.size > 0;\n if (hasGroupedColumns) {\n parentList.forEach((parent: any) => {\n parent.align = \"center\";\n parent.isGroupLeftColumn = true;\n parent.isGroupRightColumn = true;\n\n const { columns } = parent;\n columns[0].isGroupLeftColumn = true;\n columns[columns.length - 1].isGroupRightColumn = true;\n });\n }\n\n Object.assign(instance, { hasGroupedColumns });\n\n return visibleColumns;\n};\n\nconst useInstanceHook = (instance) => {\n if (instance.hasGroupedColumns) {\n replaceHeaderPlaceholders(instance.headerGroups);\n }\n};\n\nconst useHeaderGroups: UseHvHeaderGroupsProps = (hooks) => {\n hooks.visibleColumns.push(visibleColumnsHook);\n hooks.useInstance.push(useInstanceHook);\n\n // props target: <table><thead><tr><th>\n hooks.getHeaderProps.push(getHeaderPropsHook);\n // props target: <table><tbody><tr><td>\n hooks.getCellProps.push(getCellPropsHook);\n};\n\nuseHeaderGroups.pluginName = \"useHvHeaderGroups\";\n\nexport default useHeaderGroups;\n"],"names":["replaceHeaderPlaceholders","headerGroups","headerGroup","hasPlaceholderHeaders","headers","some","h","placeholderOf","maxDepth","length","leafGroup","forEach","header","position","isPlaceholderHeader","leafIndex","slice","findIndex","id","variant","depth","rowSpan","getCellProps","column","isHeaderCell","groupColumnMostLeft","isGroupLeftColumn","groupColumnMostRight","isGroupRightColumn","getHeaderPropsHook","props","instance","nextProps","hasGroupedColumns","isPlaceholder","style","display","hasStickyColumns","visibility","height","getCellPropsHook","cell","visibleColumnsHook","visibleColumns","parentList","Set","parent","has","add","size","align","columns","Object","assign","useInstanceHook","useHeaderGroups","hooks","push","useInstance","getHeaderProps","pluginName"],"mappings":";;AAwCA,MAAMA,4BAA6BC,CAAiB,iBAAA;AAC5C,QAAA,CAACC,WAAW,IAAID;AAEtB,QAAME,wBAAwBD,YAAYE,QAAQC,KA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AOF,UAAU,GAAG;AAEtBW,kBAAUG,MAAMI,SAAU,4DACxBhB,OAAOF,UAAU;AAAA,
|
|
1
|
+
{"version":3,"file":"useHeaderGroups.cjs","sources":["../../../../../src/components/Table/hooks/useHeaderGroups.ts"],"sourcesContent":["import { Hooks } from \"react-table\";\nimport { CSSProperties } from \"react\";\n\n// #region ##### TYPES #####\n\nexport interface UseHvHeaderGroupsInstance {\n hasGroupedColumns?: boolean;\n}\n\n// props target: <table><thead><tr><th>\nexport interface UseHvHeaderGroupsColumnProps {\n style?: CSSProperties;\n groupColumnMostLeft?: boolean;\n groupColumnMostRight?: boolean;\n}\n\n// props target: <table><tbody><tr><td>\nexport interface UseHvHeaderGroupsCellProps {\n groupColumnMostLeft?: boolean;\n groupColumnMostRight?: boolean;\n}\n\nexport type UseHvHeaderGroupsProps = (<\n D extends object = Record<string, unknown>\n>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\n/**\n * Moving non grouped headers to the top level,\n * by placing them in the position of their top level placeholder.\n *\n * By default the header groups are built bottom top,\n * that results in non grouped headers to be placed\n * at the bottom row in the table head.\n *\n * @param {Array.<Object>} headerGroups - table header groups\n */\nconst replaceHeaderPlaceholders = (headerGroups) => {\n const [headerGroup] = headerGroups;\n\n const hasPlaceholderHeaders = headerGroup.headers.some(\n (h) => h.placeholderOf != null\n );\n if (!hasPlaceholderHeaders) {\n return; // no placeholder header found to replace\n }\n\n const maxDepth = headerGroups.length - 1;\n const leafGroup = headerGroups[maxDepth];\n\n headerGroup.headers.forEach((header, position) => {\n const { placeholderOf } = header;\n\n const isPlaceholderHeader = placeholderOf != null;\n if (isPlaceholderHeader) {\n // is placeholder header\n const leafIndex =\n leafGroup.headers\n .slice(position)\n .findIndex(({ id }) => id === placeholderOf.id) + position;\n\n // store leaf placeholder header\n header.variant = placeholderOf.variant;\n header.depth = maxDepth;\n leafGroup.headers[leafIndex] = header;\n\n // replace placeholder with leaf header\n placeholderOf.rowSpan = maxDepth + 1;\n headerGroup.headers[position] = placeholderOf;\n }\n });\n};\n\nconst getCellProps = (column, isHeaderCell = false) => ({\n groupColumnMostLeft: column.isGroupLeftColumn,\n groupColumnMostRight: column.isGroupRightColumn,\n rowSpan: isHeaderCell && column.rowSpan != null ? column.rowSpan : 1,\n});\n\n// props target: <table><thead><tr><th>\nconst getHeaderPropsHook = (props, { instance, column }) => {\n const nextProps: UseHvHeaderGroupsColumnProps = instance.hasGroupedColumns\n ? getCellProps(column, true)\n : {};\n\n if (instance.hasGroupedColumns) {\n const isPlaceholder = column.placeholderOf != null;\n\n nextProps.style = {\n display: isPlaceholder ? \"none\" : props.style?.display,\n };\n\n if (instance.hasStickyColumns) {\n if (isPlaceholder) {\n nextProps.style.visibility = \"hidden\";\n }\n\n if (column.rowSpan > 1) {\n // rowSpan doesn't work with flex, so we need to simulate it by adjusting the height value manually\n nextProps.style.height = `calc(var(--first-row-cell-height) + var(--cell-height) * ${\n column.rowSpan - 1\n })`;\n }\n }\n }\n\n return [props, nextProps];\n};\n\n// props target: <table><tbody><tr><td>\nconst getCellPropsHook = (props, { instance, cell }) => {\n const nextProps: UseHvHeaderGroupsCellProps = instance.hasGroupedColumns\n ? getCellProps(cell.column)\n : {};\n\n return [props, nextProps];\n};\n\nconst visibleColumnsHook = (visibleColumns, { instance }) => {\n const parentList = new Set();\n\n visibleColumns.forEach(({ parent }) => {\n if (parent != null && !parentList.has(parent)) {\n parentList.add(parent);\n }\n });\n\n const hasGroupedColumns = parentList.size > 0;\n if (hasGroupedColumns) {\n parentList.forEach((parent: any) => {\n parent.align = \"center\";\n parent.isGroupLeftColumn = true;\n parent.isGroupRightColumn = true;\n\n const { columns } = parent;\n columns[0].isGroupLeftColumn = true;\n columns[columns.length - 1].isGroupRightColumn = true;\n });\n }\n\n Object.assign(instance, { hasGroupedColumns });\n\n return visibleColumns;\n};\n\nconst useInstanceHook = (instance) => {\n if (instance.hasGroupedColumns) {\n replaceHeaderPlaceholders(instance.headerGroups);\n }\n};\n\nconst useHeaderGroups: UseHvHeaderGroupsProps = (hooks) => {\n hooks.visibleColumns.push(visibleColumnsHook);\n hooks.useInstance.push(useInstanceHook);\n\n // props target: <table><thead><tr><th>\n hooks.getHeaderProps.push(getHeaderPropsHook);\n // props target: <table><tbody><tr><td>\n hooks.getCellProps.push(getCellPropsHook);\n};\n\nuseHeaderGroups.pluginName = \"useHvHeaderGroups\";\n\nexport default useHeaderGroups;\n"],"names":["replaceHeaderPlaceholders","headerGroups","headerGroup","hasPlaceholderHeaders","headers","some","h","placeholderOf","maxDepth","length","leafGroup","forEach","header","position","isPlaceholderHeader","leafIndex","slice","findIndex","id","variant","depth","rowSpan","getCellProps","column","isHeaderCell","groupColumnMostLeft","isGroupLeftColumn","groupColumnMostRight","isGroupRightColumn","getHeaderPropsHook","props","instance","nextProps","hasGroupedColumns","isPlaceholder","style","display","hasStickyColumns","visibility","height","getCellPropsHook","cell","visibleColumnsHook","visibleColumns","parentList","Set","parent","has","add","size","align","columns","Object","assign","useInstanceHook","useHeaderGroups","hooks","push","useInstance","getHeaderProps","pluginName"],"mappings":";;AAwCA,MAAMA,4BAA6BC,CAAiB,iBAAA;AAC5C,QAAA,CAACC,WAAW,IAAID;AAEtB,QAAME,wBAAwBD,YAAYE,QAAQC,KAC/CC,CAAMA,MAAAA,EAAEC,iBAAiB,IAC5B;AACA,MAAI,CAACJ,uBAAuB;AAC1B;AAAA,EACF;AAEMK,QAAAA,WAAWP,aAAaQ,SAAS;AACjCC,QAAAA,YAAYT,aAAaO,QAAQ;AAEvCN,cAAYE,QAAQO,QAAQ,CAACC,QAAQC,aAAa;AAC1C,UAAA;AAAA,MAAEN;AAAAA,IAAkBK,IAAAA;AAE1B,UAAME,sBAAsBP,iBAAiB;AAC7C,QAAIO,qBAAqB;AAEvB,YAAMC,YACJL,UAAUN,QACPY,MAAMH,QAAQ,EACdI,UAAU,CAAC;AAAA,QAAEC;AAAAA,MAASA,MAAAA,OAAOX,cAAcW,EAAE,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Q,CAAC;AAAA,IAAEmC;AAAAA,EAAAA,MAAa;AACrC,QAAIA,UAAU,QAAQ,CAACF,WAAWG,IAAID,MAAM,GAAG;AAC7CF,iBAAWI,IAAIF,MAAM;AAAA,IACvB;AAAA,EAAA,CACD;AAEKb,QAAAA,oBAAoBW,WAAWK,OAAO;AAC5C,MAAIhB,mBAAmB;AACVtB,eAAAA,QAAQ,CAACmC,WAAgB;AAClCA,aAAOI,QAAQ;AACfJ,aAAOpB,oBAAoB;AAC3BoB,aAAOlB,qBAAqB;AAEtB,YAAA;AAAA,QAAEuB;AAAAA,MAAYL,IAAAA;AACZ,cAAA,CAAC,EAAEpB,oBAAoB;AAC/ByB,cAAQA,QAAQ1C,SAAS,CAAC,EAAEmB,qBAAqB;AAAA,IAAA,CAClD;AAAA,EACH;AAEAwB,SAAOC,OAAOtB,UAAU;AAAA,IAAEE;AAAAA,EAAAA,CAAmB;AAEtCU,SAAAA;AACT;AAEA,MAAMW,kBAAmBvB,CAAa,aAAA;AACpC,MAAIA,SAASE,mBAAmB;AAC9BjC,8BAA0B+B,SAAS9B,YAAY;AAAA,EACjD;AACF;AAEA,MAAMsD,kBAA2CC,CAAU,UAAA;AACnDb,QAAAA,eAAec,KAAKf,kBAAkB;AACtCgB,QAAAA,YAAYD,KAAKH,eAAe;AAGhCK,QAAAA,eAAeF,KAAK5B,kBAAkB;AAEtCP,QAAAA,aAAamC,KAAKjB,gBAAgB;AAC1C;AAEAe,gBAAgBK,aAAa;AAE7B,MAAA,oBAAeL;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSticky.cjs","sources":["../../../../../src/components/Table/hooks/useSticky.ts"],"sourcesContent":["import {\n makePropGetter,\n useGetLatest,\n Hooks,\n PropGetter,\n TableCommonProps,\n} from \"react-table\";\nimport { CSSProperties } from \"react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\n// #region ##### TYPES #####\n\nexport interface UseHvTableStickyTableHeadProps extends TableCommonProps {\n stickyHeader?: boolean;\n}\n\nexport type HvTableHeadPropGetter<D extends object> = PropGetter<\n D,\n UseHvTableStickyTableHeadProps\n>;\n\nexport type UseHvTableStickyTableOptions = {\n stickyHeader?: boolean;\n stickyColumns?: boolean;\n};\n\nexport interface UseHvTableStickyHooks<D extends object> {\n getTableHeadProps: Array<HvTableHeadPropGetter<D>>;\n}\n\nexport interface UseHvTableStickyTableInstance<D extends object> {\n getTableHeadProps: (\n propGetter?: HvTableHeadPropGetter<D>\n ) => UseHvTableStickyTableHeadProps;\n\n totalRight?: number;\n hasStickyColumns?: boolean;\n}\n\n// props target: <table>\nexport interface UseHvTableStickyTableProps {\n stickyHeader?: boolean;\n stickyColumns?: boolean;\n}\n\n// props target: <table><thead><tr><th>\nexport interface UseHvTableStickyColumnProps {\n stickyColumn?: boolean;\n stickyColumnMostLeft?: boolean;\n stickyColumnLeastRight?: boolean;\n}\n\n// props target: <table><tbody><tr><td>\nexport interface UseHvTableStickyCellProps {\n stickyColumn?: boolean;\n stickyColumnMostLeft?: boolean;\n stickyColumnLeastRight?: boolean;\n}\n\nexport type UseHvTableSticky = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst isSticky = (value) => /left|right/i.test(value);\n\nconst getStickyValue = ({ sticky, parent }) => {\n if (isSticky(sticky)) {\n return sticky;\n }\n\n if (parent != null) {\n // check if parent is sticky\n sticky = getStickyValue(parent);\n if (isSticky(sticky)) {\n return sticky;\n }\n\n const { columns } = parent;\n // check if any column in the same group is sticky\n if (columns?.length > 0) {\n sticky = columns?.find((col) => col.sticky != null)?.sticky;\n if (isSticky(sticky)) {\n return sticky;\n }\n }\n }\n\n return undefined;\n};\n\nconst updateColumnAndParent = (column, props) => {\n Object.assign(column, props);\n\n if (column.parent != null) {\n updateColumnAndParent(column.parent, props);\n }\n};\n\nconst visibleColumnsHook = (columns, { instance }) => {\n const toTheLeft: any[] = [];\n const toTheRight: any[] = [];\n const others: any[] = [];\n\n columns.forEach((column) => {\n const sticky = getStickyValue(column)?.toLowerCase();\n\n updateColumnAndParent(column, { sticky });\n\n if (sticky === \"left\") {\n toTheLeft.push(column);\n } else if (sticky === \"right\") {\n toTheRight.push(column);\n } else {\n others.push(column);\n }\n });\n\n if (others.length > 0) {\n const [firstNotSticky] = others;\n updateColumnAndParent(firstNotSticky, { isFirstNotSticky: true });\n\n const lastNotSticky = others[others.length - 1];\n updateColumnAndParent(lastNotSticky, { isLastNotSticky: true });\n }\n\n const hasLeftSticky = toTheLeft.length > 0;\n if (hasLeftSticky) {\n const lastLeftSticky = toTheLeft[toTheLeft.length - 1];\n\n updateColumnAndParent(lastLeftSticky, { isLastLeftSticky: true });\n }\n\n const hasRightSticky = toTheRight.length > 0;\n if (hasRightSticky) {\n const [firstRightSticky] = toTheRight;\n\n updateColumnAndParent(firstRightSticky, { isFirstRightSticky: true });\n }\n\n instance.hasStickyColumns = hasLeftSticky || hasRightSticky;\n\n return [...toTheLeft, ...others, ...toTheRight];\n};\n\nconst calculateHeaderWidthsToTheRight = (headers, right = 0) => {\n if (!headers?.length) {\n return;\n }\n\n for (let i = headers.length - 1; i !== -1; i -= 1) {\n const header = headers[i];\n\n header.totalRight = right;\n\n const { headers: subHeaders } = header;\n if (subHeaders?.length > 0) {\n calculateHeaderWidthsToTheRight(subHeaders, right);\n }\n\n if (header.isVisible) {\n right += header.totalWidth;\n }\n }\n};\n\nconst useInstanceHook = (instance) => {\n calculateHeaderWidthsToTheRight(instance.headers);\n\n const getInstance = useGetLatest(instance);\n instance.getTableHeadProps = makePropGetter(\n instance.getHooks().getTableHeadProps,\n {\n instance: getInstance(),\n }\n );\n};\n\nconst getRowProps = () => ({\n style: {\n display: \"flex\",\n flex: \"1 0 auto\",\n },\n});\n\nconst getCellProps = (header, isHeaderCell: boolean) => {\n const props: UseHvTableStickyCellProps & { style: CSSProperties } = {\n style: {\n display: \"inline-flex\",\n flex: `${header.totalWidth} ${header.totalMinWidth} auto`,\n alignItems: isHeaderCell ? \"start\" : \"center\",\n justifyContent: header.align,\n\n width: `${header.totalWidth}px`,\n minWidth: `${header.totalMinWidth}px`,\n ...(isHeaderCell && { backgroundColor: theme.colors.atmo2 }),\n },\n };\n\n if (header.sticky != null) {\n props.stickyColumn = true;\n\n const margin =\n header.sticky === \"left\" ? header.totalLeft : header.totalRight;\n\n props.style[header.sticky] = `${margin}px`;\n\n if (header.isLastLeftSticky) {\n props.stickyColumnMostLeft = true;\n }\n\n if (header.isFirstRightSticky) {\n props.stickyColumnLeastRight = true;\n }\n } else {\n if (header.isFirstNotSticky) {\n props.style.borderLeft = 0;\n }\n\n if (header.isLastNotSticky) {\n props.style.borderRight = 0;\n }\n }\n\n return props;\n};\n\n/*\n * STICKY POSITION MANAGEMENT\n * <thead>: sticky if stickyHeader: true\n * <tr>: never sticky\n * <th>: sticky only if that particular column is sticky (left or right)\n */\n\n/*\n * We need to hide the last non sticky column right border, to avoid issues with double borders.\n *\n * This could be done with css, using the `:has()` selector:\n * - \".not-sticky:has(+ .first-right-sticky)\": { border-right: 0 }\n *\n * Until the `:has()` selector is supported by modern browsers,\n * that at the moment is just a proposal https://developer.mozilla.org/en-US/docs/Web/CSS/:has,\n * we need to override the last not sticky column \"borderRight\" here.\n */\n\n// props target: <table>\nconst getTablePropsHook = (props, { instance }) => {\n const nextProps: UseHvTableStickyTableProps = {\n stickyHeader: instance.stickyHeader,\n stickyColumns: instance.hasStickyColumns,\n };\n\n return [props, nextProps];\n};\n\n// props target: <table><thead>\nexport const getTableHeadPropsHook = (props, { instance }) => {\n const nextProps = {\n stickyHeader: instance.stickyHeader,\n };\n\n return [props, nextProps];\n};\n\n// props target: <table><thead><tr>\nexport const getHeaderGroupPropsHook = (props, { instance }) => {\n const nextProps = instance.hasStickyColumns ? getRowProps() : {};\n\n return [props, nextProps];\n};\n\n// props target: <table><thead><tr><th>\nconst getHeaderPropsHook = (props, { instance, column }) => {\n const nextProps = instance.hasStickyColumns ? getCellProps(column, true) : {};\n\n return [props, nextProps];\n};\n\n// props target: <table><tbody><tr>\nconst getRowPropsHook = (props, { instance }) => {\n const nextProps = instance.hasStickyColumns ? getRowProps() : {};\n\n return [props, nextProps];\n};\n\n// props target: <table><tbody><tr><td>\nconst getCellPropsHook = (props, { instance, cell }) => {\n const nextProps: UseHvTableStickyCellProps = instance.hasStickyColumns\n ? getCellProps(cell.column, false)\n : {};\n\n return [props, nextProps];\n};\n\nconst useSticky: UseHvTableSticky = (hooks) => {\n hooks.visibleColumns.push(visibleColumnsHook);\n hooks.useInstance.push(useInstanceHook);\n\n // props target: <table>\n hooks.getTableProps.push(getTablePropsHook);\n // props target: <table><thead>\n hooks.getTableHeadProps = [getTableHeadPropsHook];\n // props target: <table><thead><tr>\n hooks.getHeaderGroupProps.push(getHeaderGroupPropsHook);\n // props target: <table><thead><tr><th>\n hooks.getHeaderProps.push(getHeaderPropsHook);\n // props target: <table><tbody><tr>\n hooks.getRowProps.push(getRowPropsHook);\n // props target: <table><tbody><tr><td>\n hooks.getCellProps.push(getCellPropsHook);\n};\n\nuseSticky.pluginName = \"useHvTableSticky\";\n\nexport default useSticky;\n"],"names":["isSticky","value","test","getStickyValue","sticky","parent","columns","length","find","col","undefined","updateColumnAndParent","column","props","assign","visibleColumnsHook","instance","toTheLeft","toTheRight","others","forEach","toLowerCase","push","firstNotSticky","isFirstNotSticky","lastNotSticky","isLastNotSticky","hasLeftSticky","lastLeftSticky","isLastLeftSticky","hasRightSticky","firstRightSticky","isFirstRightSticky","hasStickyColumns","calculateHeaderWidthsToTheRight","headers","right","i","header","totalRight","subHeaders","isVisible","totalWidth","useInstanceHook","getInstance","useGetLatest","getTableHeadProps","makePropGetter","getHooks","getRowProps","style","display","flex","getCellProps","isHeaderCell","totalMinWidth","alignItems","justifyContent","align","width","minWidth","backgroundColor","theme","colors","atmo2","stickyColumn","margin","totalLeft","stickyColumnMostLeft","stickyColumnLeastRight","borderLeft","borderRight","getTablePropsHook","nextProps","stickyHeader","stickyColumns","getTableHeadPropsHook","getHeaderGroupPropsHook","getHeaderPropsHook","getRowPropsHook","getCellPropsHook","cell","useSticky","hooks","visibleColumns","useInstance","getTableProps","getHeaderGroupProps","getHeaderProps","pluginName"],"mappings":";;;;AAiEA,MAAMA,WAAYC,CAAAA,UAAU,cAAcC,KAAKD,KAAK;AAEpD,MAAME,iBAAiBA,CAAC;AAAA,EAAEC;AAAAA,EAAQC;AAAO,MAAM;;AACzCL,MAAAA,SAASI,MAAM,GAAG;AACbA,WAAAA;AAAAA,EACT;AAEA,MAAIC,UAAU,MAAM;AAElBD,aAASD,eAAeE,MAAM;AAC1BL,QAAAA,SAASI,MAAM,GAAG;AACbA,aAAAA;AAAAA,IACT;AAEM,UAAA;AAAA,MAAEE;AAAAA,IAAYD,IAAAA;AAEhBC,SAAAA,mCAASC,UAAS,GAAG;AACvBH,gBAASE,wCAASE,KAAMC,CAAAA,QAAQA,IAAIL,UAAU,UAArCE,mBAA4CF;AACjDJ,UAAAA,SAASI,MAAM,GAAG;AACbA,eAAAA;AAAAA,MACT;AAAA,IACF;AAAA,EACF;AAEOM,SAAAA;AACT;AAEA,MAAMC,wBAAwBA,CAACC,QAAQC,UAAU;AACxCC,SAAAA,OAAOF,QAAQC,KAAK;AAEvBD,MAAAA,OAAOP,UAAU,MAAM;AACHO,0BAAAA,OAAOP,QAAQQ,KAAK;AAAA,EAC5C;AACF;AAEA,MAAME,qBAAqBA,CAACT,SAAS;AAAA,EAAEU;AAAS,MAAM;AACpD,QAAMC,YAAmB,CAAA;AACzB,QAAMC,aAAoB,CAAA;AAC1B,QAAMC,SAAgB,CAAA;AAEtBb,UAAQc,QAASR,CAAW,WAAA;;AAC1B,UAAMR,UAASD,oBAAeS,MAAM,MAArBT,mBAAwBkB;AAEvCV,0BAAsBC,QAAQ;AAAA,MAAER;AAAAA,IAAAA,CAAQ;AAExC,QAAIA,WAAW,QAAQ;AACrBa,gBAAUK,KAAKV,MAAM;AAAA,IAAA,WACZR,WAAW,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QAAAA,YAAY/D,KAAKqB,eAAe;AAGhC2C,QAAAA,cAAchE,KAAKkD,iBAAiB;AAEpC1B,QAAAA,oBAAoB,CAAC8B,qBAAqB;AAE1CW,QAAAA,oBAAoBjE,KAAKuD,uBAAuB;AAEhDW,QAAAA,eAAelE,KAAKwD,kBAAkB;AAEtC7B,QAAAA,YAAY3B,KAAKyD,eAAe;AAEhC1B,QAAAA,aAAa/B,KAAK0D,gBAAgB;AAC1C;AAEAE,UAAUO,aAAa;AAEvB,MAAA,cAAeP;;;;"}
|
|
1
|
+
{"version":3,"file":"useSticky.cjs","sources":["../../../../../src/components/Table/hooks/useSticky.ts"],"sourcesContent":["import {\n makePropGetter,\n useGetLatest,\n Hooks,\n PropGetter,\n TableCommonProps,\n} from \"react-table\";\nimport { CSSProperties } from \"react\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\n// #region ##### TYPES #####\n\nexport interface UseHvTableStickyTableHeadProps extends TableCommonProps {\n stickyHeader?: boolean;\n}\n\nexport type HvTableHeadPropGetter<D extends object> = PropGetter<\n D,\n UseHvTableStickyTableHeadProps\n>;\n\nexport type UseHvTableStickyTableOptions = {\n stickyHeader?: boolean;\n stickyColumns?: boolean;\n};\n\nexport interface UseHvTableStickyHooks<D extends object> {\n getTableHeadProps: Array<HvTableHeadPropGetter<D>>;\n}\n\nexport interface UseHvTableStickyTableInstance<D extends object> {\n getTableHeadProps: (\n propGetter?: HvTableHeadPropGetter<D>\n ) => UseHvTableStickyTableHeadProps;\n\n totalRight?: number;\n hasStickyColumns?: boolean;\n}\n\n// props target: <table>\nexport interface UseHvTableStickyTableProps {\n stickyHeader?: boolean;\n stickyColumns?: boolean;\n}\n\n// props target: <table><thead><tr><th>\nexport interface UseHvTableStickyColumnProps {\n stickyColumn?: boolean;\n stickyColumnMostLeft?: boolean;\n stickyColumnLeastRight?: boolean;\n}\n\n// props target: <table><tbody><tr><td>\nexport interface UseHvTableStickyCellProps {\n stickyColumn?: boolean;\n stickyColumnMostLeft?: boolean;\n stickyColumnLeastRight?: boolean;\n}\n\nexport type UseHvTableSticky = (<D extends object = Record<string, unknown>>(\n hooks: Hooks<D>\n) => void) & { pluginName: string };\n\n// #endregion ##### TYPES #####\n\nconst isSticky = (value) => /left|right/i.test(value);\n\nconst getStickyValue = ({ sticky, parent }) => {\n if (isSticky(sticky)) {\n return sticky;\n }\n\n if (parent != null) {\n // check if parent is sticky\n sticky = getStickyValue(parent);\n if (isSticky(sticky)) {\n return sticky;\n }\n\n const { columns } = parent;\n // check if any column in the same group is sticky\n if (columns?.length > 0) {\n sticky = columns?.find((col) => col.sticky != null)?.sticky;\n if (isSticky(sticky)) {\n return sticky;\n }\n }\n }\n\n return undefined;\n};\n\nconst updateColumnAndParent = (column, props) => {\n Object.assign(column, props);\n\n if (column.parent != null) {\n updateColumnAndParent(column.parent, props);\n }\n};\n\nconst visibleColumnsHook = (columns, { instance }) => {\n const toTheLeft: any[] = [];\n const toTheRight: any[] = [];\n const others: any[] = [];\n\n columns.forEach((column) => {\n const sticky = getStickyValue(column)?.toLowerCase();\n\n updateColumnAndParent(column, { sticky });\n\n if (sticky === \"left\") {\n toTheLeft.push(column);\n } else if (sticky === \"right\") {\n toTheRight.push(column);\n } else {\n others.push(column);\n }\n });\n\n if (others.length > 0) {\n const [firstNotSticky] = others;\n updateColumnAndParent(firstNotSticky, { isFirstNotSticky: true });\n\n const lastNotSticky = others[others.length - 1];\n updateColumnAndParent(lastNotSticky, { isLastNotSticky: true });\n }\n\n const hasLeftSticky = toTheLeft.length > 0;\n if (hasLeftSticky) {\n const lastLeftSticky = toTheLeft[toTheLeft.length - 1];\n\n updateColumnAndParent(lastLeftSticky, { isLastLeftSticky: true });\n }\n\n const hasRightSticky = toTheRight.length > 0;\n if (hasRightSticky) {\n const [firstRightSticky] = toTheRight;\n\n updateColumnAndParent(firstRightSticky, { isFirstRightSticky: true });\n }\n\n instance.hasStickyColumns = hasLeftSticky || hasRightSticky;\n\n return [...toTheLeft, ...others, ...toTheRight];\n};\n\nconst calculateHeaderWidthsToTheRight = (headers, right = 0) => {\n if (!headers?.length) {\n return;\n }\n\n for (let i = headers.length - 1; i !== -1; i -= 1) {\n const header = headers[i];\n\n header.totalRight = right;\n\n const { headers: subHeaders } = header;\n if (subHeaders?.length > 0) {\n calculateHeaderWidthsToTheRight(subHeaders, right);\n }\n\n if (header.isVisible) {\n right += header.totalWidth;\n }\n }\n};\n\nconst useInstanceHook = (instance) => {\n calculateHeaderWidthsToTheRight(instance.headers);\n\n const getInstance = useGetLatest(instance);\n instance.getTableHeadProps = makePropGetter(\n instance.getHooks().getTableHeadProps,\n {\n instance: getInstance(),\n }\n );\n};\n\nconst getRowProps = () => ({\n style: {\n display: \"flex\",\n flex: \"1 0 auto\",\n },\n});\n\nconst getCellProps = (header, isHeaderCell: boolean) => {\n const props: UseHvTableStickyCellProps & { style: CSSProperties } = {\n style: {\n display: \"inline-flex\",\n flex: `${header.totalWidth} ${header.totalMinWidth} auto`,\n alignItems: isHeaderCell ? \"start\" : \"center\",\n justifyContent: header.align,\n\n width: `${header.totalWidth}px`,\n minWidth: `${header.totalMinWidth}px`,\n ...(isHeaderCell && { backgroundColor: theme.colors.atmo2 }),\n },\n };\n\n if (header.sticky != null) {\n props.stickyColumn = true;\n\n const margin =\n header.sticky === \"left\" ? header.totalLeft : header.totalRight;\n\n props.style[header.sticky] = `${margin}px`;\n\n if (header.isLastLeftSticky) {\n props.stickyColumnMostLeft = true;\n }\n\n if (header.isFirstRightSticky) {\n props.stickyColumnLeastRight = true;\n }\n } else {\n if (header.isFirstNotSticky) {\n props.style.borderLeft = 0;\n }\n\n if (header.isLastNotSticky) {\n props.style.borderRight = 0;\n }\n }\n\n return props;\n};\n\n/*\n * STICKY POSITION MANAGEMENT\n * <thead>: sticky if stickyHeader: true\n * <tr>: never sticky\n * <th>: sticky only if that particular column is sticky (left or right)\n */\n\n/*\n * We need to hide the last non sticky column right border, to avoid issues with double borders.\n *\n * This could be done with css, using the `:has()` selector:\n * - \".not-sticky:has(+ .first-right-sticky)\": { border-right: 0 }\n *\n * Until the `:has()` selector is supported by modern browsers,\n * that at the moment is just a proposal https://developer.mozilla.org/en-US/docs/Web/CSS/:has,\n * we need to override the last not sticky column \"borderRight\" here.\n */\n\n// props target: <table>\nconst getTablePropsHook = (props, { instance }) => {\n const nextProps: UseHvTableStickyTableProps = {\n stickyHeader: instance.stickyHeader,\n stickyColumns: instance.hasStickyColumns,\n };\n\n return [props, nextProps];\n};\n\n// props target: <table><thead>\nexport const getTableHeadPropsHook = (props, { instance }) => {\n const nextProps = {\n stickyHeader: instance.stickyHeader,\n };\n\n return [props, nextProps];\n};\n\n// props target: <table><thead><tr>\nexport const getHeaderGroupPropsHook = (props, { instance }) => {\n const nextProps = instance.hasStickyColumns ? getRowProps() : {};\n\n return [props, nextProps];\n};\n\n// props target: <table><thead><tr><th>\nconst getHeaderPropsHook = (props, { instance, column }) => {\n const nextProps = instance.hasStickyColumns ? getCellProps(column, true) : {};\n\n return [props, nextProps];\n};\n\n// props target: <table><tbody><tr>\nconst getRowPropsHook = (props, { instance }) => {\n const nextProps = instance.hasStickyColumns ? getRowProps() : {};\n\n return [props, nextProps];\n};\n\n// props target: <table><tbody><tr><td>\nconst getCellPropsHook = (props, { instance, cell }) => {\n const nextProps: UseHvTableStickyCellProps = instance.hasStickyColumns\n ? getCellProps(cell.column, false)\n : {};\n\n return [props, nextProps];\n};\n\nconst useSticky: UseHvTableSticky = (hooks) => {\n hooks.visibleColumns.push(visibleColumnsHook);\n hooks.useInstance.push(useInstanceHook);\n\n // props target: <table>\n hooks.getTableProps.push(getTablePropsHook);\n // props target: <table><thead>\n hooks.getTableHeadProps = [getTableHeadPropsHook];\n // props target: <table><thead><tr>\n hooks.getHeaderGroupProps.push(getHeaderGroupPropsHook);\n // props target: <table><thead><tr><th>\n hooks.getHeaderProps.push(getHeaderPropsHook);\n // props target: <table><tbody><tr>\n hooks.getRowProps.push(getRowPropsHook);\n // props target: <table><tbody><tr><td>\n hooks.getCellProps.push(getCellPropsHook);\n};\n\nuseSticky.pluginName = \"useHvTableSticky\";\n\nexport default useSticky;\n"],"names":["isSticky","value","test","getStickyValue","sticky","parent","columns","length","find","col","undefined","updateColumnAndParent","column","props","assign","visibleColumnsHook","instance","toTheLeft","toTheRight","others","forEach","toLowerCase","push","firstNotSticky","isFirstNotSticky","lastNotSticky","isLastNotSticky","hasLeftSticky","lastLeftSticky","isLastLeftSticky","hasRightSticky","firstRightSticky","isFirstRightSticky","hasStickyColumns","calculateHeaderWidthsToTheRight","headers","right","i","header","totalRight","subHeaders","isVisible","totalWidth","useInstanceHook","getInstance","useGetLatest","getTableHeadProps","makePropGetter","getHooks","getRowProps","style","display","flex","getCellProps","isHeaderCell","totalMinWidth","alignItems","justifyContent","align","width","minWidth","backgroundColor","theme","colors","atmo2","stickyColumn","margin","totalLeft","stickyColumnMostLeft","stickyColumnLeastRight","borderLeft","borderRight","getTablePropsHook","nextProps","stickyHeader","stickyColumns","getTableHeadPropsHook","getHeaderGroupPropsHook","getHeaderPropsHook","getRowPropsHook","getCellPropsHook","cell","useSticky","hooks","visibleColumns","useInstance","getTableProps","getHeaderGroupProps","getHeaderProps","pluginName"],"mappings":";;;;AAiEA,MAAMA,WAAYC,CAAAA,UAAU,cAAcC,KAAKD,KAAK;AAEpD,MAAME,iBAAiBA,CAAC;AAAA,EAAEC;AAAAA,EAAQC;AAAO,MAAM;;AACzCL,MAAAA,SAASI,MAAM,GAAG;AACbA,WAAAA;AAAAA,EACT;AAEA,MAAIC,UAAU,MAAM;AAElBD,aAASD,eAAeE,MAAM;AAC1BL,QAAAA,SAASI,MAAM,GAAG;AACbA,aAAAA;AAAAA,IACT;AAEM,UAAA;AAAA,MAAEE;AAAAA,IAAYD,IAAAA;AAEhBC,SAAAA,mCAASC,UAAS,GAAG;AACvBH,gBAASE,wCAASE,KAAMC,CAAAA,QAAQA,IAAIL,UAAU,UAArCE,mBAA4CF;AACjDJ,UAAAA,SAASI,MAAM,GAAG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AGA,MAAMK,qBAAqBA,CAACjE,OAAO;AAAA,EAAEG;AAAAA,EAAUJ;AAAO,MAAM;AAC1D,QAAM6D,YAAYzD,SAASiB,mBAAmBoB,aAAazC,QAAQ,IAAI,IAAI;AAEpE,SAAA,CAACC,OAAO4D,SAAS;AAC1B;AAGA,MAAMM,kBAAkBA,CAAClE,OAAO;AAAA,EAAEG;AAAS,MAAM;AAC/C,QAAMyD,YAAYzD,SAASiB,mBAAmBgB,YAAAA,IAAgB,CAAA;AAEvD,SAAA,CAACpC,OAAO4D,SAAS;AAC1B;AAGA,MAAMO,mBAAmBA,CAACnE,OAAO;AAAA,EAAEG;AAAAA,EAAUiE;AAAK,MAAM;AAChDR,QAAAA,YAAuCzD,SAASiB,mBAClDoB,aAAa4B,KAAKrE,QAAQ,KAAK,IAC/B;AAEG,SAAA,CAACC,OAAO4D,SAAS;AAC1B;AAEA,MAAMS,YAA+BC,CAAU,UAAA;AACvCC,QAAAA,eAAe9D,KAAKP,kBAAkB;AACtCsE,QAAAA,YAAY/D,KAAKqB,eAAe;AAGhC2C,QAAAA,cAAchE,KAAKkD,iBAAiB;AAEpC1B,QAAAA,oBAAoB,CAAC8B,qBAAqB;AAE1CW,QAAAA,oBAAoBjE,KAAKuD,uBAAuB;AAEhDW,QAAAA,eAAelE,KAAKwD,kBAAkB;AAEtC7B,QAAAA,YAAY3B,KAAKyD,eAAe;AAEhC1B,QAAAA,aAAa/B,KAAK0D,gBAAgB;AAC1C;AAEAE,UAAUO,aAAa;AAEvB,MAAA,cAAeP;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../../../src/components/Table/utils/utils.ts"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const getBorderStyles = (\n type: \"row\",\n color = theme.table.rowBorderColor,\n rowBorderRadius = theme.table.rowBorderRadius\n) => {\n return {\n \"& td\": {\n borderTop: `1px solid ${color}`,\n borderBottom: `1px solid ${color}`,\n },\n \"& td:first-of-type\": {\n borderLeft: `1px solid ${color}`,\n borderRadius: `${rowBorderRadius} 0 0 ${rowBorderRadius}`,\n },\n \"& td:last-of-type\": {\n borderRight: `1px solid ${color}`,\n borderRadius: `0 ${rowBorderRadius} ${rowBorderRadius} 0`,\n },\n };\n};\n"],"names":["getBorderStyles","type","color","theme","table","rowBorderColor","rowBorderRadius","borderTop","borderBottom","borderLeft","borderRadius","borderRight"],"mappings":";;;AAEaA,MAAAA,kBAAkBA,CAC7BC,MACAC,QAAQC,kBAAMC,MAAMC,gBACpBC,kBAAkBH,YAAAA,MAAMC,MAAME,oBAC3B;AACI,SAAA;AAAA,IACL,QAAQ;AAAA,MACNC,WAAY,aAAYL;
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../../../src/components/Table/utils/utils.ts"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const getBorderStyles = (\n type: \"row\",\n color = theme.table.rowBorderColor,\n rowBorderRadius = theme.table.rowBorderRadius\n) => {\n return {\n \"& td\": {\n borderTop: `1px solid ${color}`,\n borderBottom: `1px solid ${color}`,\n },\n \"& td:first-of-type\": {\n borderLeft: `1px solid ${color}`,\n borderRadius: `${rowBorderRadius} 0 0 ${rowBorderRadius}`,\n },\n \"& td:last-of-type\": {\n borderRight: `1px solid ${color}`,\n borderRadius: `0 ${rowBorderRadius} ${rowBorderRadius} 0`,\n },\n };\n};\n"],"names":["getBorderStyles","type","color","theme","table","rowBorderColor","rowBorderRadius","borderTop","borderBottom","borderLeft","borderRadius","borderRight"],"mappings":";;;AAEaA,MAAAA,kBAAkBA,CAC7BC,MACAC,QAAQC,kBAAMC,MAAMC,gBACpBC,kBAAkBH,YAAAA,MAAMC,MAAME,oBAC3B;AACI,SAAA;AAAA,IACL,QAAQ;AAAA,MACNC,WAAY,aAAYL,KAAM;AAAA,MAC9BM,cAAe,aAAYN,KAAM;AAAA,IACnC;AAAA,IACA,sBAAsB;AAAA,MACpBO,YAAa,aAAYP,KAAM;AAAA,MAC/BQ,cAAe,GAAEJ,eAAgB,QAAOA,eAAgB;AAAA,IAC1D;AAAA,IACA,qBAAqB;AAAA,MACnBK,aAAc,aAAYT,KAAM;AAAA,MAChCQ,cAAe,KAAIJ,eAAgB,IAAGA,eAAgB;AAAA,IACxD;AAAA,EAAA;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.cjs","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { Tabs, TabsProps as MuiTabsProps } from \"@mui/material\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport {
|
|
1
|
+
{"version":3,"file":"Tabs.cjs","sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { Tabs, TabsProps as MuiTabsProps } from \"@mui/material\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { staticClasses, useClasses } from \"./Tabs.styles\";\n\nexport { staticClasses as tabsClasses };\n\nexport type HvTabsClasses = ExtractNames<typeof useClasses>;\n\n// Mui Tabs props: https://mui.com/material-ui/api/tabs/#props\nexport interface HvTabsProps extends Omit<MuiTabsProps, \"onChange\"> {\n /**\n * The value of the currently selected Tab. If you don't want any selected Tab, you can set this property to `false`.\n */\n value?: any;\n /**\n * Callback fired when the value changes.\n */\n onChange?: (event: React.SyntheticEvent, value: any) => void;\n /**\n * A Jss Object used to override or extend the component styles.\n */\n classes?: HvTabsClasses;\n}\n\n/**\n * A Tab is a graphical control element that allows multiple documents or panels to be contained within a single window.\n * Tabs can be used as a navigational widget for switching between sets of documents.\n */\nexport const HvTabs = (props: HvTabsProps) => {\n const { classes: classesProp, ...others } = useDefaultProps(\"HvTabs\", props);\n\n const { classes } = useClasses(classesProp);\n\n return (\n <Tabs\n classes={{\n root: classes.root,\n flexContainer: classes.flexContainer,\n indicator: classes.indicator,\n scroller: classes.scroller,\n }}\n TabIndicatorProps={{ children: <div /> }}\n {...others}\n />\n );\n};\n"],"names":["HvTabs","props","classes","classesProp","others","useDefaultProps","useClasses","Tabs","root","flexContainer","indicator","scroller","TabIndicatorProps","children","_jsx"],"mappings":";;;;;;AA6BaA,MAAAA,SAASA,CAACC,UAAuB;AACtC,QAAA;AAAA,IAAEC,SAASC;AAAAA,IAAa,GAAGC;AAAAA,EAAAA,IAAWC,gBAAgB,gBAAA,UAAUJ,KAAK;AAErE,QAAA;AAAA,IAAEC;AAAAA,EAAAA,IAAYI,YAAAA,WAAWH,WAAW;AAE1C,wCACGI,SAAAA,MAAI;AAAA,IACHL,SAAS;AAAA,MACPM,MAAMN,QAAQM;AAAAA,MACdC,eAAeP,QAAQO;AAAAA,MACvBC,WAAWR,QAAQQ;AAAAA,MACnBC,UAAUT,QAAQS;AAAAA,IACpB;AAAA,IACAC,mBAAmB;AAAA,MAAEC,UAAUC,2BAAAA,IAAM,OAAA,EAAA;AAAA,IAAE;AAAA,IAAE,GACrCV;AAAAA,EAAAA,CACL;AAEL;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.styles.cjs","sources":["../../../../src/components/Tabs/Tabs.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTabs\", {\n root: {\n minHeight: 0,\n overflow: \"visible\",\n },\n indicator: {\n display: \"flex\",\n justifyContent: \"center\",\n backgroundColor: \"transparent\",\n \"& > div\": {\n width: \"100%\",\n backgroundColor: `${theme.colors.secondary}`,\n },\n height: 2,\n },\n scroller: {\n overflow: \"visible !important\",\n },\n flexContainer: {\n \"& button:first-of-type\": {\n marginLeft: \"3px\",\n },\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","minHeight","overflow","indicator","display","justifyContent","backgroundColor","width","theme","colors","secondary","height","scroller","flexContainer","marginLeft"],"mappings":";;;;AAGa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,UAAU;AAAA,EACnEC,MAAM;AAAA,IACJC,WAAW;AAAA,IACXC,UAAU;AAAA,EACZ;AAAA,EACAC,WAAW;AAAA,IACTC,SAAS;AAAA,IACTC,gBAAgB;AAAA,IAChBC,iBAAiB;AAAA,IACjB,WAAW;AAAA,MACTC,OAAO;AAAA,MACPD,iBAAkB,GAAEE,YAAAA,MAAMC,OAAOC;
|
|
1
|
+
{"version":3,"file":"Tabs.styles.cjs","sources":["../../../../src/components/Tabs/Tabs.styles.tsx"],"sourcesContent":["import { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses } from \"@core/utils/classes\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTabs\", {\n root: {\n minHeight: 0,\n overflow: \"visible\",\n },\n indicator: {\n display: \"flex\",\n justifyContent: \"center\",\n backgroundColor: \"transparent\",\n \"& > div\": {\n width: \"100%\",\n backgroundColor: `${theme.colors.secondary}`,\n },\n height: 2,\n },\n scroller: {\n overflow: \"visible !important\",\n },\n flexContainer: {\n \"& button:first-of-type\": {\n marginLeft: \"3px\",\n },\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","minHeight","overflow","indicator","display","justifyContent","backgroundColor","width","theme","colors","secondary","height","scroller","flexContainer","marginLeft"],"mappings":";;;;AAGa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,UAAU;AAAA,EACnEC,MAAM;AAAA,IACJC,WAAW;AAAA,IACXC,UAAU;AAAA,EACZ;AAAA,EACAC,WAAW;AAAA,IACTC,SAAS;AAAA,IACTC,gBAAgB;AAAA,IAChBC,iBAAiB;AAAA,IACjB,WAAW;AAAA,MACTC,OAAO;AAAA,MACPD,iBAAkB,GAAEE,YAAAA,MAAMC,OAAOC,SAAU;AAAA,IAC7C;AAAA,IACAC,QAAQ;AAAA,EACV;AAAA,EACAC,UAAU;AAAA,IACRV,UAAU;AAAA,EACZ;AAAA,EACAW,eAAe;AAAA,IACb,0BAA0B;AAAA,MACxBC,YAAY;AAAA,IACd;AAAA,EACF;AACF,CAAC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.cjs","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { CSSProperties, useState } from \"react\";\nimport { HvColorAny, theme } from \"@hitachivantara/uikit-styles\";\nimport Chip, { ChipProps as MuiChipProps } from \"@mui/material/Chip\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { CloseXS } from \"@hitachivantara/uikit-react-icons\";\nimport { staticClasses, useClasses } from \"./Tag.styles\";\nimport { getOnDeleteCallback, hasDeleteAction, hasClickAction } from \"./utils\";\n\nexport { staticClasses as tagClasses };\n\nexport type HvTagClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagProps\n extends Omit<MuiChipProps, \"color\" | \"classes\">,\n HvBaseProps<HTMLDivElement, \"children\"> {\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** The label of the tag element. */\n label?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** The type of the tag element. A tag can be of semantic or categoric type. */\n type?: \"semantic\" | \"categorical\";\n /** Background color to be applied to the tag */\n color?: HvColorAny;\n /** Icon used to customize the delete icon in the Chip element */\n deleteIcon?: React.ReactElement;\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component, in order to render the delete icon\n * */\n onDelete?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Callback triggered when any item is clicked. */\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** The role of the element with an attributed event. */\n role?: string;\n /** Aria properties to apply to delete button in tag */\n deleteButtonArialLabel?: string; // TODO: fix typo \"ArialLabel\" in next version\n /** Props to apply to delete button */\n deleteButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagClasses;\n}\n\nconst getColor = (customColor, type, colors) => {\n const defaultSemanticColor = theme.colors.neutral_20;\n const defaultCategoricalColor = colors.cat1;\n\n let backgroundColor;\n\n if (type === \"semantic\") {\n backgroundColor =\n theme.colors[customColor] || customColor || defaultSemanticColor;\n }\n if (type === \"categorical\") {\n backgroundColor =\n colors[customColor] || customColor || defaultCategoricalColor;\n }\n return backgroundColor;\n};\n\n/**\n * A Tag is one word that describes a specific aspect of an asset. A single asset can have\n * multiple tags.\n * Use tags to highlight an item's status for quick recognition and navigation\n * Use color to indicate meanings that users can learn and recognize across products\n *\n * It leverages the Chip component from Material UI\n */\nexport const HvTag = (props: HvTagProps) => {\n const {\n classes: classesProp,\n className,\n style,\n label,\n disabled,\n type = \"semantic\",\n color,\n deleteIcon,\n onDelete,\n onClick,\n role,\n deleteButtonArialLabel = \"Delete tag\",\n deleteButtonProps = {},\n ...others\n } = useDefaultProps(\"HvTag\", props);\n const { colors } = useTheme();\n const { classes, cx, css } = useClasses(classesProp);\n\n const getDeleteIcon = () => {\n const disabledSemanticColor =\n type === \"semantic\" ? \"secondary_60\" : \"base_dark\";\n const { tabIndex = 0 } = deleteButtonProps;\n\n const closeIconStyles = css({\n ...(disabled ? { cursor: \"not-allowed\" } : undefined),\n height: 16,\n \"& svg .color0\": {\n fill: theme.colors[disabled ? disabledSemanticColor : \"base_dark\"],\n },\n });\n return (\n <HvButton\n classes={{\n startIcon: classes.tagButton,\n focusVisible: classes.focusVisible,\n root: classes.button,\n }}\n aria-label={deleteButtonArialLabel}\n tabIndex={tabIndex}\n variant=\"secondaryGhost\"\n {...deleteButtonProps}\n >\n <CloseXS\n iconSize=\"XS\"\n className={closeIconStyles}\n color={disabled ? disabledSemanticColor : \"base_dark\"}\n />\n </HvButton>\n );\n };\n\n const inlineStyle = {\n ...style,\n };\n\n const categoricalBackgroundColor =\n type === \"categorical\" ? getColor(color, type, colors) : undefined;\n\n if (type === \"semantic\") {\n inlineStyle.backgroundColor = getColor(color, type, {});\n } else if (type === \"categorical\") {\n inlineStyle.backgroundColor = `${categoricalBackgroundColor}30`;\n }\n\n const [hover, setHover] = useState(false);\n\n return (\n <Chip\n label={label}\n className={cx(classes.root, className)}\n onMouseEnter={() => {\n setHover(!!onClick);\n }}\n onMouseLeave={() => {\n setHover(false);\n }}\n style={{\n ...(disabled ? null : inlineStyle),\n ...(hover && !disabled\n ? { boxShadow: `0 0 0 1pt ${categoricalBackgroundColor}` }\n : null),\n }}\n classes={{\n root: cx(classes.chipRoot, {\n [classes.disabled]: disabled,\n [classes.clickable]: !!onClick,\n [classes.categorical]: type === \"categorical\",\n [classes.categoricalFocus]: type === \"categorical\" && !disabled,\n [classes.categoricalDisabled]: type === \"categorical\" && disabled,\n }),\n label: classes.label,\n deleteIcon: cx(classes.deleteIcon, {\n [classes.disabledDeleteIcon]: disabled,\n }),\n }}\n deleteIcon={(hasDeleteAction(onDelete) && deleteIcon) || getDeleteIcon()}\n onDelete={getOnDeleteCallback(disabled, onDelete)}\n onClick={disabled ? undefined : onClick}\n role={role || (hasClickAction(onClick) ? \"button\" : undefined)}\n tabIndex={hasDeleteAction(onDelete) ? undefined : 0}\n {...others}\n />\n );\n};\n"],"names":["getColor","customColor","type","colors","defaultSemanticColor","theme","neutral_20","defaultCategoricalColor","cat1","backgroundColor","HvTag","props","classes","classesProp","className","style","label","disabled","color","deleteIcon","onDelete","onClick","role","deleteButtonArialLabel","deleteButtonProps","others","useDefaultProps","useTheme","cx","css","useClasses","getDeleteIcon","disabledSemanticColor","tabIndex","closeIconStyles","cursor","undefined","height","fill","HvButton","startIcon","tagButton","focusVisible","root","button","variant","children","CloseXS","iconSize","inlineStyle","categoricalBackgroundColor","hover","setHover","useState","Chip","onMouseEnter","onMouseLeave","boxShadow","chipRoot","clickable","categorical","categoricalFocus","categoricalDisabled","disabledDeleteIcon","hasDeleteAction","getOnDeleteCallback","hasClick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A,MACP3B,SAAS;AAAA,QACP4B,WAAW5B,QAAQ6B;AAAAA,QACnBC,cAAc9B,QAAQ8B;AAAAA,QACtBC,MAAM/B,QAAQgC;AAAAA,MAChB;AAAA,MACA,cAAYrB;AAAAA,MACZU;AAAAA,MACAY,SAAQ;AAAA,MAAgB,GACpBrB;AAAAA,MAAiBsB,yCAEpBC,yBAAO;AAAA,QACNC,UAAS;AAAA,QACTlC,WAAWoB;AAAAA,QACXhB,OAAOD,WAAWe,wBAAwB;AAAA,MAAA,CAC3C;AAAA,IAAA,CACO;AAAA,EAAA;AAId,QAAMiB,cAAc;AAAA,IAClB,GAAGlC;AAAAA,EAAAA;AAGL,QAAMmC,6BACJhD,SAAS,gBAAgBF,SAASkB,OAAOhB,MAAMC,MAAM,IAAIiC;AAE3D,MAAIlC,SAAS,YAAY;AACvB+C,gBAAYxC,kBAAkBT,SAASkB,OAAOhB,MAAM,CAAE,CAAA;AAAA,EAAA,WAC7CA,SAAS,eAAe;
|
|
1
|
+
{"version":3,"file":"Tag.cjs","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { CSSProperties, useState } from \"react\";\nimport { HvColorAny, theme } from \"@hitachivantara/uikit-styles\";\nimport Chip, { ChipProps as MuiChipProps } from \"@mui/material/Chip\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useTheme } from \"@core/hooks/useTheme\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { CloseXS } from \"@hitachivantara/uikit-react-icons\";\nimport { staticClasses, useClasses } from \"./Tag.styles\";\nimport { getOnDeleteCallback, hasDeleteAction, hasClickAction } from \"./utils\";\n\nexport { staticClasses as tagClasses };\n\nexport type HvTagClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagProps\n extends Omit<MuiChipProps, \"color\" | \"classes\">,\n HvBaseProps<HTMLDivElement, \"children\"> {\n /** Inline styles to be applied to the root element. */\n style?: CSSProperties;\n /** The label of the tag element. */\n label?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** The type of the tag element. A tag can be of semantic or categoric type. */\n type?: \"semantic\" | \"categorical\";\n /** Background color to be applied to the tag */\n color?: HvColorAny;\n /** Icon used to customize the delete icon in the Chip element */\n deleteIcon?: React.ReactElement;\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component, in order to render the delete icon\n * */\n onDelete?: (event: React.MouseEvent<HTMLElement>) => void;\n /** Callback triggered when any item is clicked. */\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n /** The role of the element with an attributed event. */\n role?: string;\n /** Aria properties to apply to delete button in tag */\n deleteButtonArialLabel?: string; // TODO: fix typo \"ArialLabel\" in next version\n /** Props to apply to delete button */\n deleteButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagClasses;\n}\n\nconst getColor = (customColor, type, colors) => {\n const defaultSemanticColor = theme.colors.neutral_20;\n const defaultCategoricalColor = colors.cat1;\n\n let backgroundColor;\n\n if (type === \"semantic\") {\n backgroundColor =\n theme.colors[customColor] || customColor || defaultSemanticColor;\n }\n if (type === \"categorical\") {\n backgroundColor =\n colors[customColor] || customColor || defaultCategoricalColor;\n }\n return backgroundColor;\n};\n\n/**\n * A Tag is one word that describes a specific aspect of an asset. A single asset can have\n * multiple tags.\n * Use tags to highlight an item's status for quick recognition and navigation\n * Use color to indicate meanings that users can learn and recognize across products\n *\n * It leverages the Chip component from Material UI\n */\nexport const HvTag = (props: HvTagProps) => {\n const {\n classes: classesProp,\n className,\n style,\n label,\n disabled,\n type = \"semantic\",\n color,\n deleteIcon,\n onDelete,\n onClick,\n role,\n deleteButtonArialLabel = \"Delete tag\",\n deleteButtonProps = {},\n ...others\n } = useDefaultProps(\"HvTag\", props);\n const { colors } = useTheme();\n const { classes, cx, css } = useClasses(classesProp);\n\n const getDeleteIcon = () => {\n const disabledSemanticColor =\n type === \"semantic\" ? \"secondary_60\" : \"base_dark\";\n const { tabIndex = 0 } = deleteButtonProps;\n\n const closeIconStyles = css({\n ...(disabled ? { cursor: \"not-allowed\" } : undefined),\n height: 16,\n \"& svg .color0\": {\n fill: theme.colors[disabled ? disabledSemanticColor : \"base_dark\"],\n },\n });\n return (\n <HvButton\n classes={{\n startIcon: classes.tagButton,\n focusVisible: classes.focusVisible,\n root: classes.button,\n }}\n aria-label={deleteButtonArialLabel}\n tabIndex={tabIndex}\n variant=\"secondaryGhost\"\n {...deleteButtonProps}\n >\n <CloseXS\n iconSize=\"XS\"\n className={closeIconStyles}\n color={disabled ? disabledSemanticColor : \"base_dark\"}\n />\n </HvButton>\n );\n };\n\n const inlineStyle = {\n ...style,\n };\n\n const categoricalBackgroundColor =\n type === \"categorical\" ? getColor(color, type, colors) : undefined;\n\n if (type === \"semantic\") {\n inlineStyle.backgroundColor = getColor(color, type, {});\n } else if (type === \"categorical\") {\n inlineStyle.backgroundColor = `${categoricalBackgroundColor}30`;\n }\n\n const [hover, setHover] = useState(false);\n\n return (\n <Chip\n label={label}\n className={cx(classes.root, className)}\n onMouseEnter={() => {\n setHover(!!onClick);\n }}\n onMouseLeave={() => {\n setHover(false);\n }}\n style={{\n ...(disabled ? null : inlineStyle),\n ...(hover && !disabled\n ? { boxShadow: `0 0 0 1pt ${categoricalBackgroundColor}` }\n : null),\n }}\n classes={{\n root: cx(classes.chipRoot, {\n [classes.disabled]: disabled,\n [classes.clickable]: !!onClick,\n [classes.categorical]: type === \"categorical\",\n [classes.categoricalFocus]: type === \"categorical\" && !disabled,\n [classes.categoricalDisabled]: type === \"categorical\" && disabled,\n }),\n label: classes.label,\n deleteIcon: cx(classes.deleteIcon, {\n [classes.disabledDeleteIcon]: disabled,\n }),\n }}\n deleteIcon={(hasDeleteAction(onDelete) && deleteIcon) || getDeleteIcon()}\n onDelete={getOnDeleteCallback(disabled, onDelete)}\n onClick={disabled ? undefined : onClick}\n role={role || (hasClickAction(onClick) ? \"button\" : undefined)}\n tabIndex={hasDeleteAction(onDelete) ? undefined : 0}\n {...others}\n />\n );\n};\n"],"names":["getColor","customColor","type","colors","defaultSemanticColor","theme","neutral_20","defaultCategoricalColor","cat1","backgroundColor","HvTag","props","classes","classesProp","className","style","label","disabled","color","deleteIcon","onDelete","onClick","role","deleteButtonArialLabel","deleteButtonProps","others","useDefaultProps","useTheme","cx","css","useClasses","getDeleteIcon","disabledSemanticColor","tabIndex","closeIconStyles","cursor","undefined","height","fill","HvButton","startIcon","tagButton","focusVisible","root","button","variant","children","CloseXS","iconSize","inlineStyle","categoricalBackgroundColor","hover","setHover","useState","Chip","onMouseEnter","onMouseLeave","boxShadow","chipRoot","clickable","categorical","categoricalFocus","categoricalDisabled","disabledDeleteIcon","hasDeleteAction","getOnDeleteCallback","hasClickAction"],"mappings":";;;;;;;;;;;;;;AAiDA,MAAMA,WAAWA,CAACC,aAAaC,MAAMC,WAAW;AACxCC,QAAAA,uBAAuBC,YAAAA,MAAMF,OAAOG;AAC1C,QAAMC,0BAA0BJ,OAAOK;AAEnCC,MAAAA;AAEJ,MAAIP,SAAS,YAAY;AACvBO,sBACEJ,YAAMF,MAAAA,OAAOF,WAAW,KAAKA,eAAeG;AAAAA,EAChD;AACA,MAAIF,SAAS,eAAe;AAExBC,sBAAAA,OAAOF,WAAW,KAAKA,eAAeM;AAAAA,EAC1C;AACOE,SAAAA;AACT;AAUaC,MAAAA,QAAQA,CAACC,UAAsB;AACpC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAf,OAAO;AAAA,IACPgB;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,yBAAyB;AAAA,IACzBC,oBAAoB,CAAC;AAAA,IACrB,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,gBAAA,SAASf,KAAK;AAC5B,QAAA;AAAA,IAAER;AAAAA,MAA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-
{"version":3,"file":"TagsInput.cjs","sources":["../../../../src/components/TagsInput/TagsInput.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport isNil from \"lodash/isNil\";\n\nimport { InputBaseComponentProps as MuiInputBaseComponentProps } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvListContainer, HvListItem } from \"@core/components/ListContainer\";\nimport { baseInputClasses } from \"@core/components/BaseInput\";\nimport { HvInput } from \"@core/components/Input\";\nimport { HvTagSuggestion, HvValidationMessages } from \"@core/types/forms\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useIsMounted } from \"@core/hooks/useIsMounted\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\nimport validationStates from \"@core/components/Forms/FormElement/validationStates\";\nimport { DEFAULT_ERROR_MESSAGES } from \"@core/components/BaseInput/validations\";\nimport { HvTag, HvTagProps } from \"@core/components/Tag\";\nimport {\n HvCharCounter,\n HvCharCounterProps,\n HvFormElement,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvSuggestions,\n HvWarningText,\n} from \"@core/components/Forms\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./TagsInput.styles\";\n\nexport { staticClasses as tagsInputClasses };\n\nexport type HvTagsInputClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagsInputProps\n extends HvBaseProps<\n HTMLElement,\n \"onChange\" | \"onBlur\" | \"onFocus\" | \"onKeyDown\" | \"color\" | \"defaultValue\"\n > {\n /** The form element name. */\n name?: string;\n /** The value of the form element. */\n value?: string[] | HvTagProps[];\n /** When uncontrolled, defines the initial input value. */\n defaultValue?: string[] | HvTagProps[];\n /**\n * The label of the form element.\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be inputted via inputProps.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** Indicates that the form element is not editable. */\n readOnly?: boolean;\n /** Indicates that the form element is required. */\n required?: boolean;\n /** The function that will be executed onChange. */\n onChange?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>\n | React.MouseEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEventHandler<HTMLElement>,\n value: HvTagProps[]\n ) => void;\n /** The function that will be executed when the element is focused. */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>, value: string) => void;\n /** The function that will be executed when the element is blurred. */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>, value: string) => void;\n /** The function that will be executed when a tag is deleted. */\n onDelete?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>\n | React.MouseEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEventHandler<HTMLElement>,\n value: HvTagProps,\n index: number\n ) => void;\n /** The function that will be executed when a tag is added. */\n onAdd?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>\n | React.MouseEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEventHandler<HTMLElement>,\n value: HvTagProps,\n index: number\n ) => void;\n /** The placeholder value of the input. */\n placeholder?: string;\n /** If `true` the character counter isn't shown even if maxTagsQuantity is set. */\n hideCounter?: boolean;\n /** Text between the current char counter and max value. */\n middleCountLabel?: string;\n /** The maximum allowed length of the characters, if this value is null no check will be performed. */\n maxTagsQuantity?: number;\n /** Attributes applied to the input element. */\n inputProps?: MuiInputBaseComponentProps;\n /** If `true` it should autofocus. */\n autoFocus?: boolean;\n /** If `true` the component is resizable. */\n resizable?: boolean;\n /** Props passed to the HvCharCount component. */\n countCharProps?: Partial<HvCharCounterProps>;\n /** If `true` the component is in multiline mode. */\n multiline?: boolean;\n /** The status of the form element. */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". */\n statusMessage?: React.ReactNode;\n /** An Object containing the various texts associated with the input. */\n validationMessages?: HvValidationMessages;\n /** An array of strings that represent the character used to input a tag. This character is the string representation of the event.code from the input event. */\n commitTagOn?: string[];\n /** If `true` the tag will be committed when the blur event occurs. */\n commitOnBlur?: boolean;\n /** The function that will be executed to received an array of objects that has a label and id to create list of suggestion */\n suggestionListCallback?: (value: string) => HvTagSuggestion[] | null;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagsInputClasses;\n}\n\n/**\n * A tags input is a single or multiline control that allows the input of tags.\n */\nexport const HvTagsInput = (props: HvTagsInputProps) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value: valueProp,\n defaultValue = [],\n readOnly = false,\n disabled = false,\n required = false,\n label: textAreaLabel,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onAdd,\n onDelete,\n onBlur,\n onFocus,\n placeholder,\n hideCounter = false,\n middleCountLabel = \"/\",\n maxTagsQuantity,\n autoFocus = false,\n resizable = true,\n inputProps = {},\n countCharProps = {},\n multiline = false,\n status,\n statusMessage,\n validationMessages,\n commitTagOn = [\"Enter\"],\n commitOnBlur = false,\n suggestionListCallback,\n ...others\n } = useDefaultProps(\"HvTagsInput\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvTagsInput\");\n\n const hasLabel = textAreaLabel != null;\n const hasDescription = description != null;\n\n const [value, setValue] = useControlled(valueProp, defaultValue);\n\n const [validationState, setValidationState] = useControlled(\n status,\n validationStates.standBy\n );\n const [validationMessage, setValidationMessage] = useControlled(\n statusMessage,\n \"\"\n );\n\n const [tagInput, setTagInput] = useState(\"\");\n const [tagCursorPos, setTagCursorPos] = useState(value.length);\n const [stateValid, setStateValid] = useState(true);\n\n const inputRef = useRef<any>();\n const containerRef = useRef<any>();\n const skipReset = useRef(false);\n const blurTimeout = useRef<any>();\n const materialInputRef = useRef<any>(null);\n\n const isTagSelected = tagCursorPos >= 0 && tagCursorPos < value.length;\n const hasCounter = maxTagsQuantity != null && !hideCounter;\n\n // suggestions related state\n const [suggestionValues, setSuggestionValues] = useState<\n HvTagSuggestion[] | null\n >(null);\n\n const isStateInvalid = useMemo(() => {\n return hasCounter && value.length > maxTagsQuantity;\n }, [hasCounter, maxTagsQuantity, value.length]);\n\n const canShowSuggestions = suggestionListCallback != null;\n const hasSuggestions = !!suggestionValues;\n\n const errorMessages = useMemo(\n () => ({ ...DEFAULT_ERROR_MESSAGES, ...validationMessages }),\n [validationMessages]\n );\n\n const performValidation = useCallback(\n (currValue) => {\n if (\n maxTagsQuantity !== null &&\n maxTagsQuantity !== undefined &&\n currValue.length > maxTagsQuantity\n ) {\n setValidationState(validationStates.invalid);\n setValidationMessage(errorMessages.maxCharError);\n setStateValid(false);\n } else {\n setValidationState(validationStates.valid);\n setValidationMessage(\"\");\n setStateValid(true);\n }\n },\n [\n errorMessages.maxCharError,\n maxTagsQuantity,\n setValidationMessage,\n setValidationState,\n ]\n );\n\n /**\n * Deletes a Tag from the array of tags and sets the new position for the tag cursor.\n * Also executes the user provided onDelete and onChange events.\n *\n * @param {number} tagPos - the position at which to remove the tag\n * @param {Event} event - the event associated with the delete\n * @param {boolean} end - whether or not to set the cursor at the end of the array\n */\n const deleteTag = useCallback(\n (tagPos, event, end) => {\n const newTagsArr = [\n ...value.slice(0, tagPos),\n ...value.slice(tagPos + 1),\n ];\n setValue(newTagsArr);\n setTagCursorPos(\n end ? newTagsArr.length : tagCursorPos > 0 ? tagCursorPos - 1 : 0\n );\n inputRef.current?.focus();\n performValidation(newTagsArr);\n onDelete?.(event, value[tagPos], tagPos);\n onChange?.(event, newTagsArr);\n skipReset.current = true;\n },\n [onChange, onDelete, performValidation, setValue, tagCursorPos, value]\n );\n\n /**\n * Adds a Tag to the array of tags.\n * Also executes the user provided onAdd and onDelete events.\n *\n * @param {Event} event - whatever event triggered adding a tag\n * @param {string} tag - the string for the tag\n */\n const addTag = useCallback(\n (event, tag) => {\n event.preventDefault();\n if (tag !== \"\") {\n const newTag: HvTagProps = { label: tag, type: \"semantic\" };\n const newTagsArr = [...value, newTag];\n setValue(newTagsArr);\n performValidation(newTagsArr);\n onAdd?.(event, newTag, newTagsArr.length - 1);\n onChange?.(event, newTagsArr);\n }\n },\n [onAdd, onChange, performValidation, setValue, value]\n );\n\n const canShowError =\n (status !== undefined &&\n status === \"invalid\" &&\n statusMessage !== undefined) ||\n !stateValid;\n\n useEffect(() => {\n if (!multiline) {\n const element = containerRef?.current?.children[tagCursorPos];\n // this setTimeout is a workaround for Firefox not properly dealing\n // with setting the scrollLeft value.\n setTimeout(() => {\n const container = containerRef.current;\n if (isNil(container)) return;\n container.scrollLeft = element\n ? element.offsetLeft -\n container.getBoundingClientRect().width / 2 +\n element.getBoundingClientRect().width / 2\n : 0;\n }, 50);\n\n element?.focus();\n }\n }, [multiline, tagCursorPos]);\n\n useEffect(() => {\n if (!skipReset.current) {\n setTagInput(\"\");\n setTagCursorPos(value.length);\n }\n skipReset.current = false;\n }, [value]);\n\n const isMounted = useIsMounted();\n\n /**\n * Looks for the node that represent the input inside the material tree and focus it.\n */\n const focusInput = () => {\n materialInputRef.current.focus();\n };\n\n const getSuggestions = useCallback(\n (li) => {\n // TODO Replace with ref\n const listEl = document.getElementById(\n setId(elementId, \"suggestions-list\") || \"\"\n );\n return li != null ? listEl?.getElementsByTagName(\"li\")?.[li] : listEl;\n },\n [elementId]\n );\n\n /**\n * Clears the suggestion array.\n */\n const suggestionClearHandler = useCallback(() => {\n if (isMounted.current) {\n setSuggestionValues(null);\n }\n }, [isMounted]);\n\n /**\n * Fills of the suggestion array.\n */\n const suggestionHandler = useCallback(\n (val) => {\n const suggestionsArray = suggestionListCallback?.(val);\n if (suggestionsArray?.[0]?.label) {\n setSuggestionValues(suggestionsArray);\n } else {\n suggestionClearHandler();\n }\n },\n [suggestionClearHandler, suggestionListCallback]\n );\n\n /**\n * Executes the user callback adds the selection to the state and clears the suggestions.\n */\n const suggestionSelectedHandler = (event, item) => {\n addTag(event, item.value || item.label);\n\n // set the input value (only when value is uncontrolled)\n setTagInput(item.value || item.label);\n\n focusInput();\n suggestionClearHandler();\n };\n\n /**\n * Handler for the `onKeyDown` event on the suggestions component\n */\n const onSuggestionKeyDown = (event) => {\n if (isKey(event, \"Esc\")) {\n suggestionClearHandler();\n focusInput();\n } else if (isKey(event, \"Tab\")) {\n suggestionClearHandler();\n }\n };\n\n /**\n * Handler for the `onChange` event on the tag input\n */\n const onChangeHandler = useCallback(\n (_, input) => {\n setTagInput(input);\n\n if (canShowSuggestions) {\n // an edge case might be a controlled input whose onChange callback\n // doesn't change the value (or sets another): the suggestionListCallback\n // callback will still receive the original rejected value.\n // a refactor is needed so the suggestionListCallback might be called only\n // when the input is uncontrolled, providing a way to externally control\n // the suggestion values.\n suggestionHandler(input);\n }\n },\n [canShowSuggestions, suggestionHandler]\n );\n\n /**\n * Handler for the `onKeyDown` event on the form element\n */\n const onInputKeyDownHandler = useCallback(\n (event) => {\n if (!canShowSuggestions && commitTagOn.includes(event.code)) {\n addTag(event, tagInput);\n }\n },\n [addTag, canShowSuggestions, commitTagOn, tagInput]\n );\n\n /**\n * Handler for the `onKeyDown` event on the list container.\n */\n const onKeyDownHandler = useCallback(\n (event) => {\n if (tagInput === \"\") {\n switch (event.code) {\n case \"ArrowLeft\":\n setTagCursorPos(tagCursorPos > 0 ? tagCursorPos - 1 : 0);\n break;\n case \"ArrowRight\":\n setTagCursorPos(\n tagCursorPos < value.length ? tagCursorPos + 1 : value.length\n );\n break;\n case \"Backspace\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n } else {\n setTagCursorPos(value.length - 1);\n }\n break;\n case \"Delete\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n }\n break;\n default:\n break;\n }\n } else {\n switch (event.code) {\n case \"ArrowDown\":\n getSuggestions(0)?.focus();\n break;\n default:\n break;\n }\n }\n },\n [\n deleteTag,\n getSuggestions,\n isTagSelected,\n tagCursorPos,\n tagInput,\n value.length,\n ]\n );\n\n /**\n * Handler for the `onDelete` event on the tag component\n */\n const onDeleteTagHandler = useCallback(\n (event, i) => {\n deleteTag(i, event, true);\n setValidationState(validationStates.standBy);\n },\n [deleteTag, setValidationState]\n );\n\n /**\n * Handler for the `onClick` event on the list container\n */\n const onContainerClickHandler = useCallback(() => {\n inputRef.current?.focus();\n clearTimeout(blurTimeout.current);\n setTagCursorPos(value.length);\n }, [value.length]);\n\n const onBlurHandler = (evt) => {\n blurTimeout.current = setTimeout(() => {\n if (commitOnBlur) {\n addTag(evt, tagInput);\n }\n onBlur?.(evt, tagInput);\n }, 250);\n };\n\n const onFocusHandler = (evt) => {\n clearTimeout(blurTimeout.current);\n onFocus?.(evt, tagInput);\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n status={validationState}\n required={required}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n className={cx(\n classes.root,\n { [classes.disabled]: disabled, [classes.readOnly]: readOnly },\n className\n )}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n className={classes.label}\n id={setId(id, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={textAreaLabel}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n className={classes.description}\n id={setId(elementId, \"description\")}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n {hasCounter && (\n <HvCharCounter\n id={setId(elementId, \"charCounter\")}\n className={classes.characterCounter}\n separator={middleCountLabel}\n currentCharQuantity={value.length}\n maxCharQuantity={maxTagsQuantity}\n {...countCharProps}\n />\n )}\n\n <HvListContainer\n className={cx(classes.tagsList, {\n [classes.error]: canShowError,\n [classes.resizable]: resizable && multiline,\n [classes.invalid]: isStateInvalid,\n [classes.singleLine]: !multiline,\n })}\n onKeyDown={onKeyDownHandler}\n onClick={onContainerClickHandler}\n ref={containerRef}\n >\n {value &&\n value.map((t, i) => {\n const tag =\n typeof t === \"string\"\n ? {\n label: t,\n type: \"semantic\",\n }\n : t;\n const { label, type, ...otherProps } = tag;\n return (\n <HvListItem\n key={`${tag.label}-${i}`}\n tabIndex={-1}\n className={cx({ [classes.singleLine]: !multiline })}\n classes={{\n gutters: classes.listItemGutters,\n root: classes.listItemRoot,\n }}\n id={setId(elementId, `tag-${i}`)}\n >\n <HvTag\n label={label}\n className={cx({ [classes.tagSelected]: i === tagCursorPos })}\n classes={{\n chipRoot: classes.chipRoot,\n }}\n type={type}\n {...(!(readOnly || disabled || type === \"categorical\") && {\n onDelete: (event) => onDeleteTagHandler(event, i),\n })}\n deleteButtonProps={{\n tabIndex: -1,\n }}\n {...otherProps}\n />\n </HvListItem>\n );\n })}\n {!(disabled || readOnly) && (\n <HvListItem\n className={cx(\n {\n [classes.singleLine]: !multiline,\n [classes.tagInputRootEmpty]: value.length === 0,\n },\n !!isTagSelected &&\n css({\n [`& .${baseInputClasses.inputRoot}`]: {\n backgroundColor: theme.colors.atmo1,\n },\n })\n )}\n classes={{\n root: classes.tagInputContainerRoot,\n gutters: classes.listItemGutters,\n }}\n id={setId(elementId, `tag-${value.length}`)}\n >\n <HvInput\n value={tagInput}\n disableClear\n onChange={onChangeHandler}\n onKeyDown={onInputKeyDownHandler}\n placeholder={value.length === 0 ? placeholder : \"\"}\n autoFocus={autoFocus}\n className={cx({\n [classes.singleLine]: !multiline,\n })}\n classes={{\n root: classes.tagInputRoot,\n input: classes.input,\n inputBorderContainer: classes.tagInputBorderContainer,\n inputRootFocused: classes.tagInputRootFocused,\n }}\n disabled={disabled}\n readOnly={readOnly || isTagSelected}\n inputProps={{\n ref: materialInputRef,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\":\n ariaDescribedBy != null\n ? ariaDescribedBy\n : (description && setId(elementId, \"description\")) ||\n undefined,\n\n ...inputProps,\n }}\n inputRef={inputRef}\n {...others}\n />\n </HvListItem>\n )}\n </HvListContainer>\n {canShowSuggestions && (\n <>\n {hasSuggestions && (\n <div role=\"presentation\" className={classes.inputExtension} />\n )}\n <HvSuggestions\n id={setId(elementId, \"suggestions\")}\n classes={{\n root: classes.suggestionsContainer,\n list: classes.suggestionList,\n }}\n expanded={hasSuggestions}\n anchorEl={containerRef?.current?.parentElement}\n onClose={suggestionClearHandler}\n onKeyDown={onSuggestionKeyDown}\n onSuggestionSelected={suggestionSelectedHandler}\n suggestionValues={suggestionValues}\n />\n </>\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n};\n"],"names":["HvTagsInput","props","classes","classesProp","className","id","name","value","valueProp","defaultValue","readOnly","disabled","required","label","textAreaLabel","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","onChange","onAdd","onDelete","onBlur","onFocus","placeholder","hideCounter","middleCountLabel","maxTagsQuantity","autoFocus","resizable","inputProps","countCharProps","multiline","status","statusMessage","validationMessages","commitTagOn","commitOnBlur","suggestionListCallback","others","useDefaultProps","cx","css","useClasses","elementId","useUniqueId","hasLabel","hasDescription","setValue","useControlled","validationState","setValidationState","validationStates","standBy","validationMessage","setValidationMessage","tagInput","setTagInput","useState","tagCursorPos","setTagCursorPos","length","stateValid","setStateValid","inputRef","useRef","containerRef","skipReset","blurTimeout","materialInputRef","isTagSelected","hasCounter","suggestionValues","setSuggestionValues","isStateInvalid","useMemo","canShowSuggestions","hasSuggestions","errorMessages","DEFAULT_ERROR_MESSAGES","performValidation","useCallback","currValue","undefined","invalid","maxCharError","valid","deleteTag","tagPos","event","end","newTagsArr","slice","current","focus","addTag","tag","preventDefault","newTag","type","canShowError","useEffect","element","children","setTimeout","container","isNil","scrollLeft","offsetLeft","getBoundingClientRect","width","isMounted","useIsMounted","focusInput","getSuggestions","li","listEl","document","getElementById","setId","getElementsByTagName","suggestionClearHandler","suggestionHandler","val","suggestionsArray","suggestionSelectedHandler","item","onSuggestionKeyDown","isKey","onChangeHandler","_","input","onInputKeyDownHandler","includes","code","onKeyDownHandler","_a","onDeleteTagHandler","i","onContainerClickHandler","clearTimeout","onBlurHandler","evt","onFocusHandler","HvFormElement","root","labelContainer","_jsx","HvLabel","htmlFor","HvInfoMessage","HvCharCounter","characterCounter","separator","currentCharQuantity","maxCharQuantity","_jsxs","HvListContainer","tagsList","error","singleLine","onKeyDown","onClick","ref","map","t","otherProps","HvListItem","tabIndex","gutters","listItemGutters","listItemRoot","HvTag","tagSelected","chipRoot","deleteButtonProps","tagInputRootEmpty","baseInputClasses","inputRoot","backgroundColor","theme","colors","atmo1","tagInputContainerRoot","HvInput","disableClear","tagInputRoot","inputBorderContainer","tagInputBorderContainer","inputRootFocused","tagInputRootFocused","_Fragment","role","inputExtension","HvSuggestions","suggestionsContainer","list","suggestionList","expanded","anchorEl","parentElement","onClose","onSuggestionSelected","HvWarningText","disableBorder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJaA,MAAAA,cAAcA,CAACC,UAA4B;;AAChD,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,OAAOC;AAAAA,IACPC,eAAe,CAAE;AAAA,IACjBC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,OAAOC;AAAAA,IACP,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnBC;AAAAA,IACA,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,cAAc;AAA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
+
{"version":3,"file":"TagsInput.cjs","sources":["../../../../src/components/TagsInput/TagsInput.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport isNil from \"lodash/isNil\";\n\nimport { InputBaseComponentProps as MuiInputBaseComponentProps } from \"@mui/material\";\n\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvListContainer, HvListItem } from \"@core/components/ListContainer\";\nimport { baseInputClasses } from \"@core/components/BaseInput\";\nimport { HvInput } from \"@core/components/Input\";\nimport { HvTagSuggestion, HvValidationMessages } from \"@core/types/forms\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useIsMounted } from \"@core/hooks/useIsMounted\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { isKey } from \"@core/utils/keyboardUtils\";\nimport { setId } from \"@core/utils/setId\";\nimport validationStates from \"@core/components/Forms/FormElement/validationStates\";\nimport { DEFAULT_ERROR_MESSAGES } from \"@core/components/BaseInput/validations\";\nimport { HvTag, HvTagProps } from \"@core/components/Tag\";\nimport {\n HvCharCounter,\n HvCharCounterProps,\n HvFormElement,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvSuggestions,\n HvWarningText,\n} from \"@core/components/Forms\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./TagsInput.styles\";\n\nexport { staticClasses as tagsInputClasses };\n\nexport type HvTagsInputClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagsInputProps\n extends HvBaseProps<\n HTMLElement,\n \"onChange\" | \"onBlur\" | \"onFocus\" | \"onKeyDown\" | \"color\" | \"defaultValue\"\n > {\n /** The form element name. */\n name?: string;\n /** The value of the form element. */\n value?: string[] | HvTagProps[];\n /** When uncontrolled, defines the initial input value. */\n defaultValue?: string[] | HvTagProps[];\n /**\n * The label of the form element.\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be inputted via inputProps.\n */\n label?: React.ReactNode;\n /** Provide additional descriptive text for the form element. */\n description?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** Indicates that the form element is not editable. */\n readOnly?: boolean;\n /** Indicates that the form element is required. */\n required?: boolean;\n /** The function that will be executed onChange. */\n onChange?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>\n | React.MouseEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEventHandler<HTMLElement>,\n value: HvTagProps[]\n ) => void;\n /** The function that will be executed when the element is focused. */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>, value: string) => void;\n /** The function that will be executed when the element is blurred. */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>, value: string) => void;\n /** The function that will be executed when a tag is deleted. */\n onDelete?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>\n | React.MouseEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEventHandler<HTMLElement>,\n value: HvTagProps,\n index: number\n ) => void;\n /** The function that will be executed when a tag is added. */\n onAdd?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLInputElement>\n | React.MouseEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEventHandler<HTMLElement>,\n value: HvTagProps,\n index: number\n ) => void;\n /** The placeholder value of the input. */\n placeholder?: string;\n /** If `true` the character counter isn't shown even if maxTagsQuantity is set. */\n hideCounter?: boolean;\n /** Text between the current char counter and max value. */\n middleCountLabel?: string;\n /** The maximum allowed length of the characters, if this value is null no check will be performed. */\n maxTagsQuantity?: number;\n /** Attributes applied to the input element. */\n inputProps?: MuiInputBaseComponentProps;\n /** If `true` it should autofocus. */\n autoFocus?: boolean;\n /** If `true` the component is resizable. */\n resizable?: boolean;\n /** Props passed to the HvCharCount component. */\n countCharProps?: Partial<HvCharCounterProps>;\n /** If `true` the component is in multiline mode. */\n multiline?: boolean;\n /** The status of the form element. */\n status?: HvFormStatus;\n /** The error message to show when `status` is \"invalid\". */\n statusMessage?: React.ReactNode;\n /** An Object containing the various texts associated with the input. */\n validationMessages?: HvValidationMessages;\n /** An array of strings that represent the character used to input a tag. This character is the string representation of the event.code from the input event. */\n commitTagOn?: string[];\n /** If `true` the tag will be committed when the blur event occurs. */\n commitOnBlur?: boolean;\n /** The function that will be executed to received an array of objects that has a label and id to create list of suggestion */\n suggestionListCallback?: (value: string) => HvTagSuggestion[] | null;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagsInputClasses;\n}\n\n/**\n * A tags input is a single or multiline control that allows the input of tags.\n */\nexport const HvTagsInput = (props: HvTagsInputProps) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value: valueProp,\n defaultValue = [],\n readOnly = false,\n disabled = false,\n required = false,\n label: textAreaLabel,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n onChange,\n onAdd,\n onDelete,\n onBlur,\n onFocus,\n placeholder,\n hideCounter = false,\n middleCountLabel = \"/\",\n maxTagsQuantity,\n autoFocus = false,\n resizable = true,\n inputProps = {},\n countCharProps = {},\n multiline = false,\n status,\n statusMessage,\n validationMessages,\n commitTagOn = [\"Enter\"],\n commitOnBlur = false,\n suggestionListCallback,\n ...others\n } = useDefaultProps(\"HvTagsInput\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvTagsInput\");\n\n const hasLabel = textAreaLabel != null;\n const hasDescription = description != null;\n\n const [value, setValue] = useControlled(valueProp, defaultValue);\n\n const [validationState, setValidationState] = useControlled(\n status,\n validationStates.standBy\n );\n const [validationMessage, setValidationMessage] = useControlled(\n statusMessage,\n \"\"\n );\n\n const [tagInput, setTagInput] = useState(\"\");\n const [tagCursorPos, setTagCursorPos] = useState(value.length);\n const [stateValid, setStateValid] = useState(true);\n\n const inputRef = useRef<any>();\n const containerRef = useRef<any>();\n const skipReset = useRef(false);\n const blurTimeout = useRef<any>();\n const materialInputRef = useRef<any>(null);\n\n const isTagSelected = tagCursorPos >= 0 && tagCursorPos < value.length;\n const hasCounter = maxTagsQuantity != null && !hideCounter;\n\n // suggestions related state\n const [suggestionValues, setSuggestionValues] = useState<\n HvTagSuggestion[] | null\n >(null);\n\n const isStateInvalid = useMemo(() => {\n return hasCounter && value.length > maxTagsQuantity;\n }, [hasCounter, maxTagsQuantity, value.length]);\n\n const canShowSuggestions = suggestionListCallback != null;\n const hasSuggestions = !!suggestionValues;\n\n const errorMessages = useMemo(\n () => ({ ...DEFAULT_ERROR_MESSAGES, ...validationMessages }),\n [validationMessages]\n );\n\n const performValidation = useCallback(\n (currValue) => {\n if (\n maxTagsQuantity !== null &&\n maxTagsQuantity !== undefined &&\n currValue.length > maxTagsQuantity\n ) {\n setValidationState(validationStates.invalid);\n setValidationMessage(errorMessages.maxCharError);\n setStateValid(false);\n } else {\n setValidationState(validationStates.valid);\n setValidationMessage(\"\");\n setStateValid(true);\n }\n },\n [\n errorMessages.maxCharError,\n maxTagsQuantity,\n setValidationMessage,\n setValidationState,\n ]\n );\n\n /**\n * Deletes a Tag from the array of tags and sets the new position for the tag cursor.\n * Also executes the user provided onDelete and onChange events.\n *\n * @param {number} tagPos - the position at which to remove the tag\n * @param {Event} event - the event associated with the delete\n * @param {boolean} end - whether or not to set the cursor at the end of the array\n */\n const deleteTag = useCallback(\n (tagPos, event, end) => {\n const newTagsArr = [\n ...value.slice(0, tagPos),\n ...value.slice(tagPos + 1),\n ];\n setValue(newTagsArr);\n setTagCursorPos(\n end ? newTagsArr.length : tagCursorPos > 0 ? tagCursorPos - 1 : 0\n );\n inputRef.current?.focus();\n performValidation(newTagsArr);\n onDelete?.(event, value[tagPos], tagPos);\n onChange?.(event, newTagsArr);\n skipReset.current = true;\n },\n [onChange, onDelete, performValidation, setValue, tagCursorPos, value]\n );\n\n /**\n * Adds a Tag to the array of tags.\n * Also executes the user provided onAdd and onDelete events.\n *\n * @param {Event} event - whatever event triggered adding a tag\n * @param {string} tag - the string for the tag\n */\n const addTag = useCallback(\n (event, tag) => {\n event.preventDefault();\n if (tag !== \"\") {\n const newTag: HvTagProps = { label: tag, type: \"semantic\" };\n const newTagsArr = [...value, newTag];\n setValue(newTagsArr);\n performValidation(newTagsArr);\n onAdd?.(event, newTag, newTagsArr.length - 1);\n onChange?.(event, newTagsArr);\n }\n },\n [onAdd, onChange, performValidation, setValue, value]\n );\n\n const canShowError =\n (status !== undefined &&\n status === \"invalid\" &&\n statusMessage !== undefined) ||\n !stateValid;\n\n useEffect(() => {\n if (!multiline) {\n const element = containerRef?.current?.children[tagCursorPos];\n // this setTimeout is a workaround for Firefox not properly dealing\n // with setting the scrollLeft value.\n setTimeout(() => {\n const container = containerRef.current;\n if (isNil(container)) return;\n container.scrollLeft = element\n ? element.offsetLeft -\n container.getBoundingClientRect().width / 2 +\n element.getBoundingClientRect().width / 2\n : 0;\n }, 50);\n\n element?.focus();\n }\n }, [multiline, tagCursorPos]);\n\n useEffect(() => {\n if (!skipReset.current) {\n setTagInput(\"\");\n setTagCursorPos(value.length);\n }\n skipReset.current = false;\n }, [value]);\n\n const isMounted = useIsMounted();\n\n /**\n * Looks for the node that represent the input inside the material tree and focus it.\n */\n const focusInput = () => {\n materialInputRef.current.focus();\n };\n\n const getSuggestions = useCallback(\n (li) => {\n // TODO Replace with ref\n const listEl = document.getElementById(\n setId(elementId, \"suggestions-list\") || \"\"\n );\n return li != null ? listEl?.getElementsByTagName(\"li\")?.[li] : listEl;\n },\n [elementId]\n );\n\n /**\n * Clears the suggestion array.\n */\n const suggestionClearHandler = useCallback(() => {\n if (isMounted.current) {\n setSuggestionValues(null);\n }\n }, [isMounted]);\n\n /**\n * Fills of the suggestion array.\n */\n const suggestionHandler = useCallback(\n (val) => {\n const suggestionsArray = suggestionListCallback?.(val);\n if (suggestionsArray?.[0]?.label) {\n setSuggestionValues(suggestionsArray);\n } else {\n suggestionClearHandler();\n }\n },\n [suggestionClearHandler, suggestionListCallback]\n );\n\n /**\n * Executes the user callback adds the selection to the state and clears the suggestions.\n */\n const suggestionSelectedHandler = (event, item) => {\n addTag(event, item.value || item.label);\n\n // set the input value (only when value is uncontrolled)\n setTagInput(item.value || item.label);\n\n focusInput();\n suggestionClearHandler();\n };\n\n /**\n * Handler for the `onKeyDown` event on the suggestions component\n */\n const onSuggestionKeyDown = (event) => {\n if (isKey(event, \"Esc\")) {\n suggestionClearHandler();\n focusInput();\n } else if (isKey(event, \"Tab\")) {\n suggestionClearHandler();\n }\n };\n\n /**\n * Handler for the `onChange` event on the tag input\n */\n const onChangeHandler = useCallback(\n (_, input) => {\n setTagInput(input);\n\n if (canShowSuggestions) {\n // an edge case might be a controlled input whose onChange callback\n // doesn't change the value (or sets another): the suggestionListCallback\n // callback will still receive the original rejected value.\n // a refactor is needed so the suggestionListCallback might be called only\n // when the input is uncontrolled, providing a way to externally control\n // the suggestion values.\n suggestionHandler(input);\n }\n },\n [canShowSuggestions, suggestionHandler]\n );\n\n /**\n * Handler for the `onKeyDown` event on the form element\n */\n const onInputKeyDownHandler = useCallback(\n (event) => {\n if (!canShowSuggestions && commitTagOn.includes(event.code)) {\n addTag(event, tagInput);\n }\n },\n [addTag, canShowSuggestions, commitTagOn, tagInput]\n );\n\n /**\n * Handler for the `onKeyDown` event on the list container.\n */\n const onKeyDownHandler = useCallback(\n (event) => {\n if (tagInput === \"\") {\n switch (event.code) {\n case \"ArrowLeft\":\n setTagCursorPos(tagCursorPos > 0 ? tagCursorPos - 1 : 0);\n break;\n case \"ArrowRight\":\n setTagCursorPos(\n tagCursorPos < value.length ? tagCursorPos + 1 : value.length\n );\n break;\n case \"Backspace\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n } else {\n setTagCursorPos(value.length - 1);\n }\n break;\n case \"Delete\":\n if (isTagSelected) {\n deleteTag(tagCursorPos, event, false);\n }\n break;\n default:\n break;\n }\n } else {\n switch (event.code) {\n case \"ArrowDown\":\n getSuggestions(0)?.focus();\n break;\n default:\n break;\n }\n }\n },\n [\n deleteTag,\n getSuggestions,\n isTagSelected,\n tagCursorPos,\n tagInput,\n value.length,\n ]\n );\n\n /**\n * Handler for the `onDelete` event on the tag component\n */\n const onDeleteTagHandler = useCallback(\n (event, i) => {\n deleteTag(i, event, true);\n setValidationState(validationStates.standBy);\n },\n [deleteTag, setValidationState]\n );\n\n /**\n * Handler for the `onClick` event on the list container\n */\n const onContainerClickHandler = useCallback(() => {\n inputRef.current?.focus();\n clearTimeout(blurTimeout.current);\n setTagCursorPos(value.length);\n }, [value.length]);\n\n const onBlurHandler = (evt) => {\n blurTimeout.current = setTimeout(() => {\n if (commitOnBlur) {\n addTag(evt, tagInput);\n }\n onBlur?.(evt, tagInput);\n }, 250);\n };\n\n const onFocusHandler = (evt) => {\n clearTimeout(blurTimeout.current);\n onFocus?.(evt, tagInput);\n };\n\n return (\n <HvFormElement\n id={id}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n status={validationState}\n required={required}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n className={cx(\n classes.root,\n { [classes.disabled]: disabled, [classes.readOnly]: readOnly },\n className\n )}\n >\n {(hasLabel || hasDescription) && (\n <div className={classes.labelContainer}>\n {hasLabel && (\n <HvLabel\n className={classes.label}\n id={setId(id, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={textAreaLabel}\n />\n )}\n\n {hasDescription && (\n <HvInfoMessage\n className={classes.description}\n id={setId(elementId, \"description\")}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n {hasCounter && (\n <HvCharCounter\n id={setId(elementId, \"charCounter\")}\n className={classes.characterCounter}\n separator={middleCountLabel}\n currentCharQuantity={value.length}\n maxCharQuantity={maxTagsQuantity}\n {...countCharProps}\n />\n )}\n\n <HvListContainer\n className={cx(classes.tagsList, {\n [classes.error]: canShowError,\n [classes.resizable]: resizable && multiline,\n [classes.invalid]: isStateInvalid,\n [classes.singleLine]: !multiline,\n })}\n onKeyDown={onKeyDownHandler}\n onClick={onContainerClickHandler}\n ref={containerRef}\n >\n {value &&\n value.map((t, i) => {\n const tag =\n typeof t === \"string\"\n ? {\n label: t,\n type: \"semantic\",\n }\n : t;\n const { label, type, ...otherProps } = tag;\n return (\n <HvListItem\n key={`${tag.label}-${i}`}\n tabIndex={-1}\n className={cx({ [classes.singleLine]: !multiline })}\n classes={{\n gutters: classes.listItemGutters,\n root: classes.listItemRoot,\n }}\n id={setId(elementId, `tag-${i}`)}\n >\n <HvTag\n label={label}\n className={cx({ [classes.tagSelected]: i === tagCursorPos })}\n classes={{\n chipRoot: classes.chipRoot,\n }}\n type={type}\n {...(!(readOnly || disabled || type === \"categorical\") && {\n onDelete: (event) => onDeleteTagHandler(event, i),\n })}\n deleteButtonProps={{\n tabIndex: -1,\n }}\n {...otherProps}\n />\n </HvListItem>\n );\n })}\n {!(disabled || readOnly) && (\n <HvListItem\n className={cx(\n {\n [classes.singleLine]: !multiline,\n [classes.tagInputRootEmpty]: value.length === 0,\n },\n !!isTagSelected &&\n css({\n [`& .${baseInputClasses.inputRoot}`]: {\n backgroundColor: theme.colors.atmo1,\n },\n })\n )}\n classes={{\n root: classes.tagInputContainerRoot,\n gutters: classes.listItemGutters,\n }}\n id={setId(elementId, `tag-${value.length}`)}\n >\n <HvInput\n value={tagInput}\n disableClear\n onChange={onChangeHandler}\n onKeyDown={onInputKeyDownHandler}\n placeholder={value.length === 0 ? placeholder : \"\"}\n autoFocus={autoFocus}\n className={cx({\n [classes.singleLine]: !multiline,\n })}\n classes={{\n root: classes.tagInputRoot,\n input: classes.input,\n inputBorderContainer: classes.tagInputBorderContainer,\n inputRootFocused: classes.tagInputRootFocused,\n }}\n disabled={disabled}\n readOnly={readOnly || isTagSelected}\n inputProps={{\n ref: materialInputRef,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\":\n ariaDescribedBy != null\n ? ariaDescribedBy\n : (description && setId(elementId, \"description\")) ||\n undefined,\n\n ...inputProps,\n }}\n inputRef={inputRef}\n {...others}\n />\n </HvListItem>\n )}\n </HvListContainer>\n {canShowSuggestions && (\n <>\n {hasSuggestions && (\n <div role=\"presentation\" className={classes.inputExtension} />\n )}\n <HvSuggestions\n id={setId(elementId, \"suggestions\")}\n classes={{\n root: classes.suggestionsContainer,\n list: classes.suggestionList,\n }}\n expanded={hasSuggestions}\n anchorEl={containerRef?.current?.parentElement}\n onClose={suggestionClearHandler}\n onKeyDown={onSuggestionKeyDown}\n onSuggestionSelected={suggestionSelectedHandler}\n suggestionValues={suggestionValues}\n />\n </>\n )}\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n};\n"],"names":["HvTagsInput","props","classes","classesProp","className","id","name","value","valueProp","defaultValue","readOnly","disabled","required","label","textAreaLabel","ariaLabel","ariaLabelledBy","description","ariaDescribedBy","onChange","onAdd","onDelete","onBlur","onFocus","placeholder","hideCounter","middleCountLabel","maxTagsQuantity","autoFocus","resizable","inputProps","countCharProps","multiline","status","statusMessage","validationMessages","commitTagOn","commitOnBlur","suggestionListCallback","others","useDefaultProps","cx","css","useClasses","elementId","useUniqueId","hasLabel","hasDescription","setValue","useControlled","validationState","setValidationState","validationStates","standBy","validationMessage","setValidationMessage","tagInput","setTagInput","useState","tagCursorPos","setTagCursorPos","length","stateValid","setStateValid","inputRef","useRef","containerRef","skipReset","blurTimeout","materialInputRef","isTagSelected","hasCounter","suggestionValues","setSuggestionValues","isStateInvalid","useMemo","canShowSuggestions","hasSuggestions","errorMessages","DEFAULT_ERROR_MESSAGES","performValidation","useCallback","currValue","undefined","invalid","maxCharError","valid","deleteTag","tagPos","event","end","newTagsArr","slice","current","focus","addTag","tag","preventDefault","newTag","type","canShowError","useEffect","element","children","setTimeout","container","isNil","scrollLeft","offsetLeft","getBoundingClientRect","width","isMounted","useIsMounted","focusInput","getSuggestions","li","listEl","document","getElementById","setId","getElementsByTagName","suggestionClearHandler","suggestionHandler","val","suggestionsArray","suggestionSelectedHandler","item","onSuggestionKeyDown","isKey","onChangeHandler","_","input","onInputKeyDownHandler","includes","code","onKeyDownHandler","_a","onDeleteTagHandler","i","onContainerClickHandler","clearTimeout","onBlurHandler","evt","onFocusHandler","HvFormElement","root","labelContainer","_jsx","HvLabel","htmlFor","HvInfoMessage","HvCharCounter","characterCounter","separator","currentCharQuantity","maxCharQuantity","_jsxs","HvListContainer","tagsList","error","singleLine","onKeyDown","onClick","ref","map","t","otherProps","HvListItem","tabIndex","gutters","listItemGutters","listItemRoot","HvTag","tagSelected","chipRoot","deleteButtonProps","tagInputRootEmpty","baseInputClasses","inputRoot","backgroundColor","theme","colors","atmo1","tagInputContainerRoot","HvInput","disableClear","tagInputRoot","inputBorderContainer","tagInputBorderContainer","inputRootFocused","tagInputRootFocused","_Fragment","role","inputExtension","HvSuggestions","suggestionsContainer","list","suggestionList","expanded","anchorEl","parentElement","onClose","onSuggestionSelected","HvWarningText","disableBorder"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgJaA,MAAAA,cAAcA,CAACC,UAA4B;;AAChD,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,OAAOC;AAAAA,IACPC,eAAe,CAAE;AAAA,IACjBC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,OAAOC;AAAAA,IACP,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnBC;AAAAA,IACA,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,cAAc;AA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