@nulogy/components 15.2.2 → 15.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +53137 -54186
- package/dist/main.module.js +5928 -6978
- package/dist/src/Alert/Alert.js +2 -14
- package/dist/src/AppTag/components/LogoWrapper.d.ts +0 -1
- package/dist/src/AppTag/components/NulogyLogo.js +2 -14
- package/dist/src/AsyncSelect/AsyncSelect.graphql.story.js +4 -13
- package/dist/src/AsyncSelect/AsyncSelect.js +14 -16
- package/dist/src/AsyncSelect/AsyncSelectComponents.js +9 -21
- package/dist/src/AsyncSelect/fixtures.js +4 -13
- package/dist/src/Banner/Banner.js +1 -15
- package/dist/src/BottomSheet/BottomSheet.js +2 -15
- package/dist/src/BottomSheet/BottomSheet.parts.d.ts +2 -2
- package/dist/src/BottomSheet/BottomSheet.parts.js +8 -22
- package/dist/src/BottomSheet/BottomSheet.styled.d.ts +4 -5
- package/dist/src/Box/Box.d.ts +12 -4
- package/dist/src/BrandedNavBar/DesktopMenu.js +22 -36
- package/dist/src/BrandedNavBar/MenuTrigger.js +4 -16
- package/dist/src/BrandedNavBar/MenuTriggerButton.js +8 -22
- package/dist/src/BrandedNavBar/MobileMenu.js +28 -35
- package/dist/src/BrandedNavBar/NavBar.js +7 -21
- package/dist/src/BrandedNavBar/NavBar.story.js +1 -1
- package/dist/src/BrandedNavBar/NavBarBackground.d.ts +0 -1
- package/dist/src/BrandedNavBar/NavBarDropdownMenu.js +14 -8
- package/dist/src/BrandedNavBar/SmallNavBar.js +4 -16
- package/dist/src/BrandedNavBar/SmallNavBar.story.js +1 -1
- package/dist/src/BrandedNavBar/SubMenuTrigger.js +4 -16
- package/dist/src/BrandedNavBar/SubMenuTriggerButton.js +2 -14
- package/dist/src/BrandedNavBar/renderSubMenuItems.js +7 -17
- package/dist/src/Branding/Branding.js +2 -14
- package/dist/src/Branding/BrandingText.d.ts +0 -1
- package/dist/src/Branding/LettermarkLogo.js +2 -14
- package/dist/src/Branding/WordmarkLogo.js +2 -14
- package/dist/src/Breadcrumbs/Breadcrumbs.js +2 -14
- package/dist/src/Breadcrumbs/BreadcrumbsList.d.ts +0 -1
- package/dist/src/Breadcrumbs/BreadcrumbsListItem.d.ts +0 -1
- package/dist/src/Button/Button.js +2 -14
- package/dist/src/Button/CloseButton.js +1 -1
- package/dist/src/Button/ControlIcon.js +2 -16
- package/dist/src/Button/DangerButton.d.ts +0 -1
- package/dist/src/Button/IconicButton.js +55 -73
- package/dist/src/Button/PrimaryButton.d.ts +0 -1
- package/dist/src/Button/QuietButton.d.ts +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.d.ts +0 -1
- package/dist/src/ButtonGroup/ButtonGroup.js +8 -2
- package/dist/src/Card/Card.js +2 -14
- package/dist/src/Card/Card.story.js +1 -1
- package/dist/src/Card/CardSet.d.ts +0 -1
- package/dist/src/Checkbox/Checkbox.js +20 -6
- package/dist/src/Checkbox/Checkbox.story.js +4 -1
- package/dist/src/Checkbox/CheckboxGroup.js +4 -16
- package/dist/src/DatePickers/DatePicker.js +2 -14
- package/dist/src/DatePickers/MonthPicker.js +2 -14
- package/dist/src/DatePickers/WeekPicker.js +10 -17
- package/dist/src/DatePickers/custom/weekPickerStyles.d.ts +0 -1
- package/dist/src/DatePickers/shared/components/BasePicker.js +9 -15
- package/dist/src/DatePickers/shared/components/DatePickerInput.js +2 -13
- package/dist/src/DatePickers/shared/styles.d.ts +0 -1
- package/dist/src/DatePickers/shared/types.d.ts +0 -1
- package/dist/src/DatePickers/stories/WeekPicker.story.js +1 -1
- package/dist/src/DateRange/DateRange.js +36 -22
- package/dist/src/DateRange/DateRangeStyles.d.ts +0 -1
- package/dist/src/DateRange/EndTime.d.ts +3 -4
- package/dist/src/DateRange/StartTime.d.ts +3 -4
- package/dist/src/Decorations/index.js +1 -1
- package/dist/src/DescriptionList/DescriptionList.js +1 -13
- package/dist/src/DescriptionList/DescriptionList.parts.d.ts +0 -1
- package/dist/src/DescriptionList/DescriptionList.parts.js +156 -77
- package/dist/src/DescriptionList/DescriptionListContext.js +1 -15
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.js +8 -5
- package/dist/src/DescriptionList/stories/fixtures.d.ts +2 -2
- package/dist/src/Divider/Divider.d.ts +0 -1
- package/dist/src/DropdownMenu/DropdownItem.d.ts +0 -1
- package/dist/src/DropdownMenu/DropdownMenu.js +13 -17
- package/dist/src/DropdownMenu/DropdownMenu.story.js +2 -2
- package/dist/src/DropdownMenu/DropdownMenuContainer.d.ts +0 -1
- package/dist/src/DropdownMenu/DropdownMenuContainer.js +10 -1
- package/dist/src/DropdownMenu/DropdownText.d.ts +1 -2
- package/dist/src/FieldLabel/FieldLabel.js +2 -14
- package/dist/src/FieldLabel/HelpText.d.ts +1 -2
- package/dist/src/FieldLabel/LabelText.d.ts +0 -1
- package/dist/src/FieldLabel/MaybeFieldLabel.js +1 -15
- package/dist/src/FieldLabel/RequirementText.js +1 -1
- package/dist/src/Flex/Flex.d.ts +0 -1
- package/dist/src/Flex/Flex.story.js +3 -17
- package/dist/src/Form/Field.d.ts +0 -1
- package/dist/src/Form/Fieldset.d.ts +0 -1
- package/dist/src/Form/Form.js +3 -17
- package/dist/src/Form/FormSection.js +3 -17
- package/dist/src/Icon/Icon.js +9 -24
- package/dist/src/Icon/LoadingIcon.js +2 -14
- package/dist/src/Input/Input.js +3 -15
- package/dist/src/Input/InputField.js +4 -16
- package/dist/src/Input/Prefix.js +2 -16
- package/dist/src/Input/Suffix.js +2 -14
- package/dist/src/Layout/ApplicationFrame.js +2 -14
- package/dist/src/Layout/Header.js +4 -17
- package/dist/src/Layout/Page.applicationFrame.story.d.ts +8 -3
- package/dist/src/Layout/Page.applicationFrame.story.js +26 -12
- package/dist/src/Layout/Page.d.ts +2 -2
- package/dist/src/Layout/Page.js +5 -19
- package/dist/src/Layout/Page.story.d.ts +10 -5
- package/dist/src/Layout/Page.story.js +54 -20
- package/dist/src/Layout/Sidebar.js +4 -18
- package/dist/src/Layout/Sidebar.story.js +16 -30
- package/dist/src/Link/Link.js +13 -21
- package/dist/src/List/List.d.ts +0 -1
- package/dist/src/MaybeTooltip/MaybeTooltip.d.ts +14 -0
- package/dist/src/{TruncatedText/components → MaybeTooltip}/MaybeTooltip.js +4 -1
- package/dist/src/MaybeTooltip/MaybeTooltip.story.d.ts +12 -0
- package/dist/src/MaybeTooltip/MaybeTooltip.story.js +23 -0
- package/dist/src/Modal/Modal.story.js +1 -1
- package/dist/src/Modal/ModalCloseButton.d.ts +0 -1
- package/dist/src/Modal/ModalFooter.d.ts +0 -1
- package/dist/src/Modal/ModalHeader.d.ts +0 -1
- package/dist/src/NDSProvider/ComponentVariantContext.js +1 -1
- package/dist/src/NDSProvider/GlobalStyles.d.ts +0 -1
- package/dist/src/NDSProvider/ModalStyleOverride.d.ts +0 -1
- package/dist/src/NDSProvider/Reset.d.ts +0 -1
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.d.ts +2 -1
- package/dist/src/NDSProvider/renderWithNDSProvider.spec-utils.js +3 -1
- package/dist/src/NavBarSearch/NavBarSearch.js +2 -14
- package/dist/src/Navigation/Navigation.js +3 -16
- package/dist/src/Navigation/components/AppSwitcher/NulogyAppSwitcher.js +6 -3
- package/dist/src/Navigation/components/AppSwitcher/parts/Item.js +1 -15
- package/dist/src/Navigation/components/AppSwitcher/parts/Link.js +2 -16
- package/dist/src/Navigation/components/AppSwitcher/parts/index.d.ts +4 -5
- package/dist/src/Navigation/components/DesktopNav/DesktopNav.js +2 -2
- package/dist/src/Navigation/components/MenuSubItem/MenuSubItem.js +4 -5
- package/dist/src/Navigation/components/MenuSubItem/parts/styled.d.ts +0 -1
- package/dist/src/Navigation/components/MenuSubItem/parts/styled.js +49 -7
- package/dist/src/Navigation/components/MobileNav/MobileNav.js +2 -2
- package/dist/src/Navigation/components/MobileNav/parts/MobileMenuItem.js +12 -21
- package/dist/src/Navigation/components/MobileNav/parts/styled.d.ts +1 -2
- package/dist/src/Navigation/components/MobileNav/parts/styled.js +35 -4
- package/dist/src/Navigation/components/NulogyLogo/SvgNulogyLogo.js +1 -1
- package/dist/src/Navigation/components/UserMenu/UserMenu.d.ts +0 -1
- package/dist/src/Navigation/components/UserMenu/parts/Header.js +1 -1
- package/dist/src/Navigation/components/UserMenu/parts/Item.js +7 -16
- package/dist/src/Navigation/components/UserMenu/parts/MobileItem.js +7 -16
- package/dist/src/Navigation/components/UserMenu/parts/styled.d.ts +0 -1
- package/dist/src/Navigation/components/UserMenu/parts/styled.js +43 -18
- package/dist/src/Navigation/components/shared/NavigationLogo.js +4 -16
- package/dist/src/Navigation/components/shared/NavigationLogoLink.js +2 -14
- package/dist/src/Navigation/components/shared/NavigationMenuContent.d.ts +0 -1
- package/dist/src/Navigation/components/shared/NavigationMenuItem.js +10 -24
- package/dist/src/Navigation/components/shared/components.d.ts +0 -1
- package/dist/src/Navigation/components/shared/components.js +29 -5
- package/dist/src/Navigation/hooks/useResponsiveMenu.d.ts +0 -1
- package/dist/src/Navigation/stories/Navigation.mobileVisibility.story.js +21 -9
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo2.js +1 -1
- package/dist/src/Navigation/stories/fixtures/logos/CustomLogo3.js +1 -1
- package/dist/src/Navigation/stories/fixtures/logos/Customlogo1.js +1 -1
- package/dist/src/Overlay/Overlay.d.ts +0 -1
- package/dist/src/Pagination/PageNumber.d.ts +0 -1
- package/dist/src/Pagination/Pagination.js +3 -16
- package/dist/src/Pagination/PaginationButton.d.ts +0 -1
- package/dist/src/Popper/Popper.js +29 -6
- package/dist/src/Primitives/index.d.ts +0 -1
- package/dist/src/Radio/Radio.js +11 -18
- package/dist/src/Radio/Radio.story.d.ts +135 -129
- package/dist/src/Radio/Radio.story.js +8 -8
- package/dist/src/Radio/RadioGroup.js +4 -16
- package/dist/src/RangeContainer/RangeContainer.js +6 -15
- package/dist/src/Select/MenuList.js +13 -18
- package/dist/src/Select/Select.d.ts +1 -1
- package/dist/src/Select/Select.js +16 -17
- package/dist/src/Select/Select.story.d.ts +2 -2
- package/dist/src/Select/Select.story.fixture.js +8 -30
- package/dist/src/Select/Select.story.js +14 -29
- package/dist/src/Select/SelectComponents.js +7 -7
- package/dist/src/Select/SelectOption.js +1 -1
- package/dist/src/Select/customReactSelectStyles.js +152 -44
- package/dist/src/Select/lib.js +1 -2
- package/dist/src/SortingTable/SortingTable.js +6 -15
- package/dist/src/StatusIndicator/StatusIndicator.d.ts +0 -1
- package/dist/src/StatusIndicator/StatusIndicator.js +16 -1
- package/dist/src/Summary/Summary.js +2 -14
- package/dist/src/Summary/SummaryDivider.js +1 -1
- package/dist/src/Summary/SummaryItem.js +2 -14
- package/dist/src/Switcher/Switch.js +23 -19
- package/dist/src/Switcher/Switcher.js +4 -16
- package/dist/src/Table/BaseTable.js +2 -14
- package/dist/src/Table/StatefulTable.d.ts +1 -1
- package/dist/src/Table/StatefulTable.js +17 -9
- package/dist/src/Table/StyledTh.d.ts +0 -1
- package/dist/src/Table/StyledTh.js +11 -2
- package/dist/src/Table/Table.js +2 -14
- package/dist/src/Table/Table.types.d.ts +0 -1
- package/dist/src/Table/TableBody.js +11 -11
- package/dist/src/Table/TableFoot.js +5 -8
- package/dist/src/Table/TableHead.js +1 -4
- package/dist/src/Table/addExpandableControl.js +5 -2
- package/dist/src/Table/addSelectableControl.js +5 -2
- package/dist/src/Table/stories/TableWithCustomSorting.story.js +4 -1
- package/dist/src/Table/stories/TableWithFiltering.story.js +8 -2
- package/dist/src/Table/stories/TableWithServerSidePagination.story.js +4 -15
- package/dist/src/Tabs/Tab.js +11 -18
- package/dist/src/Tabs/TabContainer.d.ts +0 -1
- package/dist/src/Tabs/TabScrollIndicator.js +2 -14
- package/dist/src/Tabs/Tabs.js +5 -7
- package/dist/src/Textarea/Textarea.js +3 -15
- package/dist/src/TimePicker/TimePicker.js +2 -14
- package/dist/src/TimePicker/TimePickerDropdown.d.ts +0 -1
- package/dist/src/TimePicker/TimePickerInput.d.ts +0 -1
- package/dist/src/TimePicker/TimePickerInput.js +6 -4
- package/dist/src/TimeRange/TimeRange.js +20 -20
- package/dist/src/Toast/Toast.js +4 -16
- package/dist/src/ToastContainer/ToastContainer.js +4 -16
- package/dist/src/ToastContainer/ToastContainer.story.js +1 -1
- package/dist/src/ToastContainer/ToastFunction.js +7 -19
- package/dist/src/Toggle/Toggle.js +4 -17
- package/dist/src/Toggle/ToggleButton.js +2 -14
- package/dist/src/Tooltip/Tooltip.d.ts +2 -2
- package/dist/src/Tooltip/Tooltip.story.js +7 -7
- package/dist/src/Tooltip/TooltipContainer.d.ts +0 -1
- package/dist/src/Tooltip/TooltipContainer.js +16 -1
- package/dist/src/Tooltip/components/TooltipComponents.js +9 -24
- package/dist/src/TopBar/TopBar.styled.d.ts +14 -7
- package/dist/src/TopBar/components/BackLink.js +2 -14
- package/dist/src/TopBar/components/Menu.js +2 -15
- package/dist/src/TopBar/components/MenuItemLink.js +2 -14
- package/dist/src/TopBar/components/PageTitle.js +2 -14
- package/dist/src/TopBar/stories/TopBar.backButton.story.js +3 -3
- package/dist/src/TopBar/stories/TopBar.menu.story.js +9 -20
- package/dist/src/TopBar/stories/TopBar.story.js +3 -3
- package/dist/src/TruncatedText/TruncatedText.js +8 -16
- package/dist/src/TruncatedText/components/TruncatedTextFillWidth.js +4 -16
- package/dist/src/TruncatedText/components/TruncatedTextMaxCharacters.js +5 -17
- package/dist/src/TruncatedText/types.d.ts +1 -1
- package/dist/src/Type/Headings.d.ts +4 -5
- package/dist/src/Type/Text.d.ts +0 -1
- package/dist/src/Validation/InlineValidation.js +2 -14
- package/dist/src/VerticalDivider/VerticalDivider.d.ts +0 -1
- package/dist/src/VisualTests/WithSpace.story.js +18 -18
- package/dist/src/hooks/useMediaQuery/useMediaQuery.js +1 -2
- package/dist/src/i18n.js +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/locale.story.js +1 -1
- package/dist/src/theme/mergeThemes.util.js +7 -1
- package/dist/src/theme/useNDSTheme.js +9 -3
- package/dist/src/utils/ClickInputLabel.d.ts +0 -1
- package/dist/src/utils/PopperArrow.js +5 -1
- package/dist/src/utils/story/code.d.ts +0 -1
- package/dist/src/utils/story/dashed.d.ts +2 -2
- package/dist/src/utils/story/placeholder.js +1 -1
- package/dist/src/utils/story/resizable.d.ts +2 -2
- package/dist/src/utils/story/resizable.js +1 -1
- package/dist/src/utils/story/simulatedAPIRequests.js +8 -19
- package/dist/src/utils/subPx.js +1 -1
- package/dist/src/utils/testing/useConditionalAutoClick.js +3 -3
- package/dist/src/utils/testing/useUrlProps.js +1 -1
- package/dist/src/utils/ts/FocusManager.js +1 -1
- package/dist/src/utils/useWindowDimension.story.d.ts +1 -1
- package/dist/src/utils/withMenuState.js +1 -1
- package/package.json +43 -43
- package/dist/src/TruncatedText/components/MaybeTooltip.d.ts +0 -24
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import styled from "styled-components";
|
|
14
3
|
import { space } from "styled-system";
|
|
@@ -21,9 +10,8 @@ const StyledTable = styled.table(space, {
|
|
|
21
10
|
background: "white",
|
|
22
11
|
position: "relative",
|
|
23
12
|
});
|
|
24
|
-
function BaseTable(
|
|
25
|
-
|
|
26
|
-
return (React.createElement(StyledTable, Object.assign({ id: id, className: className }, props),
|
|
13
|
+
function BaseTable({ noRowsContent = "No records have been created for this table.", keyField = "id", loading = false, footerRows = [], rowHovers = true, compact = false, stickyHeader = false, onRowMouseEnter = () => { }, onRowMouseLeave = () => { }, columns, rows, id, className, rowBorder = false, ...props }) {
|
|
14
|
+
return (React.createElement(StyledTable, { id: id, className: className, ...props },
|
|
27
15
|
React.createElement(TableHead, { columns: columns, compact: compact, sticky: stickyHeader }),
|
|
28
16
|
React.createElement(TableBody, { columns: columns, rows: rows, keyField: keyField, noRowsContent: noRowsContent, loading: loading, rowHovers: rowHovers, compact: compact, onRowMouseLeave: onRowMouseLeave, onRowMouseEnter: onRowMouseEnter, rowBorder: rowBorder }),
|
|
29
17
|
footerRows && (React.createElement(TableFoot, { columns: columns, rows: footerRows, keyField: keyField, loading: loading, compact: compact }))));
|
|
@@ -85,7 +85,7 @@ declare class StatefulTable<ColumnMetaData> extends Component<StatefulTableProps
|
|
|
85
85
|
onRowMouseLeave?: (...args: any[]) => any;
|
|
86
86
|
onMouseEnter?: any;
|
|
87
87
|
onMouseLeave?: any;
|
|
88
|
-
rowBorder?:
|
|
88
|
+
rowBorder?: import("./Table.types").RowBorder;
|
|
89
89
|
selectedRows?: string[];
|
|
90
90
|
onRowSelectionChange?: (...args: any[]) => any;
|
|
91
91
|
onRowExpansionChange?: (...args: any[]) => any;
|
|
@@ -106,9 +106,12 @@ class StatefulTable extends Component {
|
|
|
106
106
|
this.goToPage = (pageNumber) => {
|
|
107
107
|
const { selectedRows } = this.state;
|
|
108
108
|
const { hasSelectableRows } = this.props;
|
|
109
|
-
this.setState(
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
this.setState({
|
|
110
|
+
currentPage: pageNumber,
|
|
111
|
+
...(hasSelectableRows && {
|
|
112
|
+
isHeaderSelected: this.areAllRowsSelectedOnPage(selectedRows, pageNumber),
|
|
113
|
+
}),
|
|
114
|
+
}, this.onPageSelectionChangeHandler);
|
|
112
115
|
};
|
|
113
116
|
this.currentRowsByPageSelector = (rows, pageNumber) => {
|
|
114
117
|
const currentRows = this.rowsByPageSelector(pageNumber);
|
|
@@ -150,11 +153,16 @@ class StatefulTable extends Component {
|
|
|
150
153
|
onRowExpansionChange: this.onExpandRow,
|
|
151
154
|
expandedRows,
|
|
152
155
|
};
|
|
153
|
-
const props =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
const props = {
|
|
157
|
+
...this.props,
|
|
158
|
+
rows: this.rowsByPageSelector(currentPage) || [],
|
|
159
|
+
...(hasSelectableRows && selectionConfig),
|
|
160
|
+
...(hasExpandableRows && expandableConfig),
|
|
161
|
+
};
|
|
162
|
+
const selectableProps = { ...props, ...addSelectableControl(props) };
|
|
163
|
+
const expandableProps = { ...props, ...addExpandableControl(props) };
|
|
156
164
|
if (hasSelectableRows && hasExpandableRows)
|
|
157
|
-
return
|
|
165
|
+
return { ...props, ...addExpandableControl(selectableProps) };
|
|
158
166
|
if (hasSelectableRows)
|
|
159
167
|
return selectableProps;
|
|
160
168
|
if (hasExpandableRows)
|
|
@@ -185,8 +193,8 @@ class StatefulTable extends Component {
|
|
|
185
193
|
const { rowsPerPage, paginationProps, paginationCss } = this.props;
|
|
186
194
|
const baseTableProps = pick(this.getControlProps(), ...propNames);
|
|
187
195
|
return (React.createElement(React.Fragment, null,
|
|
188
|
-
React.createElement(BaseTable,
|
|
189
|
-
rowsPerPage && (React.createElement(Pagination,
|
|
196
|
+
React.createElement(BaseTable, { ...baseTableProps }),
|
|
197
|
+
rowsPerPage && (React.createElement(Pagination, { pt: "x2", currentPage: currentPage, totalPages: paginatedRows.length || 1, onSelectPage: this.goToPage, onNext: this.goToNextPage, onPrevious: this.goToPrevPage, justifyContent: "flex-end", css: paginationCss, ...paginationProps }))));
|
|
190
198
|
}
|
|
191
199
|
}
|
|
192
200
|
StatefulTable.defaultProps = {
|
|
@@ -8,8 +8,17 @@ const stickyStyles = (theme) => ({
|
|
|
8
8
|
});
|
|
9
9
|
const StyledTh = styled.th(({ compact, theme, sticky, width }) => {
|
|
10
10
|
const padding = compact ? theme.space.x1 : theme.space.x2;
|
|
11
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
fontWeight: "normal",
|
|
13
|
+
textAlign: "left",
|
|
14
|
+
padding: `${padding} 0`,
|
|
15
|
+
paddingRight: padding,
|
|
16
|
+
color: theme.colors.darkGrey,
|
|
17
|
+
...(sticky && stickyStyles(theme)),
|
|
18
|
+
"&:first-child": {
|
|
12
19
|
paddingLeft: padding,
|
|
13
|
-
},
|
|
20
|
+
},
|
|
21
|
+
width: width || "auto",
|
|
22
|
+
};
|
|
14
23
|
});
|
|
15
24
|
export default StyledTh;
|
package/dist/src/Table/Table.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import StatefulTable from "./StatefulTable";
|
|
14
3
|
import BaseTable from "./BaseTable";
|
|
15
4
|
import SortingColumnHeader from "./SortingColumnHeader";
|
|
16
|
-
function Table(
|
|
17
|
-
|
|
18
|
-
return hasSelectableRows || rowsPerPage || hasExpandableRows ? (React.createElement(StatefulTable, Object.assign({ hasExpandableRows: hasExpandableRows, hasSelectableRows: hasSelectableRows, onRowExpansionChange: onRowExpansionChange, onRowSelectionChange: onRowSelectionChange, selectedRows: selectedRows, rowsPerPage: rowsPerPage, onPageChange: onPageChange, selectAllAriaLabel: selectAllAriaLabel, deselectAllAriaLabel: deselectAllAriaLabel, paginationCss: paginationCss, paginationProps: paginationProps }, props))) : (React.createElement(BaseTable, Object.assign({}, props)));
|
|
5
|
+
function Table({ hasSelectableRows, rowsPerPage, hasExpandableRows, selectedRows, onRowSelectionChange, onRowExpansionChange, onPageChange, selectAllAriaLabel, deselectAllAriaLabel, paginationCss, paginationProps, ...props }) {
|
|
6
|
+
return hasSelectableRows || rowsPerPage || hasExpandableRows ? (React.createElement(StatefulTable, { hasExpandableRows: hasExpandableRows, hasSelectableRows: hasSelectableRows, onRowExpansionChange: onRowExpansionChange, onRowSelectionChange: onRowSelectionChange, selectedRows: selectedRows, rowsPerPage: rowsPerPage, onPageChange: onPageChange, selectAllAriaLabel: selectAllAriaLabel, deselectAllAriaLabel: deselectAllAriaLabel, paginationCss: paginationCss, paginationProps: paginationProps, ...props })) : (React.createElement(BaseTable, { ...props }));
|
|
19
7
|
}
|
|
20
8
|
Table.SortingHeader = SortingColumnHeader;
|
|
21
9
|
export default Table;
|
|
@@ -7,23 +7,23 @@ const StyledMessageContainer = styled(Box)(({ theme }) => ({
|
|
|
7
7
|
fontSize: theme.fontSizes.small,
|
|
8
8
|
color: theme.colors.darkGrey,
|
|
9
9
|
}));
|
|
10
|
-
const StyledTr = styled.tr(({ rowHovers, rowBorder, theme }) => (
|
|
10
|
+
const StyledTr = styled.tr(({ rowHovers, rowBorder, theme }) => ({
|
|
11
|
+
"&:hover": {
|
|
11
12
|
backgroundColor: rowHovers ? theme.colors.whiteGrey : null,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
},
|
|
14
|
+
...(rowBorder && {
|
|
15
|
+
borderBottomWidth: 1,
|
|
16
|
+
borderBottomStyle: "solid",
|
|
17
|
+
borderBottomColor: theme.colors.lightGrey,
|
|
18
|
+
borderCollapse: "collapse",
|
|
19
|
+
}),
|
|
20
|
+
}));
|
|
18
21
|
const renderRows = (rows, columns, keyField, rowHovers, noRowsContent, compact, onRowMouseLeave, onRowMouseEnter, rowBorder) => rows.length > 0 ? (rows.map((row, rowIndex) => {
|
|
19
22
|
const rowKey = row[keyField] !== undefined ? row[keyField] : rowIndex;
|
|
20
23
|
return (React.createElement(TableBodyRow, { key: rowKey, row: row, columns: columns, keyField: keyField, rowHovers: rowHovers, compact: compact, rowClassName: row.rowClassName, onMouseEnter: (e) => onRowMouseEnter({ row, e }), onMouseLeave: (e) => onRowMouseLeave({ row, e }), rowBorder: rowBorder }));
|
|
21
24
|
})) : (React.createElement(TableMessageContainer, { colSpan: columns.length }, noRowsContent));
|
|
22
25
|
const TableBodyRow = ({ row, columns, rowHovers, compact, rowClassName, onMouseLeave, onMouseEnter, rowBorder, }) => {
|
|
23
|
-
const renderAllCells = () => columns.map((column, index) => {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
return (React.createElement(TableCell, { key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index, row: row, column: column, cellData: row[column.dataKey], compact: compact }));
|
|
26
|
-
});
|
|
26
|
+
const renderAllCells = () => columns.map((column, index) => (React.createElement(TableCell, { key: column.dataKey ?? column.key ?? index, row: row, column: column, cellData: row[column.dataKey], compact: compact })));
|
|
27
27
|
return (React.createElement(React.Fragment, null,
|
|
28
28
|
React.createElement(StyledTr, { rowHovers: rowHovers, "data-testid": "table-row", className: rowClassName, onMouseLeave: onMouseLeave, onMouseEnter: onMouseEnter, rowBorder: rowBorder }, row.heading ? (React.createElement(TableCell, { row: row, colSpan: columns.length, cellData: row.heading, compact: compact })) : (renderAllCells())),
|
|
29
29
|
row.expandedContent && row.expanded && (React.createElement("tr", { "data-testid": "expanded-table-row" },
|
|
@@ -11,14 +11,11 @@ const renderRows = (rows, columns, keyField, loading, compact) => rows.map((row)
|
|
|
11
11
|
const TableFooterRow = ({ row, columns, loading, compact }) => {
|
|
12
12
|
const columnsWithoutControls = columns.filter((column) => column.dataKey !== "selected" && column.dataKey !== "expanded");
|
|
13
13
|
const numberOfControlColumns = columns.length - columnsWithoutControls.length;
|
|
14
|
-
return (React.createElement(StyledFooterRow, null, columnsWithoutControls.map((column, index) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
align: column.align,
|
|
20
|
-
}, cellData: row[column.dataKey], compact: compact })));
|
|
21
|
-
})));
|
|
14
|
+
return (React.createElement(StyledFooterRow, null, columnsWithoutControls.map((column, index) => index === 0 ? (React.createElement(StyledTh, { key: column.dataKey, scope: "row", colSpan: numberOfControlColumns + 1, compact: compact }, row[column.dataKey])) : (!loading && (React.createElement(TableCell, { key: column.dataKey ?? column.key ?? index, row: row, column: {
|
|
15
|
+
dataKey: column.dataKey,
|
|
16
|
+
label: column.label,
|
|
17
|
+
align: column.align,
|
|
18
|
+
}, cellData: row[column.dataKey], compact: compact }))))));
|
|
22
19
|
};
|
|
23
20
|
function TableFoot({ columns, rows, keyField = "id", loading = false, compact = false, }) {
|
|
24
21
|
return React.createElement("tfoot", null, renderRows(rows, columns, keyField, loading, compact));
|
|
@@ -11,10 +11,7 @@ function renderHeaderCellContent({ headerFormatter = ({ label }) => label, align
|
|
|
11
11
|
: headerFormatter({ align, label, width, metadata, dataKey });
|
|
12
12
|
}
|
|
13
13
|
function TableHead({ columns, compact, sticky }) {
|
|
14
|
-
const renderColumns = (allColumns) => allColumns.map((column, index) => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
return (React.createElement(StyledTh, { scope: "col", key: (_b = (_a = column.dataKey) !== null && _a !== void 0 ? _a : column.key) !== null && _b !== void 0 ? _b : index, width: column.width, compact: compact, "data-testid": "table-head", sticky: sticky }, renderHeaderCellContent(column)));
|
|
17
|
-
});
|
|
14
|
+
const renderColumns = (allColumns) => allColumns.map((column, index) => (React.createElement(StyledTh, { scope: "col", key: column.dataKey ?? column.key ?? index, width: column.width, compact: compact, "data-testid": "table-head", sticky: sticky }, renderHeaderCellContent(column))));
|
|
18
15
|
return (React.createElement("thead", null,
|
|
19
16
|
React.createElement(StyledHeaderRow, null, renderColumns(columns))));
|
|
20
17
|
}
|
|
@@ -10,7 +10,7 @@ const ExpandCell = ({ row, onRowExpansionChange }) => {
|
|
|
10
10
|
const expandLabel = row.expandAriaLabel || t("expand row");
|
|
11
11
|
return (React.createElement(React.Fragment, null, row.expandedContent && (React.createElement(ControlIcon, { icon: row[EXPANDABLE_COLUMN_DATA_KEY] ? "upArrow" : "downArrow", label: row[EXPANDABLE_COLUMN_DATA_KEY] ? collapseLabel : expandLabel, onClick: expandRowHandler }))));
|
|
12
12
|
};
|
|
13
|
-
const expandCellRenderer = (onRowExpansionChange) => (props) => (React.createElement(ExpandCell,
|
|
13
|
+
const expandCellRenderer = (onRowExpansionChange) => (props) => (React.createElement(ExpandCell, { onRowExpansionChange: onRowExpansionChange, ...props }));
|
|
14
14
|
const addExpandableColumn = ({ columns, onRowExpansionChange }) => {
|
|
15
15
|
const expandableColumn = {
|
|
16
16
|
dataKey: EXPANDABLE_COLUMN_DATA_KEY,
|
|
@@ -29,7 +29,10 @@ const addExpandableCell = ({ rows, keyField, expandedRows }) => {
|
|
|
29
29
|
[EXPANDABLE_COLUMN_DATA_KEY]: expandedRows ? expandedRows.includes(rowKey) : false,
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
const transformedRows = rows.map((row) => (
|
|
32
|
+
const transformedRows = rows.map((row) => ({
|
|
33
|
+
...expandableCellData(row[keyField]),
|
|
34
|
+
...row,
|
|
35
|
+
}));
|
|
33
36
|
return transformedRows;
|
|
34
37
|
};
|
|
35
38
|
export const addExpandableControl = (props) => ({
|
|
@@ -18,7 +18,7 @@ const SelectCell = ({ row, onSelectRow }) => {
|
|
|
18
18
|
const ariaLabel = checked ? checkedAriaLabel : uncheckedAriaLabel;
|
|
19
19
|
return React.createElement(Checkbox, { "aria-label": ariaLabel, checked: checked, onChange: selectRowHandler });
|
|
20
20
|
};
|
|
21
|
-
const selectCellRenderer = (onSelectRow) => (props) => React.createElement(SelectCell,
|
|
21
|
+
const selectCellRenderer = (onSelectRow) => (props) => React.createElement(SelectCell, { onSelectRow: onSelectRow, ...props });
|
|
22
22
|
export const addSelectableControl = ({ columns, rows, onSelectRow, onSelectHeader, keyField, selectedRows, isHeaderSelected, selectAllAriaLabel, deselectAllAriaLabel, }) => {
|
|
23
23
|
const selectableColumn = {
|
|
24
24
|
dataKey: SELECTABLE_COLUMN_DATA_KEY,
|
|
@@ -30,7 +30,10 @@ export const addSelectableControl = ({ columns, rows, onSelectRow, onSelectHeade
|
|
|
30
30
|
[SELECTABLE_COLUMN_DATA_KEY]: selectedRows.includes(rowKey),
|
|
31
31
|
});
|
|
32
32
|
const transformedColumns = [selectableColumn, ...columns];
|
|
33
|
-
const transformedRows = rows.map((row) => (
|
|
33
|
+
const transformedRows = rows.map((row) => ({
|
|
34
|
+
...selectableCellData(row[keyField]),
|
|
35
|
+
...row,
|
|
36
|
+
}));
|
|
34
37
|
return {
|
|
35
38
|
rows: transformedRows,
|
|
36
39
|
columns: transformedColumns,
|
|
@@ -46,7 +46,10 @@ const TableWithCustomSorting = () => {
|
|
|
46
46
|
};
|
|
47
47
|
const transformColumn = (column) => {
|
|
48
48
|
const isAscending = sortState.ascending && column.dataKey === sortState.sortColumn;
|
|
49
|
-
return
|
|
49
|
+
return {
|
|
50
|
+
...column,
|
|
51
|
+
headerFormatter: ({ label, dataKey }) => (React.createElement(Table.SortingHeader, { onChange: () => onSortChange(dataKey), label: label, ascending: isAscending, active: dataKey === sortState.sortColumn })),
|
|
52
|
+
};
|
|
50
53
|
};
|
|
51
54
|
const columns = COLUMNS.map((column) => transformColumn(column));
|
|
52
55
|
return React.createElement(Table, { columns: columns, rows: rows, keyField: KEY_FIELD });
|
|
@@ -17,7 +17,10 @@ const ROWS = [
|
|
|
17
17
|
{ name: "F. Scott Fitzgerald", description: "author" },
|
|
18
18
|
];
|
|
19
19
|
const transformColumn = (column, onChange) => {
|
|
20
|
-
return
|
|
20
|
+
return {
|
|
21
|
+
...column,
|
|
22
|
+
headerFormatter: ({ label, dataKey }) => (React.createElement(ColumnHeaderWithFilter, { onChange: (e) => onChange(dataKey, e), label: label })),
|
|
23
|
+
};
|
|
21
24
|
};
|
|
22
25
|
const ColumnHeaderWithFilter = ({ onChange, label }) => (React.createElement(Input, { labelText: `Filter by ${label}`, onChange: onChange, name: label }));
|
|
23
26
|
const TableWithFilters = ({ rowsPerPage }) => {
|
|
@@ -36,7 +39,10 @@ const TableWithFilters = ({ rowsPerPage }) => {
|
|
|
36
39
|
}, [filter]);
|
|
37
40
|
const onFilterInputChange = (dataKey, e) => {
|
|
38
41
|
const filterValue = e.currentTarget.value;
|
|
39
|
-
return setFilter((state) => (
|
|
42
|
+
return setFilter((state) => ({
|
|
43
|
+
...state,
|
|
44
|
+
[dataKey]: filterValue,
|
|
45
|
+
}));
|
|
40
46
|
};
|
|
41
47
|
const columns = COLUMNS.map((column) => transformColumn(column, onFilterInputChange));
|
|
42
48
|
return React.createElement(Table, { columns: columns, rows: rows, keyField: "name", rowsPerPage: rowsPerPage });
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import { Table } from "../..";
|
|
14
3
|
import { Pagination } from "../../Pagination";
|
|
@@ -29,10 +18,10 @@ class TableWithServerSidePagination extends React.Component {
|
|
|
29
18
|
.then((json) => {
|
|
30
19
|
this.setState({
|
|
31
20
|
loading: false,
|
|
32
|
-
rows: json.map((
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}),
|
|
21
|
+
rows: json.map(({ completed, ...item }) => ({
|
|
22
|
+
...item,
|
|
23
|
+
completed: completed ? "Yes" : "-",
|
|
24
|
+
})),
|
|
36
25
|
}, callback);
|
|
37
26
|
});
|
|
38
27
|
};
|
package/dist/src/Tabs/Tab.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React from "react";
|
|
13
2
|
import styled from "styled-components";
|
|
14
3
|
import { variant } from "styled-system";
|
|
@@ -41,7 +30,10 @@ const getBarHoverStyles = (selected, disabled, theme) => {
|
|
|
41
30
|
if (disabled || selected) {
|
|
42
31
|
return null;
|
|
43
32
|
}
|
|
44
|
-
return
|
|
33
|
+
return {
|
|
34
|
+
...barStyles(theme).expanded,
|
|
35
|
+
backgroundColor: theme.colors.lightBlue,
|
|
36
|
+
};
|
|
45
37
|
};
|
|
46
38
|
const TabButton = styled.button(({ selected, disabled, fullWidth, theme }) => ({
|
|
47
39
|
width: fullWidth ? "100%" : undefined,
|
|
@@ -68,9 +60,13 @@ const TabButton = styled.button(({ selected, disabled, fullWidth, theme }) => ({
|
|
|
68
60
|
"&:disabled": {
|
|
69
61
|
opacity: ".5",
|
|
70
62
|
},
|
|
71
|
-
"&:before":
|
|
63
|
+
"&:before": {
|
|
64
|
+
...getBarStyles(selected, theme),
|
|
65
|
+
},
|
|
72
66
|
"&:hover": {
|
|
73
|
-
"&:before":
|
|
67
|
+
"&:before": {
|
|
68
|
+
...getBarHoverStyles(selected, disabled, theme),
|
|
69
|
+
},
|
|
74
70
|
},
|
|
75
71
|
}), variant({
|
|
76
72
|
variants: {
|
|
@@ -80,8 +76,5 @@ const TabButton = styled.button(({ selected, disabled, fullWidth, theme }) => ({
|
|
|
80
76
|
},
|
|
81
77
|
},
|
|
82
78
|
}));
|
|
83
|
-
const Tab = React.forwardRef((
|
|
84
|
-
var { label } = _a, props = __rest(_a, ["label"]);
|
|
85
|
-
return (React.createElement(TabButton, Object.assign({ role: "tab", type: "button", ref: ref }, props), label));
|
|
86
|
-
});
|
|
79
|
+
const Tab = React.forwardRef(({ label, ...props }, ref) => (React.createElement(TabButton, { role: "tab", type: "button", ref: ref, ...props }, label)));
|
|
87
80
|
export default Tab;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
declare const TabContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("../Box").BoxProps> & import("../Box").BoxProps, never>> & string;
|
|
3
2
|
export default TabContainer;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import styled from "styled-components";
|
|
13
2
|
import React from "react";
|
|
14
3
|
import { useTranslation } from "react-i18next";
|
|
@@ -47,15 +36,14 @@ const TabScrollIndicatorButton = styled.button(({ side, width, theme }) => ({
|
|
|
47
36
|
opacity: ".5",
|
|
48
37
|
},
|
|
49
38
|
}));
|
|
50
|
-
const TabScrollIndicator = (
|
|
51
|
-
var { side = "left", width = 40, ariaLabelLeft, ariaLabelRight, onClick } = _a, props = __rest(_a, ["side", "width", "ariaLabelLeft", "ariaLabelRight", "onClick"]);
|
|
39
|
+
const TabScrollIndicator = ({ side = "left", width = 40, ariaLabelLeft, ariaLabelRight, onClick, ...props }) => {
|
|
52
40
|
const { t } = useTranslation();
|
|
53
41
|
const rightArrowLabel = ariaLabelRight || t("next");
|
|
54
42
|
const leftArrowLabel = ariaLabelLeft || t("previous");
|
|
55
43
|
function preventFocusMovement(event) {
|
|
56
44
|
event.preventDefault();
|
|
57
45
|
}
|
|
58
|
-
return (React.createElement(TabScrollIndicatorButton,
|
|
46
|
+
return (React.createElement(TabScrollIndicatorButton, { ...props, width: width, tabIndex: -1, onClick: onClick, onMouseDown: preventFocusMovement, side: side, "aria-label": side === "right" ? rightArrowLabel : leftArrowLabel },
|
|
59
47
|
React.createElement(Icon, { icon: side === "right" ? "rightArrow" : "leftArrow" })));
|
|
60
48
|
};
|
|
61
49
|
export default TabScrollIndicator;
|
package/dist/src/Tabs/Tabs.js
CHANGED
|
@@ -28,7 +28,7 @@ class Tabs extends React.Component {
|
|
|
28
28
|
}
|
|
29
29
|
getTabs(setFocusToTab, focusedIndex, handleArrowNavigation) {
|
|
30
30
|
const { fitted, children, onTabClick, variant } = this.props;
|
|
31
|
-
const componentVariant = variant
|
|
31
|
+
const componentVariant = variant ?? this.context.size;
|
|
32
32
|
const selectedIndex = this.getSelectedIndex();
|
|
33
33
|
const tabs = React.Children.toArray(children);
|
|
34
34
|
return tabs
|
|
@@ -36,10 +36,9 @@ class Tabs extends React.Component {
|
|
|
36
36
|
.map((tab, index) => {
|
|
37
37
|
return React.cloneElement(tab, {
|
|
38
38
|
onClick: (e) => {
|
|
39
|
-
var _a, _b;
|
|
40
39
|
setFocusToTab(index);
|
|
41
|
-
if (
|
|
42
|
-
|
|
40
|
+
if (tab?.props?.onClick) {
|
|
41
|
+
tab?.props?.onClick(e);
|
|
43
42
|
}
|
|
44
43
|
if (onTabClick) {
|
|
45
44
|
onTabClick(e, index);
|
|
@@ -71,13 +70,12 @@ class Tabs extends React.Component {
|
|
|
71
70
|
const tabContent = tabs
|
|
72
71
|
.filter((tab) => Boolean(tab))
|
|
73
72
|
.map((tab, index) => {
|
|
74
|
-
var _a;
|
|
75
73
|
const selected = index === selectedIndex;
|
|
76
74
|
if (renderTabContentOnlyWhenSelected && !selected) {
|
|
77
75
|
return null;
|
|
78
76
|
}
|
|
79
77
|
else {
|
|
80
|
-
return (React.createElement("div", { "aria-hidden": !selected, hidden: !selected, selected: selected, key: tab.key || tab.label },
|
|
78
|
+
return (React.createElement("div", { "aria-hidden": !selected, hidden: !selected, selected: selected, key: tab.key || tab.label }, tab?.props?.children));
|
|
81
79
|
}
|
|
82
80
|
});
|
|
83
81
|
return tabContent;
|
|
@@ -91,7 +89,7 @@ class Tabs extends React.Component {
|
|
|
91
89
|
const { className } = this.props;
|
|
92
90
|
const spaceProps = getSubset(this.props, propTypes.space);
|
|
93
91
|
return (React.createElement(Box, { position: "relative" },
|
|
94
|
-
React.createElement(FocusManager, { refs: this.tabRefs, defaultFocusedIndex: this.getSelectedIndex() }, ({ focusedIndex, setFocusedIndex, handleArrowNavigation }) => (React.createElement(TabScrollIndicators, { tabRefs: this.tabRefs, tabContainerRef: this.tabContainerRef }, ({ handleScroll, handleResize }) => (React.createElement(TabContainer,
|
|
92
|
+
React.createElement(FocusManager, { refs: this.tabRefs, defaultFocusedIndex: this.getSelectedIndex() }, ({ focusedIndex, setFocusedIndex, handleArrowNavigation }) => (React.createElement(TabScrollIndicators, { tabRefs: this.tabRefs, tabContainerRef: this.tabContainerRef }, ({ handleScroll, handleResize }) => (React.createElement(TabContainer, { className: className, role: "tablist", onScroll: handleScroll, ref: this.tabContainerRef, ...spaceProps },
|
|
95
93
|
React.createElement(ReactResizeDetector, { handleWidth: true, onResize: handleResize }),
|
|
96
94
|
this.getTabs(setFocusedIndex, focusedIndex, handleArrowNavigation)))))),
|
|
97
95
|
this.getTabContent()));
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import React, { forwardRef } from "react";
|
|
13
2
|
import propTypes from "@styled-system/prop-types";
|
|
14
3
|
import { Field } from "../Form";
|
|
@@ -17,14 +6,13 @@ import { InlineValidation } from "../Validation";
|
|
|
17
6
|
import { getSubset, omitSubset } from "../utils/subset";
|
|
18
7
|
import { useComponentVariant } from "../NDSProvider/ComponentVariantContext";
|
|
19
8
|
import StyledTextarea from "./StyledTextarea";
|
|
20
|
-
const Textarea = forwardRef((
|
|
21
|
-
var { disabled = false, required = false, rows = 3, errorMessage, errorList, error = !!(errorMessage || errorList), labelText, requirementText, helpText, id, className, isResizeable = true, variant } = _a, props = __rest(_a, ["disabled", "required", "rows", "errorMessage", "errorList", "error", "labelText", "requirementText", "helpText", "id", "className", "isResizeable", "variant"]);
|
|
9
|
+
const Textarea = forwardRef(({ disabled = false, required = false, rows = 3, errorMessage, errorList, error = !!(errorMessage || errorList), labelText, requirementText, helpText, id, className, isResizeable = true, variant, ...props }, ref) => {
|
|
22
10
|
const componentVariant = useComponentVariant(variant);
|
|
23
11
|
const spaceProps = getSubset(props, propTypes.space);
|
|
24
12
|
const restProps = omitSubset(props, propTypes.space);
|
|
25
|
-
return (React.createElement(Field,
|
|
13
|
+
return (React.createElement(Field, { className: className, ...spaceProps },
|
|
26
14
|
React.createElement(MaybeFieldLabel, { labelText: labelText, requirementText: requirementText, helpText: helpText },
|
|
27
|
-
React.createElement(StyledTextarea,
|
|
15
|
+
React.createElement(StyledTextarea, { "aria-invalid": error, "aria-required": required, required: required, id: id, ref: ref, errorMessage: errorMessage, errorList: errorList, error: error, rows: rows, isResizeable: isResizeable, variant: componentVariant, disabled: disabled, ...restProps })),
|
|
28
16
|
React.createElement(InlineValidation, { mt: "x1", errorMessage: errorMessage, errorList: errorList })));
|
|
29
17
|
});
|
|
30
18
|
export default Textarea;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
// @ts-nocheck
|
|
13
2
|
import React, { useState, useContext, useEffect, forwardRef, useRef, useCallback } from "react";
|
|
14
3
|
import { setMinutes } from "date-fns";
|
|
@@ -100,8 +89,7 @@ export const getTimeOptions = (interval, timeFormat, minTime, maxTime, locale) =
|
|
|
100
89
|
.sort((a, b) => getIntervalFromTime(a.value, interval) - getIntervalFromTime(b.value, interval))
|
|
101
90
|
.slice(startingInterval, finalInterval);
|
|
102
91
|
};
|
|
103
|
-
const TimePicker = forwardRef((
|
|
104
|
-
var { timeFormat, interval, className, minTime, maxTime, defaultValue, onInputChange, onBlur, onFocus, errorMessage, errorList, labelText, placeholder, onClick, onChange, "aria-label": ariaLabel, value, error, disabled, variant } = _a, props = __rest(_a, ["timeFormat", "interval", "className", "minTime", "maxTime", "defaultValue", "onInputChange", "onBlur", "onFocus", "errorMessage", "errorList", "labelText", "placeholder", "onClick", "onChange", "aria-label", "value", "error", "disabled", "variant"]);
|
|
92
|
+
const TimePicker = forwardRef(({ timeFormat, interval, className, minTime, maxTime, defaultValue, onInputChange, onBlur, onFocus, errorMessage, errorList, labelText, placeholder, onClick, onChange, "aria-label": ariaLabel, value, error, disabled, variant, ...props }, inputRef) => {
|
|
105
93
|
const [input, setInput] = useState(defaultValue ? defaultValue : "");
|
|
106
94
|
const [currentOptionRef, setCurrentOptionRef] = useState(null);
|
|
107
95
|
const [dropdownIsOpen, setDropdownIsOpen] = useState(false);
|
|
@@ -196,7 +184,7 @@ const TimePicker = forwardRef((_a, inputRef) => {
|
|
|
196
184
|
};
|
|
197
185
|
const displayValue = value ? value : input || "";
|
|
198
186
|
return (React.createElement(React.Fragment, null,
|
|
199
|
-
React.createElement(Box,
|
|
187
|
+
React.createElement(Box, { className: `nds-time-picker ${className || ""}`, position: "relative", ref: onRefChange, width: componentVariant === "touch" ? "208px" : "130px", "data-testid": "select-container", ...props },
|
|
200
188
|
React.createElement(TimePickerInput, { labelText: labelText, error: hasError, dropdownIsOpen: dropdownIsOpen, onChange: handleInputChange, onFocus: handleFocus, value: displayValue, placeholder: placeholder, iconRight: "queryBuilder", onClick: handleClickInput, onKeyDown: (e) => handleKeyDown(e), "aria-label": ariaLabel || t("Select a time"), inputWidth: componentVariant === "touch" ? "208px" : "130px", iconRightSize: "x2", "data-testid": "select-input", type: "text", ref: inputRef, disabled: disabled, autoComplete: "off", variant: componentVariant }),
|
|
201
189
|
React.createElement(TimePickerDropdown, { isOpen: dropdownIsOpen, "aria-expanded": dropdownIsOpen, role: "listbox", "data-testid": "select-dropdown", ref: dropdownRef }, dropdownOptions.map((option, i) => {
|
|
202
190
|
const isClosest = matchingIndex === i;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
declare const TimePickerDropdown: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
3
2
|
export default TimePickerDropdown;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import { InputField } from "../Input/InputField";
|
|
3
|
-
const TimePickerInput = styled(InputField)(({ dropdownIsOpen }) => (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const TimePickerInput = styled(InputField)(({ dropdownIsOpen }) => ({
|
|
4
|
+
...(dropdownIsOpen && {
|
|
5
|
+
borderBottomLeftRadius: "0px",
|
|
6
|
+
borderBottomRightRadius: "0px",
|
|
7
|
+
}),
|
|
8
|
+
}));
|
|
7
9
|
export default TimePickerInput;
|