@nulogy/components 15.2.1 → 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/README.md +3 -3
- package/dist/main.js +53108 -54055
- package/dist/main.module.js +8809 -9756
- package/dist/src/Alert/Alert.js +2 -14
- package/dist/src/Alert/Alert.story.d.ts +15 -19
- package/dist/src/Alert/Alert.story.js +25 -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.d.ts +4 -6
- package/dist/src/BrandedNavBar/NavBar.story.js +12 -4
- 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.d.ts +5 -2
- package/dist/src/BrandedNavBar/SmallNavBar.story.js +27 -6
- 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/DatePicker.story.d.ts +7 -3
- package/dist/src/DatePickers/stories/DatePicker.story.js +54 -22
- 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/lib/utils.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.column.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.group-min-width.story.js +15 -12
- package/dist/src/DescriptionList/stories/DescriptionList.layout.story.js +1 -1
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.d.ts +7 -8
- package/dist/src/DescriptionList/stories/DescriptionList.playground.story.js +203 -195
- 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.d.ts +1 -1
- package/dist/src/Layout/Header.js +4 -17
- package/dist/src/Layout/Header.story.d.ts +10 -9
- package/dist/src/Layout/Header.story.js +9 -8
- package/dist/src/Layout/Page.js +5 -19
- package/dist/src/Layout/Sidebar.js +4 -18
- package/dist/src/Layout/Sidebar.story.d.ts +4 -1
- package/dist/src/Layout/Sidebar.story.js +24 -31
- package/dist/src/Link/Link.js +13 -21
- package/dist/src/List/List.d.ts +0 -1
- package/dist/src/Modal/Modal.story.d.ts +39 -61
- package/dist/src/Modal/Modal.story.js +110 -85
- 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 +3 -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 +322 -32
- package/dist/src/Radio/Radio.story.js +36 -22
- package/dist/src/Radio/RadioGroup.js +4 -16
- package/dist/src/RangeContainer/RangeContainer.js +6 -15
- package/dist/src/Select/MenuList.js +14 -19
- package/dist/src/Select/Select.d.ts +2 -2
- package/dist/src/Select/Select.js +16 -17
- package/dist/src/Select/Select.spec-utils.js +1 -0
- package/dist/src/Select/Select.story.d.ts +5 -1
- package/dist/src/Select/Select.story.fixture.js +8 -30
- package/dist/src/Select/Select.story.js +107 -31
- 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/BaseTable.story.d.ts +11 -7
- package/dist/src/Table/stories/BaseTable.story.js +156 -34
- package/dist/src/Table/stories/SortingColumnHeader.story.d.ts +5 -2
- package/dist/src/Table/stories/SortingColumnHeader.story.js +20 -3
- package/dist/src/Table/stories/Table.story.d.ts +7 -14
- package/dist/src/Table/stories/Table.story.js +172 -127
- 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.d.ts +15 -52
- package/dist/src/Tooltip/Tooltip.story.js +80 -72
- 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/testing/matchers/toHaveStyle.d.ts +15 -0
- package/dist/src/testing/matchers/toHaveStyle.js +50 -0
- package/dist/src/testing/matchers/toMatchDate.d.ts +1 -0
- package/dist/src/testing/matchers/toMatchDate.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/DetectOutsideClick.d.ts +3 -0
- package/dist/src/utils/DetectOutsideClick.js +3 -0
- package/dist/src/utils/PopperArrow.js +5 -1
- package/dist/src/utils/ScrollIndicators.js +1 -1
- package/dist/src/utils/generateId.d.ts +5 -0
- package/dist/src/utils/generateId.js +5 -0
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/numberFromDimension/numberFromDimension.spec.js +1 -0
- 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/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +11 -0
- package/package.json +45 -85
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.d.ts +0 -1
- package/dist/src/NDSProvider/mountWithNDSProvider.spec-utils.js +0 -4
- package/dist/src/utils/withWindowDimensions.d.ts +0 -3
- package/dist/src/utils/withWindowDimensions.js +0 -28
|
@@ -16,202 +16,210 @@ import { Link } from "../../Link";
|
|
|
16
16
|
import { StatusIndicator } from "../../StatusIndicator";
|
|
17
17
|
import { Resizable } from "../../utils/story/resizable";
|
|
18
18
|
import { OutlinedDt, OutlinedDd } from "./fixtures";
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
React.createElement(
|
|
75
|
-
React.createElement(
|
|
76
|
-
|
|
77
|
-
React.createElement(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
React.createElement(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
React.createElement(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
{ value: "stacked", label: "Stacked" },
|
|
95
|
-
{ value: "inline", label: "Inline" },
|
|
96
|
-
{ value: "auto", label: "Auto" },
|
|
97
|
-
], labelText: "Layout" }),
|
|
98
|
-
React.createElement(Input, { value: autoLayoutBreakpoint, onChange: (e) => setAutoLayoutBreakpoint(e.target.value), labelText: "Auto Layout Breakpoint", placeholder: "e.g., 640px", disabled: layout !== "auto" })),
|
|
99
|
-
React.createElement(Select, { value: density, onChange: (value) => setDensity(value), options: [
|
|
100
|
-
{ value: "compact", label: "Compact" },
|
|
101
|
-
{ value: "medium", label: "Medium" },
|
|
102
|
-
{ value: "relaxed", label: "Relaxed" },
|
|
103
|
-
], labelText: "Density" }),
|
|
104
|
-
React.createElement(Select, { value: fontSize, onChange: (value) => setFontSize(value), options: Object.keys(theme.fontSizes).map((size) => ({
|
|
105
|
-
value: size,
|
|
106
|
-
label: size,
|
|
107
|
-
})), labelText: "Font Size" }),
|
|
108
|
-
React.createElement(Select, { value: lineHeight, onChange: (value) => setLineHeight(value), options: Object.keys(theme.lineHeights).map((height) => ({
|
|
109
|
-
value: height,
|
|
110
|
-
label: height,
|
|
111
|
-
})), labelText: "Line Height" }),
|
|
19
|
+
export default {
|
|
20
|
+
title: "Components/DescriptionList/Playground",
|
|
21
|
+
};
|
|
22
|
+
export const Playground = {
|
|
23
|
+
render: () => {
|
|
24
|
+
const [hoveredGroupIndex, setHoveredGroupIndex] = useState(null);
|
|
25
|
+
const [outlined, setOutlined] = useState(false);
|
|
26
|
+
const [containerOutline, setContainerOutline] = useState(true);
|
|
27
|
+
const [layout, setLayout] = useState("stacked");
|
|
28
|
+
const [density, setDensity] = useState("medium");
|
|
29
|
+
const [descriptionTermMaxWidth, setDescriptionTermMaxWidth] = useState("320px");
|
|
30
|
+
const [fontSize, setFontSize] = useState("medium");
|
|
31
|
+
const [lineHeight, setLineHeight] = useState("base");
|
|
32
|
+
const initialBreakpointColumns = [{ breakpoint: "extraSmall", columns: 1 }];
|
|
33
|
+
const [columns, setColumns] = useState(1);
|
|
34
|
+
const [breakpointColumns, setBreakpointColumns] = useState(initialBreakpointColumns);
|
|
35
|
+
const [groupMinWidth, setGroupMinWidth] = useState(undefined);
|
|
36
|
+
const [containerWidth, setContainerWidth] = useState("720px");
|
|
37
|
+
const [showDivider, setShowDivider] = useState(false);
|
|
38
|
+
const [autoLayoutBreakpoint, setAutoLayoutBreakpoint] = useState("640px");
|
|
39
|
+
const [rowSpan] = useState(0);
|
|
40
|
+
const [columnSpan] = useState(0);
|
|
41
|
+
const [additionalGroups, setAdditionalGroups] = useState([]);
|
|
42
|
+
const [DtValue] = useState("Key");
|
|
43
|
+
const [DdValue] = useState("Value");
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const updateGroup = (index, updates) => {
|
|
46
|
+
setAdditionalGroups((groups) => groups.map((group, i) => {
|
|
47
|
+
if (i === index) {
|
|
48
|
+
return { ...group, ...updates };
|
|
49
|
+
}
|
|
50
|
+
return group;
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
const deleteGroup = (index) => {
|
|
54
|
+
setAdditionalGroups((groups) => groups.filter((_, i) => i !== index));
|
|
55
|
+
};
|
|
56
|
+
const addRandomGroup = () => {
|
|
57
|
+
setAdditionalGroups([
|
|
58
|
+
...additionalGroups,
|
|
59
|
+
{
|
|
60
|
+
dt: DtValue,
|
|
61
|
+
dd: DdValue,
|
|
62
|
+
rowSpan: rowSpan,
|
|
63
|
+
columnSpan: columnSpan,
|
|
64
|
+
isExpanded: false,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
};
|
|
68
|
+
const toggleGroupExpansion = (index) => {
|
|
69
|
+
setAdditionalGroups((groups) => groups.map((group, i) => (i === index ? { ...group, isExpanded: !group.isExpanded } : group)));
|
|
70
|
+
};
|
|
71
|
+
const DescriptionListElement = (
|
|
72
|
+
// @ts-expect-error - This is not a valid use of the component, since we're passing both columns and groupMinWidth,
|
|
73
|
+
// but it's needed for this story
|
|
74
|
+
React.createElement(DescriptionList, { layout: layout, density: density, columns: columns, groupMinWidth: groupMinWidth, showDivider: showDivider, autoLayoutBreakpoint: autoLayoutBreakpoint, descriptionTermMaxWidth: descriptionTermMaxWidth, fontSize: fontSize, lineHeight: lineHeight },
|
|
75
|
+
React.createElement(DescriptionGroup, null,
|
|
76
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Customer"),
|
|
77
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false }, "Nulogy")),
|
|
78
|
+
React.createElement(DescriptionGroup, null,
|
|
79
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Order number"),
|
|
80
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false },
|
|
81
|
+
React.createElement(Link, { href: "/customer-details" }, "P12-90381-2039"))),
|
|
82
|
+
React.createElement(DescriptionGroup, null,
|
|
83
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Status"),
|
|
84
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false },
|
|
85
|
+
React.createElement(StatusIndicator, { type: "success" }, "Paid"))),
|
|
86
|
+
React.createElement(DescriptionGroup, null,
|
|
87
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": false }, "Amount"),
|
|
88
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": false }, "$202.12")),
|
|
89
|
+
additionalGroups.map((group, index) => (React.createElement(DescriptionGroup, { rowSpan: group.rowSpan, columnSpan: group.columnSpan, key: index },
|
|
90
|
+
React.createElement(OutlinedDt, { "$outlined": outlined, "$highlighted": hoveredGroupIndex === index }, group.dt),
|
|
91
|
+
React.createElement(OutlinedDd, { "$outlined": outlined, "$highlighted": hoveredGroupIndex === index }, group.dd))))));
|
|
92
|
+
return (React.createElement(Flex, null,
|
|
93
|
+
React.createElement(Sidebar, { height: "100%", width: "450px", hideCloseButton: true, isOpen: true, title: "Controls", overlay: "hide", top: "0px", bottom: "0px" },
|
|
112
94
|
React.createElement(Flex, { flexDirection: "column", gap: "x2" },
|
|
113
|
-
React.createElement(Flex, {
|
|
114
|
-
React.createElement(
|
|
115
|
-
React.createElement(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const newBreakpointColumns = breakpointColumns.filter((_, i) => i !== index);
|
|
167
|
-
if (newBreakpointColumns.length === 1) {
|
|
168
|
-
// Convert back to single number when only one breakpoint remains
|
|
169
|
-
setColumns(newBreakpointColumns[0].columns);
|
|
170
|
-
setBreakpointColumns(newBreakpointColumns);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
95
|
+
React.createElement(Flex, { gap: "x2", flexDirection: "column" },
|
|
96
|
+
React.createElement(Input, { value: descriptionTermMaxWidth, onChange: (e) => setDescriptionTermMaxWidth(e.target.value), labelText: "Description Term Max Width", placeholder: "e.g., 320px" }),
|
|
97
|
+
React.createElement(Select, { value: layout, onChange: (value) => setLayout(value), options: [
|
|
98
|
+
{ value: "stacked", label: "Stacked" },
|
|
99
|
+
{ value: "inline", label: "Inline" },
|
|
100
|
+
{ value: "auto", label: "Auto" },
|
|
101
|
+
], labelText: "Layout" }),
|
|
102
|
+
React.createElement(Input, { value: autoLayoutBreakpoint, onChange: (e) => setAutoLayoutBreakpoint(e.target.value), labelText: "Auto Layout Breakpoint", placeholder: "e.g., 640px", disabled: layout !== "auto" })),
|
|
103
|
+
React.createElement(Select, { value: density, onChange: (value) => setDensity(value), options: [
|
|
104
|
+
{ value: "compact", label: "Compact" },
|
|
105
|
+
{ value: "medium", label: "Medium" },
|
|
106
|
+
{ value: "relaxed", label: "Relaxed" },
|
|
107
|
+
], labelText: "Density" }),
|
|
108
|
+
React.createElement(Select, { value: fontSize, onChange: (value) => setFontSize(value), options: Object.keys(theme.fontSizes).map((size) => ({
|
|
109
|
+
value: size,
|
|
110
|
+
label: size,
|
|
111
|
+
})), labelText: "Font Size" }),
|
|
112
|
+
React.createElement(Select, { value: lineHeight, onChange: (value) => setLineHeight(value), options: Object.keys(theme.lineHeights).map((height) => ({
|
|
113
|
+
value: height,
|
|
114
|
+
label: height,
|
|
115
|
+
})), labelText: "Line Height" }),
|
|
116
|
+
React.createElement(Flex, { flexDirection: "column", gap: "x2" },
|
|
117
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "center" },
|
|
118
|
+
React.createElement(Text, { fontWeight: "bold" }, "Columns"),
|
|
119
|
+
React.createElement(IconicButton, { onClick: () => {
|
|
120
|
+
const currentColumnValue = breakpointColumns[0].columns;
|
|
121
|
+
const availableBreakpoints = Object.keys(theme.breakpoints).filter((breakpoint) => !breakpointColumns.some((col) => col.breakpoint === breakpoint || breakpoint === "map"));
|
|
122
|
+
if (breakpointColumns.length === 1) {
|
|
123
|
+
// First time adding a breakpoint, convert the single column to a breakpoint
|
|
124
|
+
const firstBreakpoint = breakpointColumns[0].breakpoint;
|
|
125
|
+
setBreakpointColumns([
|
|
126
|
+
{ breakpoint: firstBreakpoint, columns: currentColumnValue },
|
|
127
|
+
{ breakpoint: availableBreakpoints[0], columns: currentColumnValue },
|
|
128
|
+
]);
|
|
129
|
+
setColumns({
|
|
130
|
+
[firstBreakpoint]: currentColumnValue,
|
|
131
|
+
[availableBreakpoints[0]]: currentColumnValue,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// Add another breakpoint
|
|
136
|
+
const nextBreakpoint = availableBreakpoints[0];
|
|
137
|
+
setBreakpointColumns([
|
|
138
|
+
...breakpointColumns,
|
|
139
|
+
{ breakpoint: nextBreakpoint, columns: currentColumnValue },
|
|
140
|
+
]);
|
|
141
|
+
setColumns(Object.fromEntries([...breakpointColumns, { breakpoint: nextBreakpoint, columns: currentColumnValue }].map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
142
|
+
}
|
|
143
|
+
}, icon: "add", tooltip: "Add column per breakpoint", disabled: breakpointColumns.length >= Object.keys(theme.breakpoints).length - 1 })),
|
|
144
|
+
React.createElement(Flex, { flexDirection: "column", gap: "x2" }, breakpointColumns.map((breakpointColumn, index) => (React.createElement(Flex, { key: index, gap: "x2", alignItems: "flex-end" },
|
|
145
|
+
breakpointColumns.length > 1 && (React.createElement(Select, { minWidth: "240px", value: breakpointColumn.breakpoint, onChange: (value) => {
|
|
146
|
+
const newBreakpointColumns = [...breakpointColumns];
|
|
147
|
+
newBreakpointColumns[index] = { ...breakpointColumn, breakpoint: value };
|
|
173
148
|
setBreakpointColumns(newBreakpointColumns);
|
|
174
149
|
setColumns(Object.fromEntries(newBreakpointColumns.map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
150
|
+
}, options: Object.keys(theme.breakpoints)
|
|
151
|
+
.filter((breakpoint) => breakpoint === breakpointColumn.breakpoint ||
|
|
152
|
+
!breakpointColumns.some((col) => col.breakpoint === breakpoint || breakpoint === "map"))
|
|
153
|
+
.map((breakpoint) => ({
|
|
154
|
+
value: breakpoint,
|
|
155
|
+
label: `${breakpoint} (${theme.breakpoints[breakpoint]})`,
|
|
156
|
+
})), labelText: index === 0 ? "Breakpoint" : undefined })),
|
|
157
|
+
React.createElement(Input, { inputWidth: breakpointColumns.length === 1 ? undefined : "95px", type: "number", value: breakpointColumn.columns, onChange: (e) => {
|
|
158
|
+
const newValue = Math.max(1, Number(e.target.value));
|
|
159
|
+
const newBreakpointColumns = [...breakpointColumns];
|
|
160
|
+
newBreakpointColumns[index] = {
|
|
161
|
+
...breakpointColumn,
|
|
162
|
+
columns: newValue,
|
|
163
|
+
};
|
|
164
|
+
setBreakpointColumns(newBreakpointColumns);
|
|
165
|
+
if (breakpointColumns.length === 1) {
|
|
166
|
+
setColumns(newValue);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
setColumns(Object.fromEntries(newBreakpointColumns.map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
170
|
+
}
|
|
171
|
+
}, labelText: breakpointColumns.length === 1 ? "Number of columns" : index === 0 ? "Columns" : undefined, placeholder: "Number of columns", min: 1 }),
|
|
172
|
+
breakpointColumns.length > 1 && (React.createElement(IconicButton, { icon: "delete", onClick: () => {
|
|
173
|
+
const newBreakpointColumns = breakpointColumns.filter((_, i) => i !== index);
|
|
174
|
+
if (newBreakpointColumns.length === 1) {
|
|
175
|
+
// Convert back to single number when only one breakpoint remains
|
|
176
|
+
setColumns(newBreakpointColumns[0].columns);
|
|
177
|
+
setBreakpointColumns(newBreakpointColumns);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
setBreakpointColumns(newBreakpointColumns);
|
|
181
|
+
setColumns(Object.fromEntries(newBreakpointColumns.map(({ breakpoint, columns }) => [breakpoint, columns])));
|
|
182
|
+
}
|
|
183
|
+
} }))))))),
|
|
184
|
+
React.createElement(Input, { value: groupMinWidth ?? "", onChange: (e) => {
|
|
185
|
+
const value = e.target.value || undefined;
|
|
186
|
+
setGroupMinWidth(value);
|
|
187
|
+
if (value)
|
|
188
|
+
setColumns(undefined);
|
|
189
|
+
}, labelText: "Group Min Width", placeholder: "e.g., 200px", disabled: !!columns }),
|
|
190
|
+
React.createElement(Checkbox, { labelText: "Show divider", checked: showDivider, onChange: () => setShowDivider(!showDivider) }),
|
|
191
|
+
React.createElement(HorizontalDivider, null),
|
|
192
|
+
React.createElement(Text, { fontWeight: "bold" }, "Debugging"),
|
|
193
|
+
React.createElement(Checkbox, { labelText: "Show Group outline", checked: outlined, onChange: () => setOutlined(!outlined) }),
|
|
194
|
+
React.createElement(Input, { value: containerWidth, onChange: (e) => setContainerWidth(e.target.value), labelText: "Container Width", placeholder: "e.g., 720px" }),
|
|
195
|
+
React.createElement(Checkbox, { labelText: "Show container outline", checked: containerOutline, onChange: () => setContainerOutline(!containerOutline) }),
|
|
196
|
+
React.createElement(HorizontalDivider, null),
|
|
197
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "center" },
|
|
198
|
+
React.createElement(Text, { fontWeight: "bold" }, "Additional Groups"),
|
|
199
|
+
React.createElement(IconicButton, { onClick: addRandomGroup, icon: "add" })),
|
|
200
|
+
React.createElement(Box, null,
|
|
201
|
+
additionalGroups.length === 0 && (React.createElement(Text, { fontSize: "sm", color: "midGrey" }, "No additional groups")),
|
|
202
|
+
React.createElement(Flex, { flexDirection: "column" }, additionalGroups.map((group, index) => (React.createElement(React.Fragment, null,
|
|
203
|
+
index > 0 && React.createElement(HorizontalDivider, null),
|
|
204
|
+
React.createElement(Box, { key: index, onMouseEnter: () => setHoveredGroupIndex(index), onMouseLeave: () => setHoveredGroupIndex(null) },
|
|
205
|
+
React.createElement(Flex, { justifyContent: "space-between", alignItems: "center", mb: group.isExpanded ? "x2" : "none" },
|
|
206
|
+
React.createElement(Flex, { alignItems: "center", gap: "x2" },
|
|
207
|
+
React.createElement(IconicButton, { icon: group.isExpanded ? "downArrow" : "rightArrow", onClick: () => toggleGroupExpansion(index) }),
|
|
208
|
+
React.createElement(Text, null,
|
|
209
|
+
"Group ",
|
|
210
|
+
index + 1)),
|
|
211
|
+
React.createElement(IconicButton, { onClick: () => deleteGroup(index), icon: "delete" })),
|
|
212
|
+
group.isExpanded && (React.createElement(Flex, { flexDirection: "column", gap: "x2" },
|
|
213
|
+
React.createElement(Input, { value: group.dt, onChange: (e) => updateGroup(index, { dt: e.target.value }), labelText: "Description Term" }),
|
|
214
|
+
React.createElement(Textarea, { value: group.dd, onChange: (e) => updateGroup(index, { dd: e.target.value }), labelText: "Description Data" }),
|
|
215
|
+
React.createElement(Flex, { gap: "x2" },
|
|
216
|
+
React.createElement(Input, { type: "number", value: group.rowSpan, onChange: (e) => updateGroup(index, { rowSpan: Number(e.target.value) }), labelText: "Row Span", min: 1 }),
|
|
217
|
+
React.createElement(Input, { type: "number", value: group.columnSpan, onChange: (e) => updateGroup(index, { columnSpan: Number(e.target.value) }), labelText: "Column Span", min: 1 })))))))))))),
|
|
218
|
+
React.createElement(Box, { flex: 1 },
|
|
219
|
+
React.createElement(Heading1, { mb: "x3" }, "Playground"),
|
|
220
|
+
React.createElement(Resizable, { containerWidth: containerWidth, onResize: (width) => setContainerWidth(`${width}px`), showContainerOutline: containerOutline }, DescriptionListElement))));
|
|
221
|
+
},
|
|
222
|
+
parameters: {
|
|
223
|
+
chromatic: { disable: true },
|
|
224
|
+
},
|
|
217
225
|
};
|
|
@@ -12,6 +12,6 @@ export declare const OutlinedDd: import("styled-components/dist/types").IStyledC
|
|
|
12
12
|
$highlighted?: boolean;
|
|
13
13
|
}>> & string;
|
|
14
14
|
export declare const DashedBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Record<string, unknown> & {
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
}) | (Omit<Record<string, unknown>, "ref"> & React.RefAttributes<React.Component<Record<string, unknown>, any, any>>), import("styled-components/dist/types").BaseObject>> & string & (Omit<React.ComponentClass<Record<string, unknown>, any>, keyof React.Component<any, {}, any>> | Omit<React.FunctionComponent<Record<string, unknown>>, keyof React.Component<any, {}, any>>);
|
|
15
|
+
children?: React.ReactNode | undefined;
|
|
16
|
+
}) | (Omit<Record<string, unknown>, "ref"> & React.RefAttributes<React.Component<Record<string, unknown>, any, any>>), import("styled-components/dist/types").BaseObject>> & (string & (Omit<React.ComponentClass<Record<string, unknown>, any>, keyof React.Component<any, {}, any>> | Omit<React.FunctionComponent<Record<string, unknown>>, keyof React.Component<any, {}, any>>));
|
|
17
17
|
export declare const SampleContent: () => React.JSX.Element;
|
|
@@ -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, { useMemo } from "react";
|
|
13
2
|
import propTypes from "@styled-system/prop-types";
|
|
14
3
|
import { IconicButton } from "../Button";
|
|
@@ -19,21 +8,28 @@ import DropdownMenuContainer from "./DropdownMenuContainer";
|
|
|
19
8
|
const DEFAULT_POPPER_MODIFIERS = {
|
|
20
9
|
preventOverflow: { enabled: true, padding: 8, boundariesElement: "viewport" },
|
|
21
10
|
};
|
|
22
|
-
const transformPropsToModifiers = ({ boundariesElement }) => (
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
const transformPropsToModifiers = ({ boundariesElement }) => ({
|
|
12
|
+
...DEFAULT_POPPER_MODIFIERS,
|
|
13
|
+
boundariesElement,
|
|
14
|
+
});
|
|
15
|
+
const DropdownMenu = React.forwardRef(({ trigger = () => React.createElement(IconicButton, { icon: "more" }), children, showArrow = true, variant, disabled, defaultOpen, backgroundColor = "white", placement = "bottom-start", className, id, boundariesElement = "viewport", showDelay = "100", hideDelay = "200", openAriaLabel, closeAriaLabel, openOnHover = false, ...props }, ref) => {
|
|
25
16
|
const spaceProps = getSubset(props, propTypes.space);
|
|
26
17
|
const restProps = omitSubset(props, propTypes.space);
|
|
27
18
|
const modifiers = useMemo(() => {
|
|
28
19
|
return transformPropsToModifiers({ boundariesElement });
|
|
29
20
|
}, [boundariesElement]);
|
|
30
21
|
const componentVariant = useComponentVariant(variant);
|
|
31
|
-
return (React.createElement(Popper, { trigger: React.cloneElement(trigger(),
|
|
32
|
-
|
|
22
|
+
return (React.createElement(Popper, { trigger: React.cloneElement(trigger(), {
|
|
23
|
+
type: "button",
|
|
24
|
+
disabled: disabled ? true : null,
|
|
25
|
+
"aria-haspopup": true,
|
|
26
|
+
...spaceProps,
|
|
27
|
+
}), showDelay: showDelay, hideDelay: hideDelay, popperPlacement: placement, defaultOpen: defaultOpen, showArrow: showArrow, openOnClick: !openOnHover, ref: ref, openOnHover: openOnHover, modifiers: modifiers, backgroundColor: backgroundColor, borderColor: backgroundColor, openAriaLabel: openAriaLabel, closeAriaLabel: closeAriaLabel },
|
|
28
|
+
React.createElement(DropdownMenuContainer, { className: className, id: id, backgroundColor: backgroundColor, showArrow: showArrow, ...restProps }, typeof children === "function"
|
|
33
29
|
? children
|
|
34
30
|
: React.Children.map(children, (child) => {
|
|
35
31
|
if (React.isValidElement(child)) {
|
|
36
|
-
return React.cloneElement(child,
|
|
32
|
+
return React.cloneElement(child, { size: componentVariant, ...child.props }, child.props.children);
|
|
37
33
|
}
|
|
38
34
|
}))));
|
|
39
35
|
});
|
|
@@ -24,8 +24,8 @@ WithCustomTrigger.story = {
|
|
|
24
24
|
name: "with custom trigger",
|
|
25
25
|
};
|
|
26
26
|
export const WithCustomColors = () => (React.createElement(DropdownMenu, { defaultOpen: true, backgroundColor: "blackBlue", openAriaLabel: "open dropdown", closeAriaLabel: "close dropdown" },
|
|
27
|
-
React.createElement(DropdownLink,
|
|
28
|
-
React.createElement(DropdownButton,
|
|
27
|
+
React.createElement(DropdownLink, { href: "/never_been", ...customColors }, "Dropdown Link"),
|
|
28
|
+
React.createElement(DropdownButton, { onClick: () => { }, ...customColors }, "Dropdown Button")));
|
|
29
29
|
WithCustomColors.story = {
|
|
30
30
|
name: "with custom colors",
|
|
31
31
|
};
|
|
@@ -25,5 +25,14 @@ const getMenuMargin = (placement, showArrow) => {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
const DropdownMenuContainer = styled(Box)(color, ({ dataPlacement, showArrow = true, backgroundColor = "white", theme }) => (
|
|
28
|
+
const DropdownMenuContainer = styled(Box)(color, ({ dataPlacement, showArrow = true, backgroundColor = "white", theme }) => ({
|
|
29
|
+
borderRadius: theme.radii.medium,
|
|
30
|
+
backgroundColor: theme.colors[backgroundColor],
|
|
31
|
+
borderTop: `1px solid ${theme.colors[backgroundColor]}`,
|
|
32
|
+
borderBottom: `1px solid ${theme.colors[backgroundColor]}`,
|
|
33
|
+
boxShadow: theme.shadows.medium,
|
|
34
|
+
padding: "7px 0",
|
|
35
|
+
zIndex: "100",
|
|
36
|
+
...getMenuMargin(dataPlacement, showArrow),
|
|
37
|
+
}));
|
|
29
38
|
export default DropdownMenuContainer;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { TextProps } from "../Type";
|
|
3
2
|
declare const DropdownText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "textTransform" | "disabled" | keyof import("react").HTMLAttributes<HTMLParagraphElement> | "inline" | "compact" | keyof import("../StyledProps").StyledProps> & import("react").HTMLAttributes<HTMLParagraphElement> & {
|
|
4
3
|
variant?: import("../NDSProvider/ComponentVariantContext").ComponentVariant;
|
|
5
4
|
inline?: boolean;
|
|
6
5
|
compact?: boolean;
|
|
7
6
|
disabled?: boolean;
|
|
8
|
-
textTransform?: "
|
|
7
|
+
textTransform?: "none" | "inherit" | "initial" | "-moz-initial" | "revert" | "unset" | "capitalize" | "full-size-kana" | "full-width" | "lowercase" | "uppercase" | undefined;
|
|
9
8
|
fontSize?: string;
|
|
10
9
|
} & import("../StyledProps").StyledProps, "ref"> & {
|
|
11
10
|
ref?: import("react").Ref<HTMLParagraphElement>;
|
|
@@ -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 { InlineIcon } from "../Icon";
|
|
@@ -17,9 +6,8 @@ import HelpText from "./HelpText";
|
|
|
17
6
|
import Label from "./Label";
|
|
18
7
|
import RequirementText from "./RequirementText";
|
|
19
8
|
import { LabelContent, LabelText } from "./LabelText";
|
|
20
|
-
export default function FieldLabel(
|
|
21
|
-
|
|
22
|
-
return (React.createElement(Label, Object.assign({ display: "block" }, props),
|
|
9
|
+
export default function FieldLabel({ labelText, requirementText, helpText, hint, children, ...props }) {
|
|
10
|
+
return (React.createElement(Label, { display: "block", ...props },
|
|
23
11
|
React.createElement(Box, { mb: children && "x1", "data-testid": "field-label" },
|
|
24
12
|
React.createElement(LabelContent, { "data-testid": "label-content" },
|
|
25
13
|
React.createElement(LabelText, { "data-testid": "label-text" }, labelText),
|