@guardian/stand 0.0.57 → 0.0.58

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.
@@ -7,7 +7,7 @@ react = require_runtime.__toESM(react);
7
7
  let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
8
8
  let react_aria_components = require("react-aria-components");
9
9
  //#region src/components/RadioGroup/RadioGroup.tsx
10
- function RadioGroup({ size = "md", isInvalid = false, theme = {}, children, ...props }) {
10
+ function RadioGroup({ size = "md", orientation = "vertical", isInvalid = false, theme = {}, children, ...props }) {
11
11
  const mergedTheme = require_mergeDeep.mergeDeep(require_styles.defaultRadioGroupTheme, theme);
12
12
  const radios = [];
13
13
  react.default.Children.forEach(children, (child) => {
@@ -24,7 +24,10 @@ function RadioGroup({ size = "md", isInvalid = false, theme = {}, children, ...p
24
24
  isInvalid,
25
25
  ...props,
26
26
  children: /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)("div", {
27
- css: require_styles.radioGroupStyles(mergedTheme, { size }),
27
+ css: require_styles.radioGroupStyles(mergedTheme, {
28
+ size,
29
+ orientation
30
+ }),
28
31
  children: radios
29
32
  })
30
33
  });
@@ -3,6 +3,7 @@ import { RadioGroupProps, RadioProps } from "./types.cjs";
3
3
  //#region src/components/RadioGroup/RadioGroup.d.ts
4
4
  declare function RadioGroup({
5
5
  size,
6
+ orientation,
6
7
  isInvalid,
7
8
  theme,
8
9
  children,
@@ -3,6 +3,7 @@ import { RadioGroupProps, RadioProps } from "./types.js";
3
3
  //#region src/components/RadioGroup/RadioGroup.d.ts
4
4
  declare function RadioGroup({
5
5
  size,
6
+ orientation,
6
7
  isInvalid,
7
8
  theme,
8
9
  children,
@@ -5,7 +5,7 @@ import React from "react";
5
5
  import { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";
6
6
  import { Radio, RadioGroup, composeRenderProps } from "react-aria-components";
7
7
  //#region src/components/RadioGroup/RadioGroup.tsx
8
- function RadioGroup$1({ size = "md", isInvalid = false, theme = {}, children, ...props }) {
8
+ function RadioGroup$1({ size = "md", orientation = "vertical", isInvalid = false, theme = {}, children, ...props }) {
9
9
  const mergedTheme = mergeDeep(defaultRadioGroupTheme, theme);
10
10
  const radios = [];
11
11
  React.Children.forEach(children, (child) => {
@@ -22,7 +22,10 @@ function RadioGroup$1({ size = "md", isInvalid = false, theme = {}, children, ..
22
22
  isInvalid,
23
23
  ...props,
24
24
  children: /* @__PURE__ */ jsx("div", {
25
- css: radioGroupStyles(mergedTheme, { size }),
25
+ css: radioGroupStyles(mergedTheme, {
26
+ size,
27
+ orientation
28
+ }),
26
29
  children: radios
27
30
  })
28
31
  });
@@ -3,13 +3,17 @@ const require_radioGroup = require("../../styleD/build/typescript/component/radi
3
3
  let _emotion_react = require("@emotion/react");
4
4
  //#region src/components/RadioGroup/styles.ts
5
5
  const defaultRadioGroupTheme = require_radioGroup.componentRadioGroup;
6
- const radioGroupStyles = (theme, { size }) => {
6
+ const radioGroupStyles = (theme, { size, orientation }) => {
7
7
  return _emotion_react.css`
8
8
  display: ${theme.shared.display};
9
- flex-direction: ${theme.shared.flexDirection};
9
+ flex-direction: ${theme.shared.orientation.vertical.flexDirection};
10
10
  gap: ${theme[size].gap};
11
11
  margin-top: ${theme.shared.marginTop};
12
12
  margin-bottom: ${theme.shared.marginBottom};
13
+
14
+ ${orientation === "horizontal" && _emotion_react.css`
15
+ flex-direction: ${theme.shared.orientation.horizontal.flexDirection};
16
+ `}
13
17
  `;
14
18
  };
15
19
  const radioStyles = (theme, { size, isInvalid }) => {
@@ -3,13 +3,17 @@ import { componentRadioGroup } from "../../styleD/build/typescript/component/rad
3
3
  import { css } from "@emotion/react";
4
4
  //#region src/components/RadioGroup/styles.ts
5
5
  const defaultRadioGroupTheme = componentRadioGroup;
6
- const radioGroupStyles = (theme, { size }) => {
6
+ const radioGroupStyles = (theme, { size, orientation }) => {
7
7
  return css`
8
8
  display: ${theme.shared.display};
9
- flex-direction: ${theme.shared.flexDirection};
9
+ flex-direction: ${theme.shared.orientation.vertical.flexDirection};
10
10
  gap: ${theme[size].gap};
11
11
  margin-top: ${theme.shared.marginTop};
12
12
  margin-bottom: ${theme.shared.marginBottom};
13
+
14
+ ${orientation === "horizontal" && css`
15
+ flex-direction: ${theme.shared.orientation.horizontal.flexDirection};
16
+ `}
13
17
  `;
14
18
  };
15
19
  const radioStyles = (theme, { size, isInvalid }) => {
@@ -7,6 +7,11 @@ import { RadioGroupProps, RadioProps } from "react-aria-components";
7
7
  type RadioGroupProps$1 = FormInputContainerDefaultProps<RadioGroupProps, RadioGroupTheme>;
8
8
  interface RadioProps$1 extends DefaultProps<RadioGroupTheme, RadioProps['className']>, RadioProps {
9
9
  size?: keyof Omit<RadioGroupTheme, 'shared'>;
10
+ /**
11
+ * Orientation of the radio buttons. Can be either 'horizontal' or 'vertical'.
12
+ * @default 'vertical'
13
+ */
14
+ orientation?: 'horizontal' | 'vertical';
10
15
  /** Whether the input value is invalid. */
11
16
  isInvalid?: boolean;
12
17
  }
@@ -7,6 +7,11 @@ import { RadioGroupProps, RadioProps } from "react-aria-components";
7
7
  type RadioGroupProps$1 = FormInputContainerDefaultProps<RadioGroupProps, RadioGroupTheme>;
8
8
  interface RadioProps$1 extends DefaultProps<RadioGroupTheme, RadioProps['className']>, RadioProps {
9
9
  size?: keyof Omit<RadioGroupTheme, 'shared'>;
10
+ /**
11
+ * Orientation of the radio buttons. Can be either 'horizontal' or 'vertical'.
12
+ * @default 'vertical'
13
+ */
14
+ orientation?: 'horizontal' | 'vertical';
10
15
  /** Whether the input value is invalid. */
11
16
  isInvalid?: boolean;
12
17
  }
@@ -6,7 +6,8 @@
6
6
  --component-radio-group-shared-margin-top: 0.5rem; /** spacing between the input itself and the previous element (label or description) minus the flex gap (default 4px), e.g. if the spacing between label and input should be 12px, then margin-top should be 8px */
7
7
  --component-radio-group-shared-margin-bottom: 0.5rem; /** spacing between the input itself and the next element (error text) minus the flex gap (default 4px), e.g. if the spacing between label and input should be 12px, then margin-top should be 8px */
8
8
  --component-radio-group-shared-display: flex;
9
- --component-radio-group-shared-flex-direction: column;
9
+ --component-radio-group-shared-orientation-vertical-flex-direction: column;
10
+ --component-radio-group-shared-orientation-horizontal-flex-direction: row;
10
11
  --component-radio-group-shared-radio-color: #000000;
11
12
  --component-radio-group-shared-radio-disabled-color: #999999;
12
13
  --component-radio-group-shared-radio-display: flex;
@@ -7,7 +7,10 @@ const componentRadioGroup = {
7
7
  marginTop: "0.5rem",
8
8
  marginBottom: "0.5rem",
9
9
  display: "flex",
10
- flexDirection: "column",
10
+ orientation: {
11
+ vertical: { flexDirection: "column" },
12
+ horizontal: { flexDirection: "row" }
13
+ },
11
14
  radio: {
12
15
  color: "#000000",
13
16
  disabled: { color: "#999999" },
@@ -7,7 +7,14 @@ declare const componentRadioGroup: {
7
7
  marginTop: string;
8
8
  marginBottom: string;
9
9
  display: string;
10
- flexDirection: string;
10
+ orientation: {
11
+ vertical: {
12
+ flexDirection: string;
13
+ };
14
+ horizontal: {
15
+ flexDirection: string;
16
+ };
17
+ };
11
18
  radio: {
12
19
  color: string;
13
20
  disabled: {
@@ -7,7 +7,14 @@ declare const componentRadioGroup: {
7
7
  marginTop: string;
8
8
  marginBottom: string;
9
9
  display: string;
10
- flexDirection: string;
10
+ orientation: {
11
+ vertical: {
12
+ flexDirection: string;
13
+ };
14
+ horizontal: {
15
+ flexDirection: string;
16
+ };
17
+ };
11
18
  radio: {
12
19
  color: string;
13
20
  disabled: {
@@ -7,7 +7,10 @@ const componentRadioGroup = {
7
7
  marginTop: "0.5rem",
8
8
  marginBottom: "0.5rem",
9
9
  display: "flex",
10
- flexDirection: "column",
10
+ orientation: {
11
+ vertical: { flexDirection: "column" },
12
+ horizontal: { flexDirection: "row" }
13
+ },
11
14
  radio: {
12
15
  color: "#000000",
13
16
  disabled: { color: "#999999" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/stand",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "repository": {
5
5
  "url": "https://github.com/guardian/stand"
6
6
  },