@sproutsocial/seeds-react-banner 1.0.0 → 1.0.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.
@@ -8,14 +8,14 @@ CLI Target: es2022
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 5.46 KB
11
+ CJS dist/index.js 5.47 KB
12
12
  CJS dist/index.js.map 6.58 KB
13
- CJS ⚡️ Build success in 64ms
13
+ CJS ⚡️ Build success in 180ms
14
14
  ESM dist/esm/index.js 3.29 KB
15
15
  ESM dist/esm/index.js.map 6.44 KB
16
- ESM ⚡️ Build success in 64ms
16
+ ESM ⚡️ Build success in 180ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 15624ms
18
+ DTS ⚡️ Build success in 39730ms
19
19
  DTS dist/index.d.ts 1.17 KB
20
20
  DTS dist/index.d.mts 1.17 KB
21
- Done in 18.84s.
21
+ Done in 48.38s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sproutsocial/seeds-react-banner
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9fd8bac: Update dependencies to use semantic package version instead of wildcards
8
+ - Updated dependencies [9fd8bac]
9
+ - @sproutsocial/seeds-react-system-props@3.0.2
10
+ - @sproutsocial/seeds-react-button@1.2.1
11
+ - @sproutsocial/seeds-react-theme@2.2.1
12
+ - @sproutsocial/seeds-react-icon@1.1.2
13
+ - @sproutsocial/seeds-react-box@1.1.2
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
package/dist/esm/index.js CHANGED
@@ -122,9 +122,9 @@ var Banner = ({
122
122
  var Banner_default = Banner;
123
123
 
124
124
  // src/index.ts
125
- var src_default = Banner_default;
125
+ var index_default = Banner_default;
126
126
  export {
127
127
  Banner_default as Banner,
128
- src_default as default
128
+ index_default as default
129
129
  };
130
130
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Banner.tsx","../../src/styles.ts","../../src/BannerTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { StyledBannerIcon } from \"./styles\";\nimport type { TypeBannerProps, EnumBannerType } from \"./BannerTypes\";\n\nconst getBannerIconName = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"circle-check-outline\";\n case \"error\":\n return \"triangle-exclamation-outline\";\n case \"warning\":\n return \"triangle-exclamation-outline\";\n case \"opportunity\":\n return \"sparkle-outline\";\n case \"info\":\n default:\n return \"circle-i-outline\";\n }\n};\n\nconst getBannerIconColor = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"icon.success\";\n case \"error\":\n return \"icon.error\";\n case \"warning\":\n return \"icon.warning\";\n case \"opportunity\":\n return \"icon.opportunity\";\n case \"info\":\n default:\n return \"icon.info\";\n }\n};\n\n/** TODO: change to 'info' type by default in future version */\nconst Banner = ({\n type = \"info\",\n text,\n onClose,\n closeButtonLabel = \"Close\",\n typeIconProps,\n ...rest\n}: TypeBannerProps) => {\n return (\n <Container\n type={type}\n data-qa-alert=\"\"\n data-qa-alert-type={type}\n data-qa-alert-text={text}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" width={1}>\n <StyledBannerIcon\n name={getBannerIconName(type)}\n color={getBannerIconColor(type)}\n className=\"Icon\"\n fixedWidth\n mt={100}\n mr={350}\n {...typeIconProps}\n />\n {text}\n {onClose && (\n <Box ml=\"auto\" pl={400} alignSelf=\"flex-start\">\n <Button p={0} onClick={onClose} ariaLabel={closeButtonLabel}>\n <Icon name=\"x-outline\" aria-hidden />\n </Button>\n </Box>\n )}\n </Box>\n </Container>\n );\n};\n\nexport default Banner;\n","import styled, { css } from \"styled-components\";\nimport { COMMON, LAYOUT } from \"@sproutsocial/seeds-react-system-props\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { type EnumBannerType } from \"./BannerTypes\";\n\ntype TypeProps = {\n type: EnumBannerType;\n};\n\nconst Container = styled.div<TypeProps>(\n (props) => css`\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: space-between;\n color: ${props.theme.colors.text.body};\n border-radius: ${props.theme.radii.outer};\n font-family: ${props.theme.fontFamily};\n ${props.theme.typography[200]}\n padding: ${props.theme.space[300]};\n border: 1px solid ${props.theme.colors.container.border[props.type]};\n background-color: ${props.theme.colors.container.background[props.type]};\n\n a,\n button {\n font-weight: ${props.theme.fontWeights.semibold};\n color: ${props.theme.colors.text.body};\n font-size: inherit;\n &:hover {\n color: ${props.theme.colors.text.body};\n text-decoration: underline;\n }\n }\n\n > span:not(.Icon) {\n display: block;\n }\n\n ${COMMON}\n ${LAYOUT}\n `\n);\n\nexport default Container;\n\nexport const StyledBannerIcon = styled(Icon)`\n align-self: flex-start;\n min-width: 16px;\n`;\n","import * as React from \"react\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconProps } from \"@sproutsocial/seeds-react-icon\";\n\nexport type EnumBannerType =\n | \"success\"\n | \"info\"\n | \"error\"\n | \"warning\"\n | \"opportunity\";\n\nexport interface TypeBannerProps\n extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\">,\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n TypeStyledComponentsCommonProps {\n text: React.ReactNode;\n /** Type of banner. */\n type?: EnumBannerType;\n /** Show the close icon in the banner with an action when clicked */\n onClose?: () => void;\n /** Close icon aria label */\n closeButtonLabel?: string;\n /** Icon props that can be passed to the Type specific Icon */\n typeIconProps?: Partial<Omit<TypeIconProps, \"name\">>;\n}\n","import Banner from \"./Banner\";\n\nexport default Banner;\nexport { Banner };\nexport * from \"./BannerTypes\";\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;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL;AACE,aAAO;AAAA,EACX;AACF;AAGA,IAAM,SAAS,CAAC;AAAA,EACd,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA,GAAG;AACL,MAAuB;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,iBAAc;AAAA,MACd,sBAAoB;AAAA,MACpB,sBAAoB;AAAA,MACnB,GAAG;AAAA,MAEJ,+BAAC,OAAI,SAAQ,QAAO,YAAW,UAAS,OAAO,GAC7C;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,kBAAkB,IAAI;AAAA,YAC5B,OAAO,mBAAmB,IAAI;AAAA,YAC9B,WAAU;AAAA,YACV,YAAU;AAAA,YACV,IAAI;AAAA,YACJ,IAAI;AAAA,YACH,GAAG;AAAA;AAAA,QACN;AAAA,QACC;AAAA,QACA,WACC,oBAAC,OAAI,IAAG,QAAO,IAAI,KAAK,WAAU,cAChC,8BAAC,UAAO,GAAG,GAAG,SAAS,SAAS,WAAW,kBACzC,8BAACC,OAAA,EAAK,MAAK,aAAY,eAAW,MAAC,GACrC,GACF;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ;;;AG7Ef,IAAO,cAAQ;","names":["Icon","Icon"]}
1
+ {"version":3,"sources":["../../src/Banner.tsx","../../src/styles.ts","../../src/BannerTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { StyledBannerIcon } from \"./styles\";\nimport type { TypeBannerProps, EnumBannerType } from \"./BannerTypes\";\n\nconst getBannerIconName = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"circle-check-outline\";\n case \"error\":\n return \"triangle-exclamation-outline\";\n case \"warning\":\n return \"triangle-exclamation-outline\";\n case \"opportunity\":\n return \"sparkle-outline\";\n case \"info\":\n default:\n return \"circle-i-outline\";\n }\n};\n\nconst getBannerIconColor = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"icon.success\";\n case \"error\":\n return \"icon.error\";\n case \"warning\":\n return \"icon.warning\";\n case \"opportunity\":\n return \"icon.opportunity\";\n case \"info\":\n default:\n return \"icon.info\";\n }\n};\n\n/** TODO: change to 'info' type by default in future version */\nconst Banner = ({\n type = \"info\",\n text,\n onClose,\n closeButtonLabel = \"Close\",\n typeIconProps,\n ...rest\n}: TypeBannerProps) => {\n return (\n <Container\n type={type}\n data-qa-alert=\"\"\n data-qa-alert-type={type}\n data-qa-alert-text={text}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" width={1}>\n <StyledBannerIcon\n name={getBannerIconName(type)}\n color={getBannerIconColor(type)}\n className=\"Icon\"\n fixedWidth\n mt={100}\n mr={350}\n {...typeIconProps}\n />\n {text}\n {onClose && (\n <Box ml=\"auto\" pl={400} alignSelf=\"flex-start\">\n <Button p={0} onClick={onClose} ariaLabel={closeButtonLabel}>\n <Icon name=\"x-outline\" aria-hidden />\n </Button>\n </Box>\n )}\n </Box>\n </Container>\n );\n};\n\nexport default Banner;\n","import styled, { css } from \"styled-components\";\nimport { COMMON, LAYOUT } from \"@sproutsocial/seeds-react-system-props\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { type EnumBannerType } from \"./BannerTypes\";\n\ntype TypeProps = {\n type: EnumBannerType;\n};\n\nconst Container = styled.div<TypeProps>(\n (props) => css`\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: space-between;\n color: ${props.theme.colors.text.body};\n border-radius: ${props.theme.radii.outer};\n font-family: ${props.theme.fontFamily};\n ${props.theme.typography[200]}\n padding: ${props.theme.space[300]};\n border: 1px solid ${props.theme.colors.container.border[props.type]};\n background-color: ${props.theme.colors.container.background[props.type]};\n\n a,\n button {\n font-weight: ${props.theme.fontWeights.semibold};\n color: ${props.theme.colors.text.body};\n font-size: inherit;\n &:hover {\n color: ${props.theme.colors.text.body};\n text-decoration: underline;\n }\n }\n\n > span:not(.Icon) {\n display: block;\n }\n\n ${COMMON}\n ${LAYOUT}\n `\n);\n\nexport default Container;\n\nexport const StyledBannerIcon = styled(Icon)`\n align-self: flex-start;\n min-width: 16px;\n`;\n","import * as React from \"react\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconProps } from \"@sproutsocial/seeds-react-icon\";\n\nexport type EnumBannerType =\n | \"success\"\n | \"info\"\n | \"error\"\n | \"warning\"\n | \"opportunity\";\n\nexport interface TypeBannerProps\n extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\">,\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n TypeStyledComponentsCommonProps {\n text: React.ReactNode;\n /** Type of banner. */\n type?: EnumBannerType;\n /** Show the close icon in the banner with an action when clicked */\n onClose?: () => void;\n /** Close icon aria label */\n closeButtonLabel?: string;\n /** Icon props that can be passed to the Type specific Icon */\n typeIconProps?: Partial<Omit<TypeIconProps, \"name\">>;\n}\n","import Banner from \"./Banner\";\n\nexport default Banner;\nexport { Banner };\nexport * from \"./BannerTypes\";\n"],"mappings":";AAAA,OAAuB;AACvB,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAOA,WAAU;;;ACHjB,OAAO,UAAU,WAAW;AAC5B,SAAS,QAAQ,cAAc;AAC/B,OAAO,UAAU;;;ACFjB,OAAuB;;;ADSvB,IAAM,YAAY,OAAO;AAAA,EACvB,CAAC,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,aAKA,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA,qBACpB,MAAM,MAAM,MAAM,KAAK;AAAA,mBACzB,MAA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,GAAG;AAAA,MAEJ,+BAAC,OAAI,SAAQ,QAAO,YAAW,UAAS,OAAO,GAC7C;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,kBAAkB,IAAI;AAAA,YAC5B,OAAO,mBAAmB,IAAI;AAAA,YAC9B,WAAU;AAAA,YACV,YAAU;AAAA,YACV,IAAI;AAAA,YACJ,IAAI;AAAA,YACH,GAAG;AAAA;AAAA,QACN;AAAA,QACC;AAAA,QACA,WACC,oBAAC,OAAI,IAAG,QAAO,IAAI,KAAK,WAAU,cAChC,8BAAC,UAAO,GAAG,GAAG,SAAS,SAAS,WAAW,kBACzC,8BAACC,OAAA,EAAK,MAAK,aAAY,eAAW,MAAC,GACrC,GACF;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ;;;AG7Ef,IAAO,gBAAQ;","names":["Icon","Icon"]}
package/dist/index.js CHANGED
@@ -28,12 +28,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
33
  Banner: () => Banner_default,
34
- default: () => src_default
34
+ default: () => index_default
35
35
  });
36
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/Banner.tsx
39
39
  var React2 = require("react");
@@ -159,7 +159,7 @@ var Banner = ({
159
159
  var Banner_default = Banner;
160
160
 
161
161
  // src/index.ts
162
- var src_default = Banner_default;
162
+ var index_default = Banner_default;
163
163
  // Annotate the CommonJS export names for ESM import in node:
164
164
  0 && (module.exports = {
165
165
  Banner
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/Banner.tsx","../src/styles.ts","../src/BannerTypes.ts"],"sourcesContent":["import Banner from \"./Banner\";\n\nexport default Banner;\nexport { Banner };\nexport * from \"./BannerTypes\";\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { StyledBannerIcon } from \"./styles\";\nimport type { TypeBannerProps, EnumBannerType } from \"./BannerTypes\";\n\nconst getBannerIconName = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"circle-check-outline\";\n case \"error\":\n return \"triangle-exclamation-outline\";\n case \"warning\":\n return \"triangle-exclamation-outline\";\n case \"opportunity\":\n return \"sparkle-outline\";\n case \"info\":\n default:\n return \"circle-i-outline\";\n }\n};\n\nconst getBannerIconColor = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"icon.success\";\n case \"error\":\n return \"icon.error\";\n case \"warning\":\n return \"icon.warning\";\n case \"opportunity\":\n return \"icon.opportunity\";\n case \"info\":\n default:\n return \"icon.info\";\n }\n};\n\n/** TODO: change to 'info' type by default in future version */\nconst Banner = ({\n type = \"info\",\n text,\n onClose,\n closeButtonLabel = \"Close\",\n typeIconProps,\n ...rest\n}: TypeBannerProps) => {\n return (\n <Container\n type={type}\n data-qa-alert=\"\"\n data-qa-alert-type={type}\n data-qa-alert-text={text}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" width={1}>\n <StyledBannerIcon\n name={getBannerIconName(type)}\n color={getBannerIconColor(type)}\n className=\"Icon\"\n fixedWidth\n mt={100}\n mr={350}\n {...typeIconProps}\n />\n {text}\n {onClose && (\n <Box ml=\"auto\" pl={400} alignSelf=\"flex-start\">\n <Button p={0} onClick={onClose} ariaLabel={closeButtonLabel}>\n <Icon name=\"x-outline\" aria-hidden />\n </Button>\n </Box>\n )}\n </Box>\n </Container>\n );\n};\n\nexport default Banner;\n","import styled, { css } from \"styled-components\";\nimport { COMMON, LAYOUT } from \"@sproutsocial/seeds-react-system-props\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { type EnumBannerType } from \"./BannerTypes\";\n\ntype TypeProps = {\n type: EnumBannerType;\n};\n\nconst Container = styled.div<TypeProps>(\n (props) => css`\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: space-between;\n color: ${props.theme.colors.text.body};\n border-radius: ${props.theme.radii.outer};\n font-family: ${props.theme.fontFamily};\n ${props.theme.typography[200]}\n padding: ${props.theme.space[300]};\n border: 1px solid ${props.theme.colors.container.border[props.type]};\n background-color: ${props.theme.colors.container.background[props.type]};\n\n a,\n button {\n font-weight: ${props.theme.fontWeights.semibold};\n color: ${props.theme.colors.text.body};\n font-size: inherit;\n &:hover {\n color: ${props.theme.colors.text.body};\n text-decoration: underline;\n }\n }\n\n > span:not(.Icon) {\n display: block;\n }\n\n ${COMMON}\n ${LAYOUT}\n `\n);\n\nexport default Container;\n\nexport const StyledBannerIcon = styled(Icon)`\n align-self: flex-start;\n min-width: 16px;\n`;\n","import * as React from \"react\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconProps } from \"@sproutsocial/seeds-react-icon\";\n\nexport type EnumBannerType =\n | \"success\"\n | \"info\"\n | \"error\"\n | \"warning\"\n | \"opportunity\";\n\nexport interface TypeBannerProps\n extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\">,\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n TypeStyledComponentsCommonProps {\n text: React.ReactNode;\n /** Type of banner. */\n type?: EnumBannerType;\n /** Show the close icon in the banner with an action when clicked */\n onClose?: () => void;\n /** Close icon aria label */\n closeButtonLabel?: string;\n /** Icon props that can be passed to the Type specific Icon */\n typeIconProps?: Partial<Omit<TypeIconProps, \"name\">>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB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,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL;AACE,aAAO;AAAA,EACX;AACF;AAGA,IAAM,SAAS,CAAC;AAAA,EACd,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB;AAAA,EACA,GAAG;AACL,MAAuB;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,iBAAc;AAAA,MACd,sBAAoB;AAAA,MACpB,sBAAoB;AAAA,MACnB,GAAG;AAAA,MAEJ,uDAAC,uBAAAC,SAAA,EAAI,SAAQ,QAAO,YAAW,UAAS,OAAO,GAC7C;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,kBAAkB,IAAI;AAAA,YAC5B,OAAO,mBAAmB,IAAI;AAAA,YAC9B,WAAU;AAAA,YACV,YAAU;AAAA,YACV,IAAI;AAAA,YACJ,IAAI;AAAA,YACH,GAAG;AAAA;AAAA,QACN;AAAA,QACC;AAAA,QACA,WACC,4CAAC,uBAAAA,SAAA,EAAI,IAAG,QAAO,IAAI,KAAK,WAAU,cAChC,sDAAC,0BAAAC,SAAA,EAAO,GAAG,GAAG,SAAS,SAAS,WAAW,kBACzC,sDAAC,yBAAAC,SAAA,EAAK,MAAK,aAAY,eAAW,MAAC,GACrC,GACF;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ;;;AD7Ef,IAAO,cAAQ;","names":["React","import_seeds_react_icon","styled","Icon","Box","Button","Icon"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/Banner.tsx","../src/styles.ts","../src/BannerTypes.ts"],"sourcesContent":["import Banner from \"./Banner\";\n\nexport default Banner;\nexport { Banner };\nexport * from \"./BannerTypes\";\n","import * as React from \"react\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Button from \"@sproutsocial/seeds-react-button\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport Container, { StyledBannerIcon } from \"./styles\";\nimport type { TypeBannerProps, EnumBannerType } from \"./BannerTypes\";\n\nconst getBannerIconName = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"circle-check-outline\";\n case \"error\":\n return \"triangle-exclamation-outline\";\n case \"warning\":\n return \"triangle-exclamation-outline\";\n case \"opportunity\":\n return \"sparkle-outline\";\n case \"info\":\n default:\n return \"circle-i-outline\";\n }\n};\n\nconst getBannerIconColor = (type: EnumBannerType) => {\n switch (type) {\n case \"success\":\n return \"icon.success\";\n case \"error\":\n return \"icon.error\";\n case \"warning\":\n return \"icon.warning\";\n case \"opportunity\":\n return \"icon.opportunity\";\n case \"info\":\n default:\n return \"icon.info\";\n }\n};\n\n/** TODO: change to 'info' type by default in future version */\nconst Banner = ({\n type = \"info\",\n text,\n onClose,\n closeButtonLabel = \"Close\",\n typeIconProps,\n ...rest\n}: TypeBannerProps) => {\n return (\n <Container\n type={type}\n data-qa-alert=\"\"\n data-qa-alert-type={type}\n data-qa-alert-text={text}\n {...rest}\n >\n <Box display=\"flex\" alignItems=\"center\" width={1}>\n <StyledBannerIcon\n name={getBannerIconName(type)}\n color={getBannerIconColor(type)}\n className=\"Icon\"\n fixedWidth\n mt={100}\n mr={350}\n {...typeIconProps}\n />\n {text}\n {onClose && (\n <Box ml=\"auto\" pl={400} alignSelf=\"flex-start\">\n <Button p={0} onClick={onClose} ariaLabel={closeButtonLabel}>\n <Icon name=\"x-outline\" aria-hidden />\n </Button>\n </Box>\n )}\n </Box>\n </Container>\n );\n};\n\nexport default Banner;\n","import styled, { css } from \"styled-components\";\nimport { COMMON, LAYOUT } from \"@sproutsocial/seeds-react-system-props\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { type EnumBannerType } from \"./BannerTypes\";\n\ntype TypeProps = {\n type: EnumBannerType;\n};\n\nconst Container = styled.div<TypeProps>(\n (props) => css`\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: space-between;\n color: ${props.theme.colors.text.body};\n border-radius: ${props.theme.radii.outer};\n font-family: ${props.theme.fontFamily};\n ${props.theme.typography[200]}\n padding: ${props.theme.space[300]};\n border: 1px solid ${props.theme.colors.container.border[props.type]};\n background-color: ${props.theme.colors.container.background[props.type]};\n\n a,\n button {\n font-weight: ${props.theme.fontWeights.semibold};\n color: ${props.theme.colors.text.body};\n font-size: inherit;\n &:hover {\n color: ${props.theme.colors.text.body};\n text-decoration: underline;\n }\n }\n\n > span:not(.Icon) {\n display: block;\n }\n\n ${COMMON}\n ${LAYOUT}\n `\n);\n\nexport default Container;\n\nexport const StyledBannerIcon = styled(Icon)`\n align-self: flex-start;\n min-width: 16px;\n`;\n","import * as React from \"react\";\nimport type { TypeStyledComponentsCommonProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type {\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n} from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeIconProps } from \"@sproutsocial/seeds-react-icon\";\n\nexport type EnumBannerType =\n | \"success\"\n | \"info\"\n | \"error\"\n | \"warning\"\n | \"opportunity\";\n\nexport interface TypeBannerProps\n extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\">,\n TypeSystemCommonProps,\n TypeSystemLayoutProps,\n TypeStyledComponentsCommonProps {\n text: React.ReactNode;\n /** Type of banner. */\n type?: EnumBannerType;\n /** Show the close icon in the banner with an action when clicked */\n onClose?: () => void;\n /** Close icon aria label */\n closeButtonLabel?: string;\n /** Icon props that can be passed to the Type specific Icon */\n typeIconProps?: Partial<Omit<TypeIconProps, \"name\">>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,SAAuB;AACvB,6BAAgB;AAChB,gCAAmB;AACnB,IAAAC,2BAAiB;;;ACHjB,+BAA4B;AAC5B,sCAA+B;AAC/B,8BAAiB;;;ACFjB,YAAuB;;;ADSvB,IAAM,YAAY,yBAAAC,QAAO;AAAA,EACvB,CAAC,UAAU;AAAA;AAAA;AAAA;AA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;AACrB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,iBAAc;AAAA,MACd,sBAAoB;AAAA,MACpB,sBAAoB;AAAA,MACnB,GAAG;AAAA,MAEJ,uDAAC,uBAAAC,SAAA,EAAI,SAAQ,QAAO,YAAW,UAAS,OAAO,GAC7C;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,kBAAkB,IAAI;AAAA,YAC5B,OAAO,mBAAmB,IAAI;AAAA,YAC9B,WAAU;AAAA,YACV,YAAU;AAAA,YACV,IAAI;AAAA,YACJ,IAAI;AAAA,YACH,GAAG;AAAA;AAAA,QACN;AAAA,QACC;AAAA,QACA,WACC,4CAAC,uBAAAA,SAAA,EAAI,IAAG,QAAO,IAAI,KAAK,WAAU,cAChC,sDAAC,0BAAAC,SAAA,EAAO,GAAG,GAAG,SAAS,SAAS,WAAW,kBACzC,sDAAC,yBAAAC,SAAA,EAAK,MAAK,aAAY,eAAW,MAAC,GACrC,GACF;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ;;;AD7Ef,IAAO,gBAAQ;","names":["React","import_seeds_react_icon","styled","Icon","Box","Button","Icon"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-banner",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Seeds React Banner",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -18,11 +18,11 @@
18
18
  "test:watch": "jest --watch --coverage=false"
19
19
  },
20
20
  "dependencies": {
21
- "@sproutsocial/seeds-react-theme": "^*",
22
- "@sproutsocial/seeds-react-system-props": "^*",
23
- "@sproutsocial/seeds-react-box": "*",
24
- "@sproutsocial/seeds-react-button": "*",
25
- "@sproutsocial/seeds-react-icon": "*"
21
+ "@sproutsocial/seeds-react-theme": "^2.2.0",
22
+ "@sproutsocial/seeds-react-system-props": "^3.0.1",
23
+ "@sproutsocial/seeds-react-box": "^1.1.1",
24
+ "@sproutsocial/seeds-react-button": "^1.2.0",
25
+ "@sproutsocial/seeds-react-icon": "^1.1.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react": "^18.0.0",
@@ -35,8 +35,8 @@
35
35
  "@sproutsocial/seeds-tsconfig": "*",
36
36
  "@sproutsocial/seeds-testing": "*",
37
37
  "@sproutsocial/seeds-react-testing-library": "*",
38
- "@sproutsocial/seeds-react-text": "*",
39
- "@sproutsocial/seeds-react-link": "*"
38
+ "@sproutsocial/seeds-react-text": "^1.3.0",
39
+ "@sproutsocial/seeds-react-link": "^1.0.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "styled-components": "^5.2.3"
@@ -0,0 +1,148 @@
1
+ import React from "react";
2
+ import { Banner, type TypeBannerProps } from "./";
3
+ import { Box } from "@sproutsocial/seeds-react-box";
4
+ import { Link } from "@sproutsocial/seeds-react-link";
5
+ import { Text } from "@sproutsocial/seeds-react-text";
6
+ import type { Meta, StoryObj } from "@storybook/react";
7
+
8
+ const meta: Meta<typeof Banner> = {
9
+ title: "Components/Banner",
10
+ component: Banner,
11
+ argTypes: {
12
+ type: {
13
+ options: ["success", "info", "error", "warning", "opportunity"],
14
+ control: { type: "select" },
15
+ },
16
+ },
17
+ args: {
18
+ type: "success",
19
+ typeIconProps: { "aria-label": "Success" },
20
+ text: "This is a success message!",
21
+ },
22
+ };
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof Banner>;
27
+
28
+ const findText = (bannerType: TypeBannerProps["type"]) => {
29
+ switch (bannerType) {
30
+ case "warning":
31
+ return "This is a warning message!";
32
+ case "opportunity":
33
+ return "This is an opportunity message!";
34
+ case "error":
35
+ return "This is an error message!";
36
+ case "info":
37
+ return "This is an informative message!";
38
+ case "success":
39
+ default:
40
+ return "This is a success message!";
41
+ }
42
+ };
43
+
44
+ export const Permutations: Story = {
45
+ render: (args) => (
46
+ <Banner
47
+ text={findText(args.type)}
48
+ type={args.type}
49
+ typeIconProps={{ "aria-label": args.type }}
50
+ />
51
+ ),
52
+ name: "Permutations",
53
+ };
54
+
55
+ export const Links: Story = {
56
+ render: (args) => (
57
+ <Banner
58
+ type={args.type}
59
+ typeIconProps={args.typeIconProps}
60
+ text={
61
+ <Box
62
+ width={1}
63
+ display="flex"
64
+ alignItems="center"
65
+ justifyContent="space-between"
66
+ >
67
+ <Text>{findText(args.type)}</Text>
68
+ <Text>
69
+ <Link href="/">Learn more</Link>
70
+ </Text>
71
+ </Box>
72
+ }
73
+ />
74
+ ),
75
+ name: "With link",
76
+ };
77
+
78
+ export const Buttons: Story = {
79
+ render: (args) => (
80
+ <Banner
81
+ type={args.type}
82
+ typeIconProps={args.typeIconProps}
83
+ text={
84
+ <Box
85
+ width={1}
86
+ display="flex"
87
+ alignItems="center"
88
+ justifyContent="space-between"
89
+ >
90
+ <Text>{findText(args.type)}</Text>
91
+ <Text>
92
+ <Link onClick={() => alert("Clicked")}>Learn more</Link>
93
+ </Text>
94
+ </Box>
95
+ }
96
+ />
97
+ ),
98
+ name: "With button",
99
+ };
100
+
101
+ export const Multiline: Story = {
102
+ args: {
103
+ text: "A very long opportunity message that is going to stretch to multiple lines, while the icon stays aligned with the first line.",
104
+ },
105
+ render: (args) => (
106
+ <Box width="416px">
107
+ <Banner
108
+ text={args.text}
109
+ type={args.type}
110
+ typeIconProps={args.typeIconProps}
111
+ />
112
+ </Box>
113
+ ),
114
+ name: "With multiline text",
115
+ };
116
+
117
+ export const Closeable: Story = {
118
+ args: {
119
+ text: "This is a banner that has a closeable x icon with an onClose callback.",
120
+ },
121
+ render: (args) => (
122
+ <Banner
123
+ text={args.text}
124
+ type={args.type}
125
+ typeIconProps={args.typeIconProps}
126
+ onClose={() => alert("Testing...")}
127
+ closeButtonLabel="Close the banner"
128
+ />
129
+ ),
130
+ name: "With OnClose callback",
131
+ };
132
+
133
+ export const HiddenIcon: Story = {
134
+ args: {
135
+ text: "Success! This is a banner that hides the icon from screen readers!",
136
+ typeIconProps: { "aria-hidden": true },
137
+ },
138
+ render: (args) => (
139
+ <Banner
140
+ text={args.text}
141
+ type={args.type}
142
+ typeIconProps={args.typeIconProps}
143
+ onClose={() => alert("Testing...")}
144
+ closeButtonLabel="Close the banner"
145
+ />
146
+ ),
147
+ name: "With aria-hidden Icon",
148
+ };
@@ -1,140 +0,0 @@
1
- import React from "react";
2
- import { Banner, type TypeBannerProps, type EnumBannerType } from "./";
3
- import { Box } from "@sproutsocial/seeds-react-box";
4
- import { Link } from "@sproutsocial/seeds-react-link";
5
- import { Text } from "@sproutsocial/seeds-react-text";
6
-
7
- export default {
8
- title: "Components/Banner",
9
- component: Banner,
10
- argTypes: {
11
- type: {
12
- options: ["success", "info", "error", "warning", "opportunity"],
13
- control: { type: "select" },
14
- },
15
- },
16
- args: {
17
- type: "success",
18
- typeIconProps: { "aria-label": "Success" },
19
- text: "This is a success message!",
20
- },
21
- };
22
-
23
- const findText = (bannerType: TypeBannerProps["type"]) => {
24
- switch (bannerType) {
25
- case "warning":
26
- return "This is a warning message!";
27
- case "opportunity":
28
- return "This is an opportunity message!";
29
- case "error":
30
- return "This is an error message!";
31
- case "info":
32
- return "This is an informative message!";
33
- case "success":
34
- default:
35
- return "This is a success message!";
36
- }
37
- };
38
-
39
- export const permutations = (args: TypeBannerProps) => (
40
- <Banner
41
- text={findText(args.type)}
42
- type={args.type}
43
- typeIconProps={{ "aria-label": args.type }}
44
- />
45
- );
46
-
47
- permutations.storyName = "Permutations";
48
-
49
- export const links = (args: TypeBannerProps) => (
50
- <Banner
51
- type={args.type}
52
- typeIconProps={args.typeIconProps}
53
- text={
54
- <Box
55
- width={1}
56
- display="flex"
57
- alignItems="center"
58
- justifyContent="space-between"
59
- >
60
- <Text>{findText(args.type)}</Text>
61
- <Text>
62
- <Link href="/">Learn more</Link>
63
- </Text>
64
- </Box>
65
- }
66
- />
67
- );
68
-
69
- links.storyName = "With link";
70
-
71
- export const buttons = (args: TypeBannerProps) => (
72
- <Banner
73
- type={args.type}
74
- typeIconProps={args.typeIconProps}
75
- text={
76
- <Box
77
- width={1}
78
- display="flex"
79
- alignItems="center"
80
- justifyContent="space-between"
81
- >
82
- <Text>{findText(args.type)}</Text>
83
- <Text>
84
- <Link onClick={() => alert("Clicked")}>Learn more</Link>
85
- </Text>
86
- </Box>
87
- }
88
- />
89
- );
90
-
91
- buttons.storyName = "With button";
92
-
93
- export const multiline = (args: TypeBannerProps) => (
94
- <Box width="416px">
95
- <Banner
96
- text={args.text}
97
- type={args.type}
98
- typeIconProps={args.typeIconProps}
99
- />
100
- </Box>
101
- );
102
-
103
- multiline.args = {
104
- text: "A very long opportunity message that is going to stretch to multiple lines, while the icon stays aligned with the first line.",
105
- };
106
-
107
- multiline.storyName = "With multiline text";
108
-
109
- export const closeable = (args: TypeBannerProps) => (
110
- <Banner
111
- text={args.text}
112
- type={args.type}
113
- typeIconProps={args.typeIconProps}
114
- onClose={() => alert("Testing...")}
115
- closeButtonLabel="Close the banner"
116
- />
117
- );
118
-
119
- closeable.args = {
120
- text: "This is a banner that has a closeable x icon with an onClose callback.",
121
- };
122
-
123
- closeable.storyName = "With OnClose callback";
124
-
125
- export const hiddenIcon = (args: TypeBannerProps) => (
126
- <Banner
127
- text={args.text}
128
- type={args.type}
129
- typeIconProps={args.typeIconProps}
130
- onClose={() => alert("Testing...")}
131
- closeButtonLabel="Close the banner"
132
- />
133
- );
134
-
135
- hiddenIcon.args = {
136
- text: "Success! This is a banner that hides the icon from screen readers!",
137
- typeIconProps: { "aria-hidden": true },
138
- };
139
-
140
- hiddenIcon.storyName = "With aria-hidden Icon";