@pega/cosmos-react-core 3.0.0-dev.2.0 → 3.0.0-dev.4.1
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/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +59 -41
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +1 -3
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +11 -4
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +5 -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/SkipNavigation.d.ts.map +1 -1
- package/lib/components/AppShell/SkipNavigation.js +24 -15
- package/lib/components/AppShell/SkipNavigation.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.styles.js +1 -0
- package/lib/components/ComboBox/ComboBox.styles.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +2 -1
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.d.ts +20 -11
- package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyDisplay.js +16 -6
- package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +2 -0
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js +18 -7
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroupList.js +16 -13
- package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
- package/lib/components/File/FileUploadItem.js +1 -1
- package/lib/components/File/FileUploadItem.js.map +1 -1
- package/lib/components/Form/Form.d.ts.map +1 -1
- package/lib/components/Form/Form.js +2 -1
- package/lib/components/Form/Form.js.map +1 -1
- package/lib/components/HTML/HTML.d.ts +13 -0
- package/lib/components/HTML/HTML.d.ts.map +1 -0
- package/lib/components/HTML/HTML.js +148 -0
- package/lib/components/HTML/HTML.js.map +1 -0
- package/lib/components/HTML/index.d.ts +2 -0
- package/lib/components/HTML/index.d.ts.map +1 -0
- package/lib/components/HTML/index.js +2 -0
- package/lib/components/HTML/index.js.map +1 -0
- package/lib/components/Icon/iconNames.d.ts +1 -1
- package/lib/components/Icon/iconNames.d.ts.map +1 -1
- package/lib/components/Icon/iconNames.js +1 -0
- package/lib/components/Icon/iconNames.js.map +1 -1
- package/lib/components/Icon/icons/ai-assist.icon.d.ts +4 -0
- package/lib/components/Icon/icons/ai-assist.icon.d.ts.map +1 -0
- package/lib/components/Icon/icons/ai-assist.icon.js +6 -0
- package/lib/components/Icon/icons/ai-assist.icon.js.map +1 -0
- package/lib/components/Icon/icons/help-solid.icon.js +1 -1
- package/lib/components/Icon/icons/help-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/help.icon.js +1 -1
- package/lib/components/Icon/icons/help.icon.js.map +1 -1
- package/lib/components/Icon/icons/information-solid.icon.d.ts.map +1 -1
- package/lib/components/Icon/icons/information-solid.icon.js +1 -1
- package/lib/components/Icon/icons/information-solid.icon.js.map +1 -1
- package/lib/components/Icon/icons/information.icon.js +1 -1
- package/lib/components/Icon/icons/information.icon.js.map +1 -1
- package/lib/components/Icon/icons/minus.icon.js +1 -1
- package/lib/components/Icon/icons/minus.icon.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts +6 -0
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.js +110 -0
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts +4 -0
- package/lib/components/ListToolbar/ListToolbar.styles.d.ts.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.styles.js +29 -0
- package/lib/components/ListToolbar/ListToolbar.styles.js.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +73 -0
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -0
- package/lib/components/ListToolbar/ListToolbar.types.js +2 -0
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -0
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts +12 -0
- package/lib/components/ListToolbar/QueryOptionPopover.d.ts.map +1 -0
- package/lib/components/ListToolbar/QueryOptionPopover.js +66 -0
- package/lib/components/ListToolbar/QueryOptionPopover.js.map +1 -0
- package/lib/components/ListToolbar/index.d.ts +3 -0
- package/lib/components/ListToolbar/index.d.ts.map +1 -0
- package/lib/components/ListToolbar/index.js +2 -0
- package/lib/components/ListToolbar/index.js.map +1 -0
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +2 -1
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/Menu/MenuListHeader.d.ts.map +1 -1
- package/lib/components/Menu/MenuListHeader.js +4 -1
- package/lib/components/Menu/MenuListHeader.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +1 -0
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/Number/NumberDisplay.d.ts +9 -9
- package/lib/components/Number/NumberDisplay.d.ts.map +1 -1
- package/lib/components/Number/NumberDisplay.js +6 -5
- package/lib/components/Number/NumberDisplay.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts +7 -2
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +7 -2
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +69 -19
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +45 -20
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Table/Table.d.ts +1 -0
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.js +1 -1
- 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 +1 -0
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +41 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +41 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +48 -5
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +82 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/styles/gradients.d.ts +102 -0
- package/lib/styles/gradients.d.ts.map +1 -0
- package/lib/styles/gradients.js +232 -0
- package/lib/styles/gradients.js.map +1 -0
- package/lib/styles/index.d.ts +1 -0
- package/lib/styles/index.d.ts.map +1 -1
- package/lib/styles/index.js +1 -0
- package/lib/styles/index.js.map +1 -1
- package/package.json +10 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuButton.js","sourceRoot":"","sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAOR,WAAW,EAEZ,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,EAAE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,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,EAC9C,EAAE,EAAE,GAAG,EAAE,UAAU,KACf,OAAO,EACX,kBAAkB,QAClB,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,MAAM,EACtB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,GAAG,EAAE,UAAU,YAEd,IAAI,IAAI,CACP,KAAC,IAAI,OACC,IAAI,EACR,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACzB,IACE,IAAI,CAAC,IAAI,KAAK,cAAc;4BAC3B,CAAgF;iCAC9E,MAAM,GAAG,CAAC,EACb;4BACA,SAAS,CAAC,KAAK,CAAC,CAAC;yBAClB;wBACD,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;oBAChC,CAAC,EACD,cAAc,EAAE,SAAS,CAAC,OAAO,IAAI,SAAS,WAC9C,CACH,WACuB,YACzB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n KeyboardEvent,\n MouseEventHandler,\n MouseEvent,\n UIEvent,\n PropsWithoutRef,\n useCallback,\n KeyboardEventHandler\n} from 'react';\nimport styled from 'styled-components';\n\nimport { BaseProps, ForwardProps, NoChildrenProp, OmitStrict } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { useConsolidatedRef, useUID, useFocusWithin, useDirection } from '../../hooks';\nimport Button, { ButtonProps, StyledButton } from '../Button';\nimport Popover, { PopoverProps, StyledPopover } from '../Popover';\nimport Menu from '../Menu';\nimport { AcceptedMouseEventElement } from '../Menu/Menu.types';\nimport Icon, { registerIcon } from '../Icon';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport { Count } from '../Badges';\nimport type { MenuProps } from '../Menu/Menu.types';\nimport type { CountProps } from '../Badges/Count';\n\nregisterIcon(arrowMicroDownIcon);\n\nexport interface MenuButtonProps extends BaseProps, NoChildrenProp {\n /** The text for the MenuButton also used to set the aria-label. */\n text: string;\n /**\n * Determines the Button variant for the MenuButton.\n * @default \"secondary\"\n */\n variant?: ButtonProps['variant'];\n /** The name of the icon for the MenuButton. */\n icon?: string;\n /** Only display the icon. The text prop will be forwarded to a tooltip. */\n iconOnly?: ButtonProps['icon'];\n /** The total count representing the list data which was selected. */\n count?: CountProps['children'];\n /** The click handler for the MenuButton. */\n onClick?: MouseEventHandler;\n /** Menu related props. */\n menu?: MenuProps;\n /** Popover related props. */\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n /** DOM id for the button element. */\n id?: string;\n /** Ref for the button element. */\n ref?: ButtonProps['ref'];\n /** The keydown handler for the MenuButton. */\n onKeyDown?: KeyboardEventHandler;\n}\n\nconst StyledMenuButton = styled.button`\n flex-shrink: 0;\n white-space: nowrap;\n\n & + ${StyledPopover} + ${StyledButton} {\n margin-inline-start: ${props => props.theme.base.spacing};\n }\n`;\n\nStyledMenuButton.defaultProps = defaultThemeProp;\n\nconst StyledMenuButtonPopover = styled(Popover)`\n min-width: 20ch;\n`;\n\nconst MenuButton: FunctionComponent<ForwardProps & MenuButtonProps> = forwardRef(\n (props: PropsWithoutRef<MenuButtonProps>, ref: MenuButtonProps['ref']) => {\n const uid = useUID();\n const {\n id = uid,\n text,\n menu,\n popover,\n onClick,\n onKeyDown,\n icon,\n count,\n iconOnly = false,\n ...restProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(false);\n\n const buttonRef = useConsolidatedRef(ref);\n const popoverRef = useConsolidatedRef<HTMLDivElement>(popover?.ref);\n const menuRef = useConsolidatedRef<HTMLDivElement>(menu?.ref);\n\n // FIXME: Type assertion required for issue in useFocusWithin generic\n useFocusWithin<HTMLElement>(\n [popoverRef, buttonRef],\n useCallback(isFocused => {\n if (!isFocused) setIsOpen(false);\n }, [])\n );\n\n const { rtl } = useDirection();\n\n return (\n <>\n <Button\n as={StyledMenuButton}\n {...restProps}\n id={id}\n ref={buttonRef}\n aria-expanded={isOpen}\n aria-haspopup='menu'\n aria-controls={`${id}-popover`}\n aria-label={text}\n label={iconOnly && !isOpen ? text : undefined}\n onClick={(e: MouseEvent<HTMLButtonElement> & UIEvent<HTMLButtonElement>) => {\n // clickCount is 0 when triggered by keyboard.\n const clickCount = e.detail;\n\n // Close the menu if it is open and either:\n // It is a *mouse* click on the button.\n // Or, the menu mode is not multiselect.\n if (isOpen && (clickCount > 0 || menu?.mode !== 'multi-select')) {\n setIsOpen(false);\n } else {\n setIsOpen(true);\n }\n\n onClick?.(e);\n }}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Escape') setIsOpen(false);\n onKeyDown?.(e);\n }}\n icon={iconOnly}\n >\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {!iconOnly && (\n <Text>\n {text} {count !== undefined && <Count>{count}</Count>}\n {text && <Icon name='arrow-micro-down' />}\n </Text>\n )}\n </Flex>\n </Button>\n <StyledMenuButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n id={`${id}-popover`}\n {...popover}\n hideOnTargetHidden\n show={!!menu && isOpen}\n target={buttonRef.current}\n ref={popoverRef}\n >\n {menu && (\n <Menu\n {...menu}\n ref={menuRef}\n items={menu.items}\n onItemClick={(itemId, e) => {\n if (\n menu.mode !== 'multi-select' &&\n (e as MouseEvent<AcceptedMouseEventElement> & UIEvent<AcceptedMouseEventElement>)\n .detail > 0\n ) {\n setIsOpen(false);\n }\n menu.onItemClick?.(itemId, e);\n }}\n focusControlEl={buttonRef.current || undefined}\n />\n )}\n </StyledMenuButtonPopover>\n </>\n );\n }\n);\n\nexport default MenuButton;\n"]}
|
|
@@ -2,7 +2,7 @@ import { FunctionComponent, Ref } from 'react';
|
|
|
2
2
|
import type { BaseProps, ForwardProps, NoChildrenProp } from '../../types';
|
|
3
3
|
export interface NumberDisplayProps extends BaseProps, NoChildrenProp {
|
|
4
4
|
/** Number value */
|
|
5
|
-
value?:
|
|
5
|
+
value?: number | bigint;
|
|
6
6
|
/** Unit to be included in the text, for example '%' */
|
|
7
7
|
unit?: string;
|
|
8
8
|
/**
|
|
@@ -12,24 +12,24 @@ export interface NumberDisplayProps extends BaseProps, NoChildrenProp {
|
|
|
12
12
|
unitPlacement?: 'before' | 'after';
|
|
13
13
|
formattingOptions?: {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @default
|
|
15
|
+
* Value display notation.
|
|
16
|
+
* @default 'standard'
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
notation?: 'standard' | 'compact';
|
|
19
19
|
/**
|
|
20
|
-
* Determines the fixed number of
|
|
20
|
+
* Determines the fixed number of fraction digits. The value is rounded to the given precision.
|
|
21
21
|
* Maximum is 20, default is value precision.
|
|
22
|
-
* @default
|
|
22
|
+
* @default variable
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
fractionDigits?: number;
|
|
25
25
|
/**
|
|
26
26
|
* Determines whether group separators should be shown.
|
|
27
27
|
* @default true
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
groupSeparators?: boolean;
|
|
30
30
|
};
|
|
31
31
|
/** Ref for the wrapping element. */
|
|
32
|
-
ref?: Ref<
|
|
32
|
+
ref?: Ref<HTMLSpanElement>;
|
|
33
33
|
}
|
|
34
34
|
declare const NumberDisplay: FunctionComponent<NumberDisplayProps & ForwardProps>;
|
|
35
35
|
export default NumberDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Number/NumberDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK3E,MAAM,WAAW,kBAAmB,SAAQ,SAAS,EAAE,cAAc;IACnE,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"NumberDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/Number/NumberDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAK3E,MAAM,WAAW,kBAAmB,SAAQ,SAAS,EAAE,cAAc;IACnE,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE;QAClB;;;WAGG;QACH,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;QAClC;;;;WAIG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB;;;WAGG;QACH,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,CAAC;IACF,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B;AAED,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAsCvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -2,15 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { useConfiguration } from '../../hooks';
|
|
4
4
|
import { getFraction } from './utils';
|
|
5
|
-
const NumberDisplay = forwardRef(({ value
|
|
5
|
+
const NumberDisplay = forwardRef(({ value, unit = '', unitPlacement = 'after', formattingOptions: { fractionDigits = getFraction(String(value)).substring(1).length, notation, groupSeparators = true } = {}, ...restProps }, ref) => {
|
|
6
6
|
const { locale } = useConfiguration();
|
|
7
7
|
const numberFormatterOptions = {
|
|
8
|
-
minimumFractionDigits:
|
|
9
|
-
maximumFractionDigits:
|
|
10
|
-
useGrouping:
|
|
8
|
+
minimumFractionDigits: fractionDigits,
|
|
9
|
+
maximumFractionDigits: fractionDigits,
|
|
10
|
+
useGrouping: groupSeparators,
|
|
11
|
+
notation
|
|
11
12
|
};
|
|
12
13
|
const formatter = new Intl.NumberFormat(locale, numberFormatterOptions);
|
|
13
|
-
return (_jsx("span", { ref: ref, ...restProps, children: value ? (`${unit && unitPlacement === 'before' ? `${unit}\u00a0` : ''}${formatter.format(
|
|
14
|
+
return (_jsx("span", { ref: ref, ...restProps, children: value || value === 0 ? (`${unit && unitPlacement === 'before' ? `${unit}\u00a0` : ''}${formatter.format(value)}${unit && unitPlacement === 'after' ? `\u00a0${unit}` : ''}`) : (_jsx("span", { "aria-hidden": 'true', children: "\u2013\u2013" }, void 0)) }, void 0));
|
|
14
15
|
});
|
|
15
16
|
export default NumberDisplay;
|
|
16
17
|
//# sourceMappingURL=NumberDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberDisplay.js","sourceRoot":"","sources":["../../../src/components/Number/NumberDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAkCtC,MAAM,aAAa,GAAyD,UAAU,CACpF,CACE,EACE,KAAK,
|
|
1
|
+
{"version":3,"file":"NumberDisplay.js","sourceRoot":"","sources":["../../../src/components/Number/NumberDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,gBAAgB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, NoChildrenProp } from '../../types';\nimport { useConfiguration } from '../../hooks';\n\nimport { getFraction } from './utils';\n\nexport interface NumberDisplayProps extends BaseProps, NoChildrenProp {\n /** Number value */\n value?: number | bigint;\n /** Unit to be included in the text, for example '%' */\n unit?: string;\n /**\n * Determines the placement of the unit.\n * @default \"after\"\n */\n unitPlacement?: 'before' | 'after';\n formattingOptions?: {\n /**\n * Value display notation.\n * @default 'standard'\n */\n notation?: 'standard' | 'compact';\n /**\n * Determines the fixed number of fraction digits. The value is rounded to the given precision.\n * Maximum is 20, default is value precision.\n * @default variable\n */\n fractionDigits?: number;\n /**\n * Determines whether group separators should be shown.\n * @default true\n */\n groupSeparators?: boolean;\n };\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement>;\n}\n\nconst NumberDisplay: FunctionComponent<NumberDisplayProps & ForwardProps> = forwardRef(\n (\n {\n value,\n unit = '',\n unitPlacement = 'after',\n formattingOptions: {\n fractionDigits = getFraction(String(value)).substring(1).length,\n notation,\n groupSeparators = true\n } = {},\n ...restProps\n }: PropsWithoutRef<NumberDisplayProps>,\n ref: NumberDisplayProps['ref']\n ) => {\n const { locale } = useConfiguration();\n\n const numberFormatterOptions = {\n minimumFractionDigits: fractionDigits,\n maximumFractionDigits: fractionDigits,\n useGrouping: groupSeparators,\n notation\n } as Intl.NumberFormatOptions;\n\n const formatter = new Intl.NumberFormat(locale, numberFormatterOptions);\n\n return (\n <span ref={ref} {...restProps}>\n {value || value === 0 ? (\n `${unit && unitPlacement === 'before' ? `${unit}\\u00a0` : ''}${formatter.format(value)}${\n unit && unitPlacement === 'after' ? `\\u00a0${unit}` : ''\n }`\n ) : (\n <span aria-hidden='true'>––</span>\n )}\n </span>\n );\n }\n);\n\nexport default NumberDisplay;\n"]}
|
|
@@ -14,10 +14,15 @@ export interface DashboardPageLayoutProps extends PageLayoutProps {
|
|
|
14
14
|
fitToViewport?: boolean;
|
|
15
15
|
regionFullWidth: ReactNode[];
|
|
16
16
|
}
|
|
17
|
-
export declare const StyledFilterRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
18
|
-
|
|
17
|
+
export declare const StyledFilterRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
18
|
+
fillHeight?: boolean | undefined;
|
|
19
|
+
}, never>;
|
|
20
|
+
export declare const StyledDashboardRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
21
|
+
fillHeight?: boolean | undefined;
|
|
22
|
+
}, never>;
|
|
19
23
|
export declare const StyledDashboardPageLayout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
20
24
|
scrollContent: boolean | undefined;
|
|
25
|
+
minContentHeight?: number | undefined;
|
|
21
26
|
} & Pick<DashboardPageProps, "fitToViewport">, never>;
|
|
22
27
|
declare const DashboardPage: FunctionComponent<DashboardPageProps & ForwardProps>;
|
|
23
28
|
export default DashboardPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/DashboardPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EACL,iBAAiB,EACjB,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;IAC/D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,SAAS,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/DashboardPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhG,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ3C,OAAO,EACL,iBAAiB,EACjB,eAAe,EAKhB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;IAC/D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,SAAS,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB;;SAAyB,CAAC;AAIzD,eAAO,MAAM,qBAAqB;;SAEjC,CAAC;AAIF,eAAO,MAAM,yBAAyB;;;qDAYpC,CAAC;AA+LH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAiBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -65,12 +65,17 @@ export interface PageLayoutProps extends PageTemplateProps {
|
|
|
65
65
|
}
|
|
66
66
|
export declare const StyledPageIcon: import("styled-components").StyledComponent<FunctionComponent<import("../Flex").FlexProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
67
67
|
export declare const StyledPageHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
68
|
-
export declare const StyledRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
69
|
-
|
|
68
|
+
export declare const StyledRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
69
|
+
fillHeight?: boolean | undefined;
|
|
70
|
+
}, never>;
|
|
71
|
+
export declare const StyledRegions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
72
|
+
pad: boolean;
|
|
73
|
+
}, never>;
|
|
70
74
|
export declare const StyledContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
71
75
|
export declare const StyledScrollableTabPanel: typeof TabPanel;
|
|
72
76
|
export declare const StyledPageLayout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
73
77
|
scrollContent: PageLayoutProps['scrollContent'];
|
|
78
|
+
minContentHeight?: number | undefined;
|
|
74
79
|
}, never>;
|
|
75
80
|
export declare const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps>;
|
|
76
81
|
export declare const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,EACH,SAAS,EAET,YAAY,
|
|
1
|
+
{"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,EACH,SAAS,EAET,YAAY,EAGb,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAM9E,OAAO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,CAAC,kBAAkB,GAAG,YAAY,CAM9E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAMlF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAchF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAMhF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAMhF,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAetF,CAAC;AAEJ,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAetF,CAAC;AAEJ,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CAe1F,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useState, useRef, useContext } from 'react';
|
|
2
|
+
import { forwardRef, useState, useRef, useContext, useEffect } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { readableColor } from 'polished';
|
|
5
5
|
import { defaultThemeProp } from '../../theme';
|
|
@@ -10,7 +10,7 @@ import Icon from '../Icon';
|
|
|
10
10
|
import { tryCatch } from '../../utils';
|
|
11
11
|
import Tabs, { TabPanel } from '../Tabs';
|
|
12
12
|
import Flex from '../Flex';
|
|
13
|
-
import { useBreakpoint, useElement, useScrollStick } from '../../hooks';
|
|
13
|
+
import { useBreakpoint, useElement, useScrollStick, useConsolidatedRef } from '../../hooks';
|
|
14
14
|
import Breadcrumbs, { StyledBreadcrumbs } from '../Breadcrumbs';
|
|
15
15
|
import AppShellContext from '../AppShell/AppShellContext';
|
|
16
16
|
import { StyledBanner } from '../Banner/Banner';
|
|
@@ -40,11 +40,29 @@ export const StyledPageHeader = styled.header(({ theme }) => {
|
|
|
40
40
|
`;
|
|
41
41
|
});
|
|
42
42
|
StyledPageHeader.defaultProps = defaultThemeProp;
|
|
43
|
-
export const StyledRegion = styled.div
|
|
43
|
+
export const StyledRegion = styled.div(({ fillHeight }) => {
|
|
44
|
+
return css `
|
|
45
|
+
flex-grow: 1;
|
|
46
|
+
|
|
47
|
+
${fillHeight &&
|
|
48
|
+
css `
|
|
49
|
+
height: 100%;
|
|
50
|
+
`}
|
|
51
|
+
`;
|
|
52
|
+
});
|
|
44
53
|
StyledRegion.defaultProps = defaultThemeProp;
|
|
45
|
-
export const StyledRegions = styled.div
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
export const StyledRegions = styled.div(({ pad, theme }) => {
|
|
55
|
+
const spacing = theme.base.spacing;
|
|
56
|
+
return css `
|
|
57
|
+
flex-grow: 1;
|
|
58
|
+
max-width: 100%;
|
|
59
|
+
|
|
60
|
+
${pad &&
|
|
61
|
+
css `
|
|
62
|
+
padding: 0 calc(2 * ${spacing}) calc(2 * ${spacing});
|
|
63
|
+
`}
|
|
64
|
+
`;
|
|
65
|
+
});
|
|
48
66
|
StyledRegions.defaultProps = defaultThemeProp;
|
|
49
67
|
export const StyledContent = styled.div ``;
|
|
50
68
|
StyledContent.defaultProps = defaultThemeProp;
|
|
@@ -55,13 +73,16 @@ export const StyledScrollableTabPanel = styled(TabPanel)(() => {
|
|
|
55
73
|
`;
|
|
56
74
|
});
|
|
57
75
|
StyledScrollableTabPanel.defaultProps = defaultThemeProp;
|
|
58
|
-
export const StyledPageLayout = styled.div(({ theme, scrollContent }) =>
|
|
76
|
+
export const StyledPageLayout = styled.div(({ theme, scrollContent, minContentHeight }) => {
|
|
77
|
+
const emptyContentHeight = minContentHeight ? `${minContentHeight}px` : undefined;
|
|
78
|
+
return css `
|
|
79
|
+
--content-height-in-view: ${emptyContentHeight};
|
|
59
80
|
position: relative;
|
|
60
81
|
min-height: inherit;
|
|
61
82
|
background-color: ${theme.base.palette['app-background']};
|
|
62
83
|
|
|
63
84
|
${scrollContent &&
|
|
64
|
-
|
|
85
|
+
css `
|
|
65
86
|
${StyledContent} {
|
|
66
87
|
position: relative;
|
|
67
88
|
}
|
|
@@ -73,37 +94,66 @@ export const StyledPageLayout = styled.div(({ theme, scrollContent }) => css `
|
|
|
73
94
|
overflow: auto;
|
|
74
95
|
}
|
|
75
96
|
`}
|
|
76
|
-
|
|
97
|
+
`;
|
|
98
|
+
});
|
|
77
99
|
StyledPageLayout.defaultProps = defaultThemeProp;
|
|
78
100
|
const PageLayout = forwardRef(({ regions, cols = `repeat(${regions.length}, minmax(0, 1fr))`, title, icon, path, actions, banners, tabs, as, header, regionsRef, scrollContent = false, ...restProps }, ref) => {
|
|
79
101
|
const [contentEl, setContentEl] = useElement();
|
|
80
102
|
const isMediumOrAbove = useBreakpoint('md');
|
|
81
103
|
const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;
|
|
82
104
|
const { headerEl } = useContext(AppShellContext);
|
|
105
|
+
const consolidatedRegionRef = useConsolidatedRef(regionsRef);
|
|
83
106
|
const scrollStickOptions = useRef({
|
|
84
107
|
elements: []
|
|
85
108
|
});
|
|
86
109
|
scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;
|
|
87
110
|
scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;
|
|
88
111
|
useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);
|
|
112
|
+
const renderSingleRegion = regions?.length === 1;
|
|
113
|
+
const [minContentHeight, setMinContentHeight] = useState();
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (consolidatedRegionRef && consolidatedRegionRef.current) {
|
|
116
|
+
const refElement = consolidatedRegionRef.current;
|
|
117
|
+
const regionsPaddingBottomPixels = Number.parseInt(window.getComputedStyle(refElement).getPropertyValue('padding-bottom'), 10);
|
|
118
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
119
|
+
const headerOffset = headerEl?.offsetHeight ?? 0;
|
|
120
|
+
const emptyHeight = document.documentElement.offsetHeight -
|
|
121
|
+
(headerOffset + refElement?.offsetTop) -
|
|
122
|
+
regionsPaddingBottomPixels;
|
|
123
|
+
setMinContentHeight(emptyHeight);
|
|
124
|
+
});
|
|
125
|
+
resizeObserver.observe(refElement);
|
|
126
|
+
return () => {
|
|
127
|
+
resizeObserver.disconnect();
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}, [consolidatedRegionRef, headerEl]);
|
|
89
131
|
return (_jsxs(Flex, { ...restProps, container: {
|
|
90
132
|
direction: 'column',
|
|
133
|
+
alignItems: 'stretch',
|
|
91
134
|
gap: 2
|
|
92
|
-
}, scrollContent: scrollContent, as: StyledPageLayout, forwardedAs: as, ref: ref, children: [_jsxs(Flex, { container: { direction: 'column', pad: [2, 2, 0] }, item: { grow: 0, shrink: 0 }, as: StyledPageHeader, children: [path && path.length > 0 && _jsx(Breadcrumbs, { path: path }, void 0), header || (_jsx(SummaryItem, { visual: icon && (_jsx(StyledPageIcon, { container: { alignItems: 'center', justify: 'center' }, children: _jsx(Icon, { name: icon }, void 0) }, void 0)), primary: _jsx(Text, { variant: 'h1', children: title }, void 0), actions: actions }, void 0)), banners, tabs] }, void 0),
|
|
93
|
-
cols: 'minmax(0, 1fr)',
|
|
94
|
-
alignItems: 'start',
|
|
95
|
-
gap: 2,
|
|
96
|
-
pad: [0, 2, 2]
|
|
97
|
-
}, md: { container: { cols } }, as: StyledRegions, ref: regionsRef, children: regions.map((colItems, i) => {
|
|
98
|
-
return (_jsx(Flex, { container: {
|
|
135
|
+
}, scrollContent: scrollContent, as: StyledPageLayout, forwardedAs: as, ref: ref, minContentHeight: minContentHeight, children: [_jsxs(Flex, { container: { direction: 'column', pad: [2, 2, 0] }, item: { grow: 0, shrink: 0 }, as: StyledPageHeader, children: [path && path.length > 0 && _jsx(Breadcrumbs, { path: path }, void 0), header || (_jsx(SummaryItem, { visual: icon && (_jsx(StyledPageIcon, { container: { alignItems: 'center', justify: 'center' }, children: _jsx(Icon, { name: icon }, void 0) }, void 0)), primary: _jsx(Text, { variant: 'h1', children: title }, void 0), actions: actions }, void 0)), banners, tabs] }, void 0), _jsxs(Flex, { container: true, item: { grow: 1 }, as: StyledContent, ref: scrollContent ? setContentEl : undefined, children: [renderSingleRegion && (_jsx(StyledRegions, { ref: consolidatedRegionRef, pad: true, children: _jsx(Flex, { container: {
|
|
99
136
|
direction: 'column',
|
|
100
137
|
gap: 2
|
|
101
138
|
}, as: StyledRegion, ref: (el) => {
|
|
102
139
|
if (el) {
|
|
103
|
-
scrollStickOptions.current.elements[
|
|
140
|
+
scrollStickOptions.current.elements[0] = el;
|
|
104
141
|
}
|
|
105
|
-
}, children:
|
|
106
|
-
|
|
142
|
+
}, fillHeight: true, children: regions[0] }, void 0) }, void 0)), !renderSingleRegion && (_jsx(Grid, { container: {
|
|
143
|
+
cols: 'minmax(0, 1fr)',
|
|
144
|
+
alignItems: 'start',
|
|
145
|
+
gap: 2,
|
|
146
|
+
pad: [0, 2, 2]
|
|
147
|
+
}, md: { container: { cols } }, as: StyledRegions, ref: consolidatedRegionRef, children: regions.map((colItems, i) => {
|
|
148
|
+
return (_jsx(Flex, { container: {
|
|
149
|
+
direction: 'column',
|
|
150
|
+
gap: 2
|
|
151
|
+
}, as: StyledRegion, ref: (el) => {
|
|
152
|
+
if (el) {
|
|
153
|
+
scrollStickOptions.current.elements[i] = el;
|
|
154
|
+
}
|
|
155
|
+
}, children: colItems }, i));
|
|
156
|
+
}) }, void 0))] }, void 0)] }, void 0));
|
|
107
157
|
});
|
|
108
158
|
export const TabbedPage = forwardRef(({ tabs, a, ...restProps }, ref) => {
|
|
109
159
|
const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx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WAC/C,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAC/B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA8C,EACrE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,8CAA8C,WACnD,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n ReactElement,\n useContext\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, AsProp } from '../../types';\nimport Grid from '../Grid';\nimport Text from '../Text';\nimport SummaryItem from '../SummaryItem';\nimport Icon from '../Icon';\nimport { tryCatch } from '../../utils';\nimport Tabs, { TabPanel, TabsProps } from '../Tabs';\nimport Flex from '../Flex';\nimport { useBreakpoint, useElement, useScrollStick } from '../../hooks';\nimport type { ScrollStickOptions } from '../../hooks/useScrollStick';\nimport Breadcrumbs, { BreadcrumbsProps, StyledBreadcrumbs } from '../Breadcrumbs';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { StyledBanner } from '../Banner/Banner';\nimport { StyledTabs } from '../Tabs/Tabs';\n\nexport interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {\n title: string;\n icon?: string;\n actions?: ReactNode;\n banners?: ReactNode;\n path?: BreadcrumbsProps['path'];\n header?: ReactNode;\n scrollContent?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface TabbedPageProps extends PageTemplateProps {\n tabs: TabsProps;\n a: ReactNode;\n}\n\nexport interface OneColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n}\n\nexport interface TwoColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface ThreeColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface FourColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n d: ReactNode;\n}\n\nexport interface WideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface NarrowWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface WideWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface PageLayoutProps extends PageTemplateProps {\n tabs?: ReactElement<typeof Tabs>;\n regions: ReactNode[];\n regionsRef?: Ref<HTMLDivElement>;\n cols?: string;\n}\n\nexport const StyledPageIcon = styled(Flex)(({ theme }) => {\n const bgColor = theme.base.palette['brand-primary'];\n const color = tryCatch(() => readableColor(bgColor));\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\n color: ${color};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledPageIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPageHeader = styled.header(({ theme }) => {\n return css`\n ${StyledBreadcrumbs} {\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledBanner},\n ${StyledTabs} {\n margin-block-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledPageHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRegion = styled.div``;\nStyledRegion.defaultProps = defaultThemeProp;\n\nexport const StyledRegions = styled.div`\n flex-grow: 1;\n`;\nStyledRegions.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div``;\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledScrollableTabPanel: typeof TabPanel = styled(TabPanel)(() => {\n return css`\n height: 100%;\n overflow: auto;\n `;\n});\n\nStyledScrollableTabPanel.defaultProps = defaultThemeProp;\n\nexport const StyledPageLayout = styled.div<{\n scrollContent: PageLayoutProps['scrollContent'];\n}>(\n ({ theme, scrollContent }) => css`\n position: relative;\n min-height: inherit;\n background-color: ${theme.base.palette['app-background']};\n\n ${scrollContent &&\n css`\n ${StyledContent} {\n position: relative;\n }\n\n ${StyledRegions} {\n position: absolute;\n height: 100%;\n width: 100%;\n overflow: auto;\n }\n `}\n `\n);\n\nStyledPageLayout.defaultProps = defaultThemeProp;\n\nconst PageLayout: FunctionComponent<PageLayoutProps & ForwardProps> = forwardRef(\n (\n {\n regions,\n cols = `repeat(${regions.length}, minmax(0, 1fr))`,\n title,\n icon,\n path,\n actions,\n banners,\n tabs,\n as,\n header,\n regionsRef,\n scrollContent = false,\n ...restProps\n }: PropsWithoutRef<PageLayoutProps>,\n ref: PageLayoutProps['ref']\n ) => {\n const [contentEl, setContentEl] = useElement<HTMLElement>();\n const isMediumOrAbove = useBreakpoint('md');\n const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;\n const { headerEl } = useContext(AppShellContext);\n\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;\n scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;\n\n useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n gap: 2\n }}\n scrollContent={scrollContent}\n as={StyledPageLayout}\n forwardedAs={as}\n ref={ref}\n >\n <Flex\n container={{ direction: 'column', pad: [2, 2, 0] }}\n item={{ grow: 0, shrink: 0 }}\n as={StyledPageHeader}\n >\n {path && path.length > 0 && <Breadcrumbs path={...path} />}\n\n {header || (\n <SummaryItem\n visual={\n icon && (\n <StyledPageIcon container={{ alignItems: 'center', justify: 'center' }}>\n <Icon name={icon} />\n </StyledPageIcon>\n )\n }\n primary={<Text variant='h1'>{title}</Text>}\n actions={actions}\n />\n )}\n\n {banners}\n {tabs}\n </Flex>\n\n <Flex\n container\n item={{ grow: 1 }}\n as={StyledContent}\n ref={scrollContent ? setContentEl : undefined}\n >\n <Grid\n container={{\n cols: 'minmax(0, 1fr)',\n alignItems: 'start',\n gap: 2,\n pad: [0, 2, 2]\n }}\n md={{ container: { cols } }}\n as={StyledRegions}\n ref={regionsRef}\n >\n {regions.map((colItems, i) => {\n return (\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[i] = el;\n }\n }}\n >\n {colItems}\n </Flex>\n );\n })}\n </Grid>\n </Flex>\n </Flex>\n );\n }\n);\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);\n\n return (\n <PageLayout\n {...restProps}\n tabs={\n <Tabs\n {...tabs}\n onTabClick={(id, e) => {\n setTabId(id);\n tabs.onTabClick?.(id, e);\n }}\n />\n }\n regions={[\n <Flex container={{ direction: 'column', gap: 2 }} as={TabPanel} tabId={tabId}>\n {a}\n </Flex>\n ]}\n ref={ref}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n ({ a, ...restProps }: PropsWithoutRef<OneColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a]} ref={ref} {...restProps} cols='minmax(0, 1fr)' />;\n }\n);\n\nexport const TwoColumnPage: FunctionComponent<TwoColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<TwoColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='repeat(2, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const ThreeColumnPage: FunctionComponent<ThreeColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, c, ...restProps }: PropsWithoutRef<ThreeColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b, c]} ref={ref} {...restProps} cols='repeat(3, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const FourColumnPage: FunctionComponent<FourColumnPageProps & ForwardProps> = forwardRef(\n (\n { a, b, c, d, ...restProps }: PropsWithoutRef<FourColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c, d]}\n ref={ref}\n {...restProps}\n cols='repeat(4, minmax(0, 1fr))'\n />\n );\n }\n);\n\nexport const WideNarrowPage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 2fr) minmax(0, 1fr)' />\n );\n }\n);\n\nexport const NarrowWidePage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 1fr) minmax(0, 2fr)' />\n );\n }\n);\n\nexport const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<WideWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='repeat(2, minmax(0, 2fr)) minmax(0, 1fr)'\n />\n );\n }\n );\n\nexport const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideWidePageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) repeat(2, minmax(0, 2fr))'\n />\n );\n }\n );\n\nexport const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr)'\n />\n );\n }\n );\n"]}
|
|
1
|
+
{"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAKR,MAAM,EAEN,UAAU,EACV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAa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C,MAAM,kBAAkB,GAC7B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA4C,EACnE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,0CAA0C,WAC/C,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAC/B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA8C,EACrE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,8CAA8C,WACnD,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n ReactElement,\n useContext,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, AsProp } from '../../types';\nimport Grid from '../Grid';\nimport Text from '../Text';\nimport SummaryItem from '../SummaryItem';\nimport Icon from '../Icon';\nimport { tryCatch } from '../../utils';\nimport Tabs, { TabPanel, TabsProps } from '../Tabs';\nimport Flex from '../Flex';\nimport { useBreakpoint, useElement, useScrollStick, useConsolidatedRef } from '../../hooks';\nimport type { ScrollStickOptions } from '../../hooks/useScrollStick';\nimport Breadcrumbs, { BreadcrumbsProps, StyledBreadcrumbs } from '../Breadcrumbs';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { StyledBanner } from '../Banner/Banner';\nimport { StyledTabs } from '../Tabs/Tabs';\n\nexport interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {\n title: string;\n icon?: string;\n actions?: ReactNode;\n banners?: ReactNode;\n path?: BreadcrumbsProps['path'];\n header?: ReactNode;\n scrollContent?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface TabbedPageProps extends PageTemplateProps {\n tabs: TabsProps;\n a: ReactNode;\n}\n\nexport interface OneColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n}\n\nexport interface TwoColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface ThreeColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface FourColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n d: ReactNode;\n}\n\nexport interface WideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface NarrowWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface WideWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface PageLayoutProps extends PageTemplateProps {\n tabs?: ReactElement<typeof Tabs>;\n regions: ReactNode[];\n regionsRef?: Ref<HTMLDivElement>;\n cols?: string;\n}\n\nexport const StyledPageIcon = styled(Flex)(({ theme }) => {\n const bgColor = theme.base.palette['brand-primary'];\n const color = tryCatch(() => readableColor(bgColor));\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\n color: ${color};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledPageIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPageHeader = styled.header(({ theme }) => {\n return css`\n ${StyledBreadcrumbs} {\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledBanner},\n ${StyledTabs} {\n margin-block-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledPageHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRegion = styled.div<{ fillHeight?: boolean }>(({ fillHeight }) => {\n return css`\n flex-grow: 1;\n\n ${fillHeight &&\n css`\n height: 100%;\n `}\n `;\n});\nStyledRegion.defaultProps = defaultThemeProp;\n\nexport const StyledRegions = styled.div<{ pad: boolean }>(({ pad, theme }) => {\n const spacing = theme.base.spacing;\n\n return css`\n flex-grow: 1;\n max-width: 100%;\n\n ${pad &&\n css`\n padding: 0 calc(2 * ${spacing}) calc(2 * ${spacing});\n `}\n `;\n});\nStyledRegions.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div``;\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledScrollableTabPanel: typeof TabPanel = styled(TabPanel)(() => {\n return css`\n height: 100%;\n overflow: auto;\n `;\n});\n\nStyledScrollableTabPanel.defaultProps = defaultThemeProp;\n\nexport const StyledPageLayout = styled.div<{\n scrollContent: PageLayoutProps['scrollContent'];\n minContentHeight?: number;\n}>(({ theme, scrollContent, minContentHeight }) => {\n const emptyContentHeight = minContentHeight ? `${minContentHeight}px` : undefined;\n\n return css`\n --content-height-in-view: ${emptyContentHeight};\n position: relative;\n min-height: inherit;\n background-color: ${theme.base.palette['app-background']};\n\n ${scrollContent &&\n css`\n ${StyledContent} {\n position: relative;\n }\n\n ${StyledRegions} {\n position: absolute;\n height: 100%;\n width: 100%;\n overflow: auto;\n }\n `}\n `;\n});\n\nStyledPageLayout.defaultProps = defaultThemeProp;\n\nconst PageLayout: FunctionComponent<PageLayoutProps & ForwardProps> = forwardRef(\n (\n {\n regions,\n cols = `repeat(${regions.length}, minmax(0, 1fr))`,\n title,\n icon,\n path,\n actions,\n banners,\n tabs,\n as,\n header,\n regionsRef,\n scrollContent = false,\n ...restProps\n }: PropsWithoutRef<PageLayoutProps>,\n ref: PageLayoutProps['ref']\n ) => {\n const [contentEl, setContentEl] = useElement<HTMLElement>();\n const isMediumOrAbove = useBreakpoint('md');\n const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;\n const { headerEl } = useContext(AppShellContext);\n\n const consolidatedRegionRef = useConsolidatedRef(regionsRef);\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;\n scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;\n\n useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);\n\n const renderSingleRegion = regions?.length === 1;\n\n const [minContentHeight, setMinContentHeight] = useState<number | undefined>();\n\n useEffect(() => {\n if (consolidatedRegionRef && consolidatedRegionRef.current) {\n const refElement = consolidatedRegionRef.current;\n const regionsPaddingBottomPixels = Number.parseInt(\n window.getComputedStyle(refElement).getPropertyValue('padding-bottom'),\n 10\n );\n\n const resizeObserver = new ResizeObserver(() => {\n const headerOffset = headerEl?.offsetHeight ?? 0;\n const emptyHeight =\n document.documentElement.offsetHeight -\n (headerOffset + refElement?.offsetTop) -\n regionsPaddingBottomPixels;\n\n setMinContentHeight(emptyHeight);\n });\n\n resizeObserver.observe(refElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n }, [consolidatedRegionRef, headerEl]);\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n alignItems: 'stretch',\n gap: 2\n }}\n scrollContent={scrollContent}\n as={StyledPageLayout}\n forwardedAs={as}\n ref={ref}\n minContentHeight={minContentHeight}\n >\n <Flex\n container={{ direction: 'column', pad: [2, 2, 0] }}\n item={{ grow: 0, shrink: 0 }}\n as={StyledPageHeader}\n >\n {path && path.length > 0 && <Breadcrumbs path={...path} />}\n\n {header || (\n <SummaryItem\n visual={\n icon && (\n <StyledPageIcon container={{ alignItems: 'center', justify: 'center' }}>\n <Icon name={icon} />\n </StyledPageIcon>\n )\n }\n primary={<Text variant='h1'>{title}</Text>}\n actions={actions}\n />\n )}\n\n {banners}\n {tabs}\n </Flex>\n\n <Flex\n container\n item={{ grow: 1 }}\n as={StyledContent}\n ref={scrollContent ? setContentEl : undefined}\n >\n {renderSingleRegion && (\n <StyledRegions ref={consolidatedRegionRef} pad>\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[0] = el;\n }\n }}\n fillHeight\n >\n {regions[0]}\n </Flex>\n </StyledRegions>\n )}\n\n {!renderSingleRegion && (\n <Grid\n container={{\n cols: 'minmax(0, 1fr)',\n alignItems: 'start',\n gap: 2,\n pad: [0, 2, 2]\n }}\n md={{ container: { cols } }}\n as={StyledRegions}\n ref={consolidatedRegionRef}\n >\n {regions.map((colItems, i) => {\n return (\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[i] = el;\n }\n }}\n >\n {colItems}\n </Flex>\n );\n })}\n </Grid>\n )}\n </Flex>\n </Flex>\n );\n }\n);\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);\n\n return (\n <PageLayout\n {...restProps}\n tabs={\n <Tabs\n {...tabs}\n onTabClick={(id, e) => {\n setTabId(id);\n tabs.onTabClick?.(id, e);\n }}\n />\n }\n regions={[\n <Flex container={{ direction: 'column', gap: 2 }} as={TabPanel} tabId={tabId}>\n {a}\n </Flex>\n ]}\n ref={ref}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n ({ a, ...restProps }: PropsWithoutRef<OneColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a]} ref={ref} {...restProps} cols='minmax(0, 1fr)' />;\n }\n);\n\nexport const TwoColumnPage: FunctionComponent<TwoColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<TwoColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='repeat(2, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const ThreeColumnPage: FunctionComponent<ThreeColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, c, ...restProps }: PropsWithoutRef<ThreeColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b, c]} ref={ref} {...restProps} cols='repeat(3, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const FourColumnPage: FunctionComponent<FourColumnPageProps & ForwardProps> = forwardRef(\n (\n { a, b, c, d, ...restProps }: PropsWithoutRef<FourColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c, d]}\n ref={ref}\n {...restProps}\n cols='repeat(4, minmax(0, 1fr))'\n />\n );\n }\n);\n\nexport const WideNarrowPage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 2fr) minmax(0, 1fr)' />\n );\n }\n);\n\nexport const NarrowWidePage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 1fr) minmax(0, 2fr)' />\n );\n }\n);\n\nexport const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<WideWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='repeat(2, minmax(0, 2fr)) minmax(0, 1fr)'\n />\n );\n }\n );\n\nexport const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideWidePageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) repeat(2, minmax(0, 2fr))'\n />\n );\n }\n );\n\nexport const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr)'\n />\n );\n }\n );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"Popover.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.styles.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,yGAwB9B,CAAC;AAIF,eAAO,MAAM,aAAa;;SAoJzB,CAAC"}
|
|
@@ -2,22 +2,23 @@ import styled, { css } from 'styled-components';
|
|
|
2
2
|
import { defaultThemeProp } from '../../theme';
|
|
3
3
|
export const StyledPopoverArrow = styled.div(({ theme: { base: { shadow: { 'low-filter': low } } } }) => css `
|
|
4
4
|
background-color: inherit;
|
|
5
|
-
height: 0;
|
|
6
|
-
width: 0;
|
|
7
|
-
filter: ${low};
|
|
8
|
-
z-index: -1; /* Make sure it's under the Popover. */
|
|
9
5
|
|
|
6
|
+
::before,
|
|
10
7
|
::after {
|
|
11
8
|
content: '';
|
|
12
9
|
display: block;
|
|
10
|
+
position: absolute;
|
|
13
11
|
background-color: inherit;
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
::before {
|
|
15
|
+
inset: -0.25rem;
|
|
16
|
+
filter: ${low};
|
|
16
17
|
transform: rotate(45deg);
|
|
17
18
|
}
|
|
18
19
|
`);
|
|
19
20
|
StyledPopoverArrow.defaultProps = defaultThemeProp;
|
|
20
|
-
export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': borderRadius, 'z-index': { popover: zIndex }, shadow: { 'low-filter': low } }, components: { card: { background, 'border-radius':
|
|
21
|
+
export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': borderRadius, 'z-index': { popover: zIndex }, shadow: { 'low-filter': low } }, components: { card: { background }, 'form-control': { 'border-radius': formControlBorderRadius } } }, offset }) => {
|
|
21
22
|
return css `
|
|
22
23
|
/*
|
|
23
24
|
Margin should never be used with Popper.
|
|
@@ -26,7 +27,7 @@ export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': bor
|
|
|
26
27
|
margin: 0 !important;
|
|
27
28
|
z-index: ${zIndex};
|
|
28
29
|
background-color: ${background};
|
|
29
|
-
border-radius: calc(${
|
|
30
|
+
border-radius: calc(${formControlBorderRadius} * ${borderRadius});
|
|
30
31
|
|
|
31
32
|
::after {
|
|
32
33
|
content: '';
|
|
@@ -48,12 +49,18 @@ export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': bor
|
|
|
48
49
|
|
|
49
50
|
&[data-popper-placement^='top'] {
|
|
50
51
|
> ${StyledPopoverArrow} {
|
|
51
|
-
top: calc(100%
|
|
52
|
-
margin-inline-start: -0.25rem;
|
|
52
|
+
top: calc(100%);
|
|
53
53
|
|
|
54
|
-
::
|
|
54
|
+
::before {
|
|
55
55
|
border-bottom-right-radius: calc(${borderRadius} / 4);
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
::after {
|
|
59
|
+
top: -0.75rem;
|
|
60
|
+
right: -0.75rem;
|
|
61
|
+
bottom: 0;
|
|
62
|
+
left: -0.75rem;
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
::before {
|
|
@@ -68,12 +75,18 @@ export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': bor
|
|
|
68
75
|
|
|
69
76
|
&[data-popper-placement^='bottom'] {
|
|
70
77
|
> ${StyledPopoverArrow} {
|
|
71
|
-
bottom: calc(100%
|
|
72
|
-
margin-inline-start: -0.25rem;
|
|
78
|
+
bottom: calc(100%);
|
|
73
79
|
|
|
74
|
-
::
|
|
80
|
+
::before {
|
|
75
81
|
border-top-left-radius: calc(${borderRadius} / 4);
|
|
76
82
|
}
|
|
83
|
+
|
|
84
|
+
::after {
|
|
85
|
+
top: 0;
|
|
86
|
+
right: -0.75rem;
|
|
87
|
+
bottom: -0.75rem;
|
|
88
|
+
left: -0.75rem;
|
|
89
|
+
}
|
|
77
90
|
}
|
|
78
91
|
|
|
79
92
|
::before {
|
|
@@ -88,12 +101,18 @@ export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': bor
|
|
|
88
101
|
|
|
89
102
|
&[data-popper-placement^='right'] {
|
|
90
103
|
> ${StyledPopoverArrow} {
|
|
91
|
-
|
|
92
|
-
margin-block-start: -0.25rem;
|
|
104
|
+
right: calc(100%);
|
|
93
105
|
|
|
94
|
-
::
|
|
106
|
+
::before {
|
|
95
107
|
border-bottom-left-radius: calc(${borderRadius} / 4);
|
|
96
108
|
}
|
|
109
|
+
|
|
110
|
+
::after {
|
|
111
|
+
top: -0.75rem;
|
|
112
|
+
right: -0.75rem;
|
|
113
|
+
bottom: -0.75rem;
|
|
114
|
+
left: 0;
|
|
115
|
+
}
|
|
97
116
|
}
|
|
98
117
|
|
|
99
118
|
::before {
|
|
@@ -108,12 +127,18 @@ export const StyledPopover = styled.div(({ theme: { base: { 'border-radius': bor
|
|
|
108
127
|
|
|
109
128
|
&[data-popper-placement^='left'] {
|
|
110
129
|
> ${StyledPopoverArrow} {
|
|
111
|
-
left: calc(100%
|
|
112
|
-
margin-block-start: -0.25rem;
|
|
130
|
+
left: calc(100%);
|
|
113
131
|
|
|
114
|
-
::
|
|
132
|
+
::before {
|
|
115
133
|
border-top-right-radius: calc(${borderRadius} / 4);
|
|
116
134
|
}
|
|
135
|
+
|
|
136
|
+
::after {
|
|
137
|
+
top: -0.75rem;
|
|
138
|
+
right: 0;
|
|
139
|
+
bottom: -0.75rem;
|
|
140
|
+
left: -0.75rem;
|
|
141
|
+
}
|
|
117
142
|
}
|
|
118
143
|
|
|
119
144
|
::before {
|