@nulogy/components 15.2.2 → 15.2.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/main.js +53133 -54186
- package/dist/main.module.js +5924 -6977
- 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.js +5 -19
- 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/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.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/MaybeTooltip.d.ts +1 -1
- package/dist/src/TruncatedText/components/TruncatedTextFillWidth.js +3 -15
- package/dist/src/TruncatedText/components/TruncatedTextMaxCharacters.js +4 -16
- 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/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 +24 -27
|
@@ -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 { layout, space } from "styled-system";
|
|
@@ -38,9 +27,6 @@ const StyledButton = styled.button(({ toggled, disabled, theme }) => ({
|
|
|
38
27
|
backgroundColor: theme.colors.lightGrey,
|
|
39
28
|
},
|
|
40
29
|
}), space, layout);
|
|
41
|
-
const ControlIcon = React.forwardRef((
|
|
42
|
-
|
|
43
|
-
return (React.createElement(StyledButton, Object.assign({ "aria-label": label, ref: ref, disabled: disabled, toggled: toggled, type: type }, props),
|
|
44
|
-
React.createElement(Icon, { size: size, icon: icon })));
|
|
45
|
-
});
|
|
30
|
+
const ControlIcon = React.forwardRef(({ icon, toggled, disabled, label, size = "x4", type = "button", ...props }, ref) => (React.createElement(StyledButton, { "aria-label": label, ref: ref, disabled: disabled, toggled: toggled, type: type, ...props },
|
|
31
|
+
React.createElement(Icon, { size: size, icon: icon }))));
|
|
46
32
|
export default ControlIcon;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ButtonProps } from "./Button";
|
|
3
2
|
declare const DangerButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
3
|
export default DangerButton;
|
|
@@ -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, variant } from "styled-system";
|
|
@@ -18,19 +7,16 @@ import icons from "@nulogy/icons";
|
|
|
18
7
|
import { Icon } from "../Icon";
|
|
19
8
|
import { Text } from "../Type";
|
|
20
9
|
import { useComponentVariant } from "../NDSProvider/ComponentVariantContext";
|
|
21
|
-
const IconWrapper = styled.span(({ theme, size }) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
transition: ".2s",
|
|
32
|
-
});
|
|
33
|
-
});
|
|
10
|
+
const IconWrapper = styled.span(({ theme, size }) => ({
|
|
11
|
+
display: "inline-flex",
|
|
12
|
+
flexShrink: 0,
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
borderRadius: theme.radii.rounded,
|
|
16
|
+
height: `calc(${theme.sizes[size] ?? size} + ${theme.sizes.x1})`,
|
|
17
|
+
width: `calc(${theme.sizes[size] ?? size} + ${theme.sizes.x1})`,
|
|
18
|
+
transition: ".2s",
|
|
19
|
+
}));
|
|
34
20
|
const HoverText = styled.div(({ theme }) => ({
|
|
35
21
|
whiteSpace: "nowrap",
|
|
36
22
|
ontSize: theme.fontSizes.small,
|
|
@@ -42,61 +28,58 @@ const HoverText = styled.div(({ theme }) => ({
|
|
|
42
28
|
padding: `${theme.space.half} ${theme.space.x1}`,
|
|
43
29
|
pointerEvents: "none",
|
|
44
30
|
}));
|
|
45
|
-
const WrapperButton = styled.button(({ disabled, hoverBackgroundColor, theme }) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
31
|
+
const WrapperButton = styled.button(({ disabled, hoverBackgroundColor, theme }) => ({
|
|
32
|
+
background: "transparent",
|
|
33
|
+
border: "none",
|
|
34
|
+
position: "relative",
|
|
35
|
+
display: "inline-flex",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
cursor: disabled ? "default" : "pointer",
|
|
38
|
+
[`${Text}`]: {
|
|
39
|
+
display: "block",
|
|
40
|
+
fontWeight: theme.fontWeights.medium,
|
|
41
|
+
textAlign: "left",
|
|
42
|
+
},
|
|
43
|
+
[`${HoverText}`]: {
|
|
44
|
+
opacity: "0",
|
|
45
|
+
},
|
|
46
|
+
"&:hover": {
|
|
47
|
+
[`${IconWrapper}`]: {
|
|
48
|
+
backgroundColor: theme.colors[hoverBackgroundColor] ?? hoverBackgroundColor,
|
|
58
49
|
},
|
|
59
50
|
[`${HoverText}`]: {
|
|
60
|
-
opacity: "
|
|
51
|
+
opacity: "1",
|
|
61
52
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
opacity: "1",
|
|
68
|
-
},
|
|
53
|
+
},
|
|
54
|
+
"&:active": {
|
|
55
|
+
[`${IconWrapper}`]: {
|
|
56
|
+
transform: "scale(0.875)",
|
|
57
|
+
transition: ".2s ease-in",
|
|
69
58
|
},
|
|
70
|
-
|
|
59
|
+
},
|
|
60
|
+
"&:disabled": {
|
|
61
|
+
opacity: ".5",
|
|
62
|
+
"&:hover, &:active": {
|
|
71
63
|
[`${IconWrapper}`]: {
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
background: "none",
|
|
65
|
+
transform: "none",
|
|
74
66
|
},
|
|
75
67
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
transform: "none",
|
|
82
|
-
},
|
|
83
|
-
},
|
|
68
|
+
},
|
|
69
|
+
"&:focus": {
|
|
70
|
+
outline: "none",
|
|
71
|
+
[`${IconWrapper}`]: {
|
|
72
|
+
boxShadow: theme.shadows.focus,
|
|
84
73
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
[`${IconWrapper}`]: {
|
|
88
|
-
boxShadow: theme.shadows.focus,
|
|
89
|
-
},
|
|
90
|
-
[`${HoverText}`]: {
|
|
91
|
-
opacity: "1",
|
|
92
|
-
},
|
|
74
|
+
[`${HoverText}`]: {
|
|
75
|
+
opacity: "1",
|
|
93
76
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}, variant({
|
|
77
|
+
},
|
|
78
|
+
paddingTop: theme.space.half,
|
|
79
|
+
paddingBottom: theme.space.half,
|
|
80
|
+
paddingLeft: theme.space.none,
|
|
81
|
+
paddingRight: theme.space.none,
|
|
82
|
+
}), variant({
|
|
100
83
|
variants: {
|
|
101
84
|
touch: {
|
|
102
85
|
fontSize: "md",
|
|
@@ -104,10 +87,9 @@ const WrapperButton = styled.button(({ disabled, hoverBackgroundColor, theme })
|
|
|
104
87
|
},
|
|
105
88
|
},
|
|
106
89
|
}), space);
|
|
107
|
-
const IconicButton = React.forwardRef((
|
|
108
|
-
var { children, color = "darkBlue", hoverBackgroundColor = "lightBlue", icon, labelHidden, className, iconSize = "x3", fontSize, tooltip, variant } = _a, props = __rest(_a, ["children", "color", "hoverBackgroundColor", "icon", "labelHidden", "className", "iconSize", "fontSize", "tooltip", "variant"]);
|
|
90
|
+
const IconicButton = React.forwardRef(({ children, color = "darkBlue", hoverBackgroundColor = "lightBlue", icon, labelHidden, className, iconSize = "x3", fontSize, tooltip, variant, ...props }, forwardedRef) => {
|
|
109
91
|
const componentVariant = useComponentVariant(variant);
|
|
110
|
-
return (React.createElement(WrapperButton,
|
|
92
|
+
return (React.createElement(WrapperButton, { ref: forwardedRef, "aria-label": props["aria-label"] ? props["aria-label"] : typeof children === "string" ? children : undefined, className: className, hoverBackgroundColor: hoverBackgroundColor, variant: componentVariant, ...props },
|
|
111
93
|
React.createElement(Manager, null,
|
|
112
94
|
React.createElement(Reference, null, ({ ref }) => (React.createElement(IconWrapper, { ref: ref, size: iconSize },
|
|
113
95
|
React.createElement(Icon, { size: iconSize, icon: icon, color: color })))),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ButtonProps } from "./Button";
|
|
3
2
|
declare const PrimaryButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
3
|
export default PrimaryButton;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ButtonProps } from "./Button";
|
|
3
2
|
declare const QuietButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>, keyof import("react").Component<any, {}, any>>;
|
|
4
3
|
export default QuietButton;
|
|
@@ -24,7 +24,13 @@ const buttonSpacings = (theme) => ({
|
|
|
24
24
|
});
|
|
25
25
|
const getAlignment = (alignment) => alignments[alignment] || alignments.left;
|
|
26
26
|
const getButtonSpacing = (alignment, theme) => buttonSpacings(theme)[alignment] || buttonSpacings(theme).left;
|
|
27
|
-
const ButtonGroup = styled(Flex)(({ alignment = "left", theme }) => (
|
|
27
|
+
const ButtonGroup = styled(Flex)(({ alignment = "left", theme }) => ({
|
|
28
|
+
flexWrap: "wrap",
|
|
29
|
+
marginBottom: `-${theme.space.x1}`,
|
|
30
|
+
justifyContent: getAlignment(alignment),
|
|
31
|
+
button: {
|
|
28
32
|
marginBottom: theme.space.x1,
|
|
29
|
-
}
|
|
33
|
+
},
|
|
34
|
+
...getButtonSpacing(alignment, theme),
|
|
35
|
+
}));
|
|
30
36
|
export default ButtonGroup;
|
package/dist/src/Card/Card.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
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 { Box } from "../Box";
|
|
14
|
-
export default function Card(
|
|
15
|
-
|
|
16
|
-
return (React.createElement(Box, Object.assign({ border: "1px solid", borderColor: "lightGrey", borderRadius: borderRadius, boxShadow: boxShadow, py: py, px: px, position: position }, props), children));
|
|
3
|
+
export default function Card({ borderRadius = "medium", boxShadow = "small", py = "x2", px = "x2", position = "relative", children, ...props }) {
|
|
4
|
+
return (React.createElement(Box, { border: "1px solid", borderColor: "lightGrey", borderRadius: borderRadius, boxShadow: boxShadow, py: py, px: px, position: position, ...props }, children));
|
|
17
5
|
}
|
|
@@ -47,7 +47,7 @@ export const AdvancedUsage = () => {
|
|
|
47
47
|
React.createElement(TopBar.BackLink, { href: "/cycle-counts" }, "Cycle counts"),
|
|
48
48
|
React.createElement(TopBar.PageTitle, null, "Cycle count #3992"),
|
|
49
49
|
React.createElement(TopBar.Menu, null, menuItems.map((props) => (React.createElement(TopBar.MenuItem, { key: props.title },
|
|
50
|
-
React.createElement(TopBar.MenuItemLink,
|
|
50
|
+
React.createElement(TopBar.MenuItemLink, { ...props })))))) },
|
|
51
51
|
React.createElement(Page, { fullHeight: true },
|
|
52
52
|
React.createElement(CardSet, null, [...Array(10)].map((_, i) => (React.createElement(AdvancedCard, { key: i })))))));
|
|
53
53
|
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
declare const CardSet: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("../Box").BoxProps> & import("../Box").BoxProps, keyof import("../Flex/Flex").FlexProps> & import("../Flex/Flex").FlexProps, never>> & string;
|
|
3
2
|
export default CardSet;
|
|
@@ -68,7 +68,16 @@ const VisualCheckbox = styled.div(({ indeterminate, theme }) => ({
|
|
|
68
68
|
marginBottom: theme.space.x0_5,
|
|
69
69
|
},
|
|
70
70
|
// checkmark
|
|
71
|
-
"&:before":
|
|
71
|
+
"&:before": {
|
|
72
|
+
content: "''",
|
|
73
|
+
display: "none",
|
|
74
|
+
position: "relative",
|
|
75
|
+
left: theme.space.half,
|
|
76
|
+
width: theme.sizes.half,
|
|
77
|
+
height: theme.sizes.x1,
|
|
78
|
+
border: `solid ${theme.colors.white}`,
|
|
79
|
+
...(indeterminate ? indeterminateStyles : checkedStyles),
|
|
80
|
+
},
|
|
72
81
|
}), addStyledProps);
|
|
73
82
|
const CheckboxInput = styled.input((props) => ({
|
|
74
83
|
position: "absolute",
|
|
@@ -78,19 +87,24 @@ const CheckboxInput = styled.input((props) => ({
|
|
|
78
87
|
[`&:focus + ${VisualCheckbox}`]: {
|
|
79
88
|
boxShadow: props.theme.shadows.focus,
|
|
80
89
|
},
|
|
81
|
-
[`&:checked + ${VisualCheckbox}`]:
|
|
90
|
+
[`&:checked + ${VisualCheckbox}`]: {
|
|
91
|
+
...getCheckboxStyle(props, "checked"),
|
|
92
|
+
"&:before": {
|
|
82
93
|
display: "block",
|
|
83
|
-
}
|
|
84
|
-
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
[`&:not(:checked) + ${VisualCheckbox}`]: {
|
|
97
|
+
...getCheckboxStyle(props, "unchecked"),
|
|
98
|
+
},
|
|
85
99
|
}));
|
|
86
100
|
const Checkbox = forwardRef((props, ref) => {
|
|
87
101
|
const { variant, className, labelText, disabled, checked, required, error, indeterminate } = props;
|
|
88
102
|
const componentVariant = useComponentVariant(variant);
|
|
89
103
|
const spaceProps = getSubset(props, propTypes.space);
|
|
90
104
|
const restProps = omitSubset(props, propTypes.space);
|
|
91
|
-
return (React.createElement(Box,
|
|
105
|
+
return (React.createElement(Box, { className: className, px: "0", ...spaceProps },
|
|
92
106
|
React.createElement(ClickInputLabel, { variant: componentVariant, disabled: disabled },
|
|
93
|
-
React.createElement(CheckboxInput,
|
|
107
|
+
React.createElement(CheckboxInput, { type: "checkbox", required: required, "aria-required": required, "aria-invalid": error, indeterminate: indeterminate, ref: ref, ...restProps }),
|
|
94
108
|
React.createElement(VisualCheckbox, { disabled: disabled, checked: checked, indeterminate: indeterminate, "data-testid": "visual-checkbox" }),
|
|
95
109
|
labelText && (React.createElement(Text, { fontSize: componentVariant === "touch" ? "md" : undefined, lineHeight: componentVariant === "touch" ? "base" : undefined, disabled: disabled, ml: "x1" }, labelText)))));
|
|
96
110
|
});
|
|
@@ -4,7 +4,10 @@ class CheckboxWithState extends React.Component {
|
|
|
4
4
|
constructor(props) {
|
|
5
5
|
super(props);
|
|
6
6
|
this.handleChange = (key) => {
|
|
7
|
-
this.setState((state) => (
|
|
7
|
+
this.setState((state) => ({
|
|
8
|
+
...state,
|
|
9
|
+
[key]: !state[key],
|
|
10
|
+
}));
|
|
8
11
|
};
|
|
9
12
|
this.state = { checkbox1: false, checkbox2: false };
|
|
10
13
|
}
|
|
@@ -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 { HelpText, RequirementText } from "../FieldLabel";
|
|
@@ -18,9 +7,8 @@ import { InlineIcon } from "../Icon";
|
|
|
18
7
|
import { Tooltip } from "../Tooltip";
|
|
19
8
|
import LabelText, { LabelContent } from "../FieldLabel/LabelText";
|
|
20
9
|
import Checkbox from "./Checkbox";
|
|
21
|
-
export default function CheckboxGroup(
|
|
22
|
-
|
|
23
|
-
const otherProps = Object.assign(Object.assign({}, props), { errorMessage, errorList });
|
|
10
|
+
export default function CheckboxGroup({ className, id, errorMessage, errorList, labelText, helpText, requirementText, hint, ...props }) {
|
|
11
|
+
const otherProps = { ...props, errorMessage, errorList };
|
|
24
12
|
return (React.createElement(Fieldset, { className: className, id: id },
|
|
25
13
|
React.createElement(Legend, null,
|
|
26
14
|
React.createElement(LabelContent, { "data-testid": "label-content" },
|
|
@@ -34,8 +22,8 @@ export default function CheckboxGroup(_a) {
|
|
|
34
22
|
}
|
|
35
23
|
const getCheckboxButtons = (props) => {
|
|
36
24
|
const checkboxButtons = React.Children.map(props.children, (checkbox) => {
|
|
37
|
-
const
|
|
38
|
-
return (React.createElement(Checkbox,
|
|
25
|
+
const { value, disabled, required, onChange, ...checkboxProps } = checkbox.props;
|
|
26
|
+
return (React.createElement(Checkbox, { ...checkboxProps, value: value, disabled: props.disabled || disabled, error: !!(props.errorMessage || props.errorList), required: props.required || required, name: props.name, defaultChecked: props.defaultValue ? props.defaultValue.includes(value) : undefined, checked: props.checkedValue ? props.checkedValue.includes(value) : undefined, onChange: props.onChange || onChange }));
|
|
39
27
|
});
|
|
40
28
|
return checkboxButtons;
|
|
41
29
|
};
|
|
@@ -1,22 +1,10 @@
|
|
|
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, useState, useEffect } from "react";
|
|
13
2
|
import { subDays, addDays, isValid, isAfter, isBefore, isSameDay } from "date-fns";
|
|
14
3
|
import { BasePicker } from "./shared/components/BasePicker";
|
|
15
4
|
import { DatePickerHeader } from "./shared/components/DatePickerHeader";
|
|
16
5
|
const DEFAULT_DATE_FORMAT = "yyyy-MMM-dd";
|
|
17
6
|
const DEFAULT_PLACEHOLDER = "YYYY-Mon-DD";
|
|
18
|
-
const DatePicker = forwardRef((
|
|
19
|
-
var { selected, dateFormat = DEFAULT_DATE_FORMAT, onChange } = _a, props = __rest(_a, ["selected", "dateFormat", "onChange"]);
|
|
7
|
+
const DatePicker = forwardRef(({ selected, dateFormat = DEFAULT_DATE_FORMAT, onChange, ...props }, datePickerRef) => {
|
|
20
8
|
const [selectedDate, setSelectedDate] = useState(selected);
|
|
21
9
|
const [ref] = useState(null);
|
|
22
10
|
useEffect(() => {
|
|
@@ -46,6 +34,6 @@ const DatePicker = forwardRef((_a, datePickerRef) => {
|
|
|
46
34
|
ref.setOpen(!isOpen);
|
|
47
35
|
}
|
|
48
36
|
};
|
|
49
|
-
return (React.createElement(BasePicker,
|
|
37
|
+
return (React.createElement(BasePicker, { ...props, selected: selectedDate, dateFormat: dateFormat, onChange: handleSelectedDateChange, ref: datePickerRef, defaultFormat: DEFAULT_DATE_FORMAT, defaultPlaceholder: DEFAULT_PLACEHOLDER, showMonthYearPicker: false, disabledKeyboardNavigation: true, onUpKeyPress: handleUpKey, onDownKeyPress: handleDownKey, onEnterKeyPress: handleEnterKey, renderHeader: (headerProps) => (React.createElement(DatePickerHeader, { locale: props.locale, ...headerProps })) }));
|
|
50
38
|
});
|
|
51
39
|
export default DatePicker;
|
|
@@ -1,22 +1,10 @@
|
|
|
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, useState, useEffect } from "react";
|
|
13
2
|
import { noop } from "../utils/noop";
|
|
14
3
|
import { BasePicker } from "./shared/components/BasePicker";
|
|
15
4
|
import { MonthDatePickerHeader } from "./custom/MonthPickerHeader";
|
|
16
5
|
export const DEFAULT_MONTH_FORMAT = "yyyy-MMM";
|
|
17
6
|
export const DEFAULT_PLACEHOLDER = "YYYY-Mon";
|
|
18
|
-
const MonthPicker = forwardRef((
|
|
19
|
-
var { selected, dateFormat = DEFAULT_MONTH_FORMAT, onChange } = _a, props = __rest(_a, ["selected", "dateFormat", "onChange"]);
|
|
7
|
+
const MonthPicker = forwardRef(({ selected, dateFormat = DEFAULT_MONTH_FORMAT, onChange, ...props }, monthPickerRef) => {
|
|
20
8
|
const [selectedDate, setSelectedDate] = useState(selected);
|
|
21
9
|
const [ref] = useState(null);
|
|
22
10
|
useEffect(() => {
|
|
@@ -36,6 +24,6 @@ const MonthPicker = forwardRef((_a, monthPickerRef) => {
|
|
|
36
24
|
ref.setOpen(!isOpen);
|
|
37
25
|
}
|
|
38
26
|
};
|
|
39
|
-
return (React.createElement(BasePicker,
|
|
27
|
+
return (React.createElement(BasePicker, { ...props, selected: selectedDate, onChange: handleSelectedDateChange, ref: monthPickerRef, dateFormat: dateFormat, defaultFormat: DEFAULT_MONTH_FORMAT, defaultPlaceholder: DEFAULT_PLACEHOLDER, showMonthYearPicker: true, renderHeader: (headerProps) => (React.createElement(MonthDatePickerHeader, { locale: props.locale, ...headerProps })), onUpKeyPress: handleUpKey, onDownKeyPress: handleDownKey, onEnterKeyPress: handleEnterKey }));
|
|
40
28
|
});
|
|
41
29
|
export default MonthPicker;
|
|
@@ -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 propTypes from "@styled-system/prop-types";
|
|
13
2
|
import { addDays, endOfWeek, getWeek, getYear, isAfter, isBefore, isSameDay, isValid, startOfWeek, subDays, } from "date-fns";
|
|
14
3
|
import React, { forwardRef, useEffect, useState } from "react";
|
|
@@ -40,8 +29,7 @@ const roundMaxDateToWeekEnd = (date) => {
|
|
|
40
29
|
const weekEnd = endOfWeek(date, { weekStartsOn: WEEK_START_DAY });
|
|
41
30
|
return isBefore(date, weekEnd) ? addDays(startOfWeek(date, { weekStartsOn: WEEK_START_DAY }), -1) : weekEnd;
|
|
42
31
|
};
|
|
43
|
-
const WeekPicker = forwardRef((
|
|
44
|
-
var { dateFormat, errorMessage, errorList, inputProps, minDate, maxDate, locale, disableFlipping, className, onInputChange, onChange, onBlur, onFocus, selected } = _a, props = __rest(_a, ["dateFormat", "errorMessage", "errorList", "inputProps", "minDate", "maxDate", "locale", "disableFlipping", "className", "onInputChange", "onChange", "onBlur", "onFocus", "selected"]);
|
|
32
|
+
const WeekPicker = forwardRef(({ dateFormat, errorMessage, errorList, inputProps, minDate, maxDate, locale, disableFlipping, className, onInputChange, onChange, onBlur, onFocus, selected, ...props }, datePickerRef) => {
|
|
45
33
|
const [selectedDate, setSelectedDate] = useState(selected);
|
|
46
34
|
const { locale: contextLocale } = useLocale();
|
|
47
35
|
const { i18n } = useTranslation();
|
|
@@ -111,7 +99,7 @@ const WeekPicker = forwardRef((_a, datePickerRef) => {
|
|
|
111
99
|
}
|
|
112
100
|
};
|
|
113
101
|
const renderCustomHeader = (props) => {
|
|
114
|
-
return React.createElement(DatePickerHeader,
|
|
102
|
+
return React.createElement(DatePickerHeader, { locale: currentLocale, ...props });
|
|
115
103
|
};
|
|
116
104
|
const weekPickerRefHandler = (r) => {
|
|
117
105
|
if (datePickerRef) {
|
|
@@ -119,10 +107,15 @@ const WeekPicker = forwardRef((_a, datePickerRef) => {
|
|
|
119
107
|
}
|
|
120
108
|
onRefChange(r);
|
|
121
109
|
};
|
|
122
|
-
const customInputProps =
|
|
123
|
-
|
|
110
|
+
const customInputProps = {
|
|
111
|
+
...InputFieldDefaultProps,
|
|
112
|
+
error: !!(errorMessage || errorList),
|
|
113
|
+
...inputProps,
|
|
114
|
+
placeholder: (inputProps && inputProps.placeholder) ||
|
|
115
|
+
(finalDateFormat === defaultDateFormat ? defaultPlaceholder : finalDateFormat),
|
|
116
|
+
};
|
|
124
117
|
const customInput = (React.createElement(DatePickerInput, { locale: currentLocale, variant: componentVariant, inputProps: customInputProps, dateFormat: finalDateFormat, onInputChange: handleInputChange, onUpKeyPress: handleUpKey, onDownKeyPress: handleDownKey, onEnterKeyPress: handleEnterKey }));
|
|
125
|
-
return (React.createElement(Field,
|
|
118
|
+
return (React.createElement(Field, { className: `${className} nds-date-picker`, ...spaceProps },
|
|
126
119
|
React.createElement(DatePickerStyles, null),
|
|
127
120
|
React.createElement(WeekPickerStyles, { variant: componentVariant }),
|
|
128
121
|
React.createElement(ReactDatePicker, { showWeekNumbers: true, showWeekPicker: true, weekLabel: weekShorthand, calendarStartDay: WEEK_START_DAY, selected: selectedDate, openToDate: selectedDate, dateFormat: finalDateFormat, onChange: handleSelectedDateChange, customInput: customInput, renderCustomHeader: renderCustomHeader, strictParsing: true, minDate: roundedMinDate, maxDate: roundedMaxDate, locale: NDS_TO_DATE_FN_LOCALES_MAP[currentLocale], ref: weekPickerRefHandler, onFocus: onFocus, onBlur: onBlur, popperModifiers: getPopperModifiers(disableFlipping), disabledKeyboardNavigation: true }),
|
|
@@ -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, useState } from "react";
|
|
13
2
|
import propTypes from "@styled-system/prop-types";
|
|
14
3
|
import ReactDatePicker from "react-datepicker";
|
|
@@ -23,8 +12,7 @@ import { InlineValidation } from "../../../Validation";
|
|
|
23
12
|
import { DatePickerStyles } from "../styles";
|
|
24
13
|
import { getPopperModifiers } from "../helpers";
|
|
25
14
|
import DatePickerInput from "./DatePickerInput";
|
|
26
|
-
export const BasePicker = forwardRef((
|
|
27
|
-
var { dateFormat, errorMessage, errorList, inputProps, minDate, maxDate, disableFlipping, className, onInputChange, onChange, onBlur, onFocus, selected, highlightDates, defaultFormat, defaultPlaceholder, showMonthYearPicker, showWeekNumbers, renderHeader, onUpKeyPress, onDownKeyPress, onEnterKeyPress, locale, disabledKeyboardNavigation, name, required } = _a, props = __rest(_a, ["dateFormat", "errorMessage", "errorList", "inputProps", "minDate", "maxDate", "disableFlipping", "className", "onInputChange", "onChange", "onBlur", "onFocus", "selected", "highlightDates", "defaultFormat", "defaultPlaceholder", "showMonthYearPicker", "showWeekNumbers", "renderHeader", "onUpKeyPress", "onDownKeyPress", "onEnterKeyPress", "locale", "disabledKeyboardNavigation", "name", "required"]);
|
|
15
|
+
export const BasePicker = forwardRef(({ dateFormat, errorMessage, errorList, inputProps, minDate, maxDate, disableFlipping, className, onInputChange, onChange, onBlur, onFocus, selected, highlightDates, defaultFormat, defaultPlaceholder, showMonthYearPicker, showWeekNumbers, renderHeader, onUpKeyPress, onDownKeyPress, onEnterKeyPress, locale, disabledKeyboardNavigation, name, required, ...props }, pickerRef) => {
|
|
28
16
|
const { locale: contextLocale } = useLocale();
|
|
29
17
|
const [ref, setRef] = useState(null);
|
|
30
18
|
const componentVariant = useComponentVariant();
|
|
@@ -48,7 +36,13 @@ export const BasePicker = forwardRef((_a, pickerRef) => {
|
|
|
48
36
|
ref.setOpen(!isOpen);
|
|
49
37
|
}
|
|
50
38
|
};
|
|
51
|
-
const customInputProps =
|
|
39
|
+
const customInputProps = {
|
|
40
|
+
...InputFieldDefaultProps,
|
|
41
|
+
inputWidth: componentVariant === "touch" ? "280px" : "184px",
|
|
42
|
+
error: !!(errorMessage || errorList),
|
|
43
|
+
...inputProps,
|
|
44
|
+
placeholder: (inputProps && inputProps.placeholder) || (dateFormat === defaultFormat ? defaultPlaceholder : dateFormat),
|
|
45
|
+
};
|
|
52
46
|
const customInput = (React.createElement(DatePickerInput, { locale: currentLocale, variant: componentVariant, inputProps: customInputProps, dateFormat: dateFormat, onInputChange: handleInputChange, onUpKeyPress: onUpKeyPress, onDownKeyPress: onDownKeyPress, onEnterKeyPress: handleEnterKey }));
|
|
53
47
|
const pickerRefHandler = (r) => {
|
|
54
48
|
if (pickerRef) {
|
|
@@ -57,7 +51,7 @@ export const BasePicker = forwardRef((_a, pickerRef) => {
|
|
|
57
51
|
onRefChange(r);
|
|
58
52
|
};
|
|
59
53
|
const spaceProps = getSubset(props, propTypes.space);
|
|
60
|
-
return (React.createElement(Field,
|
|
54
|
+
return (React.createElement(Field, { className: `${className} nds-date-picker`, ...spaceProps },
|
|
61
55
|
React.createElement(DatePickerStyles, null),
|
|
62
56
|
React.createElement(ReactDatePicker, { highlightDates: highlightDates, selected: selected, openToDate: selected, dateFormat: dateFormat, onChange: onChange, customInput: customInput, renderCustomHeader: renderHeader, strictParsing: true, minDate: minDate, maxDate: maxDate, locale: NDS_TO_DATE_FN_LOCALES_MAP[currentLocale], ref: pickerRefHandler, onFocus: onFocus, onBlur: onBlur, showMonthYearPicker: showMonthYearPicker, showWeekNumbers: showWeekNumbers, name: name, required: required, onEnterKeyPress: onEnterKeyPress, popperModifiers: getPopperModifiers(disableFlipping), disabledKeyboardNavigation: disabledKeyboardNavigation }),
|
|
63
57
|
React.createElement(InlineValidation, { mt: "x1", errorMessage: errorMessage, errorList: errorList })));
|
|
@@ -1,20 +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, { forwardRef } from "react";
|
|
13
2
|
import { useTranslation } from "react-i18next";
|
|
14
3
|
import { InputField, InputFieldDefaultProps } from "../../../Input/InputField";
|
|
15
4
|
const DatePickerInput = forwardRef(({ onChange, onClick, onBlur, onFocus, onInputChange, value, inputProps = InputFieldDefaultProps, onUpKeyPress, onDownKeyPress, onEnterKeyPress, variant, locale, "aria-label": ariaLabel, }, ref) => {
|
|
16
5
|
const { i18n } = useTranslation();
|
|
17
|
-
const { placeholder
|
|
6
|
+
const { placeholder, ...inputFieldProps } = inputProps;
|
|
18
7
|
const handleChange = (event) => {
|
|
19
8
|
onInputChange(event);
|
|
20
9
|
if (onChange) {
|
|
@@ -40,6 +29,6 @@ const DatePickerInput = forwardRef(({ onChange, onClick, onBlur, onFocus, onInpu
|
|
|
40
29
|
break;
|
|
41
30
|
}
|
|
42
31
|
};
|
|
43
|
-
return (React.createElement(InputField,
|
|
32
|
+
return (React.createElement(InputField, { onBlur: onBlur, onFocus: onFocus, ref: ref, variant: variant, "aria-label": ariaLabel || t("select a date"), autoComplete: "off", value: value, placeholder: placeholder, iconRight: "calendarToday", iconRightSize: "x2", onClick: onClick, onKeyDown: handleKeyDown, onChange: handleChange, ...inputFieldProps }));
|
|
44
33
|
});
|
|
45
34
|
export default DatePickerInput;
|
|
@@ -33,7 +33,7 @@ export const AdvancedUsage = () => {
|
|
|
33
33
|
setInputValue(value);
|
|
34
34
|
// Custom validation could be implemented here
|
|
35
35
|
};
|
|
36
|
-
return (React.createElement(WeekPicker, { selected: selectedWeek
|
|
36
|
+
return (React.createElement(WeekPicker, { selected: selectedWeek?.startDate, onChange: handleWeekChange, onInputChange: handleInputChange, minDate: new Date(2023, 0, 1), maxDate: new Date(), errorMessage: hasError ? "Please select a valid week" : undefined, inputProps: {
|
|
37
37
|
value: inputValue,
|
|
38
38
|
inputWidth: "560px",
|
|
39
39
|
placeholder: "Select a week",
|