@guardian/stand 0.0.9 → 0.0.11

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.
Files changed (158) hide show
  1. package/README.md +1122 -1
  2. package/dist/avatar.cjs +9 -0
  3. package/dist/avatar.js +2 -0
  4. package/dist/button.cjs +9 -0
  5. package/dist/button.js +2 -0
  6. package/dist/components/TitleText.cjs +28 -0
  7. package/dist/components/TitleText.js +22 -0
  8. package/dist/components/avatar/Avatar.cjs +57 -0
  9. package/dist/components/avatar/Avatar.js +27 -0
  10. package/dist/components/avatar/styles.cjs +33 -0
  11. package/dist/components/avatar/styles.js +29 -0
  12. package/dist/components/avatar/types.cjs +16 -0
  13. package/dist/components/avatar/types.js +14 -0
  14. package/dist/components/button/Button.cjs +38 -0
  15. package/dist/components/button/Button.js +19 -0
  16. package/dist/components/button/styles.cjs +68 -0
  17. package/dist/components/button/styles.js +63 -0
  18. package/dist/components/icon/Icon.cjs +46 -0
  19. package/dist/components/icon/Icon.js +19 -0
  20. package/dist/components/icon/styles.cjs +27 -0
  21. package/dist/components/icon/styles.js +20 -0
  22. package/dist/components/icon-button/IconButton.cjs +45 -0
  23. package/dist/components/icon-button/IconButton.js +26 -0
  24. package/dist/components/icon-button/styles.cjs +9 -0
  25. package/dist/components/icon-button/styles.js +6 -0
  26. package/dist/components/icon-link-button/IconLinkButton.cjs +47 -0
  27. package/dist/components/icon-link-button/IconLinkButton.js +23 -0
  28. package/dist/components/icon-link-button/styles.cjs +9 -0
  29. package/dist/components/icon-link-button/styles.js +6 -0
  30. package/dist/components/link-button/LinkButton.cjs +35 -0
  31. package/dist/components/link-button/LinkButton.js +16 -0
  32. package/dist/components/link-button/styles.cjs +9 -0
  33. package/dist/components/link-button/styles.js +6 -0
  34. package/dist/components/typography/Typography.cjs +26 -0
  35. package/dist/components/typography/Typography.js +13 -0
  36. package/dist/components/typography/styles.cjs +15 -0
  37. package/dist/components/typography/styles.js +12 -0
  38. package/dist/components/user-menu/PreferenceRadioGroup.cjs +53 -0
  39. package/dist/components/user-menu/PreferenceRadioGroup.js +19 -0
  40. package/dist/components/user-menu/UserMenu.cjs +67 -0
  41. package/dist/components/user-menu/UserMenu.js +11 -0
  42. package/dist/components/user-menu/default-options.cjs +109 -0
  43. package/dist/components/user-menu/default-options.js +105 -0
  44. package/dist/components/user-menu/styles.cjs +90 -0
  45. package/dist/components/user-menu/styles.js +83 -0
  46. package/dist/fonts/MaterialSymbolsOutlined.css +23 -0
  47. package/dist/fonts/MaterialSymbolsRound.css +23 -0
  48. package/dist/fonts/MaterialSymbolsSharp.css +23 -0
  49. package/dist/fonts/material-symbols-types.ts +3825 -0
  50. package/dist/icon-button.cjs +7 -0
  51. package/dist/icon-button.js +1 -0
  52. package/dist/icon-link-button.cjs +7 -0
  53. package/dist/icon-link-button.js +1 -0
  54. package/dist/icon.cjs +9 -0
  55. package/dist/icon.js +2 -0
  56. package/dist/index.cjs +16 -4
  57. package/dist/index.js +6 -0
  58. package/dist/link-button.cjs +7 -0
  59. package/dist/link-button.js +1 -0
  60. package/dist/styleD/build/css/base/colors.css +1 -1
  61. package/dist/styleD/build/css/base/sizing.css +2 -0
  62. package/dist/styleD/build/css/component/avatar.css +54 -0
  63. package/dist/styleD/build/css/component/button.css +282 -0
  64. package/dist/styleD/build/css/component/byline.css +1 -1
  65. package/dist/styleD/build/css/component/icon.css +11 -0
  66. package/dist/styleD/build/css/component/typography.css +7 -0
  67. package/dist/styleD/build/css/component/userMenu.css +29 -0
  68. package/dist/styleD/build/css/semantic/colors.css +12 -8
  69. package/dist/styleD/build/css/semantic/sizing.css +1 -0
  70. package/dist/styleD/build/css/semantic/typography.css +3 -0
  71. package/dist/styleD/build/typescript/base/colors.cjs +1 -1
  72. package/dist/styleD/build/typescript/base/colors.js +1 -1
  73. package/dist/styleD/build/typescript/base/sizing.cjs +2 -0
  74. package/dist/styleD/build/typescript/base/sizing.js +2 -0
  75. package/dist/styleD/build/typescript/component/avatar.cjs +88 -0
  76. package/dist/styleD/build/typescript/component/avatar.js +86 -0
  77. package/dist/styleD/build/typescript/component/button.cjs +523 -0
  78. package/dist/styleD/build/typescript/component/button.js +521 -0
  79. package/dist/styleD/build/typescript/component/byline.cjs +1 -1
  80. package/dist/styleD/build/typescript/component/byline.js +1 -1
  81. package/dist/styleD/build/typescript/component/icon.cjs +19 -0
  82. package/dist/styleD/build/typescript/component/icon.js +17 -0
  83. package/dist/styleD/build/typescript/component/typography.cjs +7 -0
  84. package/dist/styleD/build/typescript/component/typography.js +5 -0
  85. package/dist/styleD/build/typescript/component/userMenu.cjs +37 -0
  86. package/dist/styleD/build/typescript/component/userMenu.js +35 -0
  87. package/dist/styleD/build/typescript/semantic/colors.cjs +14 -10
  88. package/dist/styleD/build/typescript/semantic/colors.js +14 -10
  89. package/dist/styleD/build/typescript/semantic/sizing.cjs +2 -1
  90. package/dist/styleD/build/typescript/semantic/sizing.js +2 -1
  91. package/dist/styleD/build/typescript/semantic/typography.cjs +5 -0
  92. package/dist/styleD/build/typescript/semantic/typography.js +5 -0
  93. package/dist/types/avatar.d.ts +19 -0
  94. package/dist/types/button.d.ts +20 -0
  95. package/dist/types/components/TitleText.d.ts +6 -0
  96. package/dist/types/components/avatar/Avatar.d.ts +2 -0
  97. package/dist/types/components/avatar/styles.d.ts +8 -0
  98. package/dist/types/components/avatar/types.d.ts +45 -0
  99. package/dist/types/components/button/Button.d.ts +2 -0
  100. package/dist/types/components/button/styles.d.ts +7 -0
  101. package/dist/types/components/button/types.d.ts +18 -0
  102. package/dist/types/components/byline/schema.d.ts +1 -1
  103. package/dist/types/components/icon/Icon.d.ts +2 -0
  104. package/dist/types/components/icon/styles.d.ts +8 -0
  105. package/dist/types/components/icon/types.d.ts +28 -0
  106. package/dist/types/components/icon-button/IconButton.d.ts +2 -0
  107. package/dist/types/components/icon-button/styles.d.ts +522 -0
  108. package/dist/types/components/icon-button/types.d.ts +26 -0
  109. package/dist/types/components/icon-link-button/IconLinkButton.d.ts +2 -0
  110. package/dist/types/components/icon-link-button/styles.d.ts +522 -0
  111. package/dist/types/components/icon-link-button/types.d.ts +26 -0
  112. package/dist/types/components/link-button/LinkButton.d.ts +2 -0
  113. package/dist/types/components/link-button/styles.d.ts +522 -0
  114. package/dist/types/components/link-button/types.d.ts +18 -0
  115. package/dist/types/components/typography/Typography.d.ts +6 -0
  116. package/dist/types/components/typography/styles.d.ts +7 -0
  117. package/dist/types/components/typography/types.d.ts +13 -0
  118. package/dist/types/components/user-menu/PreferenceRadioGroup.d.ts +15 -0
  119. package/dist/types/components/user-menu/UserMenu.d.ts +17 -0
  120. package/dist/types/components/user-menu/default-options.d.ts +5 -0
  121. package/dist/types/components/user-menu/model.d.ts +9 -0
  122. package/dist/types/components/user-menu/styles.d.ts +9 -0
  123. package/dist/types/components/user-menu/theme.d.ts +3 -0
  124. package/dist/types/components/user-menu/types.d.ts +5 -0
  125. package/dist/types/fonts/material-symbols-types.d.ts +3822 -0
  126. package/dist/types/icon-button.d.ts +20 -0
  127. package/dist/types/icon-link-button.d.ts +20 -0
  128. package/dist/types/icon.d.ts +27 -0
  129. package/dist/types/index.d.ts +17 -0
  130. package/dist/types/link-button.d.ts +20 -0
  131. package/dist/types/styleD/build/typescript/base/colors.d.ts +1 -1
  132. package/dist/types/styleD/build/typescript/base/sizing.d.ts +2 -0
  133. package/dist/types/styleD/build/typescript/component/avatar.d.ts +88 -0
  134. package/dist/types/styleD/build/typescript/component/button.d.ts +523 -0
  135. package/dist/types/styleD/build/typescript/component/icon.d.ts +19 -0
  136. package/dist/types/styleD/build/typescript/component/typography.d.ts +7 -0
  137. package/dist/types/styleD/build/typescript/component/userMenu.d.ts +37 -0
  138. package/dist/types/styleD/build/typescript/semantic/colors.d.ts +7 -3
  139. package/dist/types/styleD/build/typescript/semantic/sizing.d.ts +1 -0
  140. package/dist/types/styleD/build/typescript/semantic/typography.d.ts +5 -0
  141. package/dist/types/typography.d.ts +19 -0
  142. package/dist/types/user-menu.d.ts +18 -0
  143. package/dist/types/util/reset.d.ts +1 -0
  144. package/dist/types/util/storybookStyles.d.ts +1 -0
  145. package/dist/types/util/types.d.ts +28 -0
  146. package/dist/types/utils.d.ts +1 -0
  147. package/dist/typography.cjs +9 -0
  148. package/dist/typography.js +2 -0
  149. package/dist/user-menu.cjs +9 -0
  150. package/dist/user-menu.js +2 -0
  151. package/dist/util/css/reset.css +124 -0
  152. package/dist/util/reset.cjs +10 -0
  153. package/dist/util/reset.css.cjs +5 -0
  154. package/dist/util/reset.css.js +3 -0
  155. package/dist/util/reset.js +8 -0
  156. package/dist/utils.cjs +2 -0
  157. package/dist/utils.js +1 -0
  158. package/package.json +81 -3
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var react = require('react');
5
+ var reactAriaComponents = require('react-aria-components');
6
+ var mergeDeep = require('../../util/mergeDeep.cjs');
7
+ var Icon = require('../icon/Icon.cjs');
8
+ var styles = require('./styles.cjs');
9
+
10
+ function IconLinkButton({
11
+ variant = "emphasised-primary",
12
+ size = "md",
13
+ symbol,
14
+ ariaLabel,
15
+ theme = {},
16
+ cssOverrides,
17
+ ...props
18
+ }) {
19
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultIconLinkButtonTheme, theme);
20
+ const linkRef = react.useRef(null);
21
+ react.useEffect(() => {
22
+ if (linkRef.current) {
23
+ linkRef.current.title = ariaLabel;
24
+ }
25
+ }, [ariaLabel]);
26
+ const iconSize = size === "xs" ? "sm" : size;
27
+ return /* @__PURE__ */ jsxRuntime.jsx(
28
+ reactAriaComponents.Link,
29
+ {
30
+ ...props,
31
+ ref: linkRef,
32
+ "aria-label": ariaLabel,
33
+ css: [
34
+ styles.iconLinkButtonStyles(
35
+ mergedTheme,
36
+ { variant, size },
37
+ false,
38
+ true
39
+ ),
40
+ cssOverrides
41
+ ],
42
+ children: reactAriaComponents.composeRenderProps(props.children, (children) => /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, symbol, children }))
43
+ }
44
+ );
45
+ }
46
+
47
+ exports.IconLinkButton = IconLinkButton;
@@ -0,0 +1,23 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import { useRef, useEffect } from 'react';
3
+ import { Link, composeRenderProps } from 'react-aria-components';
4
+ import { mergeDeep } from '../../util/mergeDeep.js';
5
+ import { Icon } from '../icon/Icon.js';
6
+ import { iconLinkButtonStyles, defaultIconLinkButtonTheme } from './styles.js';
7
+
8
+ function IconLinkButton({ variant = "emphasised-primary", size = "md", symbol, ariaLabel, theme = {}, cssOverrides, ...props }) {
9
+ const mergedTheme = mergeDeep(defaultIconLinkButtonTheme, theme);
10
+ const linkRef = useRef(null);
11
+ useEffect(() => {
12
+ if (linkRef.current) {
13
+ linkRef.current.title = ariaLabel;
14
+ }
15
+ }, [ariaLabel]);
16
+ const iconSize = size === "xs" ? "sm" : size;
17
+ return jsx(Link, { ...props, ref: linkRef, "aria-label": ariaLabel, css: [
18
+ iconLinkButtonStyles(mergedTheme, { variant, size }, false, true),
19
+ cssOverrides
20
+ ], children: composeRenderProps(props.children, (children) => jsx(Icon, { size: iconSize, symbol, children })) });
21
+ }
22
+
23
+ export { IconLinkButton };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var styles = require('../button/styles.cjs');
4
+
5
+ const defaultIconLinkButtonTheme = styles.defaultButtonTheme;
6
+ const iconLinkButtonStyles = styles.buttonStyles;
7
+
8
+ exports.defaultIconLinkButtonTheme = defaultIconLinkButtonTheme;
9
+ exports.iconLinkButtonStyles = iconLinkButtonStyles;
@@ -0,0 +1,6 @@
1
+ import { buttonStyles, defaultButtonTheme } from '../button/styles.js';
2
+
3
+ const defaultIconLinkButtonTheme = defaultButtonTheme;
4
+ const iconLinkButtonStyles = buttonStyles;
5
+
6
+ export { defaultIconLinkButtonTheme, iconLinkButtonStyles };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var reactAriaComponents = require('react-aria-components');
5
+ var mergeDeep = require('../../util/mergeDeep.cjs');
6
+ var Icon = require('../icon/Icon.cjs');
7
+ var styles = require('./styles.cjs');
8
+
9
+ function LinkButton({
10
+ variant = "emphasised-primary",
11
+ size = "md",
12
+ theme = {},
13
+ cssOverrides,
14
+ icon,
15
+ ...props
16
+ }) {
17
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultLinkButtonTheme, theme);
18
+ const iconSize = size === "xs" ? "sm" : size;
19
+ return /* @__PURE__ */ jsxRuntime.jsx(
20
+ reactAriaComponents.Link,
21
+ {
22
+ ...props,
23
+ css: [
24
+ styles.linkButtonStyles(mergedTheme, { variant, size }, !!icon),
25
+ cssOverrides
26
+ ],
27
+ children: reactAriaComponents.composeRenderProps(props.children, (children) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
28
+ icon && /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: icon }),
29
+ children
30
+ ] }))
31
+ }
32
+ );
33
+ }
34
+
35
+ exports.LinkButton = LinkButton;
@@ -0,0 +1,16 @@
1
+ import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
+ import { Link, composeRenderProps } from 'react-aria-components';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { Icon } from '../icon/Icon.js';
5
+ import { linkButtonStyles, defaultLinkButtonTheme } from './styles.js';
6
+
7
+ function LinkButton({ variant = "emphasised-primary", size = "md", theme = {}, cssOverrides, icon, ...props }) {
8
+ const mergedTheme = mergeDeep(defaultLinkButtonTheme, theme);
9
+ const iconSize = size === "xs" ? "sm" : size;
10
+ return jsx(Link, { ...props, css: [
11
+ linkButtonStyles(mergedTheme, { variant, size }, !!icon),
12
+ cssOverrides
13
+ ], children: composeRenderProps(props.children, (children) => jsxs(Fragment, { children: [icon && jsx(Icon, { size: iconSize, children: icon }), children] })) });
14
+ }
15
+
16
+ export { LinkButton };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var styles = require('../button/styles.cjs');
4
+
5
+ const defaultLinkButtonTheme = styles.defaultButtonTheme;
6
+ const linkButtonStyles = styles.buttonStyles;
7
+
8
+ exports.defaultLinkButtonTheme = defaultLinkButtonTheme;
9
+ exports.linkButtonStyles = linkButtonStyles;
@@ -0,0 +1,6 @@
1
+ import { buttonStyles, defaultButtonTheme } from '../button/styles.js';
2
+
3
+ const defaultLinkButtonTheme = defaultButtonTheme;
4
+ const linkButtonStyles = buttonStyles;
5
+
6
+ export { defaultLinkButtonTheme, linkButtonStyles };
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var mergeDeep = require('../../util/mergeDeep.cjs');
5
+ var styles = require('./styles.cjs');
6
+
7
+ const Typography = ({
8
+ element = "span",
9
+ variant = "body-md",
10
+ children,
11
+ cssOverrides,
12
+ theme = {},
13
+ ...props
14
+ }) => {
15
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultTypographyTheme, theme);
16
+ return react.jsx(
17
+ element,
18
+ {
19
+ css: [styles.typographyStyles(mergedTheme, { variant }), cssOverrides],
20
+ ...props
21
+ },
22
+ children
23
+ );
24
+ };
25
+
26
+ exports.Typography = Typography;
@@ -0,0 +1,13 @@
1
+ import { jsx } from '@emotion/react';
2
+ import { mergeDeep } from '../../util/mergeDeep.js';
3
+ import { typographyStyles, defaultTypographyTheme } from './styles.js';
4
+
5
+ const Typography = ({ element = "span", variant = "body-md", children, cssOverrides, theme = {}, ...props }) => {
6
+ const mergedTheme = mergeDeep(defaultTypographyTheme, theme);
7
+ return jsx(element, {
8
+ css: [typographyStyles(mergedTheme, { variant }), cssOverrides],
9
+ ...props
10
+ }, children);
11
+ };
12
+
13
+ export { Typography };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var typography$2 = require('../../styleD/build/typescript/component/typography.cjs');
5
+ var typography = require('../../styleD/utils/semantic/typography.cjs');
6
+ var typography$1 = require('../../styleD/build/typescript/semantic/typography.cjs');
7
+
8
+ const defaultTypographyTheme = typography$2.componentTypography;
9
+ const typographyStyles = (theme, { variant }) => react.css`
10
+ ${typography.convertTypographyToEmotionStringStyle(typography$1.semanticTypography[variant])}
11
+ color: ${theme.color};
12
+ `;
13
+
14
+ exports.defaultTypographyTheme = defaultTypographyTheme;
15
+ exports.typographyStyles = typographyStyles;
@@ -0,0 +1,12 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentTypography } from '../../styleD/build/typescript/component/typography.js';
3
+ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
+ import { semanticTypography } from '../../styleD/build/typescript/semantic/typography.js';
5
+
6
+ const defaultTypographyTheme = componentTypography;
7
+ const typographyStyles = (theme, { variant }) => css`
8
+ ${convertTypographyToEmotionStringStyle(semanticTypography[variant])}
9
+ color: ${theme.color};
10
+ `;
11
+
12
+ export { defaultTypographyTheme, typographyStyles };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var react = require('@emotion/react');
5
+ var reactAriaComponents = require('react-aria-components');
6
+ var styles = require('./styles.cjs');
7
+
8
+ function PreferenceRadioGroup({
9
+ name,
10
+ options,
11
+ currentValue,
12
+ changeValue,
13
+ theme,
14
+ format = "stack"
15
+ }) {
16
+ const groupCss = format === "stack" ? styles.toggleButtonStackedGroupStyles(theme) : styles.toggleButtonRowsGroupStyles(theme);
17
+ const buttonStyle = format === "stack" ? styles.toggleButtonStyles(theme) : [styles.toggleButtonStyles(theme), react.css({ flexBasis: "30%" })];
18
+ const defaultOptionId = options.find((option) => option.isDefault)?.id;
19
+ const selectedKeys = currentValue ? [currentValue] : defaultOptionId ? [defaultOptionId] : [];
20
+ return /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
21
+ /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.radioGroupLabelStyles(theme), children: name }),
22
+ /* @__PURE__ */ jsxRuntime.jsx(
23
+ reactAriaComponents.ToggleButtonGroup,
24
+ {
25
+ css: groupCss,
26
+ selectionMode: "single",
27
+ orientation: format === "stack" ? "vertical" : "horizontal",
28
+ selectedKeys,
29
+ onSelectionChange: (e) => {
30
+ const newValue = Array.from(e).pop() ?? currentValue;
31
+ if (typeof newValue === "string") {
32
+ changeValue(newValue);
33
+ }
34
+ },
35
+ children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
36
+ reactAriaComponents.ToggleButton,
37
+ {
38
+ id: option.id,
39
+ css: buttonStyle,
40
+ style: option.buttonStyle,
41
+ children: [
42
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: option.labelStyle, children: option.label ?? option.id }),
43
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: option.description })
44
+ ]
45
+ },
46
+ index
47
+ ))
48
+ }
49
+ )
50
+ ] });
51
+ }
52
+
53
+ exports.PreferenceRadioGroup = PreferenceRadioGroup;
@@ -0,0 +1,19 @@
1
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
+ import { css } from '@emotion/react';
3
+ import { ToggleButtonGroup, ToggleButton } from 'react-aria-components';
4
+ import { toggleButtonStackedGroupStyles, toggleButtonRowsGroupStyles, toggleButtonStyles, radioGroupLabelStyles } from './styles.js';
5
+
6
+ function PreferenceRadioGroup({ name, options, currentValue, changeValue, theme, format = "stack" }) {
7
+ const groupCss = format === "stack" ? toggleButtonStackedGroupStyles(theme) : toggleButtonRowsGroupStyles(theme);
8
+ const buttonStyle = format === "stack" ? toggleButtonStyles(theme) : [toggleButtonStyles(theme), css({ flexBasis: "30%" })];
9
+ const defaultOptionId = options.find((option) => option.isDefault)?.id;
10
+ const selectedKeys = currentValue ? [currentValue] : defaultOptionId ? [defaultOptionId] : [];
11
+ return jsxs("label", { children: [jsx("div", { css: radioGroupLabelStyles(theme), children: name }), jsx(ToggleButtonGroup, { css: groupCss, selectionMode: "single", orientation: format === "stack" ? "vertical" : "horizontal", selectedKeys, onSelectionChange: (e) => {
12
+ const newValue = Array.from(e).pop() ?? currentValue;
13
+ if (typeof newValue === "string") {
14
+ changeValue(newValue);
15
+ }
16
+ }, children: options.map((option, index) => jsxs(ToggleButton, { id: option.id, css: buttonStyle, style: option.buttonStyle, children: [jsx("div", { style: option.labelStyle, children: option.label ?? option.id }), jsx("div", { children: option.description })] }, index)) })] });
17
+ }
18
+
19
+ export { PreferenceRadioGroup };
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var TitleText = require('../TitleText.cjs');
5
+ var defaultOptions = require('./default-options.cjs');
6
+ var PreferenceRadioGroup = require('./PreferenceRadioGroup.cjs');
7
+ var styles = require('./styles.cjs');
8
+
9
+ function UserMenu({
10
+ theme,
11
+ feedBacklink,
12
+ preferences,
13
+ updatePreferences,
14
+ textSizeOptions,
15
+ fontFamilyOptions,
16
+ colorSchemeOptions,
17
+ headingLevel
18
+ }) {
19
+ return /* @__PURE__ */ jsxRuntime.jsxs("aside", { css: styles.userMenuStyles(theme), children: [
20
+ /* @__PURE__ */ jsxRuntime.jsx(
21
+ TitleText.TitleText,
22
+ {
23
+ headingLevel,
24
+ css: styles.userMenuHeadingStyles(theme),
25
+ children: "Accessibility Settings"
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
29
+ "Customise your reading & writing experience.",
30
+ " ",
31
+ feedBacklink && /* @__PURE__ */ jsxRuntime.jsx("a", { href: feedBacklink, target: "_blank", rel: "noreferrer", children: "Send feedback" })
32
+ ] }) }),
33
+ (!textSizeOptions || textSizeOptions.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
34
+ PreferenceRadioGroup.PreferenceRadioGroup,
35
+ {
36
+ theme,
37
+ options: textSizeOptions ?? defaultOptions.textSizes,
38
+ name: "Text Size",
39
+ currentValue: preferences.fontpreferences,
40
+ changeValue: (fontpreferences) => updatePreferences({ fontpreferences })
41
+ }
42
+ ),
43
+ (!fontFamilyOptions || fontFamilyOptions.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
44
+ PreferenceRadioGroup.PreferenceRadioGroup,
45
+ {
46
+ theme,
47
+ options: fontFamilyOptions ?? defaultOptions.fontFamilies,
48
+ name: "Font Family",
49
+ currentValue: preferences.fontType,
50
+ changeValue: (fontType) => updatePreferences({ fontType })
51
+ }
52
+ ),
53
+ (!colorSchemeOptions || colorSchemeOptions.length > 0) && /* @__PURE__ */ jsxRuntime.jsx(
54
+ PreferenceRadioGroup.PreferenceRadioGroup,
55
+ {
56
+ theme,
57
+ format: "rows",
58
+ options: colorSchemeOptions ?? defaultOptions.colorSchemes,
59
+ name: "Color scheme",
60
+ currentValue: preferences.colorScheme,
61
+ changeValue: (colorScheme) => updatePreferences({ colorScheme })
62
+ }
63
+ )
64
+ ] });
65
+ }
66
+
67
+ exports.UserMenu = UserMenu;
@@ -0,0 +1,11 @@
1
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
+ import { TitleText } from '../TitleText.js';
3
+ import { textSizes, fontFamilies, colorSchemes } from './default-options.js';
4
+ import { PreferenceRadioGroup } from './PreferenceRadioGroup.js';
5
+ import { userMenuStyles, userMenuHeadingStyles } from './styles.js';
6
+
7
+ function UserMenu({ theme, feedBacklink, preferences, updatePreferences, textSizeOptions, fontFamilyOptions, colorSchemeOptions, headingLevel }) {
8
+ return jsxs("aside", { css: userMenuStyles(theme), children: [jsx(TitleText, { headingLevel, css: userMenuHeadingStyles(theme), children: "Accessibility Settings" }), jsx("div", { children: jsxs("p", { children: ["Customise your reading & writing experience.", " ", feedBacklink && jsx("a", { href: feedBacklink, target: "_blank", rel: "noreferrer", children: "Send feedback" })] }) }), (!textSizeOptions || textSizeOptions.length > 0) && jsx(PreferenceRadioGroup, { theme, options: textSizeOptions ?? textSizes, name: "Text Size", currentValue: preferences.fontpreferences, changeValue: (fontpreferences) => updatePreferences({ fontpreferences }) }), (!fontFamilyOptions || fontFamilyOptions.length > 0) && jsx(PreferenceRadioGroup, { theme, options: fontFamilyOptions ?? fontFamilies, name: "Font Family", currentValue: preferences.fontType, changeValue: (fontType) => updatePreferences({ fontType }) }), (!colorSchemeOptions || colorSchemeOptions.length > 0) && jsx(PreferenceRadioGroup, { theme, format: "rows", options: colorSchemeOptions ?? colorSchemes, name: "Color scheme", currentValue: preferences.colorScheme, changeValue: (colorScheme) => updatePreferences({ colorScheme }) })] });
9
+ }
10
+
11
+ export { UserMenu };
@@ -0,0 +1,109 @@
1
+ 'use strict';
2
+
3
+ var spacing = require('../../styleD/build/typescript/base/spacing.cjs');
4
+ var typography = require('../../styleD/build/typescript/base/typography.cjs');
5
+
6
+ const textSizes = [
7
+ {
8
+ id: "font-preference-small",
9
+ label: "Small",
10
+ description: "Compact reading",
11
+ labelStyle: {
12
+ fontSize: typography.baseTypography.size["12-px"]
13
+ }
14
+ },
15
+ {
16
+ id: "font-preference-medium",
17
+ label: "Medium",
18
+ description: "Standard reading",
19
+ labelStyle: {
20
+ fontSize: typography.baseTypography.size["16-px"]
21
+ }
22
+ },
23
+ {
24
+ id: "font-preference-large",
25
+ label: "Large",
26
+ description: "Comfortable reading",
27
+ labelStyle: {
28
+ fontSize: typography.baseTypography.size["20-px"]
29
+ }
30
+ }
31
+ ];
32
+ const fontFamilies = [
33
+ {
34
+ id: "font-serif",
35
+ label: "Guardian Text Egyptian",
36
+ description: "Classic Guardian Serif",
37
+ labelStyle: {
38
+ fontFamily: typography.baseTypography.family["Guardian Text Egyptian"],
39
+ fontSize: typography.baseTypography.size["20-px"]
40
+ }
41
+ },
42
+ {
43
+ id: "open-sans-compact",
44
+ label: "Open Sans Compact",
45
+ description: "compact sans-Serif",
46
+ labelStyle: {
47
+ fontFamily: typography.baseTypography.family["Open Sans Compact"],
48
+ fontSize: typography.baseTypography.size["20-px"]
49
+ }
50
+ },
51
+ {
52
+ id: "open-sans",
53
+ label: "Open Sans",
54
+ description: "Sans-Serif",
55
+ labelStyle: {
56
+ fontFamily: typography.baseTypography.family["Open Sans"],
57
+ fontSize: typography.baseTypography.size["20-px"]
58
+ }
59
+ }
60
+ ];
61
+ const colorSchemes = [
62
+ {
63
+ id: "white",
64
+ buttonStyle: {
65
+ backgroundColor: "white",
66
+ padding: spacing.baseSpacing["10-rem"]
67
+ },
68
+ isDefault: true
69
+ },
70
+ {
71
+ id: "cream",
72
+ buttonStyle: {
73
+ backgroundColor: "antiquewhite",
74
+ padding: spacing.baseSpacing["10-rem"]
75
+ }
76
+ },
77
+ {
78
+ id: "green",
79
+ buttonStyle: {
80
+ backgroundColor: "lightgreen",
81
+ padding: spacing.baseSpacing["10-rem"]
82
+ }
83
+ },
84
+ {
85
+ id: "pink",
86
+ buttonStyle: {
87
+ backgroundColor: "pink",
88
+ padding: spacing.baseSpacing["10-rem"]
89
+ }
90
+ },
91
+ {
92
+ id: "blue",
93
+ buttonStyle: {
94
+ backgroundColor: "skyblue",
95
+ padding: spacing.baseSpacing["10-rem"]
96
+ }
97
+ },
98
+ {
99
+ id: "orange",
100
+ buttonStyle: {
101
+ backgroundColor: "orange",
102
+ padding: spacing.baseSpacing["10-rem"]
103
+ }
104
+ }
105
+ ];
106
+
107
+ exports.colorSchemes = colorSchemes;
108
+ exports.fontFamilies = fontFamilies;
109
+ exports.textSizes = textSizes;
@@ -0,0 +1,105 @@
1
+ import { baseSpacing } from '../../styleD/build/typescript/base/spacing.js';
2
+ import { baseTypography } from '../../styleD/build/typescript/base/typography.js';
3
+
4
+ const textSizes = [
5
+ {
6
+ id: "font-preference-small",
7
+ label: "Small",
8
+ description: "Compact reading",
9
+ labelStyle: {
10
+ fontSize: baseTypography.size["12-px"]
11
+ }
12
+ },
13
+ {
14
+ id: "font-preference-medium",
15
+ label: "Medium",
16
+ description: "Standard reading",
17
+ labelStyle: {
18
+ fontSize: baseTypography.size["16-px"]
19
+ }
20
+ },
21
+ {
22
+ id: "font-preference-large",
23
+ label: "Large",
24
+ description: "Comfortable reading",
25
+ labelStyle: {
26
+ fontSize: baseTypography.size["20-px"]
27
+ }
28
+ }
29
+ ];
30
+ const fontFamilies = [
31
+ {
32
+ id: "font-serif",
33
+ label: "Guardian Text Egyptian",
34
+ description: "Classic Guardian Serif",
35
+ labelStyle: {
36
+ fontFamily: baseTypography.family["Guardian Text Egyptian"],
37
+ fontSize: baseTypography.size["20-px"]
38
+ }
39
+ },
40
+ {
41
+ id: "open-sans-compact",
42
+ label: "Open Sans Compact",
43
+ description: "compact sans-Serif",
44
+ labelStyle: {
45
+ fontFamily: baseTypography.family["Open Sans Compact"],
46
+ fontSize: baseTypography.size["20-px"]
47
+ }
48
+ },
49
+ {
50
+ id: "open-sans",
51
+ label: "Open Sans",
52
+ description: "Sans-Serif",
53
+ labelStyle: {
54
+ fontFamily: baseTypography.family["Open Sans"],
55
+ fontSize: baseTypography.size["20-px"]
56
+ }
57
+ }
58
+ ];
59
+ const colorSchemes = [
60
+ {
61
+ id: "white",
62
+ buttonStyle: {
63
+ backgroundColor: "white",
64
+ padding: baseSpacing["10-rem"]
65
+ },
66
+ isDefault: true
67
+ },
68
+ {
69
+ id: "cream",
70
+ buttonStyle: {
71
+ backgroundColor: "antiquewhite",
72
+ padding: baseSpacing["10-rem"]
73
+ }
74
+ },
75
+ {
76
+ id: "green",
77
+ buttonStyle: {
78
+ backgroundColor: "lightgreen",
79
+ padding: baseSpacing["10-rem"]
80
+ }
81
+ },
82
+ {
83
+ id: "pink",
84
+ buttonStyle: {
85
+ backgroundColor: "pink",
86
+ padding: baseSpacing["10-rem"]
87
+ }
88
+ },
89
+ {
90
+ id: "blue",
91
+ buttonStyle: {
92
+ backgroundColor: "skyblue",
93
+ padding: baseSpacing["10-rem"]
94
+ }
95
+ },
96
+ {
97
+ id: "orange",
98
+ buttonStyle: {
99
+ backgroundColor: "orange",
100
+ padding: baseSpacing["10-rem"]
101
+ }
102
+ }
103
+ ];
104
+
105
+ export { colorSchemes, fontFamilies, textSizes };