@pega/cosmos-react-build 3.0.0-dev.22.0 → 3.0.0-dev.23.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.
@@ -24,7 +24,7 @@ interface UtilsProps {
24
24
  avatar: AvatarProps;
25
25
  search?: SearchInputProps;
26
26
  branch?: BranchButtonProps;
27
- action?: Action;
27
+ action?: Pick<Action, 'id' | 'text' | 'onClick' | 'disabled'>;
28
28
  }
29
29
  declare const AppHeader: FunctionComponent<AppHeaderProps & ForwardProps>;
30
30
  export default AppHeader;
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,GAAG,EACH,UAAU,EAMX,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,GAAG,EAEH,MAAM,EAEN,WAAW,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,UAAU,EAIX,MAAM,yBAAyB,CAAC;AAajC,OAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,cAAe,SAAQ,SAAS,EAAE,cAAc;IAC/D,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AACD,UAAU,UAAU;IAClB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,MAAM,EAAE,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;IACtE,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAA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CAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACtD;AAED,UAAU,SAAU,SAAQ,GAAG;IAC7B,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACvF;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;CAC/D;AAkFD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAU/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useEffect, useState } from 'react';
3
- import { Flex, SearchInput, Avatar, useI18n, useBreakpoint, useTheme } from '@pega/cosmos-react-core';
3
+ import { readableColor } from 'polished';
4
+ import { Flex, SearchInput, Avatar, useBreakpoint, useTheme, Button, tryCatch } from '@pega/cosmos-react-core';
4
5
  import { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';
5
- import { StyledAppHeader, StyledTabs, StyledAppAvatar, StyledUtilsContainer, StyledBrandContainer, StyledPreviewButton, StyledTitle, StyledBrandButton } from './AppHeader.styles';
6
+ import { StyledAppHeader, StyledTabs, StyledAppAvatar, StyledUtilsContainer, StyledBrandContainer, StyledTitle, StyledBrandButton } from './AppHeader.styles';
6
7
  import BranchButton from './BranchButton';
7
8
  const BrandContainer = ({ name, onClick, href, visual }) => {
8
9
  const { base: { palette } } = useTheme();
9
- return (_jsxs(StyledBrandContainer, { container: { alignItems: 'center', justify: 'between' }, onClick: onClick, href: href, forwardedAs: onClick || href ? StyledBrandButton : 'div', children: [_jsx(Avatar, { ...visual, shape: 'squircle', name: name, backgroundColor: visual.backgroundColor || palette['brand-primary'], color: visual.color || palette.light }), _jsx(StyledTitle, { children: name })] }));
10
+ return (_jsxs(StyledBrandContainer, { container: { alignItems: 'center', justify: 'between' }, onClick: onClick, href: href, forwardedAs: onClick || href ? StyledBrandButton : 'div', children: [_jsx(Avatar, { ...visual, shape: 'squircle', name: name, backgroundColor: visual.backgroundColor || palette['brand-primary'], color: visual.color ||
11
+ tryCatch(() => readableColor(visual.backgroundColor || palette['brand-primary'])) }), _jsx(StyledTitle, { children: name })] }));
10
12
  };
11
13
  const Links = ({ links = [] }) => {
12
14
  const [currentTabId, setCurrentTabId] = useState(links[0].id || '');
@@ -23,9 +25,8 @@ const Links = ({ links = [] }) => {
23
25
  return _jsx(StyledTabs, { tabs: links, currentTabId: currentTabId, onTabClick: handleTabClick });
24
26
  };
25
27
  const Utils = ({ avatar, search, branch, action }) => {
26
- const t = useI18n();
27
28
  const isMediumOrAbove = useBreakpoint('md');
28
- return (_jsxs(StyledUtilsContainer, { isMediumOrAbove: isMediumOrAbove, container: { justify: 'end' }, children: [search && (_jsx(StyledAppHeaderSearchForm, { role: 'search', "aria-label": search.searchInputAriaLabel, onSubmit: e => e.preventDefault(), isMediumOrAbove: isMediumOrAbove, children: _jsx(SearchInput, { ...search }) })), branch && _jsx(BranchButton, { ...branch }), action && (_jsx(StyledPreviewButton, { variant: 'primary', onClick: (e) => action.onClick?.(action.id, e), children: t('preview') })), _jsx(StyledAppAvatar, { ...avatar })] }));
29
+ return (_jsxs(StyledUtilsContainer, { isMediumOrAbove: isMediumOrAbove, container: { justify: 'end' }, children: [search && (_jsx(StyledAppHeaderSearchForm, { role: 'search', "aria-label": search.searchInputAriaLabel, onSubmit: e => e.preventDefault(), isMediumOrAbove: isMediumOrAbove, children: _jsx(SearchInput, { ...search }) })), branch && _jsx(BranchButton, { ...branch }), action && (_jsx(Flex, { item: { shrink: 0 }, as: Button, variant: 'primary', onClick: (e) => action.onClick?.(action.id, e), disabled: action.disabled, children: action.text })), _jsx(StyledAppAvatar, { ...avatar })] }));
29
30
  };
30
31
  const AppHeader = forwardRef(({ brand, utils, links }, ref) => {
31
32
  return (_jsxs(Flex, { as: StyledAppHeader, container: { justify: 'between' }, ref: ref, children: [_jsx(BrandContainer, { ...brand }), links && links.length > 0 && _jsx(Links, { links: links }), utils && _jsx(Utils, { ...utils })] }));
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAMV,WAAW,EACX,SAAS,EACT,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,IAAI,EAEJ,WAAW,EAEX,MAAM,EAON,OAAO,EACP,aAAa,EACb,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kEAAkE,CAAC;AAE7G,OAAO,EACL,eAAe,EACf,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,YAAmC,MAAM,gBAAgB,CAAC;AA8BjE,MAAM,cAAc,GAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;IACzE,MAAM,EACJ,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,GAAG,QAAQ,EAAE,CAAC;IAEf,OAAO,CACL,MAAC,oBAAoB,IACnB,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,EACvD,OAAO,EAAE,O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AAK,EAAE,KAAK,GAAI,EACpD,KAAK,IAAI,KAAC,KAAK,OAAK,KAAK,GAAI,IACzB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n Ref,\n MouseEvent,\n FC,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useState\n} from 'react';\n\nimport {\n Flex,\n Tab,\n SearchInput,\n Action,\n Avatar,\n AvatarProps,\n BaseProps,\n ForwardProps,\n SearchInputProps,\n NoChildrenProp,\n OmitStrict,\n useI18n,\n useBreakpoint,\n useTheme\n} from '@pega/cosmos-react-core';\nimport { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\n\nimport {\n StyledAppHeader,\n StyledTabs,\n StyledAppAvatar,\n StyledUtilsContainer,\n StyledBrandContainer,\n StyledPreviewButton,\n StyledTitle,\n StyledBrandButton\n} from './AppHeader.styles';\nimport BranchButton, { BranchButtonProps } from './BranchButton';\n\nexport interface AppHeaderProps extends BaseProps, NoChildrenProp {\n brand: BrandProps;\n links?: LinkProps[];\n utils?: UtilsProps;\n ref?: Ref<HTMLDivElement>;\n}\ninterface BrandProps {\n /** The primary text to render in the header. */\n name: string;\n /** The name of icon to render in the header. */\n visual: OmitStrict<AvatarProps, 'name' | 'shape' | 'size' | 'status'>;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** Click handler for the header. */\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n}\n\ninterface LinkProps extends Tab {\n onClick?: (id: string, e?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n}\n\ninterface UtilsProps {\n avatar: AvatarProps;\n search?: SearchInputProps;\n branch?: BranchButtonProps;\n action?: Action;\n}\n\nconst BrandContainer: FC<BrandProps> = ({ name, onClick, href, visual }) => {\n const {\n base: { palette }\n } = useTheme();\n\n return (\n <StyledBrandContainer\n container={{ alignItems: 'center', justify: 'between' }}\n onClick={onClick}\n href={href}\n forwardedAs={onClick || href ? StyledBrandButton : 'div'}\n >\n <Avatar\n {...visual}\n shape='squircle'\n name={name}\n backgroundColor={visual.backgroundColor || palette['brand-primary']}\n color={visual.color || palette.light}\n />\n <StyledTitle>{name}</StyledTitle>\n </StyledBrandContainer>\n );\n};\n\nconst Links: FC<{ links: AppHeaderProps['links'] }> = ({ links = [] }) => {\n const [currentTabId, setCurrentTabId] = useState(links[0].id || '');\n\n useEffect(() => {\n setCurrentTabId(links[0].id || '');\n }, [links]);\n\n const handleTabClick = useCallback(\n (id: string, e?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const newActiveTab = links.find(item => item.id === id);\n if (newActiveTab) {\n newActiveTab.onClick?.(id, e);\n setCurrentTabId(newActiveTab.id);\n }\n },\n [links]\n );\n\n return <StyledTabs tabs={links} currentTabId={currentTabId} onTabClick={handleTabClick} />;\n};\n\nconst Utils: FC<UtilsProps> = ({ avatar, search, branch, action }: UtilsProps) => {\n const t = useI18n();\n const isMediumOrAbove = useBreakpoint('md');\n\n return (\n <StyledUtilsContainer isMediumOrAbove={isMediumOrAbove} container={{ justify: 'end' }}>\n {search && (\n <StyledAppHeaderSearchForm\n role='search'\n aria-label={search.searchInputAriaLabel}\n onSubmit={e => e.preventDefault()}\n isMediumOrAbove={isMediumOrAbove}\n >\n <SearchInput {...search} />\n </StyledAppHeaderSearchForm>\n )}\n {branch && <BranchButton {...branch} />}\n {action && (\n <StyledPreviewButton\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n >\n {t('preview')}\n </StyledPreviewButton>\n )}\n <StyledAppAvatar {...avatar} />\n </StyledUtilsContainer>\n );\n};\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(\n ({ brand, utils, links }: PropsWithoutRef<AppHeaderProps>, ref: AppHeaderProps['ref']) => {\n return (\n <Flex as={StyledAppHeader} container={{ justify: 'between' }} ref={ref}>\n <BrandContainer {...brand} />\n {links && links.length > 0 && <Links links={links} />}\n {utils && <Utils {...utils} />}\n </Flex>\n );\n }\n);\n\nexport default AppHeader;\n"]}
1
+ {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAMV,WAAW,EACX,SAAS,EACT,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,IAAI,EAEJ,WAAW,EAEX,MAAM,EAON,aAAa,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kEAAkE,CAAC;AAE7G,OAAO,EACL,eAAe,EACf,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,YAAmC,MAAM,gBAAgB,CAAC;AA8BjE,MAAM,cAAc,GAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;IACzE,MAAM,EACJ,IAAI,EAAE,EAAE,OAAO,EAAE,EAClB,GAAG,QAAQ,EAAE,CAAC;IAEf,OAAO,CACL,MAAC,oBAAoB,IACnB,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,EACvD,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,aAExD,KAAC,MAAM,OACD,MAAM,EACV,KAAK,EAAC,UAAU,EAChB,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,OAAO,CAAC,eAAe,CAAC,EACnE,KAAK,EACH,MAAM,CAAC,KA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["import {\n forwardRef,\n FunctionComponent,\n Ref,\n MouseEvent,\n FC,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useState\n} from 'react';\nimport { readableColor } from 'polished';\n\nimport {\n Flex,\n Tab,\n SearchInput,\n Action,\n Avatar,\n AvatarProps,\n BaseProps,\n ForwardProps,\n SearchInputProps,\n NoChildrenProp,\n OmitStrict,\n useBreakpoint,\n useTheme,\n Button,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\n\nimport {\n StyledAppHeader,\n StyledTabs,\n StyledAppAvatar,\n StyledUtilsContainer,\n StyledBrandContainer,\n StyledTitle,\n StyledBrandButton\n} from './AppHeader.styles';\nimport BranchButton, { BranchButtonProps } from './BranchButton';\n\nexport interface AppHeaderProps extends BaseProps, NoChildrenProp {\n brand: BrandProps;\n links?: LinkProps[];\n utils?: UtilsProps;\n ref?: Ref<HTMLDivElement>;\n}\ninterface BrandProps {\n /** The primary text to render in the header. */\n name: string;\n /** The name of icon to render in the header. */\n visual: OmitStrict<AvatarProps, 'name' | 'shape' | 'size' | 'status'>;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** Click handler for the header. */\n onClick?: (e: MouseEvent<HTMLButtonElement>) => void;\n}\n\ninterface LinkProps extends Tab {\n onClick?: (id: string, e?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n}\n\ninterface UtilsProps {\n avatar: AvatarProps;\n search?: SearchInputProps;\n branch?: BranchButtonProps;\n action?: Pick<Action, 'id' | 'text' | 'onClick' | 'disabled'>;\n}\n\nconst BrandContainer: FC<BrandProps> = ({ name, onClick, href, visual }) => {\n const {\n base: { palette }\n } = useTheme();\n\n return (\n <StyledBrandContainer\n container={{ alignItems: 'center', justify: 'between' }}\n onClick={onClick}\n href={href}\n forwardedAs={onClick || href ? StyledBrandButton : 'div'}\n >\n <Avatar\n {...visual}\n shape='squircle'\n name={name}\n backgroundColor={visual.backgroundColor || palette['brand-primary']}\n color={\n visual.color ||\n tryCatch(() => readableColor(visual.backgroundColor || palette['brand-primary']))\n }\n />\n <StyledTitle>{name}</StyledTitle>\n </StyledBrandContainer>\n );\n};\n\nconst Links: FC<{ links: AppHeaderProps['links'] }> = ({ links = [] }) => {\n const [currentTabId, setCurrentTabId] = useState(links[0].id || '');\n\n useEffect(() => {\n setCurrentTabId(links[0].id || '');\n }, [links]);\n\n const handleTabClick = useCallback(\n (id: string, e?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const newActiveTab = links.find(item => item.id === id);\n if (newActiveTab) {\n newActiveTab.onClick?.(id, e);\n setCurrentTabId(newActiveTab.id);\n }\n },\n [links]\n );\n\n return <StyledTabs tabs={links} currentTabId={currentTabId} onTabClick={handleTabClick} />;\n};\n\nconst Utils: FC<UtilsProps> = ({ avatar, search, branch, action }: UtilsProps) => {\n const isMediumOrAbove = useBreakpoint('md');\n\n return (\n <StyledUtilsContainer isMediumOrAbove={isMediumOrAbove} container={{ justify: 'end' }}>\n {search && (\n <StyledAppHeaderSearchForm\n role='search'\n aria-label={search.searchInputAriaLabel}\n onSubmit={e => e.preventDefault()}\n isMediumOrAbove={isMediumOrAbove}\n >\n <SearchInput {...search} />\n </StyledAppHeaderSearchForm>\n )}\n {branch && <BranchButton {...branch} />}\n {action && (\n <Flex\n item={{ shrink: 0 }}\n as={Button}\n variant='primary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n disabled={action.disabled}\n >\n {action.text}\n </Flex>\n )}\n <StyledAppAvatar {...avatar} />\n </StyledUtilsContainer>\n );\n};\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(\n ({ brand, utils, links }: PropsWithoutRef<AppHeaderProps>, ref: AppHeaderProps['ref']) => {\n return (\n <Flex as={StyledAppHeader} container={{ justify: 'between' }} ref={ref}>\n <BrandContainer {...brand} />\n {links && links.length > 0 && <Links links={links} />}\n {utils && <Utils {...utils} />}\n </Flex>\n );\n }\n);\n\nexport default AppHeader;\n"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Avatar, Flex, Text, Tabs, Button } from '@pega/cosmos-react-core';
2
+ import { Avatar, Flex, Text, Tabs } from '@pega/cosmos-react-core';
3
3
  export declare const StyledAppHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
4
4
  export declare const StyledTitle: typeof Text;
5
5
  export declare const StyledBrandContainer: typeof Flex;
@@ -7,6 +7,5 @@ export declare const StyledBrandButton: import("styled-components").StyledCompon
7
7
  export declare const StyledTabs: typeof Tabs;
8
8
  export declare const StyledUtilsContainer: typeof Flex;
9
9
  export declare const StyledBranchContainer: typeof Flex;
10
- export declare const StyledPreviewButton: typeof Button;
11
10
  export declare const StyledAppAvatar: typeof Avatar;
12
11
  //# sourceMappingURL=AppHeader.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAoB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAI7F,eAAO,MAAM,eAAe,4GAU1B,CAAC;AAIH,eAAO,MAAM,WAAW,EAAE,OAAO,IAU/B,CAAC;AAIH,eAAO,MAAM,oBAAoB,EAAE,OAAO,IAKxC,CAAC;AAIH,eAAO,MAAM,iBAAiB,0QAM5B,CAAC;AAIH,eAAO,MAAM,UAAU,EAAE,OAAO,IAqB9B,CAAC;AAIH,eAAO,MAAM,oBAAoB,EAAE,OAAO,IAmBzC,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,OAAO,IAYzC,CAAC;AAIH,eAAO,MAAM,mBAAmB,EAAE,OAAO,MAExC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,OAAO,MAQnC,CAAC"}
1
+ {"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAoB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIrF,eAAO,MAAM,eAAe,4GAU1B,CAAC;AAIH,eAAO,MAAM,WAAW,EAAE,OAAO,IAU/B,CAAC;AAIH,eAAO,MAAM,oBAAoB,EAAE,OAAO,IAKxC,CAAC;AAIH,eAAO,MAAM,iBAAiB,0QAM5B,CAAC;AAIH,eAAO,MAAM,UAAU,EAAE,OAAO,IAqB9B,CAAC;AAIH,eAAO,MAAM,oBAAoB,EAAE,OAAO,IAmBzC,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,OAAO,IAYzC,CAAC;AAIH,eAAO,MAAM,eAAe,EAAE,OAAO,MAQnC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
- import { Avatar, defaultThemeProp, Flex, Text, Tabs, Button } from '@pega/cosmos-react-core';
2
+ import { Avatar, defaultThemeProp, Flex, Text, Tabs } from '@pega/cosmos-react-core';
3
3
  import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
4
4
  import { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';
5
5
  export const StyledAppHeader = styled.header(({ theme }) => {
@@ -97,9 +97,6 @@ export const StyledBranchContainer = styled(Flex)(({ theme }) => {
97
97
  `;
98
98
  });
99
99
  StyledBranchContainer.defaultProps = defaultThemeProp;
100
- export const StyledPreviewButton = styled(Button) `
101
- flex-shrink: 0;
102
- `;
103
100
  export const StyledAppAvatar = styled(Avatar)(({ theme }) => {
104
101
  return css `
105
102
  width: 1.5rem;
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG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CAAA;;;;;;qBAMS,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;wCACnB,KAAK,CAAC,IAAI,CAAC,OAAO;uCACnB,KAAK,CAAC,IAAI,CAAC,OAAO;;GAEtD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,mBAAmB,GAAkB,MAAM,CAAC,MAAM,CAAC,CAAA;;CAE/D,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAkB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzE,OAAO,GAAG,CAAA;;;;sCAI0B,KAAK,CAAC,IAAI,CAAC,OAAO;;GAErD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Avatar, defaultThemeProp, Flex, Text, Tabs, Button } from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\n\nexport const StyledAppHeader = styled.header(({ theme }) => {\n return css`\n height: 3rem;\n padding: 0 calc(2 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.colors.gray.light};\n background-color: ${theme.base.palette['primary-background']};\n position: sticky;\n top: 0;\n z-index: calc(${theme.base['z-index'].drawer + 1});\n `;\n});\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n\nexport const StyledTitle: typeof Text = styled(Text)(({ theme }) => {\n return css`\n max-width: 25ch;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${theme.base.palette['foreground-color']};\n font-weight: ${theme.base['font-weight'].bold};\n margin-inline-start: calc(0.75 * ${theme.base.spacing});\n `;\n});\n\nStyledTitle.defaultProps = defaultThemeProp;\n\nexport const StyledBrandContainer: typeof Flex = styled(Flex)(({ theme }) => {\n return css`\n padding-block: ${theme.base.spacing};\n text-decoration: none;\n `;\n});\n\nStyledBrandContainer.defaultProps = defaultThemeProp;\n\nexport const StyledBrandButton = styled(BareButton)(({ theme }) => {\n return css`\n &:not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledBrandButton.defaultProps = defaultThemeProp;\n\nexport const StyledTabs: typeof Tabs = styled(Tabs)(({ theme }) => {\n return css`\n margin-inline-start: calc(2 * ${theme.base.spacing});\n margin-inline-end: calc(2 * ${theme.base.spacing});\n border: none;\n min-height: 3rem;\n button {\n height: auto;\n span:first-of-type {\n text-transform: none;\n }\n }\n button[aria-selected='false'] > span {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n }\n button:hover,\n button:focus,\n button:active {\n box-shadow: none;\n }\n `;\n});\n\nStyledTabs.defaultProps = defaultThemeProp;\n\nexport const StyledUtilsContainer: typeof Flex = styled(Flex)<{ isMediumOrAbove: boolean }>(\n ({ theme, isMediumOrAbove }) => {\n return css`\n margin-inline-start: auto;\n padding-block: ${theme.base.spacing};\n width: auto;\n min-width: ${isMediumOrAbove ? '32%' : 'auto'};\n & > div,\n & > span {\n margin-inline-start: ${theme.base.spacing};\n }\n & > div:last-child {\n margin-inline-end: 0;\n }\n ${StyledAppHeaderSearchForm} {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n }\n);\n\nStyledUtilsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledBranchContainer: typeof Flex = styled(Flex)(({ theme }) => {\n return css`\n span {\n white-space: nowrap;\n max-width: 25ch;\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n margin-inline-start: calc(0.5 * ${theme.base.spacing});\n margin-inline-end: calc(0.75 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledBranchContainer.defaultProps = defaultThemeProp;\n\nexport const StyledPreviewButton: typeof Button = styled(Button)`\n flex-shrink: 0;\n`;\n\nexport const StyledAppAvatar: typeof Avatar = styled(Avatar)(({ theme }) => {\n return css`\n width: 1.5rem;\n height: 1.5rem;\n && {\n margin-inline-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledAppAvatar.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppHeader/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kEAAkE,CAAC;AAE7G,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzD,OAAO,GAAG,CAAA;;0BAEc,KAAK,CAAC,IAAI,CAAC,OAAO;qCACP,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;wBACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;;;oBAG5C,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC;GACjD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEhD,MAAM,CAAC,MAAM,WAAW,GAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACjE,OAAO,GAAG,CAAA;;;;;aAKC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;mBAChC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI;uCACV,KAAK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AM;;;+BAGpB,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;QAKzC,yBAAyB;6BACJ,KAAK,CAAC,IAAI,CAAC,OAAO;;KAE1C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,qBAAqB,GAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,OAAO,GAAG,CAAA;;;;;;qBAMS,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;wCACnB,KAAK,CAAC,IAAI,CAAC,OAAO;uCACnB,KAAK,CAAC,IAAI,CAAC,OAAO;;GAEtD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,eAAe,GAAkB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzE,OAAO,GAAG,CAAA;;;;sCAI0B,KAAK,CAAC,IAAI,CAAC,OAAO;;GAErD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { Avatar, defaultThemeProp, Flex, Text, Tabs } from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\n\nexport const StyledAppHeader = styled.header(({ theme }) => {\n return css`\n height: 3rem;\n padding: 0 calc(2 * ${theme.base.spacing});\n border-bottom: 0.0625rem solid ${theme.base.colors.gray.light};\n background-color: ${theme.base.palette['primary-background']};\n position: sticky;\n top: 0;\n z-index: calc(${theme.base['z-index'].drawer + 1});\n `;\n});\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n\nexport const StyledTitle: typeof Text = styled(Text)(({ theme }) => {\n return css`\n max-width: 25ch;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${theme.base.palette['foreground-color']};\n font-weight: ${theme.base['font-weight'].bold};\n margin-inline-start: calc(0.75 * ${theme.base.spacing});\n `;\n});\n\nStyledTitle.defaultProps = defaultThemeProp;\n\nexport const StyledBrandContainer: typeof Flex = styled(Flex)(({ theme }) => {\n return css`\n padding-block: ${theme.base.spacing};\n text-decoration: none;\n `;\n});\n\nStyledBrandContainer.defaultProps = defaultThemeProp;\n\nexport const StyledBrandButton = styled(BareButton)(({ theme }) => {\n return css`\n &:not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledBrandButton.defaultProps = defaultThemeProp;\n\nexport const StyledTabs: typeof Tabs = styled(Tabs)(({ theme }) => {\n return css`\n margin-inline-start: calc(2 * ${theme.base.spacing});\n margin-inline-end: calc(2 * ${theme.base.spacing});\n border: none;\n min-height: 3rem;\n button {\n height: auto;\n span:first-of-type {\n text-transform: none;\n }\n }\n button[aria-selected='false'] > span {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n }\n button:hover,\n button:focus,\n button:active {\n box-shadow: none;\n }\n `;\n});\n\nStyledTabs.defaultProps = defaultThemeProp;\n\nexport const StyledUtilsContainer: typeof Flex = styled(Flex)<{ isMediumOrAbove: boolean }>(\n ({ theme, isMediumOrAbove }) => {\n return css`\n margin-inline-start: auto;\n padding-block: ${theme.base.spacing};\n width: auto;\n min-width: ${isMediumOrAbove ? '32%' : 'auto'};\n & > div,\n & > span {\n margin-inline-start: ${theme.base.spacing};\n }\n & > div:last-child {\n margin-inline-end: 0;\n }\n ${StyledAppHeaderSearchForm} {\n margin-inline-end: ${theme.base.spacing};\n }\n `;\n }\n);\n\nStyledUtilsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledBranchContainer: typeof Flex = styled(Flex)(({ theme }) => {\n return css`\n span {\n white-space: nowrap;\n max-width: 25ch;\n overflow: hidden;\n text-overflow: ellipsis;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n margin-inline-start: calc(0.5 * ${theme.base.spacing});\n margin-inline-end: calc(0.75 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledBranchContainer.defaultProps = defaultThemeProp;\n\nexport const StyledAppAvatar: typeof Avatar = styled(Avatar)(({ theme }) => {\n return css`\n width: 1.5rem;\n height: 1.5rem;\n && {\n margin-inline-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledAppAvatar.defaultProps = defaultThemeProp;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BranchButton.d.ts","sourceRoot":"","sources":["../../../src/components/AppHeader/BranchButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAGnE,OAAO,EACL,MAAM,EACN,UAAU,EAGV,IAAI,EAGJ,SAAS,EAMT,WAAW,EAEZ,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;IAChE,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,KAAK,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/B,iCAAiC;IACjC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,EAAE,OAAO,MAwDvC,CAAC;AAaF,eAAO,MAAM,cAAc,EAAE,OAAO,IAIlC,CAAC;AAYH,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAqEtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"BranchButton.d.ts","sourceRoot":"","sources":["../../../src/components/AppHeader/BranchButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,iBAAiB,EAAiB,MAAM,OAAO,CAAC;AAInE,OAAO,EACL,MAAM,EACN,UAAU,EAGV,IAAI,EAGJ,SAAS,EAMT,WAAW,EAGZ,MAAM,yBAAyB,CAAC;AAQjC,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;IAChE,6CAA6C;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,KAAK,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/B,iCAAiC;IACjC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,EAAE,OAAO,MAuDvC,CAAC;AAqBF,eAAO,MAAM,cAAc,EAAE,OAAO,IAIlC,CAAC;AAgBH,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAqEtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,25 +1,25 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { Button, defaultThemeProp, Flex, Icon, Menu, Count, Popover, useDirection, useElement, registerIcon, useOuterEvent, useI18n } from '@pega/cosmos-react-core';
4
+ import { readableColor } from 'polished';
5
+ import { Button, defaultThemeProp, Flex, Icon, Menu, Count, Popover, useDirection, useElement, registerIcon, useOuterEvent, useI18n, tryCatch } from '@pega/cosmos-react-core';
5
6
  import * as nodesDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/nodes-down-solid.icon';
6
7
  import * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';
7
8
  import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
8
9
  import { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';
9
10
  registerIcon(nodesDownSolidIcon, warnSolidIcon, caretDownIcon);
10
11
  export const StyledBranchButton = styled(Button)(({ theme, branchVariant }) => {
11
- const { base: { colors, palette: { 'foreground-color': foregroundColor }, shadow: { focus }, spacing }, components: { badges: { status, count: { base: { background, foreground } } } } } = theme;
12
- const backgroundColor = branchVariant ? status[branchVariant].background : colors.white;
12
+ const { base: { colors, palette: { 'primary-background': primaryBackground }, shadow: { focus }, spacing }, components: { badges: { status, count: { base: { background, foreground } } } } } = theme;
13
+ const backgroundColor = branchVariant ? status[branchVariant].background : primaryBackground;
13
14
  const borderColor = !branchVariant ? colors.gray.medium : 'transparent';
14
15
  const countBgColor = branchVariant === 'success' ? colors.green.medium : background;
15
16
  const countColor = branchVariant === 'success' ? colors.white : foreground;
17
+ const buttonColor = tryCatch(() => readableColor(backgroundColor));
16
18
  return css `
17
19
  flex-shrink: 0;
18
- min-width: calc(7 * ${spacing});
19
- max-width: calc(23 * ${spacing});
20
20
  background-color: ${backgroundColor};
21
21
  border-color: ${borderColor};
22
- color: ${foregroundColor};
22
+ color: ${buttonColor};
23
23
  padding-inline-start: ${spacing};
24
24
  padding-inline-end: ${spacing};
25
25
 
@@ -40,11 +40,12 @@ export const StyledBranchButton = styled(Button)(({ theme, branchVariant }) => {
40
40
  `;
41
41
  });
42
42
  StyledBranchButton.defaultProps = defaultThemeProp;
43
- const StyledBranchButtonPopover = styled(Popover)(({ theme }) => {
43
+ const StyledBranchButtonPopover = styled(Popover)(({ theme: { base: { spacing, 'content-width': contentWidth } } }) => {
44
+ const minWidth = `calc(${contentWidth.xs} + (2 * ${spacing}))`;
44
45
  return css `
45
- min-width: 23ch;
46
- max-width: calc(23 * ${theme.base.spacing});
47
- `;
46
+ min-width: ${minWidth};
47
+ max-width: calc(${minWidth} + 5ch);
48
+ `;
48
49
  });
49
50
  StyledBranchButtonPopover.defaultProps = defaultThemeProp;
50
51
  export const StyledWarnIcon = styled(Icon)(({ theme }) => {
@@ -53,13 +54,16 @@ export const StyledWarnIcon = styled(Icon)(({ theme }) => {
53
54
  `;
54
55
  });
55
56
  StyledWarnIcon.defaultProps = defaultThemeProp;
56
- const StyledEllipsisedText = styled.span `
57
- max-width: 11ch;
58
- white-space: nowrap;
59
- overflow: hidden;
60
- text-overflow: ellipsis;
61
- line-height: 1.5;
62
- `;
57
+ const StyledEllipsisedText = styled.span(({ theme }) => {
58
+ return css `
59
+ max-width: ${theme.base['content-width'].xs};
60
+ white-space: nowrap;
61
+ overflow: hidden;
62
+ text-overflow: ellipsis;
63
+ line-height: 1.5;
64
+ `;
65
+ });
66
+ StyledEllipsisedText.defaultProps = defaultThemeProp;
63
67
  const BranchButton = (props) => {
64
68
  const { text, variant, count, compact = false, items = [] } = props;
65
69
  const [open, setOpen] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"file":"BranchButton.js","sourceRoot":"","sources":["../../../src/components/AppHeader/BranchButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAoC,MAAM,OAAO,CAAC;AACnE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EACL,MAAM,EAEN,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,KAAK,EAEL,OAAO,EACP,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,aAAa,EAEb,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,kBAAkB,MAAM,yEAAyE,CAAC;AAC9G,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,YAAY,CAAC,kBAAkB,EAAE,aAAa,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EACrB,KAAC,yBAAyB,IACxB,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,EAC9C,EAAE,EAAC,gBAAgB,EACnB,kBAAkB,QAClB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,QAAQ,EAChB,GAAG,EAAE,aAAa,YAElB,KAAC,IAAI,IACH,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,EAAE,EACZ,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EACjC,cAAc,EAAE,QAAQ,IAAI,SAAS,EACrC,cAAc,EAAE,KAAK,GACrB,GACwB,IAC3B,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useState, FunctionComponent, KeyboardEvent } from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\n\nimport {\n Button,\n CountProps,\n defaultThemeProp,\n Flex,\n Icon,\n Menu,\n Count,\n MenuProps,\n Popover,\n useDirection,\n useElement,\n registerIcon,\n useOuterEvent,\n StatusProps,\n useI18n\n} from '@pega/cosmos-react-core';\nimport * as nodesDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/nodes-down-solid.icon';\nimport * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';\n\nregisterIcon(nodesDownSolidIcon, warnSolidIcon, caretDownIcon);\n\nexport interface BranchButtonProps {\n /** The text for the BranchButton also used to set the aria-label. */\n text: string;\n /** Determines the variant for the BranchButton. */\n variant?: Extract<StatusProps['variant'], 'success' | 'urgent'>;\n /** Only display the branch and caret icon */\n compact?: boolean;\n /** The total count representing the number of unmerged changes. */\n count?: CountProps['children'];\n /** An array of MenuItemProps. */\n items: MenuProps['items'];\n}\n\nexport const StyledBranchButton: typeof Button = styled(Button)(\n ({\n theme,\n branchVariant\n }: {\n theme: DefaultTheme;\n branchVariant: BranchButtonProps['variant'];\n }) => {\n const {\n base: {\n colors,\n palette: { 'foreground-color': foregroundColor },\n shadow: { focus },\n spacing\n },\n components: {\n badges: {\n status,\n count: {\n base: { background, foreground }\n }\n }\n }\n } = theme;\n\n const backgroundColor = branchVariant ? status[branchVariant].background : colors.white;\n const borderColor = !branchVariant ? colors.gray.medium : 'transparent';\n const countBgColor = branchVariant === 'success' ? colors.green.medium : background;\n const countColor = branchVariant === 'success' ? colors.white : foreground;\n\n return css`\n flex-shrink: 0;\n min-width: calc(7 * ${spacing});\n max-width: calc(23 * ${spacing});\n background-color: ${backgroundColor};\n border-color: ${borderColor};\n color: ${foregroundColor};\n padding-inline-start: ${spacing};\n padding-inline-end: ${spacing};\n\n &:hover {\n background-color: ${backgroundColor};\n box-shadow: ${focus};\n }\n\n svg {\n height: 1rem;\n width: 1rem;\n }\n\n ${StyledCount} {\n background-color: ${countBgColor};\n color: ${countColor};\n }\n `;\n }\n);\n\nStyledBranchButton.defaultProps = defaultThemeProp;\n\nconst StyledBranchButtonPopover = styled(Popover)(({ theme }) => {\n return css`\n min-width: 23ch;\n max-width: calc(23 * ${theme.base.spacing});\n `;\n});\n\nStyledBranchButtonPopover.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.colors.red.medium};\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nconst StyledEllipsisedText = styled.span`\n max-width: 11ch;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.5;\n`;\n\nconst BranchButton: FunctionComponent<BranchButtonProps> = (props: BranchButtonProps) => {\n const { text, variant, count, compact = false, items = [] } = props;\n\n const [open, setOpen] = useState(false);\n\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const { rtl } = useDirection();\n const t = useI18n();\n\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n if (open) setOpen(false);\n });\n\n let ariaLabel = t('branch_with_no_changes', [text]);\n if (variant === 'success') {\n ariaLabel = t('branch_with_no_potential_conflicts', [text, count ?? 0]);\n } else if (variant === 'urgent') {\n ariaLabel = t('branch_with_potential_conflicts', [text]);\n }\n\n return (\n <>\n <StyledBranchButton\n ref={setButtonEl}\n aria-expanded={open}\n aria-haspopup='menu'\n aria-controls='branch-popover'\n aria-label={ariaLabel}\n branchVariant={variant}\n label={!open ? text : undefined}\n onClick={() => setOpen(cur => !cur)}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Escape') setOpen(false);\n }}\n >\n <Flex container={{ alignItems: 'center', gap: compact ? 1 : 0.5 }}>\n <Icon name='nodes-down-solid' />\n {!compact && (\n <>\n <StyledEllipsisedText>{text}</StyledEllipsisedText>\n {variant === 'urgent' ? (\n <StyledWarnIcon name='warn-solid' />\n ) : (\n count !== undefined && <Count>{count}</Count>\n )}\n </>\n )}\n <Icon name='caret-down' />\n </Flex>\n </StyledBranchButton>\n <StyledBranchButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n id='branch-popover'\n hideOnTargetHidden\n show={open}\n target={buttonEl}\n ref={setPopoverRef}\n >\n <Menu\n items={items}\n scrollAt={20}\n onItemClick={() => setOpen(false)}\n focusControlEl={buttonEl || undefined}\n focusElOnClose={false}\n />\n </StyledBranchButtonPopover>\n </>\n );\n};\n\nexport default BranchButton;\n"]}
1
+ {"version":3,"file":"BranchButton.js","sourceRoot":"","sources":["../../../src/components/AppHeader/BranchButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAoC,MAAM,OAAO,CAAC;AACnE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,MAAM,EAEN,gBAAgB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Content":["import { useState, FunctionComponent, KeyboardEvent } from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n Button,\n CountProps,\n defaultThemeProp,\n Flex,\n Icon,\n Menu,\n Count,\n MenuProps,\n Popover,\n useDirection,\n useElement,\n registerIcon,\n useOuterEvent,\n StatusProps,\n useI18n,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport * as nodesDownSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/nodes-down-solid.icon';\nimport * as warnSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/warn-solid.icon';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';\n\nregisterIcon(nodesDownSolidIcon, warnSolidIcon, caretDownIcon);\n\nexport interface BranchButtonProps {\n /** The text for the BranchButton also used to set the aria-label. */\n text: string;\n /** Determines the variant for the BranchButton. */\n variant?: Extract<StatusProps['variant'], 'success' | 'urgent'>;\n /** Only display the branch and caret icon */\n compact?: boolean;\n /** The total count representing the number of unmerged changes. */\n count?: CountProps['children'];\n /** An array of MenuItemProps. */\n items: MenuProps['items'];\n}\n\nexport const StyledBranchButton: typeof Button = styled(Button)(\n ({\n theme,\n branchVariant\n }: {\n theme: DefaultTheme;\n branchVariant: BranchButtonProps['variant'];\n }) => {\n const {\n base: {\n colors,\n palette: { 'primary-background': primaryBackground },\n shadow: { focus },\n spacing\n },\n components: {\n badges: {\n status,\n count: {\n base: { background, foreground }\n }\n }\n }\n } = theme;\n\n const backgroundColor = branchVariant ? status[branchVariant].background : primaryBackground;\n const borderColor = !branchVariant ? colors.gray.medium : 'transparent';\n const countBgColor = branchVariant === 'success' ? colors.green.medium : background;\n const countColor = branchVariant === 'success' ? colors.white : foreground;\n const buttonColor = tryCatch(() => readableColor(backgroundColor));\n\n return css`\n flex-shrink: 0;\n background-color: ${backgroundColor};\n border-color: ${borderColor};\n color: ${buttonColor};\n padding-inline-start: ${spacing};\n padding-inline-end: ${spacing};\n\n &:hover {\n background-color: ${backgroundColor};\n box-shadow: ${focus};\n }\n\n svg {\n height: 1rem;\n width: 1rem;\n }\n\n ${StyledCount} {\n background-color: ${countBgColor};\n color: ${countColor};\n }\n `;\n }\n);\n\nStyledBranchButton.defaultProps = defaultThemeProp;\n\nconst StyledBranchButtonPopover = styled(Popover)(\n ({\n theme: {\n base: { spacing, 'content-width': contentWidth }\n }\n }) => {\n const minWidth = `calc(${contentWidth.xs} + (2 * ${spacing}))`;\n\n return css`\n min-width: ${minWidth};\n max-width: calc(${minWidth} + 5ch);\n `;\n }\n);\n\nStyledBranchButtonPopover.defaultProps = defaultThemeProp;\n\nexport const StyledWarnIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.colors.red.medium};\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nconst StyledEllipsisedText = styled.span(({ theme }) => {\n return css`\n max-width: ${theme.base['content-width'].xs};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.5;\n `;\n});\n\nStyledEllipsisedText.defaultProps = defaultThemeProp;\n\nconst BranchButton: FunctionComponent<BranchButtonProps> = (props: BranchButtonProps) => {\n const { text, variant, count, compact = false, items = [] } = props;\n\n const [open, setOpen] = useState(false);\n\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [buttonEl, setButtonEl] = useElement<HTMLElement>();\n const { rtl } = useDirection();\n const t = useI18n();\n\n useOuterEvent('mousedown', [popoverEl, buttonEl], () => {\n if (open) setOpen(false);\n });\n\n let ariaLabel = t('branch_with_no_changes', [text]);\n if (variant === 'success') {\n ariaLabel = t('branch_with_no_potential_conflicts', [text, count ?? 0]);\n } else if (variant === 'urgent') {\n ariaLabel = t('branch_with_potential_conflicts', [text]);\n }\n\n return (\n <>\n <StyledBranchButton\n ref={setButtonEl}\n aria-expanded={open}\n aria-haspopup='menu'\n aria-controls='branch-popover'\n aria-label={ariaLabel}\n branchVariant={variant}\n label={!open ? text : undefined}\n onClick={() => setOpen(cur => !cur)}\n onKeyDown={(e: KeyboardEvent) => {\n if (e.key === 'Escape') setOpen(false);\n }}\n >\n <Flex container={{ alignItems: 'center', gap: compact ? 1 : 0.5 }}>\n <Icon name='nodes-down-solid' />\n {!compact && (\n <>\n <StyledEllipsisedText>{text}</StyledEllipsisedText>\n {variant === 'urgent' ? (\n <StyledWarnIcon name='warn-solid' />\n ) : (\n count !== undefined && <Count>{count}</Count>\n )}\n </>\n )}\n <Icon name='caret-down' />\n </Flex>\n </StyledBranchButton>\n <StyledBranchButtonPopover\n placement={rtl ? 'bottom-end' : 'bottom-start'}\n id='branch-popover'\n hideOnTargetHidden\n show={open}\n target={buttonEl}\n ref={setPopoverRef}\n >\n <Menu\n items={items}\n scrollAt={20}\n onItemClick={() => setOpen(false)}\n focusControlEl={buttonEl || undefined}\n focusElOnClose={false}\n />\n </StyledBranchButtonPopover>\n </>\n );\n};\n\nexport default BranchButton;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-build",
3
- "version": "3.0.0-dev.22.0",
3
+ "version": "3.0.0-dev.23.2",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,19 +20,18 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "3.0.0-dev.22.0",
24
- "@pega/cosmos-react-dnd": "3.0.0-dev.22.0",
23
+ "@pega/cosmos-react-core": "3.0.0-dev.23.2",
24
+ "@pega/cosmos-react-dnd": "3.0.0-dev.23.2",
25
25
  "@types/dagre": "^0.7.46",
26
26
  "@types/react": "^16.14.24 || ^17.0.38",
27
27
  "@types/react-dom": "^16.9.14 || ^17.0.11",
28
28
  "@types/styled-components": "^5.1.7",
29
- "@types/tinymce": "^4.6.4",
30
29
  "dagre": "^0.8.5",
31
30
  "polished": "^4.1.0",
32
31
  "react": "^16.14.0 || ^17.0.0",
33
32
  "react-dom": "^16.14.0 || ^17.0.0",
34
33
  "styled-components": "^5.2.0",
35
- "tinymce": "^5.10.2"
34
+ "tinymce": "^6.0.3"
36
35
  },
37
36
  "devDependencies": {
38
37
  "@storybook/addon-a11y": "^6.4.19",