@pega/cosmos-react-core 2.0.0-dev.12.1 → 2.0.0-dev.14.2
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/lib/components/Actions/Actions.js +1 -1
- package/lib/components/Actions/Actions.js.map +1 -1
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +1 -2
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +16 -6
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +3 -3
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +32 -43
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.js +4 -4
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/Drawer.js +1 -1
- package/lib/components/AppShell/Drawer.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts.map +1 -1
- package/lib/components/Avatar/Avatar.js +3 -2
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +1 -0
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Button/Button.d.ts +5 -0
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +16 -7
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Card/Card.d.ts.map +1 -1
- package/lib/components/Card/Card.js +2 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContent.d.ts.map +1 -1
- package/lib/components/Card/CardContent.js +4 -3
- package/lib/components/Card/CardContent.js.map +1 -1
- package/lib/components/Card/CardFooter.d.ts.map +1 -1
- package/lib/components/Card/CardFooter.js +3 -2
- package/lib/components/Card/CardFooter.js.map +1 -1
- package/lib/components/Card/CardHeader.d.ts +3 -1
- package/lib/components/Card/CardHeader.d.ts.map +1 -1
- package/lib/components/Card/CardHeader.js +9 -6
- package/lib/components/Card/CardHeader.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +2 -1
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +1 -0
- package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.d.ts.map +1 -1
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js +1 -0
- package/lib/components/ComboBox/SingleSelectInput/SingleSelectInput.js.map +1 -1
- package/lib/components/Configuration/Configuration.js +1 -1
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js +4 -1
- package/lib/components/DateTime/Input/DayOfWeekInput.js.map +1 -1
- package/lib/components/DateTime/Input/QuarterInput.d.ts +9 -0
- package/lib/components/DateTime/Input/QuarterInput.d.ts.map +1 -0
- package/lib/components/DateTime/Input/QuarterInput.js +102 -0
- package/lib/components/DateTime/Input/QuarterInput.js.map +1 -0
- package/lib/components/DateTime/Input/utils.d.ts +5 -3
- package/lib/components/DateTime/Input/utils.d.ts.map +1 -1
- package/lib/components/DateTime/Input/utils.js +14 -5
- package/lib/components/DateTime/Input/utils.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +5 -1
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +2 -2
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/index.d.ts +2 -0
- package/lib/components/DateTime/index.d.ts.map +1 -1
- package/lib/components/DateTime/index.js +1 -0
- package/lib/components/DateTime/index.js.map +1 -1
- package/lib/components/EmptyState/EmptyState.d.ts +14 -0
- package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/components/{NoItems/NoItems.js → EmptyState/EmptyState.js} +6 -6
- package/lib/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/components/EmptyState/index.d.ts +4 -0
- package/lib/components/EmptyState/index.d.ts.map +1 -0
- package/lib/components/EmptyState/index.js +3 -0
- package/lib/components/EmptyState/index.js.map +1 -0
- package/lib/components/File/FileDisplay.d.ts +4 -1
- package/lib/components/File/FileDisplay.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +1 -1
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/Flex/Flex.d.ts +2 -2
- package/lib/components/Flex/Flex.d.ts.map +1 -1
- package/lib/components/Flex/Flex.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +1 -1
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/Grid/Grid.d.ts +1 -1
- package/lib/components/Grid/Grid.d.ts.map +1 -1
- package/lib/components/Input/Input.styles.js +2 -2
- package/lib/components/Input/Input.styles.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +6 -4
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +10 -0
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +198 -3
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +17 -8
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/MenuGroup.d.ts +6 -0
- package/lib/components/Menu/MenuGroup.d.ts.map +1 -0
- package/lib/components/Menu/MenuGroup.js +17 -0
- package/lib/components/Menu/MenuGroup.js.map +1 -0
- package/lib/components/Menu/MenuItem.d.ts +0 -3
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +9 -116
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuList.d.ts.map +1 -1
- package/lib/components/Menu/MenuList.js +8 -7
- package/lib/components/Menu/MenuList.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.d.ts +0 -1
- package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +4 -54
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/Menu/helpers.d.ts +13 -12
- package/lib/components/Menu/helpers.d.ts.map +1 -1
- package/lib/components/Menu/helpers.js +32 -22
- package/lib/components/Menu/helpers.js.map +1 -1
- package/lib/components/Menu/index.d.ts +2 -3
- package/lib/components/Menu/index.d.ts.map +1 -1
- package/lib/components/Menu/index.js +1 -2
- package/lib/components/Menu/index.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts +1 -6
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +23 -111
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts +9 -0
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -0
- package/lib/components/Modal/Modal.styles.js +133 -0
- package/lib/components/Modal/Modal.styles.js.map +1 -0
- package/lib/components/Modal/Modal.types.d.ts +19 -4
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/Modal/ModalManager.js +1 -1
- package/lib/components/Modal/ModalManager.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.js +1 -1
- package/lib/components/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js +1 -1
- package/lib/components/MultiStep/MultiStep.styles.js.map +1 -1
- package/lib/components/MultiStep/MultiStep.types.d.ts +2 -0
- package/lib/components/MultiStep/MultiStep.types.d.ts.map +1 -1
- package/lib/components/MultiStep/MultiStep.types.js.map +1 -1
- package/lib/components/Number/NumberInput.styles.d.ts +2 -2
- package/lib/components/Number/NumberInput.styles.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts +1 -1
- package/lib/components/PageTemplates/CategorySubPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/CategorySubPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +2 -0
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +19 -22
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +0 -4
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +1 -115
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +5 -0
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -0
- package/lib/components/Popover/Popover.styles.js +116 -0
- package/lib/components/Popover/Popover.styles.js.map +1 -0
- package/lib/components/Popover/index.d.ts +1 -1
- package/lib/components/Popover/index.d.ts.map +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Progress/Bar.js +1 -1
- package/lib/components/Progress/Bar.js.map +1 -1
- package/lib/components/Progress/Ring.js +1 -1
- package/lib/components/Progress/Ring.js.map +1 -1
- package/lib/components/RadioCheck/RadioCheck.js +3 -3
- package/lib/components/RadioCheck/RadioCheck.js.map +1 -1
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js +2 -2
- package/lib/components/RadioCheckGroup/RadioCheckGroup.js.map +1 -1
- package/lib/components/Rating/Rating.js +1 -1
- package/lib/components/Rating/Rating.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.js +7 -7
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Select/Select.js +2 -2
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Slider/Slider.styles.d.ts +1 -1
- package/lib/components/Slider/Slider.styles.js +1 -1
- package/lib/components/Slider/Slider.styles.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts +8 -2
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js +9 -5
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts +1 -1
- package/lib/components/SummaryList/ViewAll.d.ts.map +1 -1
- package/lib/components/SummaryList/ViewAll.js +7 -6
- package/lib/components/SummaryList/ViewAll.js.map +1 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +39 -29
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Table/Table.js +2 -2
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +7 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +2 -2
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Text/Text.d.ts +1 -1
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Tree/StandardTree.styles.js +1 -1
- package/lib/components/Tree/StandardTree.styles.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useDraggable.d.ts +8 -0
- package/lib/hooks/useDraggable.d.ts.map +1 -0
- package/lib/hooks/useDraggable.js +64 -0
- package/lib/hooks/useDraggable.js.map +1 -0
- package/lib/hooks/useI18n.d.ts +22 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.json +23 -1
- package/lib/i18n/i18n.d.ts +44 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +2 -26
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/theme/theme.d.ts +41 -11
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +50 -30
- package/lib/theme/themeOverrides.schema.json +15 -3
- package/lib/types/types.d.ts +4 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/utils.d.ts +14 -0
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +24 -0
- package/lib/utils/utils.js.map +1 -1
- package/package.json +9 -9
- package/lib/components/NoItems/NoItems.d.ts +0 -14
- package/lib/components/NoItems/NoItems.d.ts.map +0 -1
- package/lib/components/NoItems/NoItems.js.map +0 -1
- package/lib/components/NoItems/index.d.ts +0 -4
- package/lib/components/NoItems/index.d.ts.map +0 -1
- package/lib/components/NoItems/index.js +0 -3
- package/lib/components/NoItems/index.js.map +0 -1
|
@@ -7,8 +7,8 @@ export interface FlexContainerProps {
|
|
|
7
7
|
pad?: number | [topRightBottomLeft: number] | [topBottom: number, rightLeft: number] | [top: number, rightLeft: number, bottom: number] | [top: number, right: number, bottom: number, left: number];
|
|
8
8
|
/** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */
|
|
9
9
|
direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
10
|
-
/** [justify-content](https://
|
|
11
|
-
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';
|
|
10
|
+
/** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */
|
|
11
|
+
justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';
|
|
12
12
|
/** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */
|
|
13
13
|
wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
14
14
|
/** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG9D,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yHAAyH;IACzH,GAAG,CAAC,EACA,MAAM,GACN,CAAC,kBAAkB,EAAE,MAAM,CAAC,GAC5B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,GACtC,CAAC,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,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nexport interface FlexContainerProps {\n /** Display as inline-flex. */\n inline?: boolean;\n /** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */\n pad?:\n | number\n | [topRightBottomLeft: number]\n | [topBottom: number, rightLeft: number]\n | [top: number, rightLeft: number, bottom: number]\n | [top: number, right: number, bottom: number, left: number];\n /** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */\n direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n /** [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/) */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly';\n /** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';\n /** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */\n alignItems?: 'stretch' | 'start' | 'end' | 'center' | 'baseline';\n /** [align-content](https://css-tricks.com/almanac/properties/a/align-content/) */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';\n /**\n * Defines how much equal space to place between items represented as a multiplier to the base spacing value in the theme.\n * @deprecated\n */\n itemGap?: number;\n /**\n * Defines how much equal space to place between columns represented as a multiplier to the base spacing value in the theme.\n * [column-gap](https://css-tricks.com/almanac/properties/c/column-gap/)\n */\n colGap?: number;\n /**\n * Defines how much equal space to place between rows represented as a multiplier to the base spacing value in the theme.\n * [row-gap](https://css-tricks.com/almanac/properties/r/row-gap/)\n */\n rowGap?: number;\n /**\n * Defines how much equal space to place between both rows and columns represented as a multiplier to the base spacing value in the theme.\n * [gap](https://css-tricks.com/almanac/properties/g/gap/)\n */\n gap?: number;\n}\n\nexport interface FlexItemProps {\n /** [align-self](https://css-tricks.com/almanac/properties/a/align-self/) */\n alignSelf?: 'auto' | 'start' | 'end' | 'baseline' | 'center' | 'stretch';\n /** [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/) */\n grow?: number;\n /** [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/) */\n shrink?: number;\n /** [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/) */\n basis?: string;\n}\n\nexport interface FlexProps extends BaseProps, AsProp {\n /** Content for either a container or item. */\n children?: ReactNode;\n /** Display as flex. Passed as a boolean, only a display flex will be applied. Provide FlexContainer object props to enable flex functionality. */\n container?: FlexContainerProps | boolean;\n /** Use to leverage flex item functionality when rendered as a child of a flex container. Items can be containers as well. */\n item?: FlexItemProps;\n /** Ref for the flex element. */\n ref?: Ref<Element>;\n}\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n if (['start', 'end'].includes(value)) return `flex-${value}`;\n return value;\n};\n\nconst getContainerStyles = (container: FlexProps['container']) => {\n if (!container) return '';\n\n if (container === true) {\n return css`\n display: flex;\n `;\n }\n\n if (container && typeof container === 'object') {\n const isRow = !container.direction || container.direction.includes('row');\n const isReverse = container.direction && container.direction.includes('reverse');\n\n return css`\n display: ${container.inline ? 'inline-flex' : 'flex'};\n\n ${typeof container.pad !== 'undefined' &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) =>\n (Array.isArray(container.pad) ? container.pad : [container.pad])\n .map(p => `calc(${p} * ${spacing})`)\n .join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${container.direction &&\n css`\n flex-direction: ${container.direction};\n `}\n\n ${container.justify &&\n css`\n justify-content: ${prefix(container.justify)};\n `}\n\n ${container.wrap &&\n css`\n flex-wrap: ${container.wrap};\n `}\n\n ${container.alignItems &&\n css`\n align-items: ${prefix(container.alignItems)};\n `}\n\n ${container.alignContent &&\n css`\n align-content: ${prefix(container.alignContent)};\n `}\n\n ${container.itemGap &&\n css`\n > * {\n margin-${isRow ? 'inline-start' : 'block-start'}: calc(${container.itemGap} * ${props =>\n props.theme.base.spacing});\n ${isReverse ? ':last-child' : ':first-child'} {\n margin-${isRow ? 'inline-start' : 'block-start'}: 0;\n }\n }\n `}\n\n ${typeof container.gap !== 'undefined' &&\n css`\n gap: calc(${container.gap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.colGap !== 'undefined' &&\n css`\n column-gap: calc(${container.colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.rowGap !== 'undefined' &&\n css`\n row-gap: calc(${container.rowGap} * ${props => props.theme.base.spacing});\n `}\n `;\n }\n};\n\nconst getItemStyles = (item: FlexProps['item']) => {\n return css`\n ${item &&\n css`\n max-width: 100%;\n min-width: 0;\n\n ${item.grow !== undefined &&\n css`\n flex-grow: ${item.grow};\n `}\n\n ${item.shrink !== undefined &&\n css`\n flex-shrink: ${item.shrink};\n `}\n\n ${item.alignSelf &&\n css`\n align-self: ${prefix(item.alignSelf)};\n `}\n\n ${item.basis &&\n css`\n flex-basis: ${item.basis};\n `}\n `}\n `;\n};\n\nexport const StyledFlex = styled.div<FlexProps>(({ container, item }) => {\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n `;\n});\n\nStyledFlex.defaultProps = defaultThemeProp;\n\nconst Flex: FunctionComponent<FlexProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FlexProps>, ref: FlexProps['ref']) => {\n return <StyledFlex {...props} ref={ref} />;\n }\n);\n\nexport default Flex;\n"]}
|
|
1
|
+
{"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAmC,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CA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,CAAC,MAAM,MAAM,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;OACxE;KACF,CAAC;KACH;AACH,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAAuB,EAAE,EAAE;IAChD,OAAO,GAAG,CAAA;MACN,IAAI;QACN,GAAG,CAAA;;;;QAIC,IAAI,CAAC,IAAI,KAAK,SAAS;YACzB,GAAG,CAAA;qBACY,IAAI,CAAC,IAAI;OACvB;;QAEC,IAAI,CAAC,MAAM,KAAK,SAAS;YAC3B,GAAG,CAAA;uBACc,IAAI,CAAC,MAAM;OAC3B;;QAEC,IAAI,CAAC,SAAS;YAChB,GAAG,CAAA;sBACa,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;OACrC;;QAEC,IAAI,CAAC,KAAK;YACZ,GAAG,CAAA;sBACa,IAAI,CAAC,KAAK;OACzB;KACF;GACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;IACtE,OAAO,GAAG,CAAA;MACN,kBAAkB,CAAC,SAAS,CAAC;MAC7B,aAAa,CAAC,IAAI,CAAC;GACtB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAgD,UAAU,CAClE,CAAC,KAAiC,EAAE,GAAqB,EAAE,EAAE;IAC3D,OAAO,KAAC,UAAU,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,YAAI,CAAC;AAC7C,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, ReactNode } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps, BaseProps, AsProp } from '../../types';\nimport { defaultThemeProp } from '../../theme';\n\nexport interface FlexContainerProps {\n /** Display as inline-flex. */\n inline?: boolean;\n /** Padding on the container represented as a multiplier or set of multipliers to the base spacing value in the theme. */\n pad?:\n | number\n | [topRightBottomLeft: number]\n | [topBottom: number, rightLeft: number]\n | [top: number, rightLeft: number, bottom: number]\n | [top: number, right: number, bottom: number, left: number];\n /** [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/) */\n direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';\n /** [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */\n justify?: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly' | 'stretch';\n /** [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/) */\n wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';\n /** [align-items](https://css-tricks.com/almanac/properties/a/align-items/). */\n alignItems?: 'stretch' | 'start' | 'end' | 'center' | 'baseline';\n /** [align-content](https://css-tricks.com/almanac/properties/a/align-content/) */\n alignContent?: 'start' | 'end' | 'center' | 'between' | 'around' | 'stretch';\n /**\n * Defines how much equal space to place between items represented as a multiplier to the base spacing value in the theme.\n * @deprecated\n */\n itemGap?: number;\n /**\n * Defines how much equal space to place between columns represented as a multiplier to the base spacing value in the theme.\n * [column-gap](https://css-tricks.com/almanac/properties/c/column-gap/)\n */\n colGap?: number;\n /**\n * Defines how much equal space to place between rows represented as a multiplier to the base spacing value in the theme.\n * [row-gap](https://css-tricks.com/almanac/properties/r/row-gap/)\n */\n rowGap?: number;\n /**\n * Defines how much equal space to place between both rows and columns represented as a multiplier to the base spacing value in the theme.\n * [gap](https://css-tricks.com/almanac/properties/g/gap/)\n */\n gap?: number;\n}\n\nexport interface FlexItemProps {\n /** [align-self](https://css-tricks.com/almanac/properties/a/align-self/) */\n alignSelf?: 'auto' | 'start' | 'end' | 'baseline' | 'center' | 'stretch';\n /** [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/) */\n grow?: number;\n /** [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/) */\n shrink?: number;\n /** [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/) */\n basis?: string;\n}\n\nexport interface FlexProps extends BaseProps, AsProp {\n /** Content for either a container or item. */\n children?: ReactNode;\n /** Display as flex. Passed as a boolean, only a display flex will be applied. Provide FlexContainer object props to enable flex functionality. */\n container?: FlexContainerProps | boolean;\n /** Use to leverage flex item functionality when rendered as a child of a flex container. Items can be containers as well. */\n item?: FlexItemProps;\n /** Ref for the flex element. */\n ref?: Ref<Element>;\n}\n\nconst prefix = (value: string) => {\n if (['between', 'around', 'evenly'].includes(value)) return `space-${value}`;\n if (['start', 'end'].includes(value)) return `flex-${value}`;\n return value;\n};\n\nconst getContainerStyles = (container: FlexProps['container']) => {\n if (!container) return '';\n\n if (container === true) {\n return css`\n display: flex;\n `;\n }\n\n if (container && typeof container === 'object') {\n const isRow = !container.direction || container.direction.includes('row');\n const isReverse = container.direction && container.direction.includes('reverse');\n\n return css`\n display: ${container.inline ? 'inline-flex' : 'flex'};\n\n ${typeof container.pad !== 'undefined' &&\n css`\n /* stylelint-disable function-name-case, function-whitespace-after */\n padding: ${({\n theme: {\n base: { spacing }\n }\n }) =>\n (Array.isArray(container.pad) ? container.pad : [container.pad])\n .map(p => `calc(${p} * ${spacing})`)\n .join(' ')};\n\n /* stylelint-enable function-name-case, function-whitespace-after */\n `}\n\n ${container.direction &&\n css`\n flex-direction: ${container.direction};\n `}\n\n ${container.justify &&\n css`\n justify-content: ${prefix(container.justify)};\n `}\n\n ${container.wrap &&\n css`\n flex-wrap: ${container.wrap};\n `}\n\n ${container.alignItems &&\n css`\n align-items: ${prefix(container.alignItems)};\n `}\n\n ${container.alignContent &&\n css`\n align-content: ${prefix(container.alignContent)};\n `}\n\n ${container.itemGap &&\n css`\n > * {\n margin-${isRow ? 'inline-start' : 'block-start'}: calc(${container.itemGap} * ${props =>\n props.theme.base.spacing});\n ${isReverse ? ':last-child' : ':first-child'} {\n margin-${isRow ? 'inline-start' : 'block-start'}: 0;\n }\n }\n `}\n\n ${typeof container.gap !== 'undefined' &&\n css`\n gap: calc(${container.gap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.colGap !== 'undefined' &&\n css`\n column-gap: calc(${container.colGap} * ${props => props.theme.base.spacing});\n `}\n\n ${typeof container.rowGap !== 'undefined' &&\n css`\n row-gap: calc(${container.rowGap} * ${props => props.theme.base.spacing});\n `}\n `;\n }\n};\n\nconst getItemStyles = (item: FlexProps['item']) => {\n return css`\n ${item &&\n css`\n max-width: 100%;\n min-width: 0;\n\n ${item.grow !== undefined &&\n css`\n flex-grow: ${item.grow};\n `}\n\n ${item.shrink !== undefined &&\n css`\n flex-shrink: ${item.shrink};\n `}\n\n ${item.alignSelf &&\n css`\n align-self: ${prefix(item.alignSelf)};\n `}\n\n ${item.basis &&\n css`\n flex-basis: ${item.basis};\n `}\n `}\n `;\n};\n\nexport const StyledFlex = styled.div<FlexProps>(({ container, item }) => {\n return css`\n ${getContainerStyles(container)}\n ${getItemStyles(item)}\n `;\n});\n\nStyledFlex.defaultProps = defaultThemeProp;\n\nconst Flex: FunctionComponent<FlexProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<FlexProps>, ref: FlexProps['ref']) => {\n return <StyledFlex {...props} ref={ref} />;\n }\n);\n\nexport default Flex;\n"]}
|
|
@@ -34,7 +34,7 @@ export interface FormControlProps extends BaseProps {
|
|
|
34
34
|
/** Sets html name attribute for the underlying control. Useful for mapping to a data field. */
|
|
35
35
|
name?: string;
|
|
36
36
|
}
|
|
37
|
-
export declare const StyledFormControl: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
37
|
+
export declare const StyledFormControl: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../types").OmitStrict<FormControlProps, never> & Required<Pick<FormControlProps, never>>, never>;
|
|
38
38
|
declare const FormControl: FunctionComponent<FormControlProps & ForwardProps>;
|
|
39
39
|
export default FormControl;
|
|
40
40
|
//# sourceMappingURL=FormControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAIzE,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACzC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6GAA6G;IAC7G,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../src/components/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAIzE,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oDAAoD;IACpD,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACzC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6GAA6G;IAC7G,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID,eAAO,MAAM,iBAAiB,0MAwE5B,CAAC;AAIH,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAInE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
import { ForwardProps } from '../../types';
|
|
3
3
|
import GridProps from './Grid.types';
|
|
4
|
-
export declare const StyledGrid: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme,
|
|
4
|
+
export declare const StyledGrid: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../types").OmitStrict<GridProps, never> & Required<Pick<GridProps, never>>, never>;
|
|
5
5
|
declare const Grid: FunctionComponent<GridProps & ForwardProps>;
|
|
6
6
|
export default Grid;
|
|
7
7
|
//# sourceMappingURL=Grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAG9D,OAAO,SAAS,MAAM,cAAc,CAAC;AA2LrC,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAqB,MAAM,aAAa,CAAC;AAG9D,OAAO,SAAS,MAAM,cAAc,CAAC;AA2LrC,eAAO,MAAM,UAAU,4LAqCrB,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAIrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -4,14 +4,14 @@ const StyledInput = styled.input(({ theme: { base, components } }) => {
|
|
|
4
4
|
return css `
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: ${components.input.height};
|
|
7
|
-
min-height: ${base
|
|
7
|
+
min-height: ${base['hit-area']['mouse-min']};
|
|
8
8
|
padding: 0 ${components.input.padding};
|
|
9
9
|
appearance: none;
|
|
10
10
|
-webkit-appearance: none;
|
|
11
11
|
text-align: inherit;
|
|
12
12
|
|
|
13
13
|
@media (pointer: coarse) {
|
|
14
|
-
min-height: ${base
|
|
14
|
+
min-height: ${base['hit-area']['finger-min']};
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.styles.js","sourceRoot":"","sources":["../../../src/components/Input/Input.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;IACnE,OAAO,GAAG,CAAA;;cAEE,UAAU,CAAC,KAAK,CAAC,MAAM;kBACnB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"Input.styles.js","sourceRoot":"","sources":["../../../src/components/Input/Input.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;IACnE,OAAO,GAAG,CAAA;;cAEE,UAAU,CAAC,KAAK,CAAC,MAAM;kBACnB,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC;iBAC9B,UAAU,CAAC,KAAK,CAAC,OAAO;;;;;;oBAMrB,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;;GAE/C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE5C,eAAe,WAAW,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\n\nconst StyledInput = styled.input(({ theme: { base, components } }) => {\n return css`\n width: 100%;\n height: ${components.input.height};\n min-height: ${base['hit-area']['mouse-min']};\n padding: 0 ${components.input.padding};\n appearance: none;\n -webkit-appearance: none;\n text-align: inherit;\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledInput.defaultProps = defaultThemeProp;\n\nexport default StyledInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlyoutMenuList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FlyoutMenuList.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EAAE,aAAa,EAAuB,MAAM,cAAc,CAAC;AAQlE,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA+HnE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -3,12 +3,14 @@ import { createElement as _createElement } from "react";
|
|
|
3
3
|
import { forwardRef, useContext, useEffect, useRef, useState, useMemo, useCallback, useLayoutEffect } from 'react';
|
|
4
4
|
import { useAfterInitialEffect, useConsolidatedRef, useItemIntersection } from '../../hooks';
|
|
5
5
|
import Progress from '../Progress';
|
|
6
|
-
import
|
|
6
|
+
import EmptyState from '../EmptyState';
|
|
7
7
|
import Popover from '../Popover';
|
|
8
8
|
import MenuContext from './Menu.context';
|
|
9
9
|
import MenuItem from './MenuItem';
|
|
10
10
|
import { StyledLoadingItem, StyledMenuList, StyledFlyoutMenuListContainer } from './Menu.styles';
|
|
11
11
|
import { resizeRootEl } from './NavItemsList';
|
|
12
|
+
import helpers from './helpers';
|
|
13
|
+
import MenuGroup from './MenuGroup';
|
|
12
14
|
const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
|
|
13
15
|
const selfRef = useConsolidatedRef(ref);
|
|
14
16
|
const ulRef = useRef(null);
|
|
@@ -36,7 +38,7 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
|
|
|
36
38
|
const listContent = useMemo(() => {
|
|
37
39
|
if (items.length) {
|
|
38
40
|
return items.map(item => {
|
|
39
|
-
return (_createElement(MenuItem, { ...item, key: item.id, "aria-haspopup": !!item.items, "aria-expanded": item.id === expandedItem?.id, onExpand: (id, e) => {
|
|
41
|
+
return helpers.isItem(item) ? (_createElement(MenuItem, { ...item, key: item.id, "aria-haspopup": !!item.items, "aria-expanded": item.id === expandedItem?.id, onExpand: (id, e) => {
|
|
40
42
|
if (item.items) {
|
|
41
43
|
returnFocusRef.current = e.currentTarget;
|
|
42
44
|
setExpandedItem(item); // FIXME
|
|
@@ -48,11 +50,11 @@ const FlyoutMenuList = forwardRef(({ items, parent }, ref) => {
|
|
|
48
50
|
returnFocusRef.current = null;
|
|
49
51
|
setExpandedItem(undefined);
|
|
50
52
|
}
|
|
51
|
-
} }));
|
|
53
|
+
} })) : (_createElement(MenuGroup, { ...item, key: item.id }));
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
if (!loading) {
|
|
55
|
-
return _jsx(
|
|
57
|
+
return _jsx(EmptyState, { message: emptyText, forwardedAs: 'li' }, void 0);
|
|
56
58
|
}
|
|
57
59
|
return null;
|
|
58
60
|
}, [items, loading, emptyText, expandedItem]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlyoutMenuList.js","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,UAAU,EAIV,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAW,EACX,eAAe,EAChB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"FlyoutMenuList.js","sourceRoot":"","sources":["../../../src/components/Menu/FlyoutMenuList.tsx"],"names":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CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5C,IAAI,YAAY,EAAE;YAChB,eAAe,CAAC,SAAS,CAAC,CAAC;SAC5B;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,8BACE,KAAC,6BAA6B,kBAC5B,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,oBAAoB,gCACF,WAAW,yBAClB,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,WAAW,gBAElD,IAAI,YACyB,EAE/B,YAAY,IAAI,OAAO,CAAC,OAAO,IAAI,CAClC,KAAC,OAAO,kBAAC,MAAM,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,QAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,aAAa,gBACpF,KAAC,cAAc,IACb,KAAK,EAAE,YAAY,CAAC,KAAK,EACzB,MAAM,EAAE;wBACN,EAAE,EAAE,OAAO,CAAC,OAAO;wBACnB,IAAI,EAAE,YAAY;wBAClB,YAAY,EAAE,KAAK;wBACnB,eAAe;wBACf,cAAc;qBACf,WACD,YACM,CACX,YACA,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n useContext,\n useEffect,\n useRef,\n useState,\n useMemo,\n useCallback,\n useLayoutEffect\n} from 'react';\n\nimport { ForwardProps } from '../../types';\nimport { useAfterInitialEffect, useConsolidatedRef, useItemIntersection } from '../../hooks';\nimport Progress from '../Progress';\nimport EmptyState from '../EmptyState';\nimport Popover from '../Popover';\n\nimport { MenuListProps, ParentMenuItemProps } from './Menu.types';\nimport MenuContext from './Menu.context';\nimport MenuItem from './MenuItem';\nimport { StyledLoadingItem, StyledMenuList, StyledFlyoutMenuListContainer } from './Menu.styles';\nimport { resizeRootEl } from './NavItemsList';\nimport helpers from './helpers';\nimport MenuGroup from './MenuGroup';\n\nconst FlyoutMenuList: FunctionComponent<MenuListProps & ForwardProps> = forwardRef(\n ({ items, parent }: PropsWithoutRef<MenuListProps>, ref: MenuListProps['ref']) => {\n const selfRef = useConsolidatedRef(ref);\n const ulRef = useRef<HTMLUListElement>(null);\n const menuListWrapperRef: MutableRefObject<HTMLElement | null> = useRef(null);\n const returnFocusRef: MutableRefObject<HTMLButtonElement | null> = useRef(null);\n const [expandedItem, setExpandedItem] = useState<ParentMenuItemProps>();\n const {\n componentId,\n loadMore,\n loading,\n scrollAt,\n emptyText,\n onItemExpand,\n pushFlyoutId,\n flyOutActiveIdStack\n } = useContext(MenuContext);\n\n useItemIntersection(ulRef, items.length - 1, () => {\n loadMore?.(parent?.item?.id);\n });\n\n useAfterInitialEffect(() => {\n if (expandedItem) {\n setExpandedItem(items.find(item => item.id === expandedItem.id) as ParentMenuItemProps); // FIXME\n }\n }, [expandedItem, items]);\n\n useEffect(() => {\n const hasExpanded = items.some(item => {\n return flyOutActiveIdStack.includes(item.id);\n });\n\n if (!hasExpanded) {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }, [flyOutActiveIdStack]);\n\n const listContent = useMemo(() => {\n if (items.length) {\n return items.map(item => {\n return helpers.isItem(item) ? (\n <MenuItem\n {...item}\n key={item.id}\n aria-haspopup={!!item.items}\n aria-expanded={item.id === expandedItem?.id}\n onExpand={(id, e) => {\n if (item.items) {\n returnFocusRef.current = e.currentTarget as HTMLButtonElement;\n setExpandedItem(item as ParentMenuItemProps); // FIXME\n item?.onExpand?.(id, e);\n onItemExpand?.(id, e);\n pushFlyoutId(item.id || componentId);\n } else {\n returnFocusRef.current = null;\n setExpandedItem(undefined);\n }\n }}\n />\n ) : (\n <MenuGroup {...item} key={item.id} />\n );\n });\n }\n\n if (!loading) {\n return <EmptyState message={emptyText} forwardedAs='li' />;\n }\n\n return null;\n }, [items, loading, emptyText, expandedItem]);\n\n const list = (\n <StyledMenuList ref={ulRef}>\n {listContent}\n {loading && !expandedItem && (\n <StyledLoadingItem>\n <Progress placement='local' />\n </StyledLoadingItem>\n )}\n </StyledMenuList>\n );\n\n useLayoutEffect(() => {\n setExpandedItem(undefined);\n if (selfRef.current) {\n menuListWrapperRef.current = selfRef.current.parentElement;\n resizeRootEl(selfRef.current, selfRef.current, items.length, scrollAt);\n }\n }, [items]);\n\n const handleMenuListScroll = useCallback(() => {\n if (expandedItem) {\n setExpandedItem(undefined);\n }\n }, [expandedItem]);\n\n return (\n <>\n <StyledFlyoutMenuListContainer\n ref={selfRef}\n onScroll={handleMenuListScroll}\n data-flyout-menu-parent-id={componentId}\n data-flyout-menu-id={parent?.item.id || componentId}\n >\n {list}\n </StyledFlyoutMenuListContainer>\n\n {expandedItem && selfRef.current && (\n <Popover target={returnFocusRef.current} show strategy='fixed' placement='right-start'>\n <FlyoutMenuList\n items={expandedItem.items}\n parent={{\n el: selfRef.current,\n item: expandedItem,\n siblingItems: items,\n setExpandedItem,\n returnFocusRef\n }}\n />\n </Popover>\n )}\n </>\n );\n }\n);\n\nexport default FlyoutMenuList;\n"]}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export declare const StyledItemLabel: import("styled-components").StyledComponent<"label", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const StyledMenuItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {
|
|
3
|
+
isParentItem: boolean;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const StyledAncestors: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
6
|
+
export declare const StyledVisibilityHidden: import("styled-components").StyledComponent<"p", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const StyledSeparator: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const StyledMenuGroupList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
export declare const StyledMenuGroupHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
+
export declare const StyledMenuListHeader: import("styled-components").StyledComponent<"legend", import("styled-components").DefaultTheme, {}, never>;
|
|
1
11
|
export declare const StyledMenuList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
|
|
2
12
|
export declare const StyledMenuListContainer: import("styled-components").StyledComponent<"fieldset", import("styled-components").DefaultTheme, {}, never>;
|
|
3
13
|
export declare const StyledFlyoutMenuListContainer: import("styled-components").StyledComponent<"fieldset", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,2GA8D1B,CAAC;AAIH,eAAO,MAAM,cAAc;kBAA6B,OAAO;SA0C9D,CAAC;AAIF,eAAO,MAAM,eAAe,yGAW3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,uGAElC,CAAC;AAEF,eAAO,MAAM,eAAe,wGAM1B,CAAC;AAIH,eAAO,MAAM,mBAAmB,wGAM9B,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGAUhC,CAAC;AAIH,eAAO,MAAM,oBAAoB,4GAgD/B,CAAC;AAIH,eAAO,MAAM,cAAc,wGAgB1B,CAAC;AAIF,eAAO,MAAM,uBAAuB,8GAMlC,CAAC;AAIH,eAAO,MAAM,6BAA6B,8GAEzC,CAAC;AAEF,eAAO,MAAM,iBAAiB,wGAI7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAqBjC,CAAC;AAIF,eAAO,MAAM,qBAAqB,uGAEjC,CAAC;AAEF,eAAO,MAAM,UAAU,yGAiCrB,CAAC"}
|
|
@@ -1,7 +1,198 @@
|
|
|
1
|
-
import { hideVisually } from 'polished';
|
|
1
|
+
import { hideVisually, mix, readableColor, rgba } from 'polished';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
import { defaultThemeProp } from '../../theme';
|
|
4
|
-
import {
|
|
4
|
+
import { StyledEmptyState } from '../EmptyState';
|
|
5
|
+
import { StyledIcon } from '../Icon';
|
|
6
|
+
import { StyledGrid } from '../Grid';
|
|
7
|
+
import { StyledBareButton } from '../Button/BareButton';
|
|
8
|
+
import { tryCatch } from '../../utils';
|
|
9
|
+
import { StyledText } from '../Text';
|
|
10
|
+
export const StyledItemLabel = styled.label(({ theme }) => {
|
|
11
|
+
const hoverCheckColor = tryCatch(() => rgba(theme.components['radio-check'][':checked']['background-color'], theme.base.transparency['transparent-5']));
|
|
12
|
+
const checkedBackground = theme.components['radio-check'][':checked']['background-color'];
|
|
13
|
+
const checkedForeground = tryCatch(() => readableColor(checkedBackground));
|
|
14
|
+
return css `
|
|
15
|
+
padding: calc(0.5 * ${theme.base.spacing}) ${theme.base.spacing};
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
& > input[type='radio']:not(:checked) + ${StyledIcon} {
|
|
20
|
+
color: ${hoverCheckColor};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
& > input[type='checkbox'] + ${StyledIcon} {
|
|
24
|
+
border-color: ${theme.components['form-control'][':hover']['border-color']};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
> ${StyledGrid} {
|
|
29
|
+
flex-grow: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> input {
|
|
33
|
+
${hideVisually}
|
|
34
|
+
|
|
35
|
+
& + ${StyledIcon} {
|
|
36
|
+
margin-inline-start: 0;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&[type='radio'] + ${StyledIcon} {
|
|
41
|
+
color: transparent;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&[type='radio']:checked + ${StyledIcon} {
|
|
45
|
+
color: ${checkedBackground};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&[type='checkbox'] + ${StyledIcon} {
|
|
49
|
+
border: 0.0625rem solid ${theme.components['radio-check']['border-color']};
|
|
50
|
+
border-radius: min(
|
|
51
|
+
calc(${theme.base['border-radius']} * ${theme.components.checkbox['border-radius']}),
|
|
52
|
+
0.25rem
|
|
53
|
+
);
|
|
54
|
+
color: transparent;
|
|
55
|
+
background-color: ${theme.components['radio-check']['background-color']};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&[type='checkbox']:checked + ${StyledIcon} {
|
|
59
|
+
background-color: ${checkedBackground};
|
|
60
|
+
border-color: ${theme.components['radio-check'][':checked']['border-color']};
|
|
61
|
+
color: ${checkedForeground};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
});
|
|
66
|
+
StyledItemLabel.defaultProps = defaultThemeProp;
|
|
67
|
+
export const StyledMenuItem = styled.li(({ theme: { base, components }, isParentItem }) => {
|
|
68
|
+
const hoverColor = tryCatch(() => mix(0.85, base.palette['primary-background'], base.palette.interactive));
|
|
69
|
+
return css `
|
|
70
|
+
min-height: ${base['hit-area']['mouse-min']};
|
|
71
|
+
|
|
72
|
+
@media (pointer: coarse) {
|
|
73
|
+
min-height: ${base['hit-area']['finger-min']};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:focus-within,
|
|
77
|
+
&:hover:not([aria-disabled='true']),
|
|
78
|
+
&[data-current='true'] {
|
|
79
|
+
background-color: ${hoverColor};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
> button:first-child,
|
|
83
|
+
> a:first-child {
|
|
84
|
+
display: block;
|
|
85
|
+
width: 100%;
|
|
86
|
+
padding: calc(0.5 * ${base.spacing}) ${base.spacing};
|
|
87
|
+
text-align: start;
|
|
88
|
+
text-decoration: none;
|
|
89
|
+
color: inherit;
|
|
90
|
+
${isParentItem &&
|
|
91
|
+
css `
|
|
92
|
+
padding-inline-start: calc(1.125rem + 2 * ${base.spacing});
|
|
93
|
+
`}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&[aria-disabled='true'] {
|
|
97
|
+
label,
|
|
98
|
+
${StyledBareButton} {
|
|
99
|
+
background-color: ${components['form-control'][':disabled']['background-color']};
|
|
100
|
+
opacity: ${base['disabled-opacity']};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
});
|
|
105
|
+
StyledMenuItem.defaultProps = defaultThemeProp;
|
|
106
|
+
export const StyledAncestors = styled.div `
|
|
107
|
+
${StyledIcon} {
|
|
108
|
+
width: 1em;
|
|
109
|
+
height: 1em;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
& > ${StyledText} {
|
|
113
|
+
white-space: nowrap;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
text-overflow: ellipsis;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
118
|
+
export const StyledVisibilityHidden = styled.p `
|
|
119
|
+
${hideVisually}
|
|
120
|
+
`;
|
|
121
|
+
export const StyledSeparator = styled.li(({ theme }) => {
|
|
122
|
+
return css `
|
|
123
|
+
height: 0.0625rem;
|
|
124
|
+
background-color: ${theme.base.palette['border-line']};
|
|
125
|
+
margin: ${theme.base.spacing} 0;
|
|
126
|
+
`;
|
|
127
|
+
});
|
|
128
|
+
StyledSeparator.defaultProps = defaultThemeProp;
|
|
129
|
+
export const StyledMenuGroupList = styled.ul(({ theme }) => {
|
|
130
|
+
return css `
|
|
131
|
+
${StyledMenuItem} button {
|
|
132
|
+
padding-inline-start: calc(1.5 * ${theme.base.spacing});
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
});
|
|
136
|
+
StyledMenuGroupList.defaultProps = defaultThemeProp;
|
|
137
|
+
export const StyledMenuGroupHeader = styled.div(({ theme }) => {
|
|
138
|
+
return css `
|
|
139
|
+
min-height: ${theme.base['hit-area']['mouse-min']};
|
|
140
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
141
|
+
background-color: ${theme.base.palette['secondary-background']};
|
|
142
|
+
|
|
143
|
+
@media (pointer: coarse) {
|
|
144
|
+
min-height: ${theme.base['hit-area']['finger-min']};
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
});
|
|
148
|
+
StyledMenuGroupHeader.defaultProps = defaultThemeProp;
|
|
149
|
+
export const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {
|
|
150
|
+
const hoverColor = tryCatch(() => mix(0.85, base.palette['primary-background'], base.palette.interactive));
|
|
151
|
+
return css `
|
|
152
|
+
width: 100%;
|
|
153
|
+
background-color: ${base.palette['primary-background']};
|
|
154
|
+
|
|
155
|
+
&:first-child {
|
|
156
|
+
border-top-left-radius: inherit;
|
|
157
|
+
border-top-right-radius: inherit;
|
|
158
|
+
}
|
|
159
|
+
&:last-child {
|
|
160
|
+
border-bottom-left-radius: inherit;
|
|
161
|
+
border-bottom-right-radius: inherit;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&:focus-within {
|
|
165
|
+
box-shadow: inset ${base.shadow.focus};
|
|
166
|
+
background-color: ${hoverColor};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&:hover {
|
|
170
|
+
background-color: ${hoverColor};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
& > ${StyledBareButton}, & > button {
|
|
174
|
+
color: ${base.palette['foreground-color']};
|
|
175
|
+
width: 100%;
|
|
176
|
+
padding: calc(0.5 * ${base.spacing}) ${base.spacing};
|
|
177
|
+
text-align: start;
|
|
178
|
+
border-radius: inherit;
|
|
179
|
+
|
|
180
|
+
> ${StyledGrid} {
|
|
181
|
+
grid-column-gap: ${base.spacing};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
${StyledIcon} {
|
|
185
|
+
/* Fixes vertical align issue increasing box size beyond square */
|
|
186
|
+
display: block;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
> button[data-current='true'] {
|
|
191
|
+
background-color: ${hoverColor};
|
|
192
|
+
}
|
|
193
|
+
`;
|
|
194
|
+
});
|
|
195
|
+
StyledMenuListHeader.defaultProps = defaultThemeProp;
|
|
5
196
|
export const StyledMenuList = styled.ul(({ theme }) => css `
|
|
6
197
|
overflow-x: hidden;
|
|
7
198
|
overflow-y: auto;
|
|
@@ -9,9 +200,13 @@ export const StyledMenuList = styled.ul(({ theme }) => css `
|
|
|
9
200
|
height: 100%;
|
|
10
201
|
border-radius: inherit;
|
|
11
202
|
|
|
12
|
-
${
|
|
203
|
+
${StyledEmptyState} {
|
|
13
204
|
padding: ${theme.base.spacing};
|
|
14
205
|
}
|
|
206
|
+
|
|
207
|
+
li:not(:first-child) > ${StyledMenuGroupHeader} {
|
|
208
|
+
margin-block-start: ${theme.base.spacing};
|
|
209
|
+
}
|
|
15
210
|
`);
|
|
16
211
|
StyledMenuList.defaultProps = defaultThemeProp;
|
|
17
212
|
export const StyledMenuListContainer = styled.fieldset(({ theme }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,EAAE,CACrC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;;;;MAOd,aAAa;iBACF,KAAK,CAAC,IAAI,CAAC,OAAO;;GAEhC,CACF,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,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AY,GAAG,gBAAgB,CAAC","sourcesContent":["import { hideVisually } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledNoItems } from '../NoItems';\n\nexport const StyledMenuList = styled.ul(\n ({ theme }) => css`\n overflow-x: hidden;\n overflow-y: auto;\n list-style: none;\n height: 100%;\n border-radius: inherit;\n\n ${StyledNoItems} {\n padding: ${theme.base.spacing};\n }\n `\n);\n\nStyledMenuList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListContainer = styled.fieldset(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0;\n border-radius: inherit;\n `;\n});\n\nStyledMenuListContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlyoutMenuListContainer = styled(StyledMenuListContainer)`\n min-width: 10rem;\n`;\n\nexport const StyledLoadingItem = styled.li`\n display: block;\n position: relative;\n height: 2.8rem;\n`;\n\nexport const StyledMenuListWrapper = styled.div(\n ({ theme }) => css`\n position: relative;\n overflow: hidden;\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n max-height: 50vh;\n\n & > fieldset:first-child {\n position: relative;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n `\n);\n\nStyledMenuListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledAriaDescription = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledMenu = styled.div(({ theme }) => {\n const borderStyle = `0.0625rem solid ${theme.base.palette['border-line']}`;\n return css`\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n ${StyledAriaDescription}:first-child {\n + ${StyledMenuListWrapper}, + header {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n > header,\n > footer {\n padding: ${theme.base.spacing};\n }\n\n > header {\n border-bottom: ${borderStyle};\n }\n\n > footer {\n border-top: ${borderStyle};\n }\n `;\n});\n\nStyledMenu.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACxD,MAAM,eAAe,GAAG,QAAQ,CAAC,GAAG,EAAE,CACpC,IAAI,CACF,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,EAC/D,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CACzC,CACF,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,CAAC;IAC1F,MAAM,iBAAiB,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAE3E,OAAO,GAAG,CA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WAAW;;GAE5B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { hideVisually, mix, readableColor, rgba } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledEmptyState } from '../EmptyState';\nimport { StyledIcon } from '../Icon';\nimport { StyledGrid } from '../Grid';\nimport { StyledBareButton } from '../Button/BareButton';\nimport { tryCatch } from '../../utils';\nimport { StyledText } from '../Text';\n\nexport const StyledItemLabel = styled.label(({ theme }) => {\n const hoverCheckColor = tryCatch(() =>\n rgba(\n theme.components['radio-check'][':checked']['background-color'],\n theme.base.transparency['transparent-5']\n )\n );\n\n const checkedBackground = theme.components['radio-check'][':checked']['background-color'];\n const checkedForeground = tryCatch(() => readableColor(checkedBackground));\n\n return css`\n padding: calc(0.5 * ${theme.base.spacing}) ${theme.base.spacing};\n cursor: pointer;\n\n &:hover {\n & > input[type='radio']:not(:checked) + ${StyledIcon} {\n color: ${hoverCheckColor};\n }\n\n & > input[type='checkbox'] + ${StyledIcon} {\n border-color: ${theme.components['form-control'][':hover']['border-color']};\n }\n }\n\n > ${StyledGrid} {\n flex-grow: 1;\n }\n\n > input {\n ${hideVisually}\n\n & + ${StyledIcon} {\n margin-inline-start: 0;\n flex-shrink: 0;\n }\n\n &[type='radio'] + ${StyledIcon} {\n color: transparent;\n }\n\n &[type='radio']:checked + ${StyledIcon} {\n color: ${checkedBackground};\n }\n\n &[type='checkbox'] + ${StyledIcon} {\n border: 0.0625rem solid ${theme.components['radio-check']['border-color']};\n border-radius: min(\n calc(${theme.base['border-radius']} * ${theme.components.checkbox['border-radius']}),\n 0.25rem\n );\n color: transparent;\n background-color: ${theme.components['radio-check']['background-color']};\n }\n\n &[type='checkbox']:checked + ${StyledIcon} {\n background-color: ${checkedBackground};\n border-color: ${theme.components['radio-check'][':checked']['border-color']};\n color: ${checkedForeground};\n }\n }\n `;\n});\n\nStyledItemLabel.defaultProps = defaultThemeProp;\n\nexport const StyledMenuItem = styled.li<{ isParentItem: boolean }>(\n ({ theme: { base, components }, isParentItem }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n min-height: ${base['hit-area']['mouse-min']};\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n\n &:focus-within,\n &:hover:not([aria-disabled='true']),\n &[data-current='true'] {\n background-color: ${hoverColor};\n }\n\n > button:first-child,\n > a:first-child {\n display: block;\n width: 100%;\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n text-decoration: none;\n color: inherit;\n ${isParentItem &&\n css`\n padding-inline-start: calc(1.125rem + 2 * ${base.spacing});\n `}\n }\n\n &[aria-disabled='true'] {\n label,\n ${StyledBareButton} {\n background-color: ${components['form-control'][':disabled']['background-color']};\n opacity: ${base['disabled-opacity']};\n }\n }\n `;\n }\n);\n\nStyledMenuItem.defaultProps = defaultThemeProp;\n\nexport const StyledAncestors = styled.div`\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n\n & > ${StyledText} {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n`;\n\nexport const StyledVisibilityHidden = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledSeparator = styled.li(({ theme }) => {\n return css`\n height: 0.0625rem;\n background-color: ${theme.base.palette['border-line']};\n margin: ${theme.base.spacing} 0;\n `;\n});\n\nStyledSeparator.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupList = styled.ul(({ theme }) => {\n return css`\n ${StyledMenuItem} button {\n padding-inline-start: calc(1.5 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledMenuGroupList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupHeader = styled.div(({ theme }) => {\n return css`\n min-height: ${theme.base['hit-area']['mouse-min']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${theme.base.palette['secondary-background']};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledMenuGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {\n const hoverColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n width: 100%;\n background-color: ${base.palette['primary-background']};\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &:focus-within {\n box-shadow: inset ${base.shadow.focus};\n background-color: ${hoverColor};\n }\n\n &:hover {\n background-color: ${hoverColor};\n }\n\n & > ${StyledBareButton}, & > button {\n color: ${base.palette['foreground-color']};\n width: 100%;\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n border-radius: inherit;\n\n > ${StyledGrid} {\n grid-column-gap: ${base.spacing};\n }\n\n ${StyledIcon} {\n /* Fixes vertical align issue increasing box size beyond square */\n display: block;\n }\n }\n\n > button[data-current='true'] {\n background-color: ${hoverColor};\n }\n `;\n});\n\nStyledMenuListHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuList = styled.ul(\n ({ theme }) => css`\n overflow-x: hidden;\n overflow-y: auto;\n list-style: none;\n height: 100%;\n border-radius: inherit;\n\n ${StyledEmptyState} {\n padding: ${theme.base.spacing};\n }\n\n li:not(:first-child) > ${StyledMenuGroupHeader} {\n margin-block-start: ${theme.base.spacing};\n }\n `\n);\n\nStyledMenuList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListContainer = styled.fieldset(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0;\n border-radius: inherit;\n `;\n});\n\nStyledMenuListContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlyoutMenuListContainer = styled(StyledMenuListContainer)`\n min-width: 10rem;\n`;\n\nexport const StyledLoadingItem = styled.li`\n display: block;\n position: relative;\n height: 2.8rem;\n`;\n\nexport const StyledMenuListWrapper = styled.div(\n ({ theme }) => css`\n position: relative;\n overflow: hidden;\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n max-height: 50vh;\n\n & > fieldset:first-child {\n position: relative;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n `\n);\n\nStyledMenuListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledAriaDescription = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledMenu = styled.div(({ theme }) => {\n const borderStyle = `0.0625rem solid ${theme.base.palette['border-line']}`;\n return css`\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n ${StyledAriaDescription}:first-child {\n + ${StyledMenuListWrapper}, + header {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n > header,\n > footer {\n padding: ${theme.base.spacing};\n }\n\n > header {\n border-bottom: ${borderStyle};\n }\n\n > footer {\n border-top: ${borderStyle};\n }\n `;\n});\n\nStyledMenu.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { Dispatch, ReactNode, Ref, RefObject, SetStateAction, MouseEvent } from 'react';
|
|
2
2
|
import { BaseProps, OmitStrict, PropsWithDefaults } from '../../types';
|
|
3
|
+
import { MetaListProps } from '../MetaList';
|
|
3
4
|
export declare type AcceptedMouseEventElement = HTMLButtonElement | HTMLAnchorElement | HTMLInputElement;
|
|
4
|
-
export interface MenuItemProps {
|
|
5
|
-
/** A unique id within the entire tree of menu items. This will be passed back to an item's onClick handler. */
|
|
6
|
-
id: string;
|
|
5
|
+
export interface MenuItemProps extends MenuObjectProps {
|
|
7
6
|
/** The primary piece of item information as a string. */
|
|
8
7
|
primary: string;
|
|
9
8
|
/** Secondary info about an item. Useful for additional metadata or context. Will be overridden when ancestors are passed as a prop. */
|
|
10
|
-
secondary?:
|
|
9
|
+
secondary?: MetaListProps['items'];
|
|
11
10
|
/** A visual to assist identifying an item. e.g. Avatar or Icon. */
|
|
12
11
|
visual?: ReactNode;
|
|
13
12
|
/** A count to assist with number of associated items. */
|
|
14
13
|
count?: number;
|
|
15
14
|
/** An array of MenuItemProps to identify an item's ancestors by their primary value. Useful for flattened tree search results. */
|
|
16
|
-
ancestors?: MenuItemProps[];
|
|
17
|
-
/** An array of MenuItemProps children. */
|
|
18
|
-
items?: MenuItemProps[];
|
|
15
|
+
ancestors?: (MenuItemProps | MenuGroupProps)[];
|
|
16
|
+
/** An array of either MenuItemProps or MenuGroupProps children. */
|
|
17
|
+
items?: (MenuItemProps | MenuGroupProps)[];
|
|
19
18
|
/**
|
|
20
19
|
* For single or multi select menus, selected must be set true|false to render an item's radiobutton or checkbox.
|
|
21
20
|
* May be set on parent or leaf items.
|
|
@@ -38,6 +37,12 @@ export interface MenuItemProps {
|
|
|
38
37
|
/** Determines if the MenuItem will be disabled. */
|
|
39
38
|
disabled?: boolean;
|
|
40
39
|
}
|
|
40
|
+
export interface MenuGroupProps extends MenuObjectProps {
|
|
41
|
+
/** Label of the group. */
|
|
42
|
+
label: string;
|
|
43
|
+
/** An array of MenuItemProps children. */
|
|
44
|
+
items: MenuItemProps[];
|
|
45
|
+
}
|
|
41
46
|
export declare type ParentMenuItemProps = MenuItemProps & {
|
|
42
47
|
items: NonNullable<MenuItemProps['items']>;
|
|
43
48
|
};
|
|
@@ -47,6 +52,10 @@ export interface MenuListHeaderProps {
|
|
|
47
52
|
/** Internal handler. */
|
|
48
53
|
onClick: () => void;
|
|
49
54
|
}
|
|
55
|
+
export interface MenuObjectProps {
|
|
56
|
+
/** A unique id within the entire tree of menu items. */
|
|
57
|
+
id: string;
|
|
58
|
+
}
|
|
50
59
|
export interface MenuListProps {
|
|
51
60
|
items: ParentMenuItemProps['items'];
|
|
52
61
|
ref?: Ref<HTMLFieldSetElement>;
|
|
@@ -60,7 +69,7 @@ export interface MenuListProps {
|
|
|
60
69
|
}
|
|
61
70
|
export interface MenuProps extends BaseProps {
|
|
62
71
|
/** An array of MenuItemProps. */
|
|
63
|
-
items: MenuItemProps[];
|
|
72
|
+
items: (MenuItemProps | MenuGroupProps)[];
|
|
64
73
|
/**
|
|
65
74
|
* Indicates intent for the menu.
|
|
66
75
|
* As of now item types can not be mixed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Menu.types.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAY,yBAAyB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAEjG,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,uIAAuI;IACvI,SAAS,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,mEAAmE;IACnE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CA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