@instructure/ui-radio-input 11.7.5 → 11.7.6-snapshot-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 (34) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/es/RadioInput/v2/index.js +6 -8
  3. package/es/RadioInput/v2/props.js +1 -1
  4. package/es/RadioInput/v2/styles.js +8 -2
  5. package/es/RadioInputGroup/v2/props.js +1 -1
  6. package/lib/RadioInput/v2/index.js +5 -7
  7. package/lib/RadioInput/v2/props.js +1 -1
  8. package/lib/RadioInput/v2/styles.js +7 -1
  9. package/lib/RadioInputGroup/v2/props.js +1 -1
  10. package/package.json +11 -11
  11. package/src/RadioInput/v2/index.tsx +5 -8
  12. package/src/RadioInput/v2/props.ts +12 -1
  13. package/src/RadioInput/v2/styles.ts +20 -2
  14. package/src/RadioInputGroup/v2/README.md +1 -1
  15. package/src/RadioInputGroup/v2/props.ts +10 -1
  16. package/tsconfig.build.tsbuildinfo +1 -1
  17. package/types/RadioInput/v1/index.d.ts +3 -3
  18. package/types/RadioInput/v1/index.d.ts.map +1 -1
  19. package/types/RadioInput/v1/styles.d.ts.map +1 -1
  20. package/types/RadioInput/v1/theme.d.ts.map +1 -1
  21. package/types/RadioInput/v2/index.d.ts +15 -12
  22. package/types/RadioInput/v2/index.d.ts.map +1 -1
  23. package/types/RadioInput/v2/props.d.ts +7 -1
  24. package/types/RadioInput/v2/props.d.ts.map +1 -1
  25. package/types/RadioInput/v2/styles.d.ts +2 -1
  26. package/types/RadioInput/v2/styles.d.ts.map +1 -1
  27. package/types/RadioInputGroup/v1/index.d.ts +4 -4
  28. package/types/RadioInputGroup/v1/index.d.ts.map +1 -1
  29. package/types/RadioInputGroup/v1/styles.d.ts.map +1 -1
  30. package/types/RadioInputGroup/v1/theme.d.ts.map +1 -1
  31. package/types/RadioInputGroup/v2/index.d.ts +5 -4
  32. package/types/RadioInputGroup/v2/index.d.ts.map +1 -1
  33. package/types/RadioInputGroup/v2/props.d.ts +7 -0
  34. package/types/RadioInputGroup/v2/props.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [11.7.6-snapshot-11](https://github.com/instructure/instructure-ui/compare/v11.7.5...v11.7.6-snapshot-11) (2026-08-31)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **many:** generate deterministic ids with React useId ([83aa25a](https://github.com/instructure/instructure-ui/commit/83aa25aebd41720fd09beac025dbf961e1f413c2))
12
+
13
+
14
+ ### Features
15
+
16
+ * **many:** add margin prop to v2 FormFieldGroup, CheckboxGroup, RadioInputGroup, Checkbox, RadioInput, RangeInput, Text, and ToggleButton ([fea952f](https://github.com/instructure/instructure-ui/commit/fea952f22e553745c299eeba1a2700dbb3b9d296))
17
+
18
+
19
+
20
+
21
+
6
22
  ## [11.7.5](https://github.com/instructure/instructure-ui/compare/v11.7.4...v11.7.5) (2026-08-25)
7
23
 
8
24
  **Note:** Version bump only for package @instructure/ui-radio-input
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { useState, useRef, useImperativeHandle, forwardRef, useCallback, useEffect } from 'react';
25
+ import { useState, useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
26
26
  import { passthroughProps, useDeterministicId } from '@instructure/ui-react-utils';
27
27
  import { isActiveElement } from '@instructure/ui-dom-utils';
28
28
  import { useStyleNew } from '@instructure/emotion';
@@ -41,6 +41,7 @@ const RadioInput = /*#__PURE__*/forwardRef((props, ref) => {
41
41
  inline = false,
42
42
  context = 'success',
43
43
  readOnly = false,
44
+ margin,
44
45
  id: idProp,
45
46
  label,
46
47
  value,
@@ -60,12 +61,8 @@ const RadioInput = /*#__PURE__*/forwardRef((props, ref) => {
60
61
  const containerRef = useRef(null);
61
62
  const inputElementRef = useRef(null);
62
63
 
63
- // Deterministic ID generation
64
- const [deterministicId, setDeterministicId] = useState();
65
- const getId = useDeterministicId('RadioInput');
66
- useEffect(() => {
67
- setDeterministicId(getId());
68
- }, []);
64
+ // SSR-safe deterministic ID generation (stable across server/client render)
65
+ const deterministicId = useDeterministicId('RadioInput')();
69
66
  const id = idProp || deterministicId;
70
67
 
71
68
  // Computed checked value
@@ -82,7 +79,8 @@ const RadioInput = /*#__PURE__*/forwardRef((props, ref) => {
82
79
  hovered,
83
80
  readOnly,
84
81
  size,
85
- variant
82
+ variant,
83
+ margin
86
84
  },
87
85
  componentId: 'RadioInput',
88
86
  displayName: 'RadioInput'
@@ -22,5 +22,5 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- const allowedProps = ['label', 'value', 'id', 'name', 'checked', 'disabled', 'readOnly', 'variant', 'size', 'context', 'inline', 'onClick', 'onChange', 'inputRef'];
25
+ const allowedProps = ['label', 'value', 'id', 'name', 'checked', 'disabled', 'readOnly', 'variant', 'size', 'context', 'inline', 'margin', 'onClick', 'onChange', 'inputRef'];
26
26
  export { allowedProps };
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { boxShadowObjectsToCSSString } from '@instructure/ui-themes';
26
- import { calcFocusOutlineStyles } from '@instructure/emotion';
26
+ import { calcFocusOutlineStyles, calcSpacingFromShorthand } from '@instructure/emotion';
27
27
  /**
28
28
  * ---
29
29
  * private: true
@@ -42,7 +42,8 @@ const generateStyle = (componentTheme, params, sharedTokens) => {
42
42
  size,
43
43
  readOnly,
44
44
  variant,
45
- context
45
+ context,
46
+ margin
46
47
  } = params;
47
48
 
48
49
  // 4*2 states: base, hover, disabled, readonly X none/selected
@@ -237,6 +238,11 @@ const generateStyle = (componentTheme, params, sharedTokens) => {
237
238
  display: 'flex',
238
239
  alignItems: 'flex-start',
239
240
  width: inline ? 'auto' : '100%',
241
+ // Resolves spacing tokens (or custom CSS values) into a margin shorthand.
242
+ margin: calcSpacingFromShorthand(margin, {
243
+ ...sharedTokens.spacing,
244
+ ...sharedTokens.legacy.spacing
245
+ }),
240
246
  ...(inline && {
241
247
  display: 'inline-flex',
242
248
  verticalAlign: 'middle'
@@ -22,5 +22,5 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- const allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'variant', 'size', 'layout', 'isRequired'];
25
+ const allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'variant', 'size', 'layout', 'isRequired', 'margin'];
26
26
  export { allowedProps };
@@ -49,6 +49,7 @@ const RadioInput = exports.RadioInput = /*#__PURE__*/(0, _react.forwardRef)((pro
49
49
  inline = false,
50
50
  context = 'success',
51
51
  readOnly = false,
52
+ margin,
52
53
  id: idProp,
53
54
  label,
54
55
  value,
@@ -68,12 +69,8 @@ const RadioInput = exports.RadioInput = /*#__PURE__*/(0, _react.forwardRef)((pro
68
69
  const containerRef = (0, _react.useRef)(null);
69
70
  const inputElementRef = (0, _react.useRef)(null);
70
71
 
71
- // Deterministic ID generation
72
- const [deterministicId, setDeterministicId] = (0, _react.useState)();
73
- const getId = (0, _useDeterministicId.useDeterministicId)('RadioInput');
74
- (0, _react.useEffect)(() => {
75
- setDeterministicId(getId());
76
- }, []);
72
+ // SSR-safe deterministic ID generation (stable across server/client render)
73
+ const deterministicId = (0, _useDeterministicId.useDeterministicId)('RadioInput')();
77
74
  const id = idProp || deterministicId;
78
75
 
79
76
  // Computed checked value
@@ -90,7 +87,8 @@ const RadioInput = exports.RadioInput = /*#__PURE__*/(0, _react.forwardRef)((pro
90
87
  hovered,
91
88
  readOnly,
92
89
  size,
93
- variant
90
+ variant,
91
+ margin
94
92
  },
95
93
  componentId: 'RadioInput',
96
94
  displayName: 'RadioInput'
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
28
28
  * SOFTWARE.
29
29
  */
30
30
 
31
- const allowedProps = exports.allowedProps = ['label', 'value', 'id', 'name', 'checked', 'disabled', 'readOnly', 'variant', 'size', 'context', 'inline', 'onClick', 'onChange', 'inputRef'];
31
+ const allowedProps = exports.allowedProps = ['label', 'value', 'id', 'name', 'checked', 'disabled', 'readOnly', 'variant', 'size', 'context', 'inline', 'margin', 'onClick', 'onChange', 'inputRef'];
@@ -48,7 +48,8 @@ const generateStyle = (componentTheme, params, sharedTokens) => {
48
48
  size,
49
49
  readOnly,
50
50
  variant,
51
- context
51
+ context,
52
+ margin
52
53
  } = params;
53
54
 
54
55
  // 4*2 states: base, hover, disabled, readonly X none/selected
@@ -243,6 +244,11 @@ const generateStyle = (componentTheme, params, sharedTokens) => {
243
244
  display: 'flex',
244
245
  alignItems: 'flex-start',
245
246
  width: inline ? 'auto' : '100%',
247
+ // Resolves spacing tokens (or custom CSS values) into a margin shorthand.
248
+ margin: (0, _emotion.calcSpacingFromShorthand)(margin, {
249
+ ...sharedTokens.spacing,
250
+ ...sharedTokens.legacy.spacing
251
+ }),
246
252
  ...(inline && {
247
253
  display: 'inline-flex',
248
254
  verticalAlign: 'middle'
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
28
28
  * SOFTWARE.
29
29
  */
30
30
 
31
- const allowedProps = exports.allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'variant', 'size', 'layout', 'isRequired'];
31
+ const allowedProps = exports.allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'variant', 'size', 'layout', 'isRequired', 'margin'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-radio-input",
3
- "version": "11.7.5",
3
+ "version": "11.7.6-snapshot-11",
4
4
  "description": "A styled HTML input type='radio' element",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,22 +15,22 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.29.7",
18
- "@instructure/emotion": "11.7.5",
19
- "@instructure/shared-types": "11.7.5",
20
- "@instructure/ui-a11y-utils": "11.7.5",
21
- "@instructure/ui-form-field": "11.7.5",
22
- "@instructure/ui-dom-utils": "11.7.5",
23
- "@instructure/ui-react-utils": "11.7.5",
24
- "@instructure/ui-themes": "11.7.5"
18
+ "@instructure/emotion": "11.7.6-snapshot-11",
19
+ "@instructure/ui-a11y-utils": "11.7.6-snapshot-11",
20
+ "@instructure/ui-form-field": "11.7.6-snapshot-11",
21
+ "@instructure/ui-dom-utils": "11.7.6-snapshot-11",
22
+ "@instructure/shared-types": "11.7.6-snapshot-11",
23
+ "@instructure/ui-react-utils": "11.7.6-snapshot-11",
24
+ "@instructure/ui-themes": "11.7.6-snapshot-11"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@testing-library/jest-dom": "^6.9.1",
28
28
  "@testing-library/react": "16.3.2",
29
29
  "@testing-library/user-event": "^14.6.1",
30
30
  "vitest": "^4.1.9",
31
- "@instructure/ui-babel-preset": "11.7.5",
32
- "@instructure/ui-color-utils": "11.7.5",
33
- "@instructure/ui-axe-check": "11.7.5"
31
+ "@instructure/ui-babel-preset": "11.7.6-snapshot-11",
32
+ "@instructure/ui-color-utils": "11.7.6-snapshot-11",
33
+ "@instructure/ui-axe-check": "11.7.6-snapshot-11"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18 <=19"
@@ -28,7 +28,6 @@ import {
28
28
  useImperativeHandle,
29
29
  forwardRef,
30
30
  useCallback,
31
- useEffect,
32
31
  type RefObject
33
32
  } from 'react'
34
33
 
@@ -58,6 +57,7 @@ const RadioInput = forwardRef<RadioInputHandle, RadioInputProps>(
58
57
  inline = false,
59
58
  context = 'success',
60
59
  readOnly = false,
60
+ margin,
61
61
  id: idProp,
62
62
  label,
63
63
  value,
@@ -77,12 +77,8 @@ const RadioInput = forwardRef<RadioInputHandle, RadioInputProps>(
77
77
  const containerRef = useRef<HTMLDivElement | null>(null)
78
78
  const inputElementRef = useRef<HTMLInputElement | null>(null)
79
79
 
80
- // Deterministic ID generation
81
- const [deterministicId, setDeterministicId] = useState<string | undefined>()
82
- const getId = useDeterministicId('RadioInput')
83
- useEffect(() => {
84
- setDeterministicId(getId())
85
- }, [])
80
+ // SSR-safe deterministic ID generation (stable across server/client render)
81
+ const deterministicId = useDeterministicId('RadioInput')()
86
82
  const id = idProp || deterministicId
87
83
 
88
84
  // Computed checked value
@@ -100,7 +96,8 @@ const RadioInput = forwardRef<RadioInputHandle, RadioInputProps>(
100
96
  hovered,
101
97
  readOnly,
102
98
  size,
103
- variant
99
+ variant,
100
+ margin
104
101
  },
105
102
  componentId: 'RadioInput',
106
103
  displayName: 'RadioInput'
@@ -25,7 +25,11 @@
25
25
  import React from 'react'
26
26
  import type { InputHTMLAttributes } from 'react'
27
27
  import type { OtherHTMLAttributes } from '@instructure/shared-types'
28
- import type { ComponentStyle, NewThemeOverrideProp } from '@instructure/emotion'
28
+ import type {
29
+ ComponentStyle,
30
+ NewThemeOverrideProp,
31
+ Spacing
32
+ } from '@instructure/emotion'
29
33
  import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
30
34
  import type { NewComponentTypes } from '@instructure/ui-themes'
31
35
 
@@ -77,6 +81,12 @@ type RadioInputOwnProps = {
77
81
  * Sets the `display:inline-flex` in CSS
78
82
  */
79
83
  inline?: boolean
84
+ /**
85
+ * Valid values are `0`, `none`, `auto`, and Spacing token values,
86
+ * see https://instructure.design/layout-spacing. Apply these values via
87
+ * familiar CSS-like shorthand. For example, `margin="general.spaceMd auto"`.
88
+ */
89
+ margin?: Spacing
80
90
  onClick?: (event: React.MouseEvent<HTMLInputElement>) => void
81
91
  /**
82
92
  * Callback fired when the input fires a change event.
@@ -118,6 +128,7 @@ const allowedProps: AllowedPropKeys = [
118
128
  'size',
119
129
  'context',
120
130
  'inline',
131
+ 'margin',
121
132
  'onClick',
122
133
  'onChange',
123
134
  'inputRef'
@@ -25,7 +25,10 @@
25
25
  import type { RadioInputProps, RadioInputStyle } from './props'
26
26
  import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
27
27
  import { boxShadowObjectsToCSSString } from '@instructure/ui-themes'
28
- import { calcFocusOutlineStyles } from '@instructure/emotion'
28
+ import {
29
+ calcFocusOutlineStyles,
30
+ calcSpacingFromShorthand
31
+ } from '@instructure/emotion'
29
32
 
30
33
  type StyleParams = {
31
34
  disabled: RadioInputProps['disabled']
@@ -35,6 +38,7 @@ type StyleParams = {
35
38
  readOnly: RadioInputProps['readOnly']
36
39
  size: RadioInputProps['size']
37
40
  variant: RadioInputProps['variant']
41
+ margin: RadioInputProps['margin']
38
42
  }
39
43
 
40
44
  /**
@@ -52,7 +56,16 @@ const generateStyle = (
52
56
  params: StyleParams,
53
57
  sharedTokens: SharedTokens
54
58
  ): RadioInputStyle => {
55
- const { disabled, inline, hovered, size, readOnly, variant, context } = params
59
+ const {
60
+ disabled,
61
+ inline,
62
+ hovered,
63
+ size,
64
+ readOnly,
65
+ variant,
66
+ context,
67
+ margin
68
+ } = params
56
69
 
57
70
  // 4*2 states: base, hover, disabled, readonly X none/selected
58
71
  const insetSizes = {
@@ -272,6 +285,11 @@ const generateStyle = (
272
285
  display: 'flex',
273
286
  alignItems: 'flex-start',
274
287
  width: inline ? 'auto' : '100%',
288
+ // Resolves spacing tokens (or custom CSS values) into a margin shorthand.
289
+ margin: calcSpacingFromShorthand(margin, {
290
+ ...sharedTokens.spacing,
291
+ ...sharedTokens.legacy.spacing
292
+ }),
275
293
  ...(inline && {
276
294
  display: 'inline-flex',
277
295
  verticalAlign: 'middle'
@@ -25,7 +25,7 @@ function Example () {
25
25
  console.log(value)
26
26
  }
27
27
  return (
28
- <RadioInputGroup onChange={handleChange} name="example1" defaultValue="foo" description="Select something">
28
+ <RadioInputGroup onChange={handleChange} name="example1" defaultValue="foo" description="Select something" margin="general.spaceMd 0">
29
29
  {inputs.map(input => <RadioInput key={input.value} value={input.value} label={input.label} />)}
30
30
  </RadioInputGroup>
31
31
  )
@@ -27,6 +27,7 @@ import React from 'react'
27
27
  import type { FormMessage } from '@instructure/ui-form-field/latest'
28
28
  import type { OtherHTMLAttributes } from '@instructure/shared-types'
29
29
  import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
30
+ import type { Spacing } from '@instructure/emotion'
30
31
 
31
32
  type RadioInputGroupOwnProps = {
32
33
  /**
@@ -88,6 +89,13 @@ type RadioInputGroupOwnProps = {
88
89
  * Setting this to `true` adds and asterisk after the description (group label). It does not cause any behavioural change.
89
90
  */
90
91
  isRequired?: boolean
92
+
93
+ /**
94
+ * Valid values are `0`, `none`, `auto`, and Spacing token values,
95
+ * see https://instructure.design/layout-spacing. Apply these values via
96
+ * familiar CSS-like shorthand. For example, `margin="general.spaceMd auto"`.
97
+ */
98
+ margin?: Spacing
91
99
  }
92
100
 
93
101
  type PropKeys = keyof RadioInputGroupOwnProps
@@ -115,7 +123,8 @@ const allowedProps: AllowedPropKeys = [
115
123
  'variant',
116
124
  'size',
117
125
  'layout',
118
- 'isRequired'
126
+ 'isRequired',
127
+ 'margin'
119
128
  ]
120
129
 
121
130
  export type { RadioInputGroupProps, RadioInputGroupState }