@guardian/stand 0.0.19 → 0.0.21

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 (59) hide show
  1. package/dist/TopBar.cjs +2 -0
  2. package/dist/TopBar.js +1 -1
  3. package/dist/components/form/Form.cjs +47 -0
  4. package/dist/components/form/Form.js +17 -0
  5. package/dist/components/form/styles.cjs +49 -0
  6. package/dist/components/form/styles.js +35 -0
  7. package/dist/components/form/types.cjs +7 -0
  8. package/dist/components/form/types.js +5 -0
  9. package/dist/components/menu/Menu.cjs +1 -7
  10. package/dist/components/menu/Menu.js +1 -9
  11. package/dist/components/menu/styles.cjs +25 -11
  12. package/dist/components/menu/styles.js +25 -11
  13. package/dist/components/select/Select.cjs +6 -15
  14. package/dist/components/select/Select.js +5 -5
  15. package/dist/components/select/styles.cjs +30 -55
  16. package/dist/components/select/styles.js +31 -53
  17. package/dist/components/text-input/TextInput.cjs +28 -0
  18. package/dist/components/text-input/TextInput.js +12 -0
  19. package/dist/components/text-input/styles.cjs +35 -0
  20. package/dist/components/text-input/styles.js +32 -0
  21. package/dist/form.cjs +7 -0
  22. package/dist/form.js +1 -0
  23. package/dist/index.cjs +4 -0
  24. package/dist/index.js +2 -0
  25. package/dist/styleD/build/css/component/form.css +28 -0
  26. package/dist/styleD/build/css/component/menu.css +2 -0
  27. package/dist/styleD/build/css/component/select.css +37 -46
  28. package/dist/styleD/build/css/component/textInput.css +29 -0
  29. package/dist/styleD/build/typescript/component/form.cjs +57 -0
  30. package/dist/styleD/build/typescript/component/form.js +55 -0
  31. package/dist/styleD/build/typescript/component/menu.cjs +5 -1
  32. package/dist/styleD/build/typescript/component/menu.js +5 -1
  33. package/dist/styleD/build/typescript/component/select.cjs +50 -69
  34. package/dist/styleD/build/typescript/component/select.js +50 -69
  35. package/dist/styleD/build/typescript/component/textInput.cjs +45 -0
  36. package/dist/styleD/build/typescript/component/textInput.js +43 -0
  37. package/dist/text-input.cjs +9 -0
  38. package/dist/text-input.js +2 -0
  39. package/dist/types/TopBar.d.ts +1 -1
  40. package/dist/types/components/form/Form.d.ts +5 -0
  41. package/dist/types/components/form/styles.d.ts +15 -0
  42. package/dist/types/components/form/types.d.ts +40 -0
  43. package/dist/types/components/menu/styles.d.ts +1 -1
  44. package/dist/types/components/select/Select.d.ts +1 -1
  45. package/dist/types/components/select/styles.d.ts +0 -3
  46. package/dist/types/components/select/types.d.ts +2 -14
  47. package/dist/types/components/text-input/TextInput.d.ts +2 -0
  48. package/dist/types/components/text-input/sandbox.d.ts +5 -0
  49. package/dist/types/components/text-input/styles.d.ts +7 -0
  50. package/dist/types/components/text-input/types.d.ts +4 -0
  51. package/dist/types/form.d.ts +8 -0
  52. package/dist/types/index.d.ts +4 -0
  53. package/dist/types/menu.d.ts +0 -1
  54. package/dist/types/styleD/build/typescript/component/form.d.ts +57 -0
  55. package/dist/types/styleD/build/typescript/component/menu.d.ts +4 -0
  56. package/dist/types/styleD/build/typescript/component/select.d.ts +46 -65
  57. package/dist/types/styleD/build/typescript/component/textInput.d.ts +45 -0
  58. package/dist/types/text-input.d.ts +20 -0
  59. package/package.json +30 -17
package/dist/TopBar.cjs CHANGED
@@ -13,3 +13,5 @@ exports.TopBarToolName = TopBarToolName.TopBarToolName;
13
13
  exports.TopBarNavigation = TopBarNavigation.TopBarNavigation;
14
14
  exports.TopBarItem = TopBarItem.TopBarItem;
15
15
  exports.TopBar = TopBar.TopBar;
16
+ exports.TopBarContainerLeft = TopBar.TopBarContainerLeft;
17
+ exports.TopBarContainerRight = TopBar.TopBarContainerRight;
package/dist/TopBar.js CHANGED
@@ -2,4 +2,4 @@ export { componentTopBar } from './styleD/build/typescript/component/TopBar.js';
2
2
  export { TopBarToolName } from './components/topbar/topBarToolName/TopBarToolName.js';
3
3
  export { TopBarNavigation } from './components/topbar/topBarNavigation/TopBarNavigation.js';
4
4
  export { TopBarItem } from './components/topbar/topBarItem/TopBarItem.js';
5
- export { TopBar } from './components/topbar/TopBar.js';
5
+ export { TopBar, TopBarContainerLeft, TopBarContainerRight } from './components/topbar/TopBar.js';
@@ -0,0 +1,47 @@
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
+ var types = require('./types.cjs');
8
+ var InlineMessage = require('../inline-message/InlineMessage.cjs');
9
+
10
+ function FormInputContainer({
11
+ as: Component,
12
+ size = "md",
13
+ label,
14
+ description,
15
+ error,
16
+ isDisabled = false,
17
+ theme = {},
18
+ formInputContainerTheme,
19
+ cssOverrides,
20
+ children,
21
+ ...props
22
+ }) {
23
+ if (!types.ALLOWED_FORM_CONTAINERS.includes(Component)) {
24
+ return null;
25
+ }
26
+ const mergedTheme = mergeDeep.mergeDeep(
27
+ mergeDeep.mergeDeep(styles.defaultFormInputContainerTheme, theme),
28
+ formInputContainerTheme ?? {}
29
+ );
30
+ const Tag = Component;
31
+ return /* @__PURE__ */ jsxRuntime.jsxs(
32
+ Tag,
33
+ {
34
+ css: [styles.formInputContainerStyles(mergedTheme, { size }), cssOverrides],
35
+ isDisabled,
36
+ ...props,
37
+ children: [
38
+ label && /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Label, { css: styles.formInputLabelStyles(mergedTheme, { size, isDisabled }), children: label }),
39
+ description && /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.formInputDescriptionStyles(mergedTheme, { isDisabled }), children: description }),
40
+ children,
41
+ error && /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.FieldError, { children: /* @__PURE__ */ jsxRuntime.jsx(InlineMessage.InlineMessage, { level: "error", children: error }) })
42
+ ]
43
+ }
44
+ );
45
+ }
46
+
47
+ exports.FormInputContainer = FormInputContainer;
@@ -0,0 +1,17 @@
1
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
+ import { Label, FieldError } from 'react-aria-components';
3
+ import { mergeDeep } from '../../util/mergeDeep.js';
4
+ import { defaultFormInputContainerTheme, formInputLabelStyles, formInputDescriptionStyles, formInputContainerStyles } from './styles.js';
5
+ import { ALLOWED_FORM_CONTAINERS } from './types.js';
6
+ import { InlineMessage } from '../inline-message/InlineMessage.js';
7
+
8
+ function FormInputContainer({ as: Component, size = "md", label, description, error, isDisabled = false, theme = {}, formInputContainerTheme, cssOverrides, children, ...props }) {
9
+ if (!ALLOWED_FORM_CONTAINERS.includes(Component)) {
10
+ return null;
11
+ }
12
+ const mergedTheme = mergeDeep(mergeDeep(defaultFormInputContainerTheme, theme), formInputContainerTheme ?? {});
13
+ const Tag = Component;
14
+ return jsxs(Tag, { css: [formInputContainerStyles(mergedTheme, { size }), cssOverrides], isDisabled, ...props, children: [label && jsx(Label, { css: formInputLabelStyles(mergedTheme, { size, isDisabled }), children: label }), description && jsx("div", { css: formInputDescriptionStyles(mergedTheme, { isDisabled }), children: description }), children, error && jsx(FieldError, { children: jsx(InlineMessage, { level: "error", children: error }) })] });
15
+ }
16
+
17
+ export { FormInputContainer };
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var react = require('@emotion/react');
4
+ var form = require('../../styleD/build/typescript/component/form.cjs');
5
+ var typography = require('../../styleD/utils/semantic/typography.cjs');
6
+
7
+ const defaultFormInputContainerTheme = form.componentForm.input;
8
+ const formInputContainerStyles = (theme, {
9
+ size
10
+ }) => {
11
+ return react.css`
12
+ display: ${theme.shared.container.display};
13
+ flex-direction: ${theme.shared.container["flex-direction"]};
14
+ gap: ${theme.shared.container.gap};
15
+ width: ${theme.shared.container.width};
16
+ max-width: ${theme[size].container["max-width"]};
17
+ `;
18
+ };
19
+ const formInputLabelStyles = (theme, {
20
+ isDisabled,
21
+ size
22
+ }) => {
23
+ return react.css`
24
+ color: ${theme.shared.label.color};
25
+ ${typography.convertTypographyToEmotionStringStyle(theme[size].label.typography)}
26
+
27
+ ${isDisabled && react.css`
28
+ color: ${theme.shared.label.disabled.color};
29
+ `}
30
+ `;
31
+ };
32
+ const formInputDescriptionStyles = (theme, {
33
+ isDisabled
34
+ }) => {
35
+ return react.css`
36
+ color: ${theme.shared.description.color};
37
+ ${typography.convertTypographyToEmotionStringStyle(
38
+ theme.shared.description.typography
39
+ )}
40
+ ${isDisabled && react.css`
41
+ color: ${theme.shared.description.disabled.color};
42
+ `}
43
+ `;
44
+ };
45
+
46
+ exports.defaultFormInputContainerTheme = defaultFormInputContainerTheme;
47
+ exports.formInputContainerStyles = formInputContainerStyles;
48
+ exports.formInputDescriptionStyles = formInputDescriptionStyles;
49
+ exports.formInputLabelStyles = formInputLabelStyles;
@@ -0,0 +1,35 @@
1
+ import { css } from '@emotion/react';
2
+ import { componentForm } from '../../styleD/build/typescript/component/form.js';
3
+ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
+
5
+ const defaultFormInputContainerTheme = componentForm.input;
6
+ const formInputContainerStyles = (theme, { size }) => {
7
+ return css`
8
+ display: ${theme.shared.container.display};
9
+ flex-direction: ${theme.shared.container["flex-direction"]};
10
+ gap: ${theme.shared.container.gap};
11
+ width: ${theme.shared.container.width};
12
+ max-width: ${theme[size].container["max-width"]};
13
+ `;
14
+ };
15
+ const formInputLabelStyles = (theme, { isDisabled, size }) => {
16
+ return css`
17
+ color: ${theme.shared.label.color};
18
+ ${convertTypographyToEmotionStringStyle(theme[size].label.typography)}
19
+
20
+ ${isDisabled && css`
21
+ color: ${theme.shared.label.disabled.color};
22
+ `}
23
+ `;
24
+ };
25
+ const formInputDescriptionStyles = (theme, { isDisabled }) => {
26
+ return css`
27
+ color: ${theme.shared.description.color};
28
+ ${convertTypographyToEmotionStringStyle(theme.shared.description.typography)}
29
+ ${isDisabled && css`
30
+ color: ${theme.shared.description.disabled.color};
31
+ `}
32
+ `;
33
+ };
34
+
35
+ export { defaultFormInputContainerTheme, formInputContainerStyles, formInputDescriptionStyles, formInputLabelStyles };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var reactAriaComponents = require('react-aria-components');
4
+
5
+ const ALLOWED_FORM_CONTAINERS = [reactAriaComponents.TextField, reactAriaComponents.Select];
6
+
7
+ exports.ALLOWED_FORM_CONTAINERS = ALLOWED_FORM_CONTAINERS;
@@ -0,0 +1,5 @@
1
+ import { TextField, Select } from 'react-aria-components';
2
+
3
+ const ALLOWED_FORM_CONTAINERS = [TextField, Select];
4
+
5
+ export { ALLOWED_FORM_CONTAINERS };
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('@emotion/react/jsx-runtime');
4
- var focus = require('@react-aria/focus');
5
4
  var React = require('react');
6
5
  var reactAriaComponents = require('react-aria-components');
7
6
  var mergeDeep = require('../../util/mergeDeep.cjs');
@@ -83,15 +82,10 @@ function MenuItem({
83
82
  }) {
84
83
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultMenuItemTheme, theme);
85
84
  const textValue = props.textValue ?? (typeof label === "string" ? label : void 0);
86
- const { isFocusVisible, focusProps } = focus.useFocusRing();
87
85
  return /* @__PURE__ */ jsxRuntime.jsx(
88
86
  reactAriaComponents.MenuItem,
89
87
  {
90
- ...focusProps,
91
- css: [
92
- styles.menuItemStyles(mergedTheme, { description }, isFocusVisible),
93
- cssOverrides
94
- ],
88
+ css: [styles.menuItemStyles(mergedTheme, { description }), cssOverrides],
95
89
  ...props,
96
90
  textValue,
97
91
  children: ({ isSelected, selectionMode }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1,5 +1,4 @@
1
1
  import { jsxs, jsx, Fragment } from '@emotion/react/jsx-runtime';
2
- import { useFocusRing } from '@react-aria/focus';
3
2
  import React from 'react';
4
3
  import { MenuTrigger, Menu as Menu$1, MenuItem as MenuItem$1, MenuSection as MenuSection$1, Header, Separator, Popover as Popover$1 } from 'react-aria-components';
5
4
  import { mergeDeep } from '../../util/mergeDeep.js';
@@ -36,14 +35,7 @@ function MenuSection({ name, size = "md", theme = {}, cssOverrides, children, ..
36
35
  function MenuItem({ label, description, aside, icon, size = "md", theme = {}, cssOverrides, ...props }) {
37
36
  const mergedTheme = mergeDeep(defaultMenuItemTheme, theme);
38
37
  const textValue = props.textValue ?? (typeof label === "string" ? label : void 0);
39
- const { isFocusVisible, focusProps } = useFocusRing();
40
- return jsx(
41
- MenuItem$1,
42
- { ...focusProps, css: [
43
- menuItemStyles(mergedTheme, { description }, isFocusVisible),
44
- cssOverrides
45
- ], ...props, textValue, children: ({ isSelected, selectionMode }) => jsxs(Fragment, { children: [icon && selectionMode === "none" ? jsx(Icon, { size, cssOverrides: menuItemIconStyles(mergedTheme, { size }), children: icon }) : null, isSelected && selectionMode === "multiple" ? jsx(Icon, { size, symbol: "check_box", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, !isSelected && selectionMode === "multiple" ? jsx(Icon, { size, symbol: "check_box_outline_blank", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, isSelected && selectionMode === "single" ? jsx(Icon, { size, symbol: "radio_button_checked", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, !isSelected && selectionMode === "single" ? jsx(Icon, { size, symbol: "radio_button_unchecked", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, jsx("div", { css: menuItemLabelStyles(mergedTheme), children: label }), description && jsx("div", { css: menuItemDescriptionStyles(mergedTheme), children: description }), aside && jsx("div", { css: menuItemAsideStyles(mergedTheme), children: aside })] }) }
46
- );
38
+ return jsx(MenuItem$1, { css: [menuItemStyles(mergedTheme, { description }), cssOverrides], ...props, textValue, children: ({ isSelected, selectionMode }) => jsxs(Fragment, { children: [icon && selectionMode === "none" ? jsx(Icon, { size, cssOverrides: menuItemIconStyles(mergedTheme, { size }), children: icon }) : null, isSelected && selectionMode === "multiple" ? jsx(Icon, { size, symbol: "check_box", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, !isSelected && selectionMode === "multiple" ? jsx(Icon, { size, symbol: "check_box_outline_blank", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, isSelected && selectionMode === "single" ? jsx(Icon, { size, symbol: "radio_button_checked", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, !isSelected && selectionMode === "single" ? jsx(Icon, { size, symbol: "radio_button_unchecked", cssOverrides: menuItemIconStyles(mergedTheme, { size }) }) : null, jsx("div", { css: menuItemLabelStyles(mergedTheme), children: label }), description && jsx("div", { css: menuItemDescriptionStyles(mergedTheme), children: description }), aside && jsx("div", { css: menuItemAsideStyles(mergedTheme), children: aside })] }) });
47
39
  }
48
40
  function Menu({ theme = {}, size = "md", popoverProps, menuTriggerProps, children, cssOverrides, ...props }) {
49
41
  const mergedTheme = mergeDeep(defaultMenuTheme, theme);
@@ -24,7 +24,7 @@ const menuSectionHeaderStyles = (theme, { size }) => react.css`
24
24
  ${typography.convertTypographyToEmotionStringStyle(theme.header[size].typography)}
25
25
  `;
26
26
  const defaultMenuItemTheme = menu.componentMenu.menuItem;
27
- const menuItemStyles = (theme, { description }, isFocusVisible = false) => react.css`
27
+ const menuItemStyles = (theme, { description }) => react.css`
28
28
  display: ${theme.shared.display};
29
29
  grid-template-columns: ${theme.shared["grid-template-columns"]};
30
30
  grid-template-areas: ${description ? theme.shared["grid-template-areas-with-description"] : theme.shared["grid-template-areas"]};
@@ -37,17 +37,31 @@ const menuItemStyles = (theme, { description }, isFocusVisible = false) => react
37
37
  &:last-child {
38
38
  border-bottom: ${theme.shared[":last-child"]["border-bottom"]};
39
39
  }
40
- &[data-hovered],
41
- &:hover {
42
- background: ${theme.shared[":hover"]["background-color"]};
40
+
41
+ /* Hovering adds data-focused and the item stays focused after hovering away */
42
+ &[data-focused] {
43
+ background-color: ${theme.shared[":hover"]["background-color"]};
44
+ }
45
+ &[data-hovered] {
46
+ outline: ${theme.shared[":hover"].outline};
47
+ }
48
+
49
+ /* Override default browser focus behaviour */
50
+ :focus-visible {
51
+ outline: none;
52
+ }
53
+
54
+ /* focus visible used for keyboard focus */
55
+ &[data-focus-visible] {
56
+ outline: ${theme.shared[":focus-visible"]["outline"]};
57
+ outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
58
+ background-color: ${theme.shared[":hover"]["background-color"]};
59
+ }
60
+
61
+ /* Must be last to take precedence */
62
+ &[data-pressed] {
63
+ background-color: ${theme.shared[":pressed"]["background-color"]};
43
64
  }
44
- ${isFocusVisible ? react.css`
45
- outline: ${theme.shared[":focus-visible"]["outline"]};
46
- outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
47
- background: ${theme.shared[":hover"]["background-color"]};
48
- ` : react.css`
49
- outline: none;
50
- `}
51
65
  `;
52
66
  const menuItemIconStyles = (theme, { size }) => react.css`
53
67
  grid-area: ${theme.shared.icon["grid-area"]};
@@ -22,7 +22,7 @@ const menuSectionHeaderStyles = (theme, { size }) => css`
22
22
  ${convertTypographyToEmotionStringStyle(theme.header[size].typography)}
23
23
  `;
24
24
  const defaultMenuItemTheme = componentMenu.menuItem;
25
- const menuItemStyles = (theme, { description }, isFocusVisible = false) => css`
25
+ const menuItemStyles = (theme, { description }) => css`
26
26
  display: ${theme.shared.display};
27
27
  grid-template-columns: ${theme.shared["grid-template-columns"]};
28
28
  grid-template-areas: ${description ? theme.shared["grid-template-areas-with-description"] : theme.shared["grid-template-areas"]};
@@ -35,17 +35,31 @@ const menuItemStyles = (theme, { description }, isFocusVisible = false) => css`
35
35
  &:last-child {
36
36
  border-bottom: ${theme.shared[":last-child"]["border-bottom"]};
37
37
  }
38
- &[data-hovered],
39
- &:hover {
40
- background: ${theme.shared[":hover"]["background-color"]};
38
+
39
+ /* Hovering adds data-focused and the item stays focused after hovering away */
40
+ &[data-focused] {
41
+ background-color: ${theme.shared[":hover"]["background-color"]};
42
+ }
43
+ &[data-hovered] {
44
+ outline: ${theme.shared[":hover"].outline};
45
+ }
46
+
47
+ /* Override default browser focus behaviour */
48
+ :focus-visible {
49
+ outline: none;
50
+ }
51
+
52
+ /* focus visible used for keyboard focus */
53
+ &[data-focus-visible] {
54
+ outline: ${theme.shared[":focus-visible"]["outline"]};
55
+ outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
56
+ background-color: ${theme.shared[":hover"]["background-color"]};
57
+ }
58
+
59
+ /* Must be last to take precedence */
60
+ &[data-pressed] {
61
+ background-color: ${theme.shared[":pressed"]["background-color"]};
41
62
  }
42
- ${isFocusVisible ? css`
43
- outline: ${theme.shared[":focus-visible"]["outline"]};
44
- outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
45
- background: ${theme.shared[":hover"]["background-color"]};
46
- ` : css`
47
- outline: none;
48
- `}
49
63
  `;
50
64
  const menuItemIconStyles = (theme, { size }) => css`
51
65
  grid-area: ${theme.shared.icon["grid-area"]};
@@ -4,8 +4,8 @@ var jsxRuntime = require('@emotion/react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var reactAriaComponents = require('react-aria-components');
6
6
  var mergeDeep = require('../../util/mergeDeep.cjs');
7
+ var Form = require('../form/Form.cjs');
7
8
  var Icon = require('../icon/Icon.cjs');
8
- var InlineMessage = require('../inline-message/InlineMessage.cjs');
9
9
  var styles = require('./styles.cjs');
10
10
 
11
11
  function Option({ children, theme = {} }) {
@@ -30,33 +30,24 @@ function ListBox({ children, theme = {} }) {
30
30
  return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.ListBox, { css: styles.listBoxStyles(mergedTheme), children: items });
31
31
  }
32
32
  function Select({
33
- children,
34
- label,
35
- contextualHelpText,
36
- theme = {},
37
- cssOverrides,
38
- className,
39
33
  isInvalid,
40
- errorMessage,
34
+ theme = {},
35
+ children,
41
36
  ...props
42
37
  }) {
43
38
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultSelectTheme, theme);
44
39
  return /* @__PURE__ */ jsxRuntime.jsxs(
45
- reactAriaComponents.Select,
40
+ Form.FormInputContainer,
46
41
  {
47
- css: [styles.selectStyles(mergedTheme), cssOverrides],
48
- className,
42
+ as: reactAriaComponents.Select,
43
+ size: "md",
49
44
  isInvalid,
50
45
  ...props,
51
46
  children: [
52
- label && /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Label, { css: styles.labelStyles(mergedTheme), children: label }),
53
- " ",
54
- contextualHelpText && /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.helpTextStyles(mergedTheme), children: contextualHelpText }),
55
47
  /* @__PURE__ */ jsxRuntime.jsxs(reactAriaComponents.Button, { css: styles.buttonStyles(mergedTheme, isInvalid), children: [
56
48
  /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.SelectValue, {}),
57
49
  /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { symbol: "keyboard_arrow_down", size: "lg" })
58
50
  ] }),
59
- /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.FieldError, { children: /* @__PURE__ */ jsxRuntime.jsx(InlineMessage.InlineMessage, { level: "error", children: errorMessage }) }),
60
51
  /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Popover, { css: styles.popoverStyles(mergedTheme), children: /* @__PURE__ */ jsxRuntime.jsx(ListBox, { children }) })
61
52
  ]
62
53
  }
@@ -1,10 +1,10 @@
1
1
  import { jsxs, jsx } from '@emotion/react/jsx-runtime';
2
2
  import React from 'react';
3
- import { Select as Select$1, Label, Button, SelectValue, FieldError, Popover, ListBox as ListBox$1, ListBoxItem } from 'react-aria-components';
3
+ import { Select as Select$1, Button, SelectValue, Popover, ListBox as ListBox$1, ListBoxItem } from 'react-aria-components';
4
4
  import { mergeDeep } from '../../util/mergeDeep.js';
5
+ import { FormInputContainer } from '../form/Form.js';
5
6
  import { Icon } from '../icon/Icon.js';
6
- import { InlineMessage } from '../inline-message/InlineMessage.js';
7
- import { labelStyles, helpTextStyles, buttonStyles, popoverStyles, selectStyles, defaultSelectTheme, listBoxStyles, listBoxItemStyles } from './styles.js';
7
+ import { buttonStyles, popoverStyles, defaultSelectTheme, listBoxStyles, listBoxItemStyles } from './styles.js';
8
8
 
9
9
  function Option({ children, theme = {} }) {
10
10
  const mergedTheme = mergeDeep(defaultSelectTheme, theme);
@@ -25,9 +25,9 @@ function ListBox({ children, theme = {} }) {
25
25
  });
26
26
  return jsx(ListBox$1, { css: listBoxStyles(mergedTheme), children: items });
27
27
  }
28
- function Select({ children, label, contextualHelpText, theme = {}, cssOverrides, className, isInvalid, errorMessage, ...props }) {
28
+ function Select({ isInvalid, theme = {}, children, ...props }) {
29
29
  const mergedTheme = mergeDeep(defaultSelectTheme, theme);
30
- return jsxs(Select$1, { css: [selectStyles(mergedTheme), cssOverrides], className, isInvalid, ...props, children: [label && jsx(Label, { css: labelStyles(mergedTheme), children: label }), " ", contextualHelpText && jsx("div", { css: helpTextStyles(mergedTheme), children: contextualHelpText }), jsxs(Button, { css: buttonStyles(mergedTheme, isInvalid), children: [jsx(SelectValue, {}), jsx(Icon, { symbol: "keyboard_arrow_down", size: "lg" })] }), jsx(FieldError, { children: jsx(InlineMessage, { level: "error", children: errorMessage }) }), jsx(Popover, { css: popoverStyles(mergedTheme), children: jsx(ListBox, { children }) })] });
30
+ return jsxs(FormInputContainer, { as: Select$1, size: "md", isInvalid, ...props, children: [jsxs(Button, { css: buttonStyles(mergedTheme, isInvalid), children: [jsx(SelectValue, {}), jsx(Icon, { symbol: "keyboard_arrow_down", size: "lg" })] }), jsx(Popover, { css: popoverStyles(mergedTheme), children: jsx(ListBox, { children }) })] });
31
31
  }
32
32
 
33
33
  export { Option, Select };
@@ -5,16 +5,6 @@ var select = require('../../styleD/build/typescript/component/select.cjs');
5
5
  var typography = require('../../styleD/utils/semantic/typography.cjs');
6
6
 
7
7
  const defaultSelectTheme = select.componentSelect;
8
- const selectStyles = (theme) => {
9
- return react.css`
10
- display: ${theme.shared.display};
11
- flex-direction: ${theme.shared.flexDirection};
12
- gap: ${theme.shared.gap};
13
-
14
- max-width: ${theme.shared.maxWidth};
15
- width: ${theme.shared.width};
16
- `;
17
- };
18
8
  const popoverStyles = (theme) => {
19
9
  return react.css`
20
10
  max-width: ${theme.shared.maxWidth};
@@ -23,10 +13,10 @@ const popoverStyles = (theme) => {
23
13
  };
24
14
  const listBoxItemStyles = (theme) => {
25
15
  return react.css`
26
- padding-left: ${theme.option.paddingLeft};
27
- padding-right: ${theme.option.paddingRight};
28
- padding-top: ${theme.option.paddingTop};
29
- padding-bottom: ${theme.option.paddingBottom};
16
+ padding-left: ${theme.shared.option.paddingLeft};
17
+ padding-right: ${theme.shared.option.paddingRight};
18
+ padding-top: ${theme.shared.option.paddingTop};
19
+ padding-bottom: ${theme.shared.option.paddingBottom};
30
20
 
31
21
  &[data-hovered] {
32
22
  outline: ${theme.shared.hover.outline};
@@ -43,9 +33,9 @@ const listBoxItemStyles = (theme) => {
43
33
  }
44
34
 
45
35
  &[data-focus-visible] {
46
- outline: ${theme.option.focused.outline};
47
- outline-offset: ${theme.option.focused["outline-offset"]};
48
- background-color: ${theme.option.focused.backgroundColor};
36
+ outline: ${theme.shared.option.focused.outline};
37
+ outline-offset: ${theme.shared.option.focused["outline-offset"]};
38
+ background-color: ${theme.shared.option.focused.backgroundColor};
49
39
  }
50
40
 
51
41
  /* Must be last to take precedence */
@@ -56,41 +46,29 @@ const listBoxItemStyles = (theme) => {
56
46
  };
57
47
  const listBoxStyles = (theme) => {
58
48
  return react.css`
59
- ${typography.convertTypographyToEmotionStringStyle(theme.listBox.typography)}
60
- background-color: ${theme.listBox.backgroundColor};
61
- border: ${theme.listBox.border};
62
- box-shadow: ${theme.listBox.shadow};
49
+ ${typography.convertTypographyToEmotionStringStyle(theme.shared.listBox.typography)}
50
+ background-color: ${theme.shared.listBox.backgroundColor};
51
+ border: ${theme.shared.listBox.border};
52
+ box-shadow: ${theme.shared.listBox.shadow};
63
53
  max-width: ${theme.shared.maxWidth};
64
54
  width: ${theme.shared.width};
65
55
  outline: none;
66
56
  `;
67
57
  };
68
- const labelStyles = (theme) => {
69
- return react.css`
70
- color: ${theme.label.color};
71
- ${typography.convertTypographyToEmotionStringStyle(theme.label.typography)};
72
- `;
73
- };
74
- const helpTextStyles = (theme) => {
75
- return react.css`
76
- color: ${theme.helpText.color};
77
- ${typography.convertTypographyToEmotionStringStyle(theme.helpText.typography)}
78
- `;
79
- };
80
58
  const buttonStyles = (theme, isInvalid) => {
81
59
  return react.css`
82
- display: ${theme.button.display};
83
- justify-content: ${theme.button.justifyContent};
84
- align-items: ${theme.button.alignItems};
85
- background-color: ${theme.button.backgroundColor};
86
- border: ${theme.button.border};
87
- border-radius: ${theme.button.borderRadius};
88
- height: ${theme.button.height};
89
- padding-left: ${theme.button.paddingLeft};
90
- padding-right: ${theme.button.paddingRight};
91
- margin-top: ${theme.button.marginTop};
92
- ${typography.convertTypographyToEmotionStringStyle(theme.button.typography)}
93
- color: ${theme.button.color};
60
+ display: ${theme.shared.button.display};
61
+ justify-content: ${theme.shared.button.justifyContent};
62
+ align-items: ${theme.shared.button.alignItems};
63
+ background-color: ${theme.shared.button.backgroundColor};
64
+ border: ${theme.shared.button.border};
65
+ border-radius: ${theme.shared.button.borderRadius};
66
+ height: ${theme.shared.button.height};
67
+ padding-left: ${theme.shared.button.paddingLeft};
68
+ padding-right: ${theme.shared.button.paddingRight};
69
+ margin-top: ${theme.shared.button.marginTop};
70
+ ${typography.convertTypographyToEmotionStringStyle(theme.shared.button.typography)}
71
+ color: ${theme.shared.button.color};
94
72
 
95
73
  &[data-hovered] {
96
74
  background-color: ${theme.shared.hover.backgroundColor};
@@ -101,26 +79,23 @@ const buttonStyles = (theme, isInvalid) => {
101
79
  }
102
80
 
103
81
  &[data-focus-visible] {
104
- outline: ${theme.button.focused.outline};
105
- outline-offset: ${theme.button.focused["outline-offset"]};
82
+ outline: ${theme.shared.button.focused.outline};
83
+ outline-offset: ${theme.shared.button.focused["outline-offset"]};
106
84
  }
107
85
 
108
86
  &[data-disabled] {
109
- cursor: ${theme.button.disabled.cursor};
110
- background-color: ${theme.button.disabled.backgroundColor};
111
- color: ${theme.button.disabled.color};
112
- border: ${theme.button.disabled.border};
87
+ cursor: ${theme.shared.button.disabled.cursor};
88
+ background-color: ${theme.shared.button.disabled.backgroundColor};
89
+ color: ${theme.shared.button.disabled.color};
90
+ border: ${theme.shared.button.disabled.border};
113
91
  }
114
92
 
115
- ${isInvalid ? `border: ${theme.button.error.border};` : ``}
93
+ ${isInvalid ? `border: ${theme.shared.button.error.border};` : ``}
116
94
  `;
117
95
  };
118
96
 
119
97
  exports.buttonStyles = buttonStyles;
120
98
  exports.defaultSelectTheme = defaultSelectTheme;
121
- exports.helpTextStyles = helpTextStyles;
122
- exports.labelStyles = labelStyles;
123
99
  exports.listBoxItemStyles = listBoxItemStyles;
124
100
  exports.listBoxStyles = listBoxStyles;
125
101
  exports.popoverStyles = popoverStyles;
126
- exports.selectStyles = selectStyles;