@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,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,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,38 @@
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 Button({
10
+ variant = "emphasised-primary",
11
+ size = "md",
12
+ theme = {},
13
+ cssOverrides,
14
+ icon,
15
+ ...props
16
+ }) {
17
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultButtonTheme, theme);
18
+ const iconSize = size === "xs" ? "sm" : size;
19
+ return /* @__PURE__ */ jsxRuntime.jsx(
20
+ reactAriaComponents.Button,
21
+ {
22
+ ...props,
23
+ css: [
24
+ styles.buttonStyles(mergedTheme, { variant, size }, !!icon),
25
+ cssOverrides
26
+ ],
27
+ children: reactAriaComponents.composeRenderProps(props.children, (children) => (
28
+ // TODO: isPending (loading) state - see https://react-aria.adobe.com/Button
29
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30
+ icon && /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: icon }),
31
+ children
32
+ ] })
33
+ ))
34
+ }
35
+ );
36
+ }
37
+
38
+ exports.Button = Button;
@@ -0,0 +1,19 @@
1
+ import { jsx, jsxs, 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 { Icon } from '../icon/Icon.js';
5
+ import { buttonStyles, defaultButtonTheme } from './styles.js';
6
+
7
+ function Button({ variant = "emphasised-primary", size = "md", theme = {}, cssOverrides, icon, ...props }) {
8
+ const mergedTheme = mergeDeep(defaultButtonTheme, theme);
9
+ const iconSize = size === "xs" ? "sm" : size;
10
+ return jsx(Button$1, { ...props, css: [
11
+ buttonStyles(mergedTheme, { variant, size }, !!icon),
12
+ cssOverrides
13
+ ], children: composeRenderProps(props.children, (children) => (
14
+ // TODO: isPending (loading) state - see https://react-aria.adobe.com/Button
15
+ jsxs(Fragment, { children: [icon && jsx(Icon, { size: iconSize, children: icon }), children] })
16
+ )) });
17
+ }
18
+
19
+ export { Button };
@@ -0,0 +1,68 @@
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 }, hasIcon = false, isIconButton = false) => {
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
+ ${hasIcon && react.css`
34
+ padding-left: ${theme[variant][size].padding.withIcon.iconLeft.left};
35
+ gap: ${theme[variant][size].icon.gap};
36
+ `}
37
+
38
+ ${isIconButton && react.css`
39
+ width: ${theme[variant][size].iconButton.width};
40
+ padding: 0;
41
+ `}
42
+
43
+ &[data-hovered] {
44
+ background: ${theme[variant].shared[":hover"].backgroundColor};
45
+ border: ${theme[variant].shared[":hover"].border};
46
+ }
47
+
48
+ &[data-pressed] {
49
+ background: ${theme[variant].shared[":active"].backgroundColor};
50
+ border: ${theme[variant].shared[":active"].border};
51
+ }
52
+
53
+ &[data-focus-visible] {
54
+ outline: ${theme.shared[":focus-visible"].outline};
55
+ outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
56
+ }
57
+
58
+ &[data-disabled] {
59
+ cursor: ${theme.shared[":disabled"].cursor};
60
+ color: ${theme[variant].shared[":disabled"].color};
61
+ background: ${theme[variant].shared[":disabled"].backgroundColor};
62
+ border: ${theme[variant].shared[":disabled"].border};
63
+ }
64
+ `;
65
+ };
66
+
67
+ exports.buttonStyles = buttonStyles;
68
+ exports.defaultButtonTheme = defaultButtonTheme;
@@ -0,0 +1,63 @@
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 }, hasIcon = false, isIconButton = false) => {
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
+ ${hasIcon && css`
30
+ padding-left: ${theme[variant][size].padding.withIcon.iconLeft.left};
31
+ gap: ${theme[variant][size].icon.gap};
32
+ `}
33
+
34
+ ${isIconButton && css`
35
+ width: ${theme[variant][size].iconButton.width};
36
+ padding: 0;
37
+ `}
38
+
39
+ &[data-hovered] {
40
+ background: ${theme[variant].shared[":hover"].backgroundColor};
41
+ border: ${theme[variant].shared[":hover"].border};
42
+ }
43
+
44
+ &[data-pressed] {
45
+ background: ${theme[variant].shared[":active"].backgroundColor};
46
+ border: ${theme[variant].shared[":active"].border};
47
+ }
48
+
49
+ &[data-focus-visible] {
50
+ outline: ${theme.shared[":focus-visible"].outline};
51
+ outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
52
+ }
53
+
54
+ &[data-disabled] {
55
+ cursor: ${theme.shared[":disabled"].cursor};
56
+ color: ${theme[variant].shared[":disabled"].color};
57
+ background: ${theme[variant].shared[":disabled"].backgroundColor};
58
+ border: ${theme[variant].shared[":disabled"].border};
59
+ }
60
+ `;
61
+ };
62
+
63
+ export { buttonStyles, defaultButtonTheme };
@@ -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,45 @@
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 IconButton({
11
+ variant = "emphasised-primary",
12
+ size = "md",
13
+ symbol,
14
+ ariaLabel,
15
+ theme = {},
16
+ cssOverrides,
17
+ ...props
18
+ }) {
19
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultIconButtonTheme, theme);
20
+ const buttonRef = react.useRef(null);
21
+ react.useEffect(() => {
22
+ if (buttonRef.current) {
23
+ buttonRef.current.title = ariaLabel;
24
+ }
25
+ }, [ariaLabel]);
26
+ const iconSize = size === "xs" ? "sm" : size;
27
+ return /* @__PURE__ */ jsxRuntime.jsx(
28
+ reactAriaComponents.Button,
29
+ {
30
+ ...props,
31
+ ref: buttonRef,
32
+ "aria-label": ariaLabel,
33
+ css: [
34
+ styles.iconButtonStyles(mergedTheme, { variant, size }, false, true),
35
+ cssOverrides
36
+ ],
37
+ children: reactAriaComponents.composeRenderProps(props.children, (children) => (
38
+ // TODO: isPending (loading) state - see https://react-aria.adobe.com/Button
39
+ /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, symbol, children })
40
+ ))
41
+ }
42
+ );
43
+ }
44
+
45
+ exports.IconButton = IconButton;
@@ -0,0 +1,26 @@
1
+ import { jsx } from '@emotion/react/jsx-runtime';
2
+ import { useRef, useEffect } from 'react';
3
+ import { Button, composeRenderProps } from 'react-aria-components';
4
+ import { mergeDeep } from '../../util/mergeDeep.js';
5
+ import { Icon } from '../icon/Icon.js';
6
+ import { iconButtonStyles, defaultIconButtonTheme } from './styles.js';
7
+
8
+ function IconButton({ variant = "emphasised-primary", size = "md", symbol, ariaLabel, theme = {}, cssOverrides, ...props }) {
9
+ const mergedTheme = mergeDeep(defaultIconButtonTheme, theme);
10
+ const buttonRef = useRef(null);
11
+ useEffect(() => {
12
+ if (buttonRef.current) {
13
+ buttonRef.current.title = ariaLabel;
14
+ }
15
+ }, [ariaLabel]);
16
+ const iconSize = size === "xs" ? "sm" : size;
17
+ return jsx(Button, { ...props, ref: buttonRef, "aria-label": ariaLabel, css: [
18
+ iconButtonStyles(mergedTheme, { variant, size }, false, true),
19
+ cssOverrides
20
+ ], children: composeRenderProps(props.children, (children) => (
21
+ // TODO: isPending (loading) state - see https://react-aria.adobe.com/Button
22
+ jsx(Icon, { size: iconSize, symbol, children })
23
+ )) });
24
+ }
25
+
26
+ export { IconButton };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var styles = require('../button/styles.cjs');
4
+
5
+ const defaultIconButtonTheme = styles.defaultButtonTheme;
6
+ const iconButtonStyles = styles.buttonStyles;
7
+
8
+ exports.defaultIconButtonTheme = defaultIconButtonTheme;
9
+ exports.iconButtonStyles = iconButtonStyles;
@@ -0,0 +1,6 @@
1
+ import { buttonStyles, defaultButtonTheme } from '../button/styles.js';
2
+
3
+ const defaultIconButtonTheme = defaultButtonTheme;
4
+ const iconButtonStyles = buttonStyles;
5
+
6
+ export { defaultIconButtonTheme, iconButtonStyles };