@guardian/stand 0.0.8 → 0.0.10

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 (170) hide show
  1. package/README.md +1148 -10
  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/byline.cjs +9 -0
  7. package/dist/byline.js +2 -0
  8. package/dist/components/TitleText.cjs +28 -0
  9. package/dist/components/TitleText.js +22 -0
  10. package/dist/components/avatar/Avatar.cjs +57 -0
  11. package/dist/components/avatar/Avatar.js +27 -0
  12. package/dist/components/avatar/styles.cjs +33 -0
  13. package/dist/components/avatar/styles.js +29 -0
  14. package/dist/components/avatar/types.cjs +16 -0
  15. package/dist/components/avatar/types.js +14 -0
  16. package/dist/components/button/Button.cjs +29 -0
  17. package/dist/components/button/Button.js +14 -0
  18. package/dist/components/button/styles.cjs +58 -0
  19. package/dist/components/button/styles.js +53 -0
  20. package/dist/components/byline/styles.cjs +5 -5
  21. package/dist/components/byline/styles.js +1 -1
  22. package/dist/components/icon/Icon.cjs +46 -0
  23. package/dist/components/icon/Icon.js +19 -0
  24. package/dist/components/icon/styles.cjs +27 -0
  25. package/dist/components/icon/styles.js +20 -0
  26. package/dist/components/link-button/LinkButton.cjs +29 -0
  27. package/dist/components/link-button/LinkButton.js +14 -0
  28. package/dist/components/link-button/styles.cjs +9 -0
  29. package/dist/components/link-button/styles.js +6 -0
  30. package/dist/components/tag-picker/styles.cjs +11 -11
  31. package/dist/components/tag-picker/styles.js +1 -1
  32. package/dist/components/typography/Typography.cjs +26 -0
  33. package/dist/components/typography/Typography.js +13 -0
  34. package/dist/components/typography/styles.cjs +15 -0
  35. package/dist/components/typography/styles.js +12 -0
  36. package/dist/components/user-menu/PreferenceRadioGroup.cjs +53 -0
  37. package/dist/components/user-menu/PreferenceRadioGroup.js +19 -0
  38. package/dist/components/user-menu/UserMenu.cjs +67 -0
  39. package/dist/components/user-menu/UserMenu.js +11 -0
  40. package/dist/components/user-menu/default-options.cjs +109 -0
  41. package/dist/components/user-menu/default-options.js +105 -0
  42. package/dist/components/user-menu/styles.cjs +90 -0
  43. package/dist/components/user-menu/styles.js +83 -0
  44. package/dist/fonts/MaterialSymbolsOutlined.css +23 -0
  45. package/dist/fonts/MaterialSymbolsRound.css +23 -0
  46. package/dist/fonts/MaterialSymbolsSharp.css +23 -0
  47. package/dist/fonts/material-symbols-types.ts +3825 -0
  48. package/dist/icon.cjs +9 -0
  49. package/dist/icon.js +2 -0
  50. package/dist/index.cjs +22 -13
  51. package/dist/index.js +9 -4
  52. package/dist/link-button.cjs +7 -0
  53. package/dist/link-button.js +1 -0
  54. package/dist/styleD/build/css/{css/base → base}/colors.css +1 -1
  55. package/dist/styleD/build/css/{css/base → base}/sizing.css +4 -0
  56. package/dist/styleD/build/css/{css/base → base}/spacing.css +4 -0
  57. package/dist/styleD/build/css/{css/base → base}/typography.css +1 -0
  58. package/dist/styleD/build/css/component/avatar.css +54 -0
  59. package/dist/styleD/build/css/component/button.css +218 -0
  60. package/dist/styleD/build/css/{css/component → component}/byline.css +1 -1
  61. package/dist/styleD/build/css/component/icon.css +11 -0
  62. package/dist/styleD/build/css/component/typography.css +7 -0
  63. package/dist/styleD/build/css/component/userMenu.css +29 -0
  64. package/dist/styleD/build/css/semantic/colors.css +69 -0
  65. package/dist/styleD/build/css/{css/semantic → semantic}/sizing.css +2 -0
  66. package/dist/styleD/build/css/{css/semantic → semantic}/typography.css +9 -0
  67. package/dist/styleD/build/typescript/base/colors.cjs +1 -1
  68. package/dist/styleD/build/typescript/base/colors.js +1 -1
  69. package/dist/styleD/build/typescript/base/sizing.cjs +4 -0
  70. package/dist/styleD/build/typescript/base/sizing.js +4 -0
  71. package/dist/styleD/build/typescript/base/spacing.cjs +4 -0
  72. package/dist/styleD/build/typescript/base/spacing.js +4 -0
  73. package/dist/styleD/build/typescript/base/typography.cjs +2 -1
  74. package/dist/styleD/build/typescript/base/typography.js +2 -1
  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 +331 -0
  78. package/dist/styleD/build/typescript/component/button.js +329 -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 +47 -5
  88. package/dist/styleD/build/typescript/semantic/colors.js +47 -5
  89. package/dist/styleD/build/typescript/semantic/sizing.cjs +3 -1
  90. package/dist/styleD/build/typescript/semantic/sizing.js +3 -1
  91. package/dist/styleD/build/typescript/semantic/typography.cjs +15 -0
  92. package/dist/styleD/build/typescript/semantic/typography.js +15 -0
  93. package/dist/tag-picker.cjs +13 -0
  94. package/dist/tag-picker.js +4 -0
  95. package/dist/types/avatar.d.ts +19 -0
  96. package/dist/types/button.d.ts +20 -0
  97. package/dist/types/byline.d.ts +25 -0
  98. package/dist/types/components/TitleText.d.ts +6 -0
  99. package/dist/types/components/avatar/Avatar.d.ts +2 -0
  100. package/dist/types/components/avatar/styles.d.ts +8 -0
  101. package/dist/types/components/avatar/types.d.ts +45 -0
  102. package/dist/types/components/button/Button.d.ts +2 -0
  103. package/dist/types/components/button/styles.d.ts +7 -0
  104. package/dist/types/components/button/types.d.ts +13 -0
  105. package/dist/types/components/byline/Byline.d.ts +1 -1
  106. package/dist/types/components/byline/schema.d.ts +1 -1
  107. package/dist/types/components/byline/styles.d.ts +1 -1
  108. package/dist/types/components/byline/theme.d.ts +1 -1
  109. package/dist/types/components/icon/Icon.d.ts +2 -0
  110. package/dist/types/components/icon/styles.d.ts +8 -0
  111. package/dist/types/components/icon/types.d.ts +28 -0
  112. package/dist/types/components/link-button/LinkButton.d.ts +2 -0
  113. package/dist/types/components/link-button/styles.d.ts +330 -0
  114. package/dist/types/components/link-button/types.d.ts +13 -0
  115. package/dist/types/components/tag-picker/TagAutocomplete.d.ts +1 -1
  116. package/dist/types/components/tag-picker/TagTable.d.ts +1 -1
  117. package/dist/types/components/tag-picker/styles.d.ts +1 -1
  118. package/dist/types/components/typography/Typography.d.ts +6 -0
  119. package/dist/types/components/typography/styles.d.ts +7 -0
  120. package/dist/types/components/typography/types.d.ts +13 -0
  121. package/dist/types/components/user-menu/PreferenceRadioGroup.d.ts +15 -0
  122. package/dist/types/components/user-menu/UserMenu.d.ts +17 -0
  123. package/dist/types/components/user-menu/default-options.d.ts +5 -0
  124. package/dist/types/components/user-menu/model.d.ts +9 -0
  125. package/dist/types/components/user-menu/styles.d.ts +9 -0
  126. package/dist/types/components/user-menu/theme.d.ts +3 -0
  127. package/dist/types/components/user-menu/types.d.ts +5 -0
  128. package/dist/types/fonts/material-symbols-types.d.ts +3822 -0
  129. package/dist/types/icon.d.ts +27 -0
  130. package/dist/types/index.d.ts +25 -7
  131. package/dist/types/link-button.d.ts +20 -0
  132. package/dist/types/styleD/build/typescript/base/colors.d.ts +1 -1
  133. package/dist/types/styleD/build/typescript/base/sizing.d.ts +4 -0
  134. package/dist/types/styleD/build/typescript/base/spacing.d.ts +4 -0
  135. package/dist/types/styleD/build/typescript/base/typography.d.ts +1 -0
  136. package/dist/types/styleD/build/typescript/component/avatar.d.ts +88 -0
  137. package/dist/types/styleD/build/typescript/component/button.d.ts +331 -0
  138. package/dist/types/styleD/build/typescript/component/icon.d.ts +19 -0
  139. package/dist/types/styleD/build/typescript/component/typography.d.ts +7 -0
  140. package/dist/types/styleD/build/typescript/component/userMenu.d.ts +37 -0
  141. package/dist/types/styleD/build/typescript/semantic/colors.d.ts +45 -3
  142. package/dist/types/styleD/build/typescript/semantic/sizing.d.ts +2 -0
  143. package/dist/types/styleD/build/typescript/semantic/typography.d.ts +15 -0
  144. package/dist/types/tag-picker.d.ts +21 -0
  145. package/dist/types/typography.d.ts +19 -0
  146. package/dist/types/user-menu.d.ts +18 -0
  147. package/dist/types/util/mergeDeep.d.ts +1 -0
  148. package/dist/types/util/reset.d.ts +1 -0
  149. package/dist/types/util/storybookStyles.d.ts +1 -0
  150. package/dist/types/util/types.d.ts +34 -0
  151. package/dist/types/utils.d.ts +7 -0
  152. package/dist/typography.cjs +9 -0
  153. package/dist/typography.js +2 -0
  154. package/dist/user-menu.cjs +9 -0
  155. package/dist/user-menu.js +2 -0
  156. package/dist/util/css/reset.css +124 -0
  157. package/dist/util/reset.cjs +10 -0
  158. package/dist/util/reset.css.cjs +5 -0
  159. package/dist/util/reset.css.js +3 -0
  160. package/dist/util/reset.js +8 -0
  161. package/dist/utils.cjs +10 -0
  162. package/dist/utils.js +2 -0
  163. package/package.json +112 -3
  164. package/dist/styleD/build/css/css/semantic/colors.css +0 -29
  165. package/dist/types/components/util.d.ts +0 -4
  166. /package/dist/styleD/build/css/{css/base → base}/radius.css +0 -0
  167. /package/dist/styleD/build/css/{css/component → component}/tagAutocomplete.css +0 -0
  168. /package/dist/styleD/build/css/{css/component → component}/tagTable.css +0 -0
  169. /package/dist/{components/util.cjs → util/mergeDeep.cjs} +0 -0
  170. /package/dist/{components/util.js → util/mergeDeep.js} +0 -0
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Avatar = require('./components/avatar/Avatar.cjs');
4
+ var avatar = require('./styleD/build/typescript/component/avatar.cjs');
5
+
6
+
7
+
8
+ exports.Avatar = Avatar.Avatar;
9
+ exports.componentAvatar = avatar.componentAvatar;
package/dist/avatar.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Avatar } from './components/avatar/Avatar.js';
2
+ export { componentAvatar } from './styleD/build/typescript/component/avatar.js';
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Button = require('./components/button/Button.cjs');
4
+ var button = require('./styleD/build/typescript/component/button.cjs');
5
+
6
+
7
+
8
+ exports.Button = Button.Button;
9
+ exports.componentButton = button.componentButton;
package/dist/button.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Button } from './components/button/Button.js';
2
+ export { componentButton } from './styleD/build/typescript/component/button.js';
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Byline = require('./components/byline/Byline.cjs');
4
+ var byline = require('./styleD/build/typescript/component/byline.cjs');
5
+
6
+
7
+
8
+ exports.Byline = Byline.Byline;
9
+ exports.componentByline = byline.componentByline;
package/dist/byline.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Byline } from './components/byline/Byline.js';
2
+ export { componentByline } from './styleD/build/typescript/component/byline.js';
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+
5
+ const TitleText = ({
6
+ headingLevel,
7
+ children,
8
+ className
9
+ }) => {
10
+ switch (headingLevel) {
11
+ case 1:
12
+ return /* @__PURE__ */ jsxRuntime.jsx("h1", { className, children });
13
+ case 2:
14
+ return /* @__PURE__ */ jsxRuntime.jsx("h2", { className, children });
15
+ case 3:
16
+ return /* @__PURE__ */ jsxRuntime.jsx("h3", { className, children });
17
+ case 4:
18
+ return /* @__PURE__ */ jsxRuntime.jsx("h4", { className, children });
19
+ case 5:
20
+ return /* @__PURE__ */ jsxRuntime.jsx("h5", { className, children });
21
+ case 6:
22
+ return /* @__PURE__ */ jsxRuntime.jsx("h6", { className, children });
23
+ default:
24
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
25
+ }
26
+ };
27
+
28
+ exports.TitleText = TitleText;
@@ -0,0 +1,22 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+
3
+ const TitleText = ({ headingLevel, children, className }) => {
4
+ switch (headingLevel) {
5
+ case 1:
6
+ return jsx("h1", { className, children });
7
+ case 2:
8
+ return jsx("h2", { className, children });
9
+ case 3:
10
+ return jsx("h3", { className, children });
11
+ case 4:
12
+ return jsx("h4", { className, children });
13
+ case 5:
14
+ return jsx("h5", { className, children });
15
+ case 6:
16
+ return jsx("h6", { className, children });
17
+ default:
18
+ return jsx("div", { className, children });
19
+ }
20
+ };
21
+
22
+ export { TitleText };
@@ -0,0 +1,57 @@
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 types = require('./types.cjs');
8
+
9
+ const getColorFromString = (input) => {
10
+ const sum = input.split("").slice(0, 2).reduce((acc, char) => acc + (char.codePointAt(0) ?? 0), 0);
11
+ const index = sum % types.avatarColors.length;
12
+ return types.avatarColors[index];
13
+ };
14
+ function Avatar({
15
+ src,
16
+ initials,
17
+ alt,
18
+ size = "md",
19
+ color,
20
+ theme = {},
21
+ cssOverrides,
22
+ ...props
23
+ }) {
24
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultAvatarTheme, theme);
25
+ const [imageError, setImageError] = react.useState(false);
26
+ const handleImageError = () => {
27
+ setImageError(true);
28
+ };
29
+ const showImage = src && !imageError;
30
+ const displayInitials = initials?.slice(0, 2).toUpperCase() ?? "";
31
+ const avatarColor = color ?? getColorFromString(src ?? displayInitials);
32
+ return /* @__PURE__ */ jsxRuntime.jsx(
33
+ "div",
34
+ {
35
+ css: [
36
+ styles.avatarStyles(mergedTheme, { size, color: avatarColor }),
37
+ cssOverrides
38
+ ],
39
+ role: "img",
40
+ "aria-label": alt ?? `Avatar ${displayInitials ? `with initials ${displayInitials}` : ""}`,
41
+ title: alt ?? displayInitials,
42
+ ...props,
43
+ children: showImage ? /* @__PURE__ */ jsxRuntime.jsx(
44
+ "img",
45
+ {
46
+ src,
47
+ alt,
48
+ title: alt,
49
+ onError: handleImageError,
50
+ css: styles.avatarImageStyles
51
+ }
52
+ ) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: displayInitials })
53
+ }
54
+ );
55
+ }
56
+
57
+ exports.Avatar = Avatar;
@@ -0,0 +1,27 @@
1
+ import { jsx, Fragment } from '@emotion/react/jsx-runtime';
2
+ import { useState } from 'react';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { avatarStyles, avatarImageStyles, defaultAvatarTheme } from './styles.js';
5
+ import { avatarColors } from './types.js';
6
+
7
+ const getColorFromString = (input) => {
8
+ const sum = input.split("").slice(0, 2).reduce((acc, char) => acc + (char.codePointAt(0) ?? 0), 0);
9
+ const index = sum % avatarColors.length;
10
+ return avatarColors[index];
11
+ };
12
+ function Avatar({ src, initials, alt, size = "md", color, theme = {}, cssOverrides, ...props }) {
13
+ const mergedTheme = mergeDeep(defaultAvatarTheme, theme);
14
+ const [imageError, setImageError] = useState(false);
15
+ const handleImageError = () => {
16
+ setImageError(true);
17
+ };
18
+ const showImage = src && !imageError;
19
+ const displayInitials = initials?.slice(0, 2).toUpperCase() ?? "";
20
+ const avatarColor = color ?? getColorFromString(src ?? displayInitials);
21
+ return jsx("div", { css: [
22
+ avatarStyles(mergedTheme, { size, color: avatarColor }),
23
+ cssOverrides
24
+ ], role: "img", "aria-label": alt ?? `Avatar ${displayInitials ? `with initials ${displayInitials}` : ""}`, title: alt ?? displayInitials, ...props, children: showImage ? jsx("img", { src, alt, title: alt, onError: handleImageError, css: avatarImageStyles }) : jsx(Fragment, { children: displayInitials }) });
25
+ }
26
+
27
+ export { Avatar };
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var avatar = require('../../styleD/build/typescript/component/avatar.cjs');
5
+ var typography = require('../../styleD/utils/semantic/typography.cjs');
6
+
7
+ const defaultAvatarTheme = avatar.componentAvatar;
8
+ const avatarImageStyles = react.css`
9
+ width: 100%;
10
+ height: 100%;
11
+ object-fit: cover;
12
+ `;
13
+ const avatarStyles = (theme, { size, color }) => {
14
+ return react.css`
15
+ display: ${theme.shared.display};
16
+ align-items: ${theme.shared["align-items"]};
17
+ justify-content: ${theme.shared["justify-content"]};
18
+ overflow: ${theme.shared.overflow};
19
+ flex-shrink: ${theme.shared["flex-shrink"]};
20
+ border-radius: ${theme.shared["border-radius"]};
21
+ background-color: ${theme.shared.color[color].background};
22
+ width: ${theme[size].size};
23
+ height: ${theme[size].size};
24
+ border: ${theme.shared.color[color].border};
25
+ user-select: ${theme.shared["user-select"]};
26
+ color: ${theme.shared.color[color].text};
27
+ ${typography.convertTypographyToEmotionStringStyle(theme[size].typography)}
28
+ `;
29
+ };
30
+
31
+ exports.avatarImageStyles = avatarImageStyles;
32
+ exports.avatarStyles = avatarStyles;
33
+ exports.defaultAvatarTheme = defaultAvatarTheme;
@@ -0,0 +1,29 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentAvatar } from '../../styleD/build/typescript/component/avatar.js';
3
+ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
+
5
+ const defaultAvatarTheme = componentAvatar;
6
+ const avatarImageStyles = css`
7
+ width: 100%;
8
+ height: 100%;
9
+ object-fit: cover;
10
+ `;
11
+ const avatarStyles = (theme, { size, color }) => {
12
+ return css`
13
+ display: ${theme.shared.display};
14
+ align-items: ${theme.shared["align-items"]};
15
+ justify-content: ${theme.shared["justify-content"]};
16
+ overflow: ${theme.shared.overflow};
17
+ flex-shrink: ${theme.shared["flex-shrink"]};
18
+ border-radius: ${theme.shared["border-radius"]};
19
+ background-color: ${theme.shared.color[color].background};
20
+ width: ${theme[size].size};
21
+ height: ${theme[size].size};
22
+ border: ${theme.shared.color[color].border};
23
+ user-select: ${theme.shared["user-select"]};
24
+ color: ${theme.shared.color[color].text};
25
+ ${convertTypographyToEmotionStringStyle(theme[size].typography)}
26
+ `;
27
+ };
28
+
29
+ export { avatarImageStyles, avatarStyles, defaultAvatarTheme };
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ const avatarColors = [
4
+ "blue",
5
+ "green",
6
+ "red",
7
+ "cyan",
8
+ "teal",
9
+ "cool-purple",
10
+ "warm-purple",
11
+ "magenta",
12
+ "orange",
13
+ "yellow"
14
+ ];
15
+
16
+ exports.avatarColors = avatarColors;
@@ -0,0 +1,14 @@
1
+ const avatarColors = [
2
+ "blue",
3
+ "green",
4
+ "red",
5
+ "cyan",
6
+ "teal",
7
+ "cool-purple",
8
+ "warm-purple",
9
+ "magenta",
10
+ "orange",
11
+ "yellow"
12
+ ];
13
+
14
+ export { avatarColors };
@@ -0,0 +1,29 @@
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 styles = require('./styles.cjs');
7
+
8
+ function Button({
9
+ variant = "emphasised-primary",
10
+ size = "md",
11
+ theme = {},
12
+ cssOverrides,
13
+ ...props
14
+ }) {
15
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultButtonTheme, theme);
16
+ return /* @__PURE__ */ jsxRuntime.jsx(
17
+ reactAriaComponents.Button,
18
+ {
19
+ ...props,
20
+ css: [styles.buttonStyles(mergedTheme, { variant, size }), cssOverrides],
21
+ children: reactAriaComponents.composeRenderProps(props.children, (children) => (
22
+ // TODO: isPending (loading) state - see https://react-aria.adobe.com/Button
23
+ /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
24
+ ))
25
+ }
26
+ );
27
+ }
28
+
29
+ exports.Button = Button;
@@ -0,0 +1,14 @@
1
+ import { jsx, Fragment } from '@emotion/react/jsx-runtime';
2
+ import { Button as Button$1, composeRenderProps } from 'react-aria-components';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { buttonStyles, defaultButtonTheme } from './styles.js';
5
+
6
+ function Button({ variant = "emphasised-primary", size = "md", theme = {}, cssOverrides, ...props }) {
7
+ const mergedTheme = mergeDeep(defaultButtonTheme, theme);
8
+ return jsx(Button$1, { ...props, css: [buttonStyles(mergedTheme, { variant, size }), cssOverrides], children: composeRenderProps(props.children, (children) => (
9
+ // TODO: isPending (loading) state - see https://react-aria.adobe.com/Button
10
+ jsx(Fragment, { children })
11
+ )) });
12
+ }
13
+
14
+ export { Button };
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var button = require('../../styleD/build/typescript/component/button.cjs');
5
+ var typography = require('../../styleD/utils/semantic/typography.cjs');
6
+
7
+ const defaultButtonTheme = button.componentButton;
8
+ const buttonStyles = (theme, { size, variant }) => {
9
+ return react.css`
10
+ /* button/link button reset styles */
11
+ display: ${theme.shared["display"]};
12
+ -webkit-appearance: ${theme.shared["-webkit-appearance"]};
13
+ text-align: ${theme.shared["text-align"]};
14
+ box-shadow: ${theme.shared["box-shadow"]};
15
+ text-decoration: ${theme.shared["text-decoration"]};
16
+ /* button component styles */
17
+ cursor: ${theme.shared.cursor};
18
+ justify-content: ${theme.shared["justify-content"]};
19
+ align-items: ${theme.shared["align-items"]};
20
+ color: ${theme[variant].shared.color};
21
+ background: ${theme[variant].shared.backgroundColor};
22
+ height: ${theme[variant][size].height};
23
+ padding: ${theme[variant][size].padding.top}
24
+ ${theme[variant][size].padding.right}
25
+ ${theme[variant][size].padding.bottom}
26
+ ${theme[variant][size].padding.left};
27
+ ${typography.convertTypographyToEmotionStringStyle(
28
+ theme[variant][size].typography
29
+ )}
30
+ border: ${theme[variant].shared.border};
31
+ border-radius: ${theme[variant].shared.borderRadius};
32
+
33
+ &[data-hovered] {
34
+ background: ${theme[variant].shared[":hover"].backgroundColor};
35
+ border: ${theme[variant].shared[":hover"].border};
36
+ }
37
+
38
+ &[data-pressed] {
39
+ background: ${theme[variant].shared[":active"].backgroundColor};
40
+ border: ${theme[variant].shared[":active"].border};
41
+ }
42
+
43
+ &[data-focus-visible] {
44
+ outline: ${theme.shared[":focus-visible"].outline};
45
+ outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
46
+ }
47
+
48
+ &[data-disabled] {
49
+ cursor: ${theme.shared[":disabled"].cursor};
50
+ color: ${theme[variant].shared[":disabled"].color};
51
+ background: ${theme[variant].shared[":disabled"].backgroundColor};
52
+ border: ${theme[variant].shared[":disabled"].border};
53
+ }
54
+ `;
55
+ };
56
+
57
+ exports.buttonStyles = buttonStyles;
58
+ exports.defaultButtonTheme = defaultButtonTheme;
@@ -0,0 +1,53 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentButton } from '../../styleD/build/typescript/component/button.js';
3
+ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
+
5
+ const defaultButtonTheme = componentButton;
6
+ const buttonStyles = (theme, { size, variant }) => {
7
+ return css`
8
+ /* button/link button reset styles */
9
+ display: ${theme.shared["display"]};
10
+ -webkit-appearance: ${theme.shared["-webkit-appearance"]};
11
+ text-align: ${theme.shared["text-align"]};
12
+ box-shadow: ${theme.shared["box-shadow"]};
13
+ text-decoration: ${theme.shared["text-decoration"]};
14
+ /* button component styles */
15
+ cursor: ${theme.shared.cursor};
16
+ justify-content: ${theme.shared["justify-content"]};
17
+ align-items: ${theme.shared["align-items"]};
18
+ color: ${theme[variant].shared.color};
19
+ background: ${theme[variant].shared.backgroundColor};
20
+ height: ${theme[variant][size].height};
21
+ padding: ${theme[variant][size].padding.top}
22
+ ${theme[variant][size].padding.right}
23
+ ${theme[variant][size].padding.bottom}
24
+ ${theme[variant][size].padding.left};
25
+ ${convertTypographyToEmotionStringStyle(theme[variant][size].typography)}
26
+ border: ${theme[variant].shared.border};
27
+ border-radius: ${theme[variant].shared.borderRadius};
28
+
29
+ &[data-hovered] {
30
+ background: ${theme[variant].shared[":hover"].backgroundColor};
31
+ border: ${theme[variant].shared[":hover"].border};
32
+ }
33
+
34
+ &[data-pressed] {
35
+ background: ${theme[variant].shared[":active"].backgroundColor};
36
+ border: ${theme[variant].shared[":active"].border};
37
+ }
38
+
39
+ &[data-focus-visible] {
40
+ outline: ${theme.shared[":focus-visible"].outline};
41
+ outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
42
+ }
43
+
44
+ &[data-disabled] {
45
+ cursor: ${theme.shared[":disabled"].cursor};
46
+ color: ${theme[variant].shared[":disabled"].color};
47
+ background: ${theme[variant].shared[":disabled"].backgroundColor};
48
+ border: ${theme[variant].shared[":disabled"].border};
49
+ }
50
+ `;
51
+ };
52
+
53
+ export { buttonStyles, defaultButtonTheme };
@@ -2,14 +2,14 @@
2
2
 
3
3
  var react = require('@emotion/react');
4
4
  var byline = require('../../styleD/build/typescript/component/byline.cjs');
5
- var util = require('../util.cjs');
5
+ var mergeDeep = require('../../util/mergeDeep.cjs');
6
6
 
7
7
  const bylineContainerStyles = react.css`
8
8
  position: relative;
9
9
  width: 100%;
10
10
  `;
11
11
  const bylineEditorStyles = (partialTheme = {}) => {
12
- const theme = util.mergeDeep(byline.componentByline, partialTheme);
12
+ const theme = mergeDeep.mergeDeep(byline.componentByline, partialTheme);
13
13
  return react.css`
14
14
  border-color: ${theme.borderColor};
15
15
  border-style: ${theme.borderStyle};
@@ -205,7 +205,7 @@ const bylineEditorStyles = (partialTheme = {}) => {
205
205
  `;
206
206
  };
207
207
  const dropdownContainerStyles = (showDropdown, partialTheme = {}) => {
208
- const theme = util.mergeDeep(byline.componentByline["dropdown"], partialTheme);
208
+ const theme = mergeDeep.mergeDeep(byline.componentByline["dropdown"], partialTheme);
209
209
  return react.css`
210
210
  position: absolute;
211
211
  box-sizing: border-box;
@@ -226,7 +226,7 @@ const dropdownUlStyles = react.css`
226
226
  list-style-type: none;
227
227
  `;
228
228
  const dropdownLiStyles = (partialTheme = {}) => {
229
- const theme = util.mergeDeep(byline.componentByline["dropdown"], partialTheme);
229
+ const theme = mergeDeep.mergeDeep(byline.componentByline["dropdown"], partialTheme);
230
230
  return react.css`
231
231
  cursor: pointer;
232
232
  padding: 5px;
@@ -237,7 +237,7 @@ const dropdownLiStyles = (partialTheme = {}) => {
237
237
  `;
238
238
  };
239
239
  const selectedDropdownLiStyles = (partialTheme = {}) => {
240
- const theme = util.mergeDeep(byline.componentByline["dropdown"], partialTheme);
240
+ const theme = mergeDeep.mergeDeep(byline.componentByline["dropdown"], partialTheme);
241
241
  return react.css`
242
242
  background-color: ${theme.li.selectedBackgroundColor};
243
243
  color: ${theme.li.selectedColor};
@@ -1,6 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { componentByline } from '../../styleD/build/typescript/component/byline.js';
3
- import { mergeDeep } from '../util.js';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
4
 
5
5
  const bylineContainerStyles = css`
6
6
  position: relative;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
+ var mergeDeep = require('../../util/mergeDeep.cjs');
5
+ var styles = require('./styles.cjs');
6
+
7
+ function Icon({
8
+ children,
9
+ size = "md",
10
+ fill,
11
+ alt,
12
+ symbol,
13
+ theme = {},
14
+ cssOverrides,
15
+ className
16
+ }) {
17
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultIconTheme, theme);
18
+ if (symbol || typeof children === "string") {
19
+ return /* @__PURE__ */ jsxRuntime.jsx(
20
+ "span",
21
+ {
22
+ className: `material-symbols ${className ?? ""}`,
23
+ css: [
24
+ styles.iconStyles(mergedTheme, { size, fill, mode: "text" }),
25
+ cssOverrides
26
+ ],
27
+ ...alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true },
28
+ children: symbol ?? children
29
+ }
30
+ );
31
+ }
32
+ return /* @__PURE__ */ jsxRuntime.jsx(
33
+ "span",
34
+ {
35
+ className,
36
+ css: [
37
+ styles.iconStyles(mergedTheme, { size, fill, mode: "svg" }),
38
+ cssOverrides
39
+ ],
40
+ ...alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true },
41
+ children
42
+ }
43
+ );
44
+ }
45
+
46
+ exports.Icon = Icon;
@@ -0,0 +1,19 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import { mergeDeep } from '../../util/mergeDeep.js';
3
+ import { iconStyles, defaultIconTheme } from './styles.js';
4
+
5
+ function Icon({ children, size = "md", fill, alt, symbol, theme = {}, cssOverrides, className }) {
6
+ const mergedTheme = mergeDeep(defaultIconTheme, theme);
7
+ if (symbol || typeof children === "string") {
8
+ return jsx("span", { className: `material-symbols ${className ?? ""}`, css: [
9
+ iconStyles(mergedTheme, { size, fill, mode: "text" }),
10
+ cssOverrides
11
+ ], ...alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true }, children: symbol ?? children });
12
+ }
13
+ return jsx("span", { className, css: [
14
+ iconStyles(mergedTheme, { size, fill, mode: "svg" }),
15
+ cssOverrides
16
+ ], ...alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true }, children });
17
+ }
18
+
19
+ export { Icon };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var icon = require('../../styleD/build/typescript/component/icon.cjs');
5
+
6
+ const defaultIconTheme = icon.componentIcon;
7
+ const iconStyles = (theme, {
8
+ size,
9
+ fill,
10
+ mode
11
+ }) => react.css`
12
+ display: ${theme.shared.display};
13
+ font-size: ${theme[size].size};
14
+ user-select: ${theme.shared["user-select"]};
15
+ ${fill ? `color: ${fill};` : ""}
16
+
17
+ ${mode === "svg" ? `
18
+ & > svg {
19
+ width: ${theme[size].size};
20
+ height: ${theme[size].size};
21
+ ${fill ? `fill: ${fill};` : ""}
22
+ }
23
+ ` : ""}
24
+ `;
25
+
26
+ exports.defaultIconTheme = defaultIconTheme;
27
+ exports.iconStyles = iconStyles;
@@ -0,0 +1,20 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentIcon } from '../../styleD/build/typescript/component/icon.js';
3
+
4
+ const defaultIconTheme = componentIcon;
5
+ const iconStyles = (theme, { size, fill, mode }) => css`
6
+ display: ${theme.shared.display};
7
+ font-size: ${theme[size].size};
8
+ user-select: ${theme.shared["user-select"]};
9
+ ${fill ? `color: ${fill};` : ""}
10
+
11
+ ${mode === "svg" ? `
12
+ & > svg {
13
+ width: ${theme[size].size};
14
+ height: ${theme[size].size};
15
+ ${fill ? `fill: ${fill};` : ""}
16
+ }
17
+ ` : ""}
18
+ `;
19
+
20
+ export { defaultIconTheme, iconStyles };
@@ -0,0 +1,29 @@
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 styles = require('./styles.cjs');
7
+
8
+ function LinkButton({
9
+ variant = "emphasised-primary",
10
+ size = "md",
11
+ theme = {},
12
+ cssOverrides,
13
+ ...props
14
+ }) {
15
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultLinkButtonTheme, theme);
16
+ return /* @__PURE__ */ jsxRuntime.jsx(
17
+ reactAriaComponents.Link,
18
+ {
19
+ ...props,
20
+ css: [
21
+ styles.linkButtonStyles(mergedTheme, { variant, size }),
22
+ cssOverrides
23
+ ],
24
+ children: props.children
25
+ }
26
+ );
27
+ }
28
+
29
+ exports.LinkButton = LinkButton;
@@ -0,0 +1,14 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import { Link } from 'react-aria-components';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { linkButtonStyles, defaultLinkButtonTheme } from './styles.js';
5
+
6
+ function LinkButton({ variant = "emphasised-primary", size = "md", theme = {}, cssOverrides, ...props }) {
7
+ const mergedTheme = mergeDeep(defaultLinkButtonTheme, theme);
8
+ return jsx(Link, { ...props, css: [
9
+ linkButtonStyles(mergedTheme, { variant, size }),
10
+ cssOverrides
11
+ ], children: props.children });
12
+ }
13
+
14
+ 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;