@guardian/stand 0.0.25 → 0.0.27

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,9 @@
1
+ 'use strict';
2
+
3
+ var AlertBanner = require('./components/alert-banner/AlertBanner.cjs');
4
+ var alertBanner = require('./styleD/build/typescript/component/alertBanner.cjs');
5
+
6
+
7
+
8
+ exports.AlertBanner = AlertBanner.AlertBanner;
9
+ exports.componentAlertBanner = alertBanner.componentAlertBanner;
@@ -0,0 +1,2 @@
1
+ export { AlertBanner } from './components/alert-banner/AlertBanner.js';
2
+ export { componentAlertBanner } from './styleD/build/typescript/component/alertBanner.js';
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var React = require('react');
5
+ var mergeDeep = require('../../util/mergeDeep.cjs');
6
+ var styles = require('./styles.cjs');
7
+ var Icon = require('../icon/Icon.cjs');
8
+ var IconButton = require('../icon-button/IconButton.cjs');
9
+
10
+ function AlertBanner({
11
+ level,
12
+ showIcon = false,
13
+ icon,
14
+ closeButtonProps,
15
+ children,
16
+ theme = {},
17
+ cssOverrides,
18
+ className,
19
+ ...props
20
+ }) {
21
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultAlertBannerTheme, theme);
22
+ const determinedIcon = React.useMemo(() => {
23
+ if (icon) {
24
+ return icon;
25
+ }
26
+ switch (level) {
27
+ case "error":
28
+ return "warning";
29
+ case "success":
30
+ return "sentiment_satisfied";
31
+ case "warning":
32
+ return "flag";
33
+ case "information":
34
+ default:
35
+ return "info";
36
+ }
37
+ }, [icon, level]);
38
+ return /* @__PURE__ */ jsxRuntime.jsxs(
39
+ "div",
40
+ {
41
+ css: [styles.alertBannerStyles(mergedTheme, { level }), cssOverrides],
42
+ className,
43
+ ...props,
44
+ children: [
45
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.alertBannerContentStyles(mergedTheme), children: [
46
+ showIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: "md", fill: mergedTheme.shared.content.icon.color, children: determinedIcon }),
47
+ children
48
+ ] }),
49
+ closeButtonProps && /* @__PURE__ */ jsxRuntime.jsx(
50
+ IconButton.IconButton,
51
+ {
52
+ variant: "tertiary",
53
+ size: "xs",
54
+ symbol: "close",
55
+ ariaLabel: "Close alert banner",
56
+ ...closeButtonProps
57
+ }
58
+ )
59
+ ]
60
+ }
61
+ );
62
+ }
63
+
64
+ exports.AlertBanner = AlertBanner;
@@ -0,0 +1,29 @@
1
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { alertBannerContentStyles, alertBannerStyles, defaultAlertBannerTheme } from './styles.js';
5
+ import { Icon } from '../icon/Icon.js';
6
+ import { IconButton } from '../icon-button/IconButton.js';
7
+
8
+ function AlertBanner({ level, showIcon = false, icon, closeButtonProps, children, theme = {}, cssOverrides, className, ...props }) {
9
+ const mergedTheme = mergeDeep(defaultAlertBannerTheme, theme);
10
+ const determinedIcon = useMemo(() => {
11
+ if (icon) {
12
+ return icon;
13
+ }
14
+ switch (level) {
15
+ case "error":
16
+ return "warning";
17
+ case "success":
18
+ return "sentiment_satisfied";
19
+ case "warning":
20
+ return "flag";
21
+ case "information":
22
+ default:
23
+ return "info";
24
+ }
25
+ }, [icon, level]);
26
+ return jsxs("div", { css: [alertBannerStyles(mergedTheme, { level }), cssOverrides], className, ...props, children: [jsxs("div", { css: alertBannerContentStyles(mergedTheme), children: [showIcon && jsx(Icon, { size: "md", fill: mergedTheme.shared.content.icon.color, children: determinedIcon }), children] }), closeButtonProps && jsx(IconButton, { variant: "tertiary", size: "xs", symbol: "close", ariaLabel: "Close alert banner", ...closeButtonProps })] });
27
+ }
28
+
29
+ export { AlertBanner };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var alertBanner = require('../../styleD/build/typescript/component/alertBanner.cjs');
5
+ var typography = require('../../styleD/utils/semantic/typography.cjs');
6
+
7
+ const defaultAlertBannerTheme = alertBanner.componentAlertBanner;
8
+ const alertBannerStyles = (theme, { level }) => {
9
+ return react.css`
10
+ display: ${theme.shared.display};
11
+ align-items: ${theme.shared["align-items"]};
12
+ justify-content: ${theme.shared["justify-content"]};
13
+ width: ${theme.shared.width};
14
+ height: ${theme.shared.height};
15
+ padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
16
+ ${theme.shared.padding.bottom} ${theme.shared.padding.left};
17
+ background-color: ${theme[level]["background-color"]};
18
+ `;
19
+ };
20
+ const alertBannerContentStyles = (theme) => {
21
+ return react.css`
22
+ display: ${theme.shared.content.display};
23
+ justify-content: ${theme.shared.content["justify-content"]};
24
+ gap: ${theme.shared.content.gap};
25
+ height: ${theme.shared.content.height};
26
+ align-items: ${theme.shared.content["align-items"]};
27
+ flex: ${theme.shared.content.flex};
28
+ color: ${theme.shared.content.color};
29
+ ${typography.convertTypographyToEmotionStringStyle(theme.shared.content.typography)}
30
+ `;
31
+ };
32
+
33
+ exports.alertBannerContentStyles = alertBannerContentStyles;
34
+ exports.alertBannerStyles = alertBannerStyles;
35
+ exports.defaultAlertBannerTheme = defaultAlertBannerTheme;
@@ -0,0 +1,31 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentAlertBanner } from '../../styleD/build/typescript/component/alertBanner.js';
3
+ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
+
5
+ const defaultAlertBannerTheme = componentAlertBanner;
6
+ const alertBannerStyles = (theme, { level }) => {
7
+ return css`
8
+ display: ${theme.shared.display};
9
+ align-items: ${theme.shared["align-items"]};
10
+ justify-content: ${theme.shared["justify-content"]};
11
+ width: ${theme.shared.width};
12
+ height: ${theme.shared.height};
13
+ padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
14
+ ${theme.shared.padding.bottom} ${theme.shared.padding.left};
15
+ background-color: ${theme[level]["background-color"]};
16
+ `;
17
+ };
18
+ const alertBannerContentStyles = (theme) => {
19
+ return css`
20
+ display: ${theme.shared.content.display};
21
+ justify-content: ${theme.shared.content["justify-content"]};
22
+ gap: ${theme.shared.content.gap};
23
+ height: ${theme.shared.content.height};
24
+ align-items: ${theme.shared.content["align-items"]};
25
+ flex: ${theme.shared.content.flex};
26
+ color: ${theme.shared.content.color};
27
+ ${convertTypographyToEmotionStringStyle(theme.shared.content.typography)}
28
+ `;
29
+ };
30
+
31
+ export { alertBannerContentStyles, alertBannerStyles, defaultAlertBannerTheme };
@@ -1,10 +1,10 @@
1
- import { jsxs, jsx } from '@emotion/react/jsx-runtime';
1
+ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
2
2
  import React from 'react';
3
- import { Select as Select$1, Button, SelectValue, Popover, ListBox as ListBox$1, ListBoxItem } from 'react-aria-components';
3
+ import { ListBoxItem, Select as Select$1, Button, SelectValue, Popover, ListBox as ListBox$1 } from 'react-aria-components';
4
4
  import { mergeDeep } from '../../util/mergeDeep.js';
5
5
  import { FormInputContainer } from '../form/Form.js';
6
6
  import { Icon } from '../icon/Icon.js';
7
- import { buttonStyles, popoverStyles, defaultSelectTheme, listBoxStyles, listBoxItemStyles } from './styles.js';
7
+ import { listBoxItemStyles, buttonStyles, popoverStyles, defaultSelectTheme, listBoxStyles } from './styles.js';
8
8
 
9
9
  function Option({ children, theme = {} }) {
10
10
  const mergedTheme = mergeDeep(defaultSelectTheme, theme);
package/dist/index.cjs CHANGED
@@ -9,6 +9,7 @@ var button = require('./styleD/build/typescript/component/button.cjs');
9
9
  var typography$1 = require('./styleD/build/typescript/component/typography.cjs');
10
10
  var icon = require('./styleD/build/typescript/component/icon.cjs');
11
11
  var favicon = require('./styleD/build/typescript/component/favicon.cjs');
12
+ var alertBanner = require('./styleD/build/typescript/component/alertBanner.cjs');
12
13
  var radioGroup = require('./styleD/build/typescript/component/radioGroup.cjs');
13
14
  var checkbox = require('./styleD/build/typescript/component/checkbox.cjs');
14
15
  var textArea = require('./styleD/build/typescript/component/textArea.cjs');
@@ -39,6 +40,7 @@ exports.componentButton = button.componentButton;
39
40
  exports.componentTypography = typography$1.componentTypography;
40
41
  exports.componentIcon = icon.componentIcon;
41
42
  exports.componentFavicon = favicon.componentFavicon;
43
+ exports.componentAlertBanner = alertBanner.componentAlertBanner;
42
44
  exports.componentRadioGroup = radioGroup.componentRadioGroup;
43
45
  exports.componentCheckbox = checkbox.componentCheckbox;
44
46
  exports.componentTextArea = textArea.componentTextArea;
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { componentButton } from './styleD/build/typescript/component/button.js';
7
7
  export { componentTypography } from './styleD/build/typescript/component/typography.js';
8
8
  export { componentIcon } from './styleD/build/typescript/component/icon.js';
9
9
  export { componentFavicon } from './styleD/build/typescript/component/favicon.js';
10
+ export { componentAlertBanner } from './styleD/build/typescript/component/alertBanner.js';
10
11
  export { componentRadioGroup } from './styleD/build/typescript/component/radioGroup.js';
11
12
  export { componentCheckbox } from './styleD/build/typescript/component/checkbox.js';
12
13
  export { componentTextArea } from './styleD/build/typescript/component/textArea.js';
package/dist/select.cjs CHANGED
@@ -5,5 +5,6 @@ var select = require('./styleD/build/typescript/component/select.cjs');
5
5
 
6
6
 
7
7
 
8
+ exports.Option = Select.Option;
8
9
  exports.Select = Select.Select;
9
10
  exports.componentSelect = select.componentSelect;
package/dist/select.js CHANGED
@@ -1,2 +1,2 @@
1
- export { Select } from './components/select/Select.js';
1
+ export { Option, Select } from './components/select/Select.js';
2
2
  export { componentSelect } from './styleD/build/typescript/component/select.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+
5
+ :root {
6
+ --component-alert-banner-shared-display: flex;
7
+ --component-alert-banner-shared-align-items: center;
8
+ --component-alert-banner-shared-justify-content: space-between;
9
+ --component-alert-banner-shared-padding-top: 0;
10
+ --component-alert-banner-shared-padding-right: 1rem;
11
+ --component-alert-banner-shared-padding-bottom: 0;
12
+ --component-alert-banner-shared-padding-left: 1rem;
13
+ --component-alert-banner-shared-width: 100%;
14
+ --component-alert-banner-shared-height: 2.5rem;
15
+ --component-alert-banner-shared-content-display: flex;
16
+ --component-alert-banner-shared-content-justify-content: center;
17
+ --component-alert-banner-shared-content-gap: 0.5rem;
18
+ --component-alert-banner-shared-content-flex: 1;
19
+ --component-alert-banner-shared-content-height: 100%;
20
+ --component-alert-banner-shared-content-align-items: center;
21
+ --component-alert-banner-shared-content-color: #000000;
22
+ --component-alert-banner-shared-content-typography-font: normal 460
23
+ 0.875rem/1.3 'Open Sans';
24
+ --component-alert-banner-shared-content-typography-letter-spacing: 0;
25
+ --component-alert-banner-shared-content-typography-font-width: 95;
26
+ --component-alert-banner-shared-content-icon-color: #545454;
27
+ --component-alert-banner-information-background-color: #e8f0fb;
28
+ --component-alert-banner-success-background-color: #cde4c9;
29
+ --component-alert-banner-warning-background-color: #fbeebf;
30
+ --component-alert-banner-error-background-color: #f5c6c0;
31
+ }
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ const componentAlertBanner = {
4
+ shared: {
5
+ display: "flex",
6
+ "align-items": "center",
7
+ "justify-content": "space-between",
8
+ padding: {
9
+ top: "0",
10
+ right: "1rem",
11
+ bottom: "0",
12
+ left: "1rem"
13
+ },
14
+ width: "100%",
15
+ height: "2.5rem",
16
+ content: {
17
+ display: "flex",
18
+ "justify-content": "center",
19
+ gap: "0.5rem",
20
+ flex: "1",
21
+ height: "100%",
22
+ "align-items": "center",
23
+ color: "#000000",
24
+ typography: {
25
+ font: "normal 460 0.875rem/1.3 Open Sans",
26
+ letterSpacing: "0rem",
27
+ fontWidth: 95
28
+ },
29
+ icon: {
30
+ color: "#545454"
31
+ }
32
+ }
33
+ },
34
+ information: {
35
+ "background-color": "#e8f0fb"
36
+ },
37
+ success: {
38
+ "background-color": "#cde4c9"
39
+ },
40
+ warning: {
41
+ "background-color": "#fbeebf"
42
+ },
43
+ error: {
44
+ "background-color": "#f5c6c0"
45
+ }
46
+ };
47
+
48
+ exports.componentAlertBanner = componentAlertBanner;
@@ -0,0 +1,46 @@
1
+ const componentAlertBanner = {
2
+ shared: {
3
+ display: "flex",
4
+ "align-items": "center",
5
+ "justify-content": "space-between",
6
+ padding: {
7
+ top: "0",
8
+ right: "1rem",
9
+ bottom: "0",
10
+ left: "1rem"
11
+ },
12
+ width: "100%",
13
+ height: "2.5rem",
14
+ content: {
15
+ display: "flex",
16
+ "justify-content": "center",
17
+ gap: "0.5rem",
18
+ flex: "1",
19
+ height: "100%",
20
+ "align-items": "center",
21
+ color: "#000000",
22
+ typography: {
23
+ font: "normal 460 0.875rem/1.3 Open Sans",
24
+ letterSpacing: "0rem",
25
+ fontWidth: 95
26
+ },
27
+ icon: {
28
+ color: "#545454"
29
+ }
30
+ }
31
+ },
32
+ information: {
33
+ "background-color": "#e8f0fb"
34
+ },
35
+ success: {
36
+ "background-color": "#cde4c9"
37
+ },
38
+ warning: {
39
+ "background-color": "#fbeebf"
40
+ },
41
+ error: {
42
+ "background-color": "#f5c6c0"
43
+ }
44
+ };
45
+
46
+ export { componentAlertBanner };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * AlertBanner component entry point
3
+ *
4
+ * Peer dependencies required to use these components:
5
+ * - `@emotion/react`
6
+ * - `react`
7
+ * - `react-dom`
8
+ * - `typescript`
9
+ *
10
+ * See the `peerDependencies` section of package.json for compatible versions.
11
+ *
12
+ * If you only need the built CSS (./component/alertBanner.css),
13
+ * you don't need to install these.
14
+ */
15
+ export { AlertBanner } from './components/alert-banner/AlertBanner';
16
+ export type { AlertBannerProps } from './components/alert-banner/types';
17
+ export type { AlertBannerTheme } from './components/alert-banner/styles';
18
+ export { componentAlertBanner } from './styleD/build/typescript/component/alertBanner';
19
+ export type { ComponentAlertBanner } from './styleD/build/typescript/component/alertBanner';
@@ -0,0 +1,2 @@
1
+ import type { AlertBannerProps } from './types';
2
+ export declare function AlertBanner({ level, showIcon, icon, closeButtonProps, children, theme, cssOverrides, className, ...props }: AlertBannerProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare const componentName = "AlertBanner";
2
+ export declare const componentTsx = "import { AlertBanner } from '@guardian/stand/alert-banner';\n\nexport const Component = () => (\n\t<>\n\t\t<AlertBanner level=\"information\">\n\t\t\tYou are working in the CODE Environment\n\t\t</AlertBanner>\n\t\t<AlertBanner level=\"success\" showIcon>\n\t\t\tYour changes have been published.\n\t\t</AlertBanner>\n\t\t<AlertBanner\n\t\t\tlevel=\"error\"\n\t\t\tshowIcon\n\t\t\tcloseButtonProps={{ onPress: () => alert('Dismissed') }}\n\t\t>\n\t\t\tUnable to save changes.\n\t\t</AlertBanner>\n\t</>\n);\n";
3
+ export declare const componentCss = "\n/* import the alertbanner styles */\n@import '@guardian/stand/component/alertBanner.css';\n\n.stand-alert-banner {\n\tdisplay: var(--component-alert-banner-shared-display);\n\talign-items: var(--component-alert-banner-shared-align-items);\n\tjustify-content: var(--component-alert-banner-shared-justify-content);\n\tpadding: var(--component-alert-banner-shared-padding-top)\n\t\tvar(--component-alert-banner-shared-padding-right)\n\t\tvar(--component-alert-banner-shared-padding-bottom)\n\t\tvar(--component-alert-banner-shared-padding-left);\n\twidth: var(--component-alert-banner-shared-width);\n\theight: var(--component-alert-banner-shared-height);\n}\n\n.stand-alert-banner-content {\n\tdisplay: var(--component-alert-banner-shared-content-display);\n\tjustify-content: var(--component-alert-banner-shared-content-justify-content);\n\tgap: var(--component-alert-banner-shared-content-gap);\n\tflex: var(--component-alert-banner-shared-content-flex);\n\theight: var(--component-alert-banner-shared-content-height);\n\talign-items: var(--component-alert-banner-shared-content-align-items);\n\tcolor: var(--component-alert-banner-shared-content-color);\n\tfont: var(--component-alert-banner-shared-content-typography-font);\n\tletter-spacing: var(--component-alert-banner-shared-content-typography-letter-spacing);\n\tfont-variation-settings: 'wdth'\n\t\tvar(--component-alert-banner-shared-content-typography-font-width);\n}\n\n.stand-alert-banner-content > .material-symbols {\n\tfont-size: 1rem;\n\tcolor: var(--component-alert-banner-shared-content-icon-color);\n}\n\n.stand-alert-banner-information {\n\tbackground-color: var(--component-alert-banner-information-background-color);\n}\n\n.stand-alert-banner-success {\n\tbackground-color: var(--component-alert-banner-success-background-color);\n}\n\n.stand-alert-banner-warning {\n\tbackground-color: var(--component-alert-banner-warning-background-color);\n}\n\n.stand-alert-banner-error {\n\tbackground-color: var(--component-alert-banner-error-background-color);\n}\n\n/* see IconButton for example of styling close button */\n.stand-alert-banner-close {\n\tborder: 0;\n\tbackground: transparent;\n\tcursor: pointer;\n\tpadding: 0.125rem;\n}\n";
4
+ export declare const componentHtml = "<div class=\"container flow-column\">\n\t<div class=\"stand-alert-banner stand-alert-banner-information\">\n\t\t<div class=\"stand-alert-banner-content\">\n\t\t\tYou are working in the CODE Environment\n\t\t</div>\n\t</div>\n\n\t<div class=\"stand-alert-banner stand-alert-banner-success\">\n\t\t<div class=\"stand-alert-banner-content\">\n\t\t\t<span class=\"material-symbols\">sentiment_satisfied</span>\n\t\t\tYour changes have been published.\n\t\t</div>\n\t</div>\n\n\t<div class=\"stand-alert-banner stand-alert-banner-error\">\n\t\t<div class=\"stand-alert-banner-content\">\n\t\t\t<span class=\"material-symbols\">warning</span>\n\t\t\tUnable to save changes.\n\t\t</div>\n\t\t<button class=\"stand-alert-banner-close\" aria-label=\"Close alert banner\">x</button>\n\t</div>\n</div>\n";
5
+ export declare const componentJs = "\nimport { componentAlertBanner } from \"@guardian/stand\";\n\nconst sheet = new CSSStyleSheet();\n\nsheet.replaceSync(`\n\t.js-stand-alert-banner {\n\t\tdisplay: ${componentAlertBanner.shared.display};\n\t\talign-items: ${componentAlertBanner.shared['align-items']};\n\t\tjustify-content: ${componentAlertBanner.shared['justify-content']};\n\t\tpadding: ${componentAlertBanner.shared.padding.top}\n\t\t\t${componentAlertBanner.shared.padding.right}\n\t\t\t${componentAlertBanner.shared.padding.bottom}\n\t\t\t${componentAlertBanner.shared.padding.left};\n\t\twidth: ${componentAlertBanner.shared.width};\n\t\theight: ${componentAlertBanner.shared.height};\n\t}\n\n\t.js-stand-alert-banner-content {\n\t\tdisplay: ${componentAlertBanner.shared.content.display};\n\t\tjustify-content: ${componentAlertBanner.shared.content['justify-content']};\n\t\tgap: ${componentAlertBanner.shared.content.gap};\n\t\tflex: ${componentAlertBanner.shared.content.flex};\n\t\theight: ${componentAlertBanner.shared.content.height};\n\t\talign-items: ${componentAlertBanner.shared.content['align-items']};\n\t\tcolor: ${componentAlertBanner.shared.content.color};\n\t\tfont: ${componentAlertBanner.shared.content.typography.font};\n\t\tletter-spacing: ${componentAlertBanner.shared.content.typography.letterSpacing};\n\t\tfont-variation-settings: 'wdth' ${componentAlertBanner.shared.content.typography.fontWidth};\n\t}\n\n\t.js-stand-alert-banner-content > .material-symbols {\n\t\tfont-size: 1rem;\n\t\tcolor: ${componentAlertBanner.shared.content.icon.color};\n\t}\n\n\t.js-stand-alert-banner-information {\n\t\tbackground-color: ${componentAlertBanner.information['background-color']};\n\t}\n\n\t.js-stand-alert-banner-success {\n\t\tbackground-color: ${componentAlertBanner.success['background-color']};\n\t}\n\n\t.js-stand-alert-banner-error {\n\t\tbackground-color: ${componentAlertBanner.error['background-color']};\n\t}\n\n\t/* see IconButton for example of styling close button */\n\t.js-stand-alert-banner-close {\n\t\tborder: 0;\n\t\tbackground: transparent;\n\t\tcursor: pointer;\n\t\tpadding: 0.125rem;\n\t}\n`);\n\ndocument.adoptedStyleSheets.push(sheet);\n\ndocument.getElementById(\"app\").innerHTML = `\n\t<div class=\"container flow-column\">\n\t\t<div class=\"js-stand-alert-banner js-stand-alert-banner-information\">\n\t\t\t<div class=\"js-stand-alert-banner-content\">\n\t\t\t\tYou are working in the CODE Environment\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"js-stand-alert-banner js-stand-alert-banner-success\">\n\t\t\t<div class=\"js-stand-alert-banner-content\">\n\t\t\t\t<span class=\"material-symbols\">sentiment_satisfied</span>\n\t\t\t\tYour changes have been published.\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class=\"js-stand-alert-banner js-stand-alert-banner-error\">\n\t\t\t<div class=\"js-stand-alert-banner-content\">\n\t\t\t\t<span class=\"material-symbols\">warning</span>\n\t\t\t\tUnable to save changes.\n\t\t\t</div>\n\t\t\t<button class=\"js-stand-alert-banner-close\" aria-label=\"Close alert banner\">x</button>\n\t\t</div>\n\t</div>\n`;\n";
@@ -0,0 +1,9 @@
1
+ import type { SerializedStyles } from '@emotion/react';
2
+ import type { ComponentAlertBanner } from '../../styleD/build/typescript/component/alertBanner';
3
+ import type { DeepPartial, Prettify } from '../../util/types';
4
+ import type { AlertBannerProps } from './types';
5
+ export type AlertBannerTheme = Prettify<ComponentAlertBanner>;
6
+ export type PartialAlertBannerTheme = Prettify<DeepPartial<AlertBannerTheme>>;
7
+ export declare const defaultAlertBannerTheme: AlertBannerTheme;
8
+ export declare const alertBannerStyles: (theme: AlertBannerTheme, { level }: Required<Pick<AlertBannerProps, 'level'>>) => SerializedStyles;
9
+ export declare const alertBannerContentStyles: (theme: AlertBannerTheme) => SerializedStyles;
@@ -0,0 +1,27 @@
1
+ import type { IconProps } from '../../icon';
2
+ import type { IconButtonProps } from '../../icon-button';
3
+ import type { DefaultPropsWithChildren, Prettify } from '../../util/types';
4
+ import type { AlertBannerTheme } from './styles';
5
+ export interface AlertBannerProps extends DefaultPropsWithChildren<AlertBannerTheme> {
6
+ /**
7
+ * The severity level of the AlertBanner, which determines its styling.
8
+ * This is a required prop.
9
+ * Levels: 'error', 'success', 'information', 'warning
10
+ */
11
+ level: keyof Omit<AlertBannerTheme, 'shared'>;
12
+ /**
13
+ * Indicates whether the AlertBanner has an icon.
14
+ * Icon is based on the level of the AlertBanner
15
+ */
16
+ showIcon?: boolean;
17
+ /**
18
+ * Override the default icon for the message by providing a custom icon, for example when not using material symbols.
19
+ * This can be either a string (for material symbols) or an SVG element.
20
+ * Passed to the Icon component, so can be either a string (for material symbols) or an SVG element.
21
+ */
22
+ icon?: IconProps['symbol'] | Exclude<IconProps['children'], string>;
23
+ /**
24
+ * Optional props for the close button. If provided, a close button will be rendered in the AlertBanner, and these props will be passed to the IconButton component.
25
+ */
26
+ closeButtonProps?: Prettify<Partial<IconButtonProps>>;
27
+ }
@@ -1,5 +1,5 @@
1
1
  export declare const componentName = "Select";
2
- export declare const componentTsx = "import { Select } from '@guardian/stand/select';\n\nexport const Component = () => (\n\t<Select label=\"Select\">\n\t\t<Option>Option 1</Option>\n\t\t<Option>Option 2</Option>\n\t</Select>\n);\n";
3
- export declare const componentCss = "\n/* import the select styles */\n@import '@guardian/stand/component/select.css';\n\n.stand-select-container {\n\tdisplay: var(--component-select-shared-display);\n\tflex-direction: var(--component-select-shared-flex-direction);\n\tgap: var(--component-select-shared-gap);\n\n\tmax-width: var(--component-select-shared-maxWidth);\n\twidth: var(--component-select-shared-width);\n}\n\n.stand-select {\n\t\tdisplay: var(--component-select-button-display);\n\t\tjustify-content: var(--component-select-button-justify-content);\n\t\talign-items: var(--component-select-button-align-items);\n\t\tbackground-color: var(--component-select-button-background-color);\n\t\tborder: var(--component-select-button-border);\n\t\tborder-radius: var(--component-select-button-border-radius);\n\t\theight: var(--component-select-button-height);\n\t\tpadding-left: var(--component-select-button-padding-left);\n\t\tpadding-right: var(--component-select-button-padding-right);\n\t\tmargin-top: var(--component-select-button-margin-top);\n\t\tcolor: var(--component-select-button-color);\n\n\t\tfont: var(--component-select-button-body-md-typography-font);\n\t\tletter-spacing: var(--component-select-button-body-md-typography-letter-spacing);\n\t\tfont-variation-settings: \"wdth\" var(--component-select-button-body-md-typography-font-width);\n\n\n\t\t&:hover {\n\t\t\tbackground: var(--component-select-shared-hover-background-color);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground: var(--component-select-shared-active-background-color);\n\t\t}\n\n\t\t&:focus-visible {\n\t\t\toutline: var(--component-select-button-focused-outline);\n\t\t\toutline-offset: var(--component-select-button-focused-outline-offset);\n\t\t}\n\n\t\t&:disabled {\n\t\t\tcursor: var(--component-select-button-disabled-cursor);\n\t\t\tbackground-color: var(--component-select-button-disabled-background-color);\n\t\t\tcolor: var(--component-select-button-disabled-color);\n\t\t\tborder: var(--component-select-button-disabled-border);\n\t\t}\n}\n";
2
+ export declare const componentTsx = "import { Option, Select } from '@guardian/stand/select';\n\nexport const Component = () => (\n\t<Select label=\"Select\">\n\t\t<Option>Option 1</Option>\n\t\t<Option>Option 2</Option>\n\t</Select>\n);\n";
3
+ export declare const componentCss = "\n/* import the select styles */\n@import '@guardian/stand/component/select.css';\n@import '@guardian/stand/component/form.css';\n\n.stand-select-container {\n\tdisplay: var(--component-form-input-shared-container-display);\n\tflex-direction: var(--component-form-input-shared-container-flex-direction);\n\tgap: var(--component-form-input-shared-container-gap);\n\twidth: var(--component-form-input-shared-container-width);\n}\n\n.stand-select-container > label {\n\tcolor: var(--component-form-input-shared-label-color);\n\tfont: var(--component-form-input-md-label-typography-font);\n\tletter-spacing: var(--component-form-input-md-label-typography-letter-spacing);\n\tfont-variation-settings: \"wdth\" var(--component-form-input-md-label-typography-font-width);\n}\n\n.stand-select-container > span.description {\n\tcolor: var(--component-form-input-shared-description-color);\n\tfont: var(--component-form-input-shared-description-typography-font);\n\tletter-spacing: var(--component-form-input-shared-description-typography-letter-spacing);\n\tfont-variation-settings: \"wdth\" var(--component-form-input-shared-description-typography-font-width);\n}\n\n.stand-select {\n\t\tdisplay: var(--component-select-shared-button-display);\n\t\tjustify-content: var(--component-select-shared-button-justify-content);\n\t\talign-items: var(--component-select-shared-button-align-items);\n\t\tbackground-color: var(--component-select-shared-button-background-color);\n\t\tborder: var(--component-select-shared-button-border);\n\t\tborder-radius: var(--component-select-shared-button-border-radius);\n\t\theight: var(--component-select-shared-button-height);\n\t\tpadding-left: var(--component-select-shared-button-padding-left);\n\t\tpadding-right: var(--component-select-shared-button-padding-right);\n\t\tmargin-top: var(--component-select-shared-button-margin-top);\n\t\tcolor: var(--component-select-shared-button-color);\n\n\t\tfont: var(--component-select-shared-button-body-md-typography-font);\n\t\tletter-spacing: var(--component-select-shared-button-body-md-typography-letter-spacing);\n\t\tfont-variation-settings: \"wdth\" var(--component-select-shared-button-body-md-typography-font-width);\n\n\n\t\t&:hover {\n\t\t\tbackground: var(--component-select-shared-hover-background-color);\n\t\t}\n\n\t\t&:active {\n\t\t\tbackground: var(--component-select-shared-active-background-color);\n\t\t}\n\n\t\t&:focus-visible {\n\t\t\toutline: var(--component-select-button-focused-outline);\n\t\t\toutline-offset: var(--component-select-button-focused-outline-offset);\n\t\t}\n\n\t\t&:disabled {\n\t\t\tcursor: var(--component-select-button-disabled-cursor);\n\t\t\tbackground-color: var(--component-select-button-disabled-background-color);\n\t\t\tcolor: var(--component-select-button-disabled-color);\n\t\t\tborder: var(--component-select-button-disabled-border);\n\t\t}\n}\n";
4
4
  export declare const componentHtml = "<div class=\"container\">\n\t<div class=\"stand-select-container\">\n\t\t<label>Select</label>\n\t\t<select class=\"stand-select\">\n\t\t\t<option>Option 1</option>\n\t\t\t<option>Option 2</option>\n\t\t</select>\n\t</div>\n</div>\n";
5
- export declare const componentJs = "\nimport { componentSelect } from \"@guardian/stand\";\n\n// example of creating a stylesheet in js\nconst sheet = new CSSStyleSheet();\n\n// apply the rules to the sheet\nsheet.replaceSync(`\n\n.js-stand-select-container {\n\tdisplay: ${componentSelect.shared.display};\n\tflex-direction: ${componentSelect.shared.flexDirection};\n\tgap: ${componentSelect.shared.gap};\n\n\tmax-width: ${componentSelect.shared.maxWidth};\n\twidth: ${componentSelect.shared.width};\n}\n\n.js-stand-select {\n\tdisplay: ${componentSelect.button.display};\n\tjustify-content: ${componentSelect.button.justifyContent};\n\talign-items: ${componentSelect.button.alignItems};\n\tbackground-color: ${componentSelect.button.backgroundColor};\n\tborder: ${componentSelect.button.border};\n\tborder-radius: ${componentSelect.button.borderRadius};\n\theight: ${componentSelect.button.height};\n\tpadding-left: ${componentSelect.button.paddingLeft};\n\tpadding-right: ${componentSelect.button.paddingRight};\n\tmargin-top: ${componentSelect.button.marginTop};\n\tcolor: ${componentSelect.button.color};\n\n\tfont: ${componentSelect.button.typography.font};\n\tletter-spacing: ${componentSelect.button.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentSelect.button.typography.fontWidth};\n\n\t&:hover {\n\t\tbackground: ${componentSelect.shared.hover.backgroundColor};\n\t}\n\n\t&:active {\n\t\tbackground: ${componentSelect.shared.pressed.backgroundColor};\n\t}\n\n\t&:focus-visible {\n\t\toutline: ${componentSelect.button.focused.outline};\n\t\toutline-offset: ${componentSelect.button.focused['outline-offset']};\n\t}\n\n\t&:disabled {\n\t\tcursor: ${componentSelect.button.disabled.cursor};\n\t\tbackground-color: ${componentSelect.button.disabled.backgroundColor};\n\t\tcolor: ${componentSelect.button.disabled.color};\n\t\tborder: ${componentSelect.button.disabled.border};\n\t}\n}\n`);\n\n// update the document with the sheet\ndocument.adoptedStyleSheets.push(sheet);\n\ndocument.getElementById(\"app\").innerHTML = `\n\t<div class=\"js-stand-select-container\">\n\t\t<label>Select</label>\n\t\t<select class=\"js-stand-select\">\n\t\t\t<option>Option 1</option>\n\t\t\t<option>Option 2</option>\n\t\t</select>\n\t</div>\n`;\n";
5
+ export declare const componentJs = "\nimport { componentForm, componentSelect } from \"@guardian/stand\";\n\n// example of creating a stylesheet in js\nconst sheet = new CSSStyleSheet();\n\n// apply the rules to the sheet\nsheet.replaceSync(`\n\n.js-stand-select-container {\n\tdisplay: ${componentForm.input.shared.container.display};\n\tflex-direction: ${componentForm.input.shared.container['flex-direction']};\n\tgap: ${componentForm.input.shared.container.gap};\n\twidth: ${componentForm.input.shared.container.width};\n}\n\n.js-stand-select-container > label {\n\tcolor: ${componentForm.input.shared.label.color};\n\tfont: ${componentForm.input.md.label.typography.font};\n\tletter-spacing: ${componentForm.input.md.label.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentForm.input.md.label.typography.fontWidth};\n}\n\n.js-stand-select-container > span.description {\n\tcolor: ${componentForm.input.shared.description.color};\n\tfont: ${componentForm.input.shared.description.font};\n\tletter-spacing: ${componentForm.input.shared.description.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentForm.input.shared.description.fontWidth};\n}\n\n.js-stand-select {\n\tdisplay: ${componentSelect.shared.button.display};\n\tjustify-content: ${componentSelect.shared.button.justifyContent};\n\talign-items: ${componentSelect.shared.button.alignItems};\n\tbackground-color: ${componentSelect.shared.button.backgroundColor};\n\tborder: ${componentSelect.shared.button.border};\n\tborder-radius: ${componentSelect.shared.button.borderRadius};\n\theight: ${componentSelect.shared.button.height};\n\tpadding-left: ${componentSelect.shared.button.paddingLeft};\n\tpadding-right: ${componentSelect.shared.button.paddingRight};\n\tmargin-top: ${componentSelect.shared.button.marginTop};\n\tcolor: ${componentSelect.shared.button.color};\n\n\tfont: ${componentSelect.shared.button.typography.font};\n\tletter-spacing: ${componentSelect.shared.button.typography.letterSpacing};\n\tfont-variation-settings: \"wdth\" ${componentSelect.shared.button.typography.fontWidth};\n\n\t&:hover {\n\t\tbackground: ${componentSelect.shared.hover.backgroundColor};\n\t}\n\n\t&:active {\n\t\tbackground: ${componentSelect.shared.pressed.backgroundColor};\n\t}\n\n\t&:focus-visible {\n\t\toutline: ${componentSelect.shared.button.focused.outline};\n\t\toutline-offset: ${componentSelect.shared.button.focused['outline-offset']};\n\t}\n\n\t&:disabled {\n\t\tcursor: ${componentSelect.shared.button.disabled.cursor};\n\t\tbackground-color: ${componentSelect.shared.button.disabled.backgroundColor};\n\t\tcolor: ${componentSelect.shared.button.disabled.color};\n\t\tborder: ${componentSelect.shared.button.disabled.border};\n\t}\n}\n`);\n\n// update the document with the sheet\ndocument.adoptedStyleSheets.push(sheet);\n\ndocument.getElementById(\"app\").innerHTML = `\n\t<div class=\"js-stand-select-container\">\n\t\t<label>Select</label>\n\t\t<select class=\"js-stand-select\">\n\t\t\t<option>Option 1</option>\n\t\t\t<option>Option 2</option>\n\t\t</select>\n\t</div>\n`;\n";
@@ -26,6 +26,8 @@ export { componentIcon } from './styleD/build/typescript/component/icon';
26
26
  export type { ComponentIcon } from './styleD/build/typescript/component/icon';
27
27
  export { componentFavicon } from './styleD/build/typescript/component/favicon';
28
28
  export type { ComponentFavicon } from './styleD/build/typescript/component/favicon';
29
+ export { componentAlertBanner } from './styleD/build/typescript/component/alertBanner';
30
+ export type { ComponentAlertBanner } from './styleD/build/typescript/component/alertBanner';
29
31
  export { componentRadioGroup } from './styleD/build/typescript/component/radioGroup';
30
32
  export type { ComponentRadioGroup } from './styleD/build/typescript/component/radioGroup';
31
33
  export { componentCheckbox } from './styleD/build/typescript/component/checkbox';
@@ -13,8 +13,8 @@
13
13
  * If you only need the built CSS (./component/select.css),
14
14
  * you don't need to install these.
15
15
  */
16
- export { Select } from './components/select/Select';
17
- export type { SelectProps } from './components/select/types';
16
+ export { Option, Select } from './components/select/Select';
17
+ export type { OptionProps, SelectProps } from './components/select/types';
18
18
  export type { PartialSelectTheme as SelectTheme } from './components/select/styles';
19
19
  export { componentSelect } from './styleD/build/typescript/component/select';
20
20
  export type { ComponentSelect } from './styleD/build/typescript/component/select';
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Do not edit directly, this file was auto-generated.
3
+ */
4
+ export declare const componentAlertBanner: {
5
+ shared: {
6
+ display: string;
7
+ 'align-items': string;
8
+ 'justify-content': string;
9
+ padding: {
10
+ top: string;
11
+ right: string;
12
+ bottom: string;
13
+ left: string;
14
+ };
15
+ width: string;
16
+ height: string;
17
+ content: {
18
+ display: string;
19
+ 'justify-content': string;
20
+ gap: string;
21
+ flex: string;
22
+ height: string;
23
+ 'align-items': string;
24
+ color: string;
25
+ typography: {
26
+ font: string;
27
+ letterSpacing: string;
28
+ fontWidth: number;
29
+ };
30
+ icon: {
31
+ color: string;
32
+ };
33
+ };
34
+ };
35
+ information: {
36
+ 'background-color': string;
37
+ };
38
+ success: {
39
+ 'background-color': string;
40
+ };
41
+ warning: {
42
+ 'background-color': string;
43
+ };
44
+ error: {
45
+ 'background-color': string;
46
+ };
47
+ };
48
+ export type ComponentAlertBanner = typeof componentAlertBanner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/stand",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "//exports": "Each component has its own entry point for optimal tree-shaking. Main entry point only includes design tokens and utilities. New components/foundations should follow the same pattern.",
6
6
  "exports": {
@@ -104,6 +104,11 @@
104
104
  "import": "./dist/text-area.js",
105
105
  "require": "./dist/text-area.cjs"
106
106
  },
107
+ "./alert-banner": {
108
+ "types": "./dist/types/alert-banner.d.ts",
109
+ "import": "./dist/alert-banner.js",
110
+ "require": "./dist/alert-banner.cjs"
111
+ },
107
112
  "./byline": {
108
113
  "types": "./dist/types/byline.d.ts",
109
114
  "import": "./dist/byline.js",
@@ -155,7 +160,8 @@
155
160
  "./component/textInput.css": "./dist/styleD/build/css/component/textInput.css",
156
161
  "./component/radioGroup.css": "./dist/styleD/build/css/component/radioGroup.css",
157
162
  "./component/checkbox.css": "./dist/styleD/build/css/component/checkbox.css",
158
- "./component/textArea.css": "./dist/styleD/build/css/component/textArea.css"
163
+ "./component/textArea.css": "./dist/styleD/build/css/component/textArea.css",
164
+ "./component/alertBanner.css": "./dist/styleD/build/css/component/alertBanner.css"
159
165
  },
160
166
  "//typesVersions": "Provides backward compatibility for TypeScript moduleResolution: node - maps subpath imports to correct type definition files. When adding new components with their own entry points, ensure to add them here.",
161
167
  "typesVersions": {
@@ -228,6 +234,9 @@
228
234
  ],
229
235
  "text-area": [
230
236
  "./dist/types/text-area.d.ts"
237
+ ],
238
+ "alert-banner": [
239
+ "./dist/types/alert-banner.d.ts"
231
240
  ]
232
241
  }
233
242
  },
@@ -304,7 +313,7 @@
304
313
  "prosemirror-state": "1.4.3",
305
314
  "prosemirror-view": "1.37.2",
306
315
  "react": "^17.0.2 || ^18.0.0 || ^19.0.0",
307
- "react-aria-components": ">= 1.13.0 <= 1.16.0",
316
+ "react-aria-components": ">= 1.13.0 <= 1.17.0",
308
317
  "react-dom": "^17.0.2 || ^18.0.0 || ^19.0.0",
309
318
  "typescript": ">=5.0.0 <=5.9.3"
310
319
  },