@pega/cosmos-react-wss 3.0.0-dev.18.1 → 3.0.0-dev.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ import { Ref, FunctionComponent, MouseEventHandler } from 'react';
2
+ import { BaseProps, ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
+ export interface QuickCreateAction {
4
+ label: string;
5
+ icon?: string;
6
+ onClick: MouseEventHandler;
7
+ }
8
+ export interface QuickCreateProps extends BaseProps, NoChildrenProp {
9
+ heading: string;
10
+ actions: QuickCreateAction[];
11
+ ref?: Ref<HTMLDivElement>;
12
+ }
13
+ export declare const StyledQuickCreate: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
14
+ export declare const StyledQuickCreateButton: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
15
+ declare const QuickCreate: FunctionComponent<QuickCreateProps & ForwardProps>;
16
+ export default QuickCreate;
17
+ //# sourceMappingURL=QuickCreate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickCreate.d.ts","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,GAAG,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,EACL,SAAS,EAIT,YAAY,EAGZ,cAAc,EAIf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS,EAAE,cAAc;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,yGAI7B,CAAC;AAEF,eAAO,MAAM,uBAAuB,mLAelC,CAAC;AAYH,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAkCnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { Button, defaultThemeProp, Flex, Grid, Icon, StyledIcon, Text, useTheme } from '@pega/cosmos-react-core';
5
+ export const StyledQuickCreate = styled.div `
6
+ & > ul {
7
+ list-style: none;
8
+ }
9
+ `;
10
+ export const StyledQuickCreateButton = styled(Button)(({ theme }) => {
11
+ return css `
12
+ width: 100%;
13
+ height: 6rem;
14
+ padding: calc(${theme.base.spacing} * 2);
15
+ border-radius: calc(${`${theme.base['border-radius']} * ${theme.base['border-radius']}`});
16
+ justify-content: start;
17
+ text-align: start;
18
+
19
+ & ${StyledIcon} {
20
+ width: 1em;
21
+ height: 1em;
22
+ flex-shrink: 0;
23
+ }
24
+ `;
25
+ });
26
+ StyledQuickCreateButton.defaultProps = defaultThemeProp;
27
+ const StyledButtonText = styled.span `
28
+ display: -webkit-box;
29
+ -webkit-box-orient: vertical;
30
+ -webkit-line-clamp: 2;
31
+ overflow: hidden;
32
+ line-height: 1.5;
33
+ `;
34
+ const QuickCreate = forwardRef(({ heading, actions, ...restProps }, ref) => {
35
+ const theme = useTheme();
36
+ return (_jsxs(Flex, { ...restProps, container: { direction: 'column', gap: 2 }, as: StyledQuickCreate, ref: ref, children: [_jsx(Text, { variant: 'h2', children: heading }), _jsx(Grid, { as: 'ul', container: {
37
+ gap: 1,
38
+ cols: `repeat(auto-fill, minmax(min(${theme.base['content-width'].sm}, 100%), 1fr))`
39
+ }, children: actions.map(({ label, icon, onClick }) => {
40
+ return (_jsx("li", { children: _jsx(StyledQuickCreateButton, { onClick: onClick, variant: 'primary', children: _jsxs(Flex, { container: { gap: 2, alignItems: 'center' }, as: 'span', children: [icon && _jsx(Icon, { name: icon }), _jsx(StyledButtonText, { children: label })] }) }) }, label));
41
+ }) })] }));
42
+ });
43
+ export default QuickCreate;
44
+ //# sourceMappingURL=QuickCreate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuickCreate.js","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA6C,MAAM,OAAO,CAAC;AAC9E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,MAAM,EACN,gBAAgB,EAChB,IAAI,EAEJ,IAAI,EACJ,IAAI,EAEJ,UAAU,EACV,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAcjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI1C,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAClE,OAAO,GAAG,CAAA;;;oBAGQ,KAAK,CAAC,IAAI,CAAC,OAAO;0BACZ,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;;;;QAInF,UAAU;;;;;GAKf,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;;CAMnC,CAAC;AAEF,MAAM,WAAW,GAAuD,UAAU,CAChF,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,SAAS,EAAoB,EAAE,GAA4B,EAAE,EAAE;IACrF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,OAAO,CACL,MAAC,IAAI,OACC,SAAS,EACb,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAC1C,EAAE,EAAE,iBAAiB,EACrB,GAAG,EAAE,GAAG,aAER,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,GAAQ,EACnC,KAAC,IAAI,IACH,EAAE,EAAC,IAAI,EACP,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,IAAI,EAAE,gCAAgC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,gBAAgB;iBACrF,YAEA,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;oBACxC,OAAO,CACL,uBACE,KAAC,uBAAuB,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,SAAS,YAC1D,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAC,MAAM,aACzD,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,EAC7B,KAAC,gBAAgB,cAAE,KAAK,GAAoB,IACvC,GACiB,IANnB,KAAK,CAOT,CACN,CAAC;gBACJ,CAAC,CAAC,GACG,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, Ref, FunctionComponent, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n BaseProps,\n Button,\n defaultThemeProp,\n Flex,\n ForwardProps,\n Grid,\n Icon,\n NoChildrenProp,\n StyledIcon,\n Text,\n useTheme\n} from '@pega/cosmos-react-core';\n\nexport interface QuickCreateAction {\n label: string;\n icon?: string;\n onClick: MouseEventHandler;\n}\n\nexport interface QuickCreateProps extends BaseProps, NoChildrenProp {\n heading: string;\n actions: QuickCreateAction[];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledQuickCreate = styled.div`\n & > ul {\n list-style: none;\n }\n`;\n\nexport const StyledQuickCreateButton = styled(Button)(({ theme }) => {\n return css`\n width: 100%;\n height: 6rem;\n padding: calc(${theme.base.spacing} * 2);\n border-radius: calc(${`${theme.base['border-radius']} * ${theme.base['border-radius']}`});\n justify-content: start;\n text-align: start;\n\n & ${StyledIcon} {\n width: 1em;\n height: 1em;\n flex-shrink: 0;\n }\n `;\n});\n\nStyledQuickCreateButton.defaultProps = defaultThemeProp;\n\nconst StyledButtonText = styled.span`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n line-height: 1.5;\n`;\n\nconst QuickCreate: FunctionComponent<QuickCreateProps & ForwardProps> = forwardRef(\n ({ heading, actions, ...restProps }: QuickCreateProps, ref: QuickCreateProps['ref']) => {\n const theme = useTheme();\n return (\n <Flex\n {...restProps}\n container={{ direction: 'column', gap: 2 }}\n as={StyledQuickCreate}\n ref={ref}\n >\n <Text variant='h2'>{heading}</Text>\n <Grid\n as='ul'\n container={{\n gap: 1,\n cols: `repeat(auto-fill, minmax(min(${theme.base['content-width'].sm}, 100%), 1fr))`\n }}\n >\n {actions.map(({ label, icon, onClick }) => {\n return (\n <li key={label}>\n <StyledQuickCreateButton onClick={onClick} variant='primary'>\n <Flex container={{ gap: 2, alignItems: 'center' }} as='span'>\n {icon && <Icon name={icon} />}\n <StyledButtonText>{label}</StyledButtonText>\n </Flex>\n </StyledQuickCreateButton>\n </li>\n );\n })}\n </Grid>\n </Flex>\n );\n }\n);\n\nexport default QuickCreate;\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from './QuickCreate';
2
+ export { QuickCreateProps } from './QuickCreate';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/QuickCreate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './QuickCreate';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/QuickCreate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './QuickCreate';\nexport { QuickCreateProps } from './QuickCreate';\n"]}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { default as AppShell } from './components/AppShell';
2
2
  export * from './components/AppShell';
3
+ export { default as QuickCreate } from './components/QuickCreate';
4
+ export * from './components/QuickCreate';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,0BAA0B,CAAC"}
package/lib/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // This file is autogenerated. Any changes will be overwritten.
2
2
  export { default as AppShell } from './components/AppShell';
3
3
  export * from './components/AppShell';
4
+ export { default as QuickCreate } from './components/QuickCreate';
5
+ export * from './components/QuickCreate';
4
6
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as AppShell } from './components/AppShell';\nexport * from './components/AppShell';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,cAAc,0BAA0B,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as AppShell } from './components/AppShell';\nexport * from './components/AppShell';\nexport { default as QuickCreate } from './components/QuickCreate';\nexport * from './components/QuickCreate';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-wss",
3
- "version": "3.0.0-dev.18.1",
3
+ "version": "3.0.0-dev.20.0",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "3.0.0-dev.18.1",
23
+ "@pega/cosmos-react-core": "3.0.0-dev.20.0",
24
24
  "polished": "^4.1.0",
25
25
  "react": "^16.14.0 || ^17.0.0",
26
26
  "react-dom": "^16.14.0 || ^17.0.0",
@@ -34,7 +34,8 @@
34
34
  "@storybook/addons": "^6.4.19",
35
35
  "@storybook/react": "^6.4.19",
36
36
  "@storybook/theming": "^6.4.19",
37
+ "@testing-library/react": "^12.1.3",
37
38
  "enzyme": "^3.11.0",
38
- "typescript": "~4.6.2"
39
+ "typescript": "~4.7.2"
39
40
  }
40
41
  }