@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, { useState, useEffect, forwardRef, useImperativeHandle, useRef } from "react";
|
|
13
2
|
import { useTranslation } from "react-i18next";
|
|
14
3
|
import { TimePicker } from "../TimePicker";
|
|
@@ -17,8 +6,10 @@ import { FieldLabelDefaultProps } from "../FieldLabel/FieldLabel.type";
|
|
|
17
6
|
import { useComponentVariant } from "../NDSProvider/ComponentVariantContext";
|
|
18
7
|
import { getDuration } from "./TimeRange.utils";
|
|
19
8
|
const DEFAULT_LABEL = "Time Range";
|
|
20
|
-
const TimeRange = forwardRef((
|
|
21
|
-
|
|
9
|
+
const TimeRange = forwardRef(({ timeFormat, onRangeChange, onStartTimeChange, onEndTimeChange, errorMessage, defaultStartTime, defaultEndTime, minTime, maxTime, interval, startAriaLabel, endAriaLabel, endTimeProps, startTimeProps, variant, disableRangeValidation = false, labelProps = {
|
|
10
|
+
...FieldLabelDefaultProps,
|
|
11
|
+
labelText: DEFAULT_LABEL,
|
|
12
|
+
}, ...props }, ref) => {
|
|
22
13
|
const [startTime, setStartTime] = useState();
|
|
23
14
|
const [endTime, setEndTime] = useState();
|
|
24
15
|
const [rangeError, setRangeError] = useState();
|
|
@@ -27,18 +18,24 @@ const TimeRange = forwardRef((_a, ref) => {
|
|
|
27
18
|
const { t } = useTranslation();
|
|
28
19
|
const componentVariant = useComponentVariant(variant);
|
|
29
20
|
useImperativeHandle(ref, () => ({
|
|
30
|
-
inputRef1:
|
|
21
|
+
inputRef1: {
|
|
22
|
+
...inputRef1,
|
|
23
|
+
focus: () => {
|
|
31
24
|
if (inputRef1.current) {
|
|
32
25
|
// @ts-ignore
|
|
33
26
|
inputRef1.current.focus();
|
|
34
27
|
}
|
|
35
|
-
}
|
|
36
|
-
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
inputRef2: {
|
|
31
|
+
...inputRef2,
|
|
32
|
+
focus: () => {
|
|
37
33
|
if (inputRef2.current) {
|
|
38
34
|
// @ts-ignore
|
|
39
35
|
inputRef2.current.focus();
|
|
40
36
|
}
|
|
41
|
-
}
|
|
37
|
+
},
|
|
38
|
+
},
|
|
42
39
|
}));
|
|
43
40
|
useEffect(() => {
|
|
44
41
|
validateTimeRange();
|
|
@@ -74,8 +71,11 @@ const TimeRange = forwardRef((_a, ref) => {
|
|
|
74
71
|
});
|
|
75
72
|
}
|
|
76
73
|
};
|
|
77
|
-
const startInput = (React.createElement(TimePicker,
|
|
78
|
-
const endInput = (React.createElement(TimePicker,
|
|
79
|
-
return (React.createElement(RangeContainer,
|
|
74
|
+
const startInput = (React.createElement(TimePicker, { timeFormat: timeFormat, defaultValue: defaultStartTime, selected: startTime, onChange: changeStartTimeHandler, minTime: minTime, maxTime: endTime || maxTime, interval: interval, "aria-label": startAriaLabel || t("select a start time"), "data-testid": "timerange-start-time", ref: inputRef1, error: rangeError, variant: componentVariant, ...startTimeProps }));
|
|
75
|
+
const endInput = (React.createElement(TimePicker, { timeFormat: timeFormat, defaultValue: defaultEndTime, selected: endTime, onChange: changeEndTimeHandler, maxTime: maxTime, minTime: startTime || minTime, interval: interval, "aria-label": endAriaLabel || t("select an end time"), "data-testid": "timerange-end-time", ref: inputRef2, error: rangeError, variant: componentVariant, ...endTimeProps }));
|
|
76
|
+
return (React.createElement(RangeContainer, { labelProps: {
|
|
77
|
+
...labelProps,
|
|
78
|
+
labelText: labelProps.labelText === DEFAULT_LABEL ? t("time range") : labelProps.labelText,
|
|
79
|
+
}, startComponent: startInput, endComponent: endInput, errorMessages: !disableRangeValidation ? [rangeError, errorMessage] : [errorMessage], variant: componentVariant, ...props }));
|
|
80
80
|
});
|
|
81
81
|
export default TimeRange;
|
package/dist/src/Toast/Toast.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, { useState, useEffect } from "react";
|
|
13
2
|
import { AnimatePresence } from "framer-motion";
|
|
14
3
|
import Alert from "../Alert/Alert";
|
|
@@ -31,8 +20,7 @@ export const toastAnimationConfig = {
|
|
|
31
20
|
transition: { ease: "easeOut", duration: 0.15 },
|
|
32
21
|
},
|
|
33
22
|
};
|
|
34
|
-
export const Toast = (
|
|
35
|
-
var { triggered = false, isCloseable = false, showDuration = TOAST_SHOW_DURATION, onHide, onShow, children, onHidden, zIndex } = _a, props = __rest(_a, ["triggered", "isCloseable", "showDuration", "onHide", "onShow", "children", "onHidden", "zIndex"]);
|
|
23
|
+
export const Toast = ({ triggered = false, isCloseable = false, showDuration = TOAST_SHOW_DURATION, onHide, onShow, children, onHidden, zIndex, ...props }) => {
|
|
36
24
|
const [visible, setVisible] = useState(triggered);
|
|
37
25
|
const [timeoutID, setTimeoutID] = useState(undefined);
|
|
38
26
|
const cancelHidingToast = () => {
|
|
@@ -85,9 +73,9 @@ export const Toast = (_a) => {
|
|
|
85
73
|
const handleCloseButtonClick = () => {
|
|
86
74
|
hideToast(0);
|
|
87
75
|
};
|
|
88
|
-
return (React.createElement(AnimatePresence, { initial: false }, visible && (React.createElement(AnimatedBox,
|
|
76
|
+
return (React.createElement(AnimatePresence, { initial: false }, visible && (React.createElement(AnimatedBox, { onMouseEnter: onMouseIn,
|
|
89
77
|
/* @ts-ignore */
|
|
90
|
-
onFocus: onMouseIn, onMouseLeave: onMouseOut, onBlur: onMouseOut, position: "fixed", bottom: "0", left: "0", right: "0", marginLeft: "auto", marginRight: "auto", width: "fit-content", zIndex: zIndex, boxShadow: "medium", layout: true
|
|
91
|
-
React.createElement(Alert,
|
|
78
|
+
onFocus: onMouseIn, onMouseLeave: onMouseOut, onBlur: onMouseOut, position: "fixed", bottom: "0", left: "0", right: "0", marginLeft: "auto", marginRight: "auto", width: "fit-content", zIndex: zIndex, boxShadow: "medium", layout: true, ...toastAnimationConfig },
|
|
79
|
+
React.createElement(Alert, { minWidth: "200px", maxWidth: "600px", isCloseable: isCloseable, onClose: handleCloseButtonClick, controlled: true, ...props }, children)))));
|
|
92
80
|
};
|
|
93
81
|
export default Toast;
|
|
@@ -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, { useEffect } from "react";
|
|
13
2
|
import { toast as _toast, Toaster, useToasterStore } from "react-hot-toast";
|
|
14
3
|
import { useTheme } from "styled-components";
|
|
15
4
|
import { TOAST_SHOW_DURATION } from "../Toast/Toast";
|
|
16
5
|
import numberFromDimension from "../utils/numberFromDimension";
|
|
17
|
-
const ToastContainer = (
|
|
18
|
-
var { gap, position = "bottom-center", reverseOrder = false, containerClassName = "nds-toast-container", toastOptions = { duration: TOAST_SHOW_DURATION }, maxVisibleToasts = 8 } = _a, props = __rest(_a, ["gap", "position", "reverseOrder", "containerClassName", "toastOptions", "maxVisibleToasts"]);
|
|
6
|
+
const ToastContainer = ({ gap, position = "bottom-center", reverseOrder = false, containerClassName = "nds-toast-container", toastOptions = { duration: TOAST_SHOW_DURATION }, maxVisibleToasts = 8, ...props }) => {
|
|
19
7
|
const theme = useTheme();
|
|
20
8
|
const { toasts } = useToasterStore();
|
|
21
9
|
useEffect(() => {
|
|
@@ -24,8 +12,8 @@ const ToastContainer = (_a) => {
|
|
|
24
12
|
.filter((_, i) => i >= maxVisibleToasts)
|
|
25
13
|
.forEach((t) => _toast.dismiss(t.id));
|
|
26
14
|
}, [toasts, maxVisibleToasts]);
|
|
27
|
-
return (React.createElement(Toaster,
|
|
28
|
-
custom:
|
|
29
|
-
}, position: position, reverseOrder: reverseOrder, containerClassName: containerClassName
|
|
15
|
+
return (React.createElement(Toaster, { gutter: gap || numberFromDimension(theme.space.x1), toastOptions: {
|
|
16
|
+
custom: { ...toastOptions },
|
|
17
|
+
}, position: position, reverseOrder: reverseOrder, containerClassName: containerClassName, ...props }));
|
|
30
18
|
};
|
|
31
19
|
export default ToastContainer;
|
|
@@ -59,7 +59,7 @@ export const WithEverything = () => {
|
|
|
59
59
|
React.createElement(Flex, { flexDirection: "column" },
|
|
60
60
|
React.createElement(Text, { fontWeight: "bold" }, "Trigger toasts from anywhere using the `toast` function"),
|
|
61
61
|
React.createElement("pre", null, `import { toast } from "@nulogy/components"`),
|
|
62
|
-
React.createElement("pre", null, toastFunctionTemplate
|
|
62
|
+
React.createElement("pre", null, toastFunctionTemplate ?? getToastFunctionTemplate())),
|
|
63
63
|
React.createElement(Flex, { gap: "x2", flexDirection: "column" },
|
|
64
64
|
React.createElement(Select, { defaultValue: type, options: [{ value: "random", label: "Random" }, ...types], labelText: "Type", onChange: (value) => setType(value) }),
|
|
65
65
|
React.createElement(Select, { defaultValue: behavior, options: [
|
|
@@ -1,32 +1,20 @@
|
|
|
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 { AnimatePresence } from "framer-motion";
|
|
14
3
|
import { toast as _toast } from "react-hot-toast";
|
|
15
4
|
import { Alert } from "../Alert";
|
|
16
5
|
import { AnimatedBox } from "../Box";
|
|
17
6
|
import { toastAnimationConfig } from "../Toast/Toast";
|
|
18
|
-
const CustomToast = (
|
|
19
|
-
var { isVisible, id, children } = _a, props = __rest(_a, ["isVisible", "id", "children"]);
|
|
7
|
+
const CustomToast = ({ isVisible, id, children, ...props }) => {
|
|
20
8
|
const handleClose = () => {
|
|
21
9
|
_toast.dismiss(id);
|
|
22
10
|
};
|
|
23
|
-
return (React.createElement(AnimatePresence, null, isVisible && (React.createElement(AnimatedBox,
|
|
24
|
-
React.createElement(Alert,
|
|
11
|
+
return (React.createElement(AnimatePresence, null, isVisible && (React.createElement(AnimatedBox, { key: "notification", role: "alert", ...toastAnimationConfig },
|
|
12
|
+
React.createElement(Alert, { controlled: true, onClose: handleClose, ...props }, children)))));
|
|
25
13
|
};
|
|
26
14
|
const toast = {
|
|
27
|
-
danger: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast,
|
|
28
|
-
informative: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast,
|
|
29
|
-
success: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast,
|
|
30
|
-
warning: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast,
|
|
15
|
+
danger: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast, { id: t.id, isVisible: t.visible, type: "danger", ...props }, children)), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
16
|
+
informative: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast, { id: t.id, isVisible: t.visible, type: "informative", ...props }, children)), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
17
|
+
success: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast, { id: t.id, isVisible: t.visible, type: "success", ...props }, children)), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
18
|
+
warning: (children, props = {}, options = {}) => _toast.custom((t) => (React.createElement(CustomToast, { id: t.id, isVisible: t.visible, type: "warning", ...props }, children)), { duration: props.isCloseable ? Infinity : options.duration, ...options }),
|
|
31
19
|
};
|
|
32
20
|
export default toast;
|
|
@@ -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, { useCallback, useEffect } from "react";
|
|
13
2
|
import propTypes from "@styled-system/prop-types";
|
|
14
3
|
import { FieldLabel } from "../FieldLabel";
|
|
@@ -18,9 +7,7 @@ import { useComponentVariant } from "../NDSProvider/ComponentVariantContext";
|
|
|
18
7
|
import { getSubset, omitSubset } from "../utils/subset";
|
|
19
8
|
import { Flex } from "../Flex";
|
|
20
9
|
import ToggleButton from "./ToggleButton";
|
|
21
|
-
const Toggle = React.forwardRef((
|
|
22
|
-
var _b;
|
|
23
|
-
var { checked, variant, className, labelText, requirementText, helpText, hint, disabled, toggled, onChange, onText, offText, required, error, id, defaultToggled, onClick, "data-testid": dataTestId } = _a, props = __rest(_a, ["checked", "variant", "className", "labelText", "requirementText", "helpText", "hint", "disabled", "toggled", "onChange", "onText", "offText", "required", "error", "id", "defaultToggled", "onClick", "data-testid"]);
|
|
10
|
+
const Toggle = React.forwardRef(({ checked, variant, className, labelText, requirementText, helpText, hint, disabled, toggled, onChange, onText, offText, required, error, id, defaultToggled, onClick, "data-testid": dataTestId, ...props }, ref) => {
|
|
24
11
|
const componentVariant = useComponentVariant(variant);
|
|
25
12
|
const spaceProps = getSubset(props, propTypes.space);
|
|
26
13
|
const restProps = omitSubset(props, propTypes.space);
|
|
@@ -36,7 +23,7 @@ const Toggle = React.forwardRef((_a, ref) => {
|
|
|
36
23
|
}
|
|
37
24
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
25
|
}, []);
|
|
39
|
-
const _checked =
|
|
26
|
+
const _checked = checked ?? defaultToggled ?? toggled;
|
|
40
27
|
const _onChange = useCallback((e) => {
|
|
41
28
|
if (onClick) {
|
|
42
29
|
onClick(e);
|
|
@@ -51,10 +38,10 @@ const Toggle = React.forwardRef((_a, ref) => {
|
|
|
51
38
|
}
|
|
52
39
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
40
|
}, []);
|
|
54
|
-
return (React.createElement(Field,
|
|
41
|
+
return (React.createElement(Field, { className: className, alignItems: "flex-start", py: "half", ...spaceProps },
|
|
55
42
|
React.createElement(FieldLabel, { htmlFor: id, labelText: labelText, requirementText: requirementText, helpText: helpText, hint: hint, disabled: disabled, variant: componentVariant, "data-testid": dataTestId },
|
|
56
43
|
React.createElement(Flex, { flexDirection: "row", alignItems: "center" },
|
|
57
|
-
React.createElement(ToggleButton,
|
|
44
|
+
React.createElement(ToggleButton, { id: id, checked: _checked, onChange: _onChange, disabled: disabled, required: required, "aria-required": required, "aria-invalid": error, ...restProps, ref: ref }),
|
|
58
45
|
(onText || offText) && (React.createElement(Text, { disabled: disabled, mb: "none", ml: "x1", "aria-hidden": true }, _checked ? onText : offText))))));
|
|
59
46
|
});
|
|
60
47
|
export default Toggle;
|
|
@@ -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 { motion } from "framer-motion";
|
|
14
3
|
import styled, { useTheme } from "styled-components";
|
|
@@ -61,10 +50,9 @@ const ToggleInput = styled.input(({ disabled, theme }) => ({
|
|
|
61
50
|
boxShadow: disabled ? undefined : theme.shadows.focus,
|
|
62
51
|
},
|
|
63
52
|
}));
|
|
64
|
-
const ToggleButton = React.forwardRef((
|
|
65
|
-
var { disabled, checked } = _a, props = __rest(_a, ["disabled", "checked"]);
|
|
53
|
+
const ToggleButton = React.forwardRef(({ disabled, checked, ...props }, ref) => {
|
|
66
54
|
return (React.createElement(Switch, { disabled: disabled, checked: checked },
|
|
67
|
-
React.createElement(ToggleInput,
|
|
55
|
+
React.createElement(ToggleInput, { type: "checkbox", role: "switch", checked: checked, ref: ref, value: checked ? "on" : "off", disabled: disabled, ...props }),
|
|
68
56
|
React.createElement(Slider, { disabled: disabled })));
|
|
69
57
|
});
|
|
70
58
|
export default ToggleButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MaxWidthProps } from "styled-system";
|
|
3
|
-
export
|
|
3
|
+
export interface TooltipProps {
|
|
4
4
|
/** Delay before showing (in ms) */
|
|
5
5
|
showDelay?: string | number;
|
|
6
6
|
/** Whether the tooltip is open by default */
|
|
@@ -15,5 +15,5 @@ export type TooltipProps = {
|
|
|
15
15
|
tooltip?: React.ReactNode;
|
|
16
16
|
/** Child element that triggers the tooltip */
|
|
17
17
|
children?: React.ReactNode;
|
|
18
|
-
}
|
|
18
|
+
}
|
|
19
19
|
export default function Tooltip({ showDelay, defaultOpen, placement, maxWidth, className, tooltip, children, }: TooltipProps): React.JSX.Element;
|
|
@@ -20,7 +20,7 @@ export const WithWrappedText = {
|
|
|
20
20
|
};
|
|
21
21
|
export const WithCustomMaxWidth = {
|
|
22
22
|
render: (args) => (React.createElement(Flex, { p: "x8" },
|
|
23
|
-
React.createElement(Tooltip,
|
|
23
|
+
React.createElement(Tooltip, { ...args, placement: "bottom", tooltip: "I am a Tooltip! I have very long text, but I have a smaller maxWidth prop that causes me to wrap frequently.", maxWidth: "128px", defaultOpen: true },
|
|
24
24
|
React.createElement(Button, null, " Button ")))),
|
|
25
25
|
name: "with custom maxWidth",
|
|
26
26
|
};
|
|
@@ -57,17 +57,17 @@ export const WithPlacement = {
|
|
|
57
57
|
name: "with placement",
|
|
58
58
|
};
|
|
59
59
|
export const WithLinkPassedIn = {
|
|
60
|
-
render: (args) => (React.createElement(Tooltip,
|
|
60
|
+
render: (args) => (React.createElement(Tooltip, { ...args, placement: "bottom", tooltip: React.createElement(Link, { href: "/" }, " Link "), defaultOpen: true },
|
|
61
61
|
React.createElement(Button, null, " Button "))),
|
|
62
62
|
name: "with Link passed in",
|
|
63
63
|
};
|
|
64
64
|
export const WithButtonPassedIn = {
|
|
65
|
-
render: (args) => (React.createElement(Tooltip,
|
|
65
|
+
render: (args) => (React.createElement(Tooltip, { ...args, placement: "bottom", tooltip: React.createElement(Button, { href: "/" }, " Button "), defaultOpen: true },
|
|
66
66
|
React.createElement(Button, null, " Button "))),
|
|
67
67
|
name: "with Button passed in",
|
|
68
68
|
};
|
|
69
69
|
export const WithCustomShowDelay = {
|
|
70
|
-
render: (args) => (React.createElement(Tooltip,
|
|
70
|
+
render: (args) => (React.createElement(Tooltip, { ...args, placement: "bottom", tooltip: "Tooltip", showDelay: "1000" },
|
|
71
71
|
React.createElement(Button, null, " Button "))),
|
|
72
72
|
name: "with custom showDelay",
|
|
73
73
|
};
|
|
@@ -86,15 +86,15 @@ export const WithOtherFocusableElements = {
|
|
|
86
86
|
name: "with other focusable elements",
|
|
87
87
|
};
|
|
88
88
|
export const OpenByDefault = {
|
|
89
|
-
render: (args) => (React.createElement(Tooltip,
|
|
89
|
+
render: (args) => (React.createElement(Tooltip, { ...args, tooltip: "I am an open Tooltip!", defaultOpen: true },
|
|
90
90
|
React.createElement(Button, null, "Hover me"))),
|
|
91
91
|
name: "open by default",
|
|
92
92
|
};
|
|
93
93
|
export const WithCustomComponent = {
|
|
94
|
-
render: (args) => (React.createElement(Tooltip,
|
|
94
|
+
render: (args) => (React.createElement(Tooltip, { ...args, tooltip: "See me on hover!", defaultOpen: true },
|
|
95
95
|
React.createElement(CustomComponent, null))),
|
|
96
96
|
};
|
|
97
|
-
const CustomComponent = React.forwardRef((props, forwardedRef) => (React.createElement("span",
|
|
97
|
+
const CustomComponent = React.forwardRef((props, forwardedRef) => (React.createElement("span", { ref: forwardedRef, ...props },
|
|
98
98
|
React.createElement(Text, { inline: true }, "This component uses the forwardedRef from the Tooltip wrapping it"))));
|
|
99
99
|
const CustomTooltip = () => (React.createElement(Flex, { flexDirection: "column", width: "320px", p: "x1_5" },
|
|
100
100
|
React.createElement(Text, { fontSize: "smaller", fontWeight: "medium", textTransform: "uppercase", color: "midGrey" }, "Purchase Order"),
|
|
@@ -27,5 +27,20 @@ const getTooltipMargin = (placement) => {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
const TooltipContainer = styled(Box)(({ theme, dataPlacement, open, position }) => (
|
|
30
|
+
const TooltipContainer = styled(Box)(({ theme, dataPlacement, open, position }) => ({
|
|
31
|
+
color: tooltipStyles(theme).textColor,
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
fontSize: theme.fontSizes.small,
|
|
35
|
+
backgroundColor: tooltipStyles(theme).backgroundColor,
|
|
36
|
+
borderRadius: theme.radii.medium,
|
|
37
|
+
border: `1px solid ${tooltipStyles(theme).borderColor}`,
|
|
38
|
+
boxShadow: theme.shadows.medium,
|
|
39
|
+
padding: theme.space.x1,
|
|
40
|
+
transition: "opacity 0.3s",
|
|
41
|
+
zIndex: theme.zIndices.content,
|
|
42
|
+
...getTooltipMargin(dataPlacement),
|
|
43
|
+
position,
|
|
44
|
+
top: open ? 0 : "-9999px",
|
|
45
|
+
}));
|
|
31
46
|
export default TooltipContainer;
|
|
@@ -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 * as React from "react";
|
|
13
2
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
14
3
|
import styled, { keyframes, useTheme } from "styled-components";
|
|
@@ -18,7 +7,7 @@ function useHasHover() {
|
|
|
18
7
|
try {
|
|
19
8
|
return matchMedia("(hover: hover)").matches;
|
|
20
9
|
}
|
|
21
|
-
catch
|
|
10
|
+
catch {
|
|
22
11
|
// Assume that if the browser is too old to support matchMedia, it's likely not a touch device
|
|
23
12
|
return true;
|
|
24
13
|
}
|
|
@@ -29,21 +18,18 @@ const TooltipTriggerContext = React.createContext({
|
|
|
29
18
|
setOpen: () => { },
|
|
30
19
|
});
|
|
31
20
|
const TooltipProvider = TooltipPrimitive.Provider;
|
|
32
|
-
function Tooltip(
|
|
33
|
-
|
|
34
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
35
|
-
const [open, setOpen] = React.useState((_b = props.defaultOpen) !== null && _b !== void 0 ? _b : false);
|
|
21
|
+
function Tooltip({ children, ...props }) {
|
|
22
|
+
const [open, setOpen] = React.useState(props.defaultOpen ?? false);
|
|
36
23
|
const hasHover = useHasHover();
|
|
37
24
|
return (React.createElement(TooltipPrimitive.Root, { delayDuration: !hasHover && props.supportMobileTap ? 0 : props.delayDuration, onOpenChange: setOpen, open: open },
|
|
38
25
|
React.createElement(TooltipTriggerContext.Provider, { value: {
|
|
39
26
|
open,
|
|
40
27
|
setOpen,
|
|
41
|
-
supportMobileTap:
|
|
28
|
+
supportMobileTap: props.supportMobileTap ?? false,
|
|
42
29
|
} }, children)));
|
|
43
30
|
}
|
|
44
31
|
Tooltip.displayName = TooltipPrimitive.Root.displayName;
|
|
45
|
-
const TooltipTrigger = React.forwardRef((
|
|
46
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
32
|
+
const TooltipTrigger = React.forwardRef(({ children, ...props }, ref) => {
|
|
47
33
|
const hasHover = useHasHover();
|
|
48
34
|
const { setOpen, supportMobileTap } = React.useContext(TooltipTriggerContext);
|
|
49
35
|
const { onClick: onClickProp } = props;
|
|
@@ -53,10 +39,10 @@ const TooltipTrigger = React.forwardRef((_a, ref) => {
|
|
|
53
39
|
setOpen(true);
|
|
54
40
|
}
|
|
55
41
|
else {
|
|
56
|
-
onClickProp
|
|
42
|
+
onClickProp?.(e);
|
|
57
43
|
}
|
|
58
44
|
}, [setOpen, hasHover, supportMobileTap, onClickProp]);
|
|
59
|
-
return (React.createElement(TooltipPrimitive.Trigger,
|
|
45
|
+
return (React.createElement(TooltipPrimitive.Trigger, { ref: ref, ...props, onClick: onClick }, children));
|
|
60
46
|
});
|
|
61
47
|
TooltipTrigger.displayName = TooltipPrimitive.Trigger.displayName;
|
|
62
48
|
const slideUpAndFade = keyframes `
|
|
@@ -132,10 +118,9 @@ const StyledArrow = styled(TooltipPrimitive.Arrow)(({ theme }) => ({
|
|
|
132
118
|
fill: theme.colors.white,
|
|
133
119
|
filter: `drop-shadow(0px 1px 0px ${theme.colors.grey})`,
|
|
134
120
|
}));
|
|
135
|
-
const TooltipContent = React.forwardRef((
|
|
136
|
-
var { sideOffset = 4, children } = _a, props = __rest(_a, ["sideOffset", "children"]);
|
|
121
|
+
const TooltipContent = React.forwardRef(({ sideOffset = 4, children, ...props }, ref) => {
|
|
137
122
|
const theme = useTheme();
|
|
138
|
-
return (React.createElement(StyledContent,
|
|
123
|
+
return (React.createElement(StyledContent, { ref: ref, sideOffset: sideOffset, ...props },
|
|
139
124
|
children,
|
|
140
125
|
React.createElement(StyledArrow, { width: theme.space.x1_5, height: theme.space.x0_75 })));
|
|
141
126
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { StyledProps } from "../StyledProps";
|
|
3
2
|
declare const MenuItemList: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, never>> & string;
|
|
4
3
|
declare const Header: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
@@ -12,11 +11,11 @@ declare const StyledBackLink: import("styled-components/dist/types").IStyledComp
|
|
|
12
11
|
declare const StyledPageTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>> & string;
|
|
13
12
|
declare const Overlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
14
13
|
ref?: import("react").Ref<HTMLDivElement>;
|
|
15
|
-
}, "as" | keyof import("@reach/dialog
|
|
14
|
+
}, "as" | keyof import("@reach/dialog").DialogOverlayProps> & import("@reach/dialog").DialogOverlayProps & {
|
|
16
15
|
as?: "div";
|
|
17
16
|
} & import("framer-motion").MotionProps, "ref"> & import("react").RefAttributes<HTMLElement | SVGElement>, never>> & string & Omit<import("framer-motion").CustomDomComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
17
|
ref?: import("react").Ref<HTMLDivElement>;
|
|
19
|
-
}, "as" | keyof import("@reach/dialog
|
|
18
|
+
}, "as" | keyof import("@reach/dialog").DialogOverlayProps> & import("@reach/dialog").DialogOverlayProps & {
|
|
20
19
|
as?: "div";
|
|
21
20
|
}>, keyof import("react").Component<any, {}, any>>;
|
|
22
21
|
declare const TileLink: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
@@ -35,12 +34,14 @@ declare const StyledMenuItem: import("styled-components/dist/types").IStyledComp
|
|
|
35
34
|
suppressContentEditableWarning?: boolean;
|
|
36
35
|
suppressHydrationWarning?: boolean;
|
|
37
36
|
accessKey?: string;
|
|
37
|
+
autoCapitalize?: (string & {}) | "none" | "off" | "on" | "sentences" | "words" | "characters";
|
|
38
38
|
autoFocus?: boolean;
|
|
39
39
|
className?: string;
|
|
40
40
|
contentEditable?: "inherit" | (boolean | "true" | "false");
|
|
41
41
|
contextMenu?: string;
|
|
42
42
|
dir?: string;
|
|
43
43
|
draggable?: boolean | "true" | "false";
|
|
44
|
+
enterKeyHint?: "search" | "enter" | "done" | "go" | "next" | "previous" | "send";
|
|
44
45
|
id?: string;
|
|
45
46
|
lang?: string;
|
|
46
47
|
nonce?: string;
|
|
@@ -58,7 +59,6 @@ declare const StyledMenuItem: import("styled-components/dist/types").IStyledComp
|
|
|
58
59
|
rev?: string;
|
|
59
60
|
typeof?: string;
|
|
60
61
|
vocab?: string;
|
|
61
|
-
autoCapitalize?: string;
|
|
62
62
|
autoCorrect?: string;
|
|
63
63
|
autoSave?: string;
|
|
64
64
|
itemProp?: string;
|
|
@@ -68,20 +68,26 @@ declare const StyledMenuItem: import("styled-components/dist/types").IStyledComp
|
|
|
68
68
|
itemRef?: string;
|
|
69
69
|
results?: number;
|
|
70
70
|
security?: string;
|
|
71
|
-
unselectable?: "
|
|
71
|
+
unselectable?: "off" | "on";
|
|
72
72
|
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal";
|
|
73
73
|
is?: string;
|
|
74
|
+
exportparts?: string;
|
|
75
|
+
part?: string;
|
|
74
76
|
"aria-activedescendant"?: string;
|
|
75
77
|
"aria-atomic"?: boolean | "true" | "false";
|
|
76
78
|
"aria-autocomplete"?: "none" | "list" | "inline" | "both";
|
|
79
|
+
"aria-braillelabel"?: string;
|
|
80
|
+
"aria-brailleroledescription"?: string;
|
|
77
81
|
"aria-busy"?: boolean | "true" | "false";
|
|
78
82
|
"aria-checked"?: boolean | "true" | "false" | "mixed";
|
|
79
83
|
"aria-colcount"?: number;
|
|
80
84
|
"aria-colindex"?: number;
|
|
85
|
+
"aria-colindextext"?: string;
|
|
81
86
|
"aria-colspan"?: number;
|
|
82
87
|
"aria-controls"?: string;
|
|
83
|
-
"aria-current"?: boolean | "time" | "
|
|
88
|
+
"aria-current"?: boolean | "time" | "page" | "true" | "false" | "step" | "location" | "date";
|
|
84
89
|
"aria-describedby"?: string;
|
|
90
|
+
"aria-description"?: string;
|
|
85
91
|
"aria-details"?: string;
|
|
86
92
|
"aria-disabled"?: boolean | "true" | "false";
|
|
87
93
|
"aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup";
|
|
@@ -111,6 +117,7 @@ declare const StyledMenuItem: import("styled-components/dist/types").IStyledComp
|
|
|
111
117
|
"aria-roledescription"?: string;
|
|
112
118
|
"aria-rowcount"?: number;
|
|
113
119
|
"aria-rowindex"?: number;
|
|
120
|
+
"aria-rowindextext"?: string;
|
|
114
121
|
"aria-rowspan"?: number;
|
|
115
122
|
"aria-selected"?: boolean | "true" | "false";
|
|
116
123
|
"aria-setsize"?: number;
|
|
@@ -140,7 +147,7 @@ declare const StyledMenuItem: import("styled-components/dist/types").IStyledComp
|
|
|
140
147
|
onBlurCapture?: import("react").FocusEventHandler<HTMLLIElement>;
|
|
141
148
|
onChange?: import("react").FormEventHandler<HTMLLIElement>;
|
|
142
149
|
onChangeCapture?: import("react").FormEventHandler<HTMLLIElement>;
|
|
143
|
-
onBeforeInput?: import("react").
|
|
150
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLLIElement>;
|
|
144
151
|
onBeforeInputCapture?: import("react").FormEventHandler<HTMLLIElement>;
|
|
145
152
|
onInput?: import("react").FormEventHandler<HTMLLIElement>;
|
|
146
153
|
onInputCapture?: import("react").FormEventHandler<HTMLLIElement>;
|
|
@@ -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 { Box } from "../../Box";
|
|
14
3
|
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
@@ -21,11 +10,10 @@ const BACK_LINK_MAX_WIDTH = {
|
|
|
21
10
|
tabletLandscape: "20ch",
|
|
22
11
|
laptop: "24ch",
|
|
23
12
|
};
|
|
24
|
-
export function BackLink(
|
|
25
|
-
var { children, maxWidth = BACK_LINK_MAX_WIDTH } = _a, props = __rest(_a, ["children", "maxWidth"]);
|
|
13
|
+
export function BackLink({ children, maxWidth = BACK_LINK_MAX_WIDTH, ...props }) {
|
|
26
14
|
const md = useMediaQuery("phoneLandscape");
|
|
27
15
|
return (React.createElement(Box, { as: "li", flex: "1 1" },
|
|
28
|
-
React.createElement(StyledBackLink,
|
|
16
|
+
React.createElement(StyledBackLink, { ...props, "data-testid": "topbar-back-link" },
|
|
29
17
|
React.createElement(Icon, { icon: "arrowBack" }),
|
|
30
18
|
md && (React.createElement(Text, { maxWidth: maxWidth, textOverflow: "ellipsis", overflow: "hidden", fontSize: "small" }, children)))));
|
|
31
19
|
}
|
|
@@ -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 { DialogContent } from "@reach/dialog";
|
|
13
2
|
import { AnimatePresence } from "framer-motion";
|
|
14
3
|
import React from "react";
|
|
@@ -38,9 +27,7 @@ const blurVariants = {
|
|
|
38
27
|
},
|
|
39
28
|
},
|
|
40
29
|
};
|
|
41
|
-
export function Menu(
|
|
42
|
-
var _b;
|
|
43
|
-
var { children, defaultOpened = false } = _a, props = __rest(_a, ["children", "defaultOpened"]);
|
|
30
|
+
export function Menu({ children, defaultOpened = false, ...props }) {
|
|
44
31
|
const [showMenu, setShowMenu] = React.useState(defaultOpened);
|
|
45
32
|
const [animationComplete, setAnimationComplete] = React.useState(false);
|
|
46
33
|
const { t } = useTranslation();
|
|
@@ -62,6 +49,6 @@ export function Menu(_a) {
|
|
|
62
49
|
setAnimationComplete(true);
|
|
63
50
|
}
|
|
64
51
|
}, onDismiss: close },
|
|
65
|
-
React.createElement(DialogContent, { "data-testid": "topbar-menu", "data-visible": animationComplete ? true : undefined, "aria-label":
|
|
52
|
+
React.createElement(DialogContent, { "data-testid": "topbar-menu", "data-visible": animationComplete ? true : undefined, "aria-label": props["aria-label"] ?? t("menu options") },
|
|
66
53
|
React.createElement(MenuItemList, null, children)))))));
|
|
67
54
|
}
|