@instructure/ui-checkbox 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.
- package/CHANGELOG.md +11 -0
- package/es/Checkbox/v2/props.js +1 -1
- package/es/Checkbox/v2/styles.js +10 -2
- package/es/CheckboxGroup/v2/props.js +1 -1
- package/lib/Checkbox/v2/props.js +1 -1
- package/lib/Checkbox/v2/styles.js +9 -2
- package/lib/CheckboxGroup/v2/props.js +1 -1
- package/package.json +16 -16
- package/src/Checkbox/v2/props.ts +12 -1
- package/src/Checkbox/v2/styles.ts +10 -3
- package/src/CheckboxGroup/v2/README.md +1 -0
- package/src/CheckboxGroup/v2/props.ts +9 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Checkbox/v1/CheckboxFacade/index.d.ts +1 -1
- package/types/Checkbox/v1/CheckboxFacade/index.d.ts.map +1 -1
- package/types/Checkbox/v1/CheckboxFacade/styles.d.ts.map +1 -1
- package/types/Checkbox/v1/CheckboxFacade/theme.d.ts.map +1 -1
- package/types/Checkbox/v1/ToggleFacade/index.d.ts +2 -2
- package/types/Checkbox/v1/ToggleFacade/index.d.ts.map +1 -1
- package/types/Checkbox/v1/ToggleFacade/styles.d.ts.map +1 -1
- package/types/Checkbox/v1/ToggleFacade/theme.d.ts.map +1 -1
- package/types/Checkbox/v1/index.d.ts +3 -3
- package/types/Checkbox/v1/index.d.ts.map +1 -1
- package/types/Checkbox/v1/styles.d.ts.map +1 -1
- package/types/Checkbox/v1/theme.d.ts.map +1 -1
- package/types/Checkbox/v2/CheckboxFacade/index.d.ts +1 -1
- package/types/Checkbox/v2/CheckboxFacade/index.d.ts.map +1 -1
- package/types/Checkbox/v2/CheckboxFacade/styles.d.ts +1 -1
- package/types/Checkbox/v2/CheckboxFacade/styles.d.ts.map +1 -1
- package/types/Checkbox/v2/ToggleFacade/index.d.ts +2 -2
- package/types/Checkbox/v2/ToggleFacade/index.d.ts.map +1 -1
- package/types/Checkbox/v2/ToggleFacade/styles.d.ts +1 -1
- package/types/Checkbox/v2/ToggleFacade/styles.d.ts.map +1 -1
- package/types/Checkbox/v2/index.d.ts +4 -3
- package/types/Checkbox/v2/index.d.ts.map +1 -1
- package/types/Checkbox/v2/props.d.ts +7 -1
- package/types/Checkbox/v2/props.d.ts.map +1 -1
- package/types/Checkbox/v2/styles.d.ts +2 -2
- package/types/Checkbox/v2/styles.d.ts.map +1 -1
- package/types/CheckboxGroup/v1/index.d.ts +2 -2
- package/types/CheckboxGroup/v1/index.d.ts.map +1 -1
- package/types/CheckboxGroup/v2/index.d.ts +3 -2
- package/types/CheckboxGroup/v2/index.d.ts.map +1 -1
- package/types/CheckboxGroup/v2/props.d.ts +7 -0
- package/types/CheckboxGroup/v2/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **many:** add margin prop to v2 FormFieldGroup, CheckboxGroup, RadioInputGroup, Checkbox, RadioInput, RangeInput, Text, and ToggleButton ([fea952f](https://github.com/instructure/instructure-ui/commit/fea952f22e553745c299eeba1a2700dbb3b9d296))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [11.7.5](https://github.com/instructure/instructure-ui/compare/v11.7.4...v11.7.5) (2026-08-25)
|
|
7
18
|
|
|
8
19
|
|
package/es/Checkbox/v2/props.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const allowedProps = ['label', 'id', 'value', 'messages', 'defaultChecked', 'checked', 'onChange', 'onKeyDown', 'onFocus', 'onBlur', 'onMouseOver', 'onMouseOut', 'disabled', 'readOnly', 'indeterminate', 'size', 'variant', 'inline', 'labelPlacement', 'isRequired', 'inputRef'];
|
|
25
|
+
const allowedProps = ['label', 'id', 'value', 'messages', 'defaultChecked', 'checked', 'onChange', 'onKeyDown', 'onFocus', 'onBlur', 'onMouseOver', 'onMouseOut', 'disabled', 'readOnly', 'indeterminate', 'size', 'variant', 'inline', 'labelPlacement', 'isRequired', 'margin', 'inputRef'];
|
|
26
26
|
export { allowedProps };
|
package/es/Checkbox/v2/styles.js
CHANGED
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import { calcSpacingFromShorthand } from '@instructure/emotion';
|
|
26
|
+
|
|
25
27
|
/**
|
|
26
28
|
* ---
|
|
27
29
|
* private: true
|
|
@@ -33,11 +35,12 @@
|
|
|
33
35
|
* @param {Object} state the state of the component, the style is applied to
|
|
34
36
|
* @return {Object} The final style object, which will be used in the component
|
|
35
37
|
*/
|
|
36
|
-
const generateStyle = (componentTheme, props) => {
|
|
38
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
37
39
|
const {
|
|
38
40
|
inline,
|
|
39
41
|
size,
|
|
40
|
-
variant
|
|
42
|
+
variant,
|
|
43
|
+
margin
|
|
41
44
|
} = props;
|
|
42
45
|
|
|
43
46
|
// toggleFullWidth calculation based on Toggle facade width (1.625rem * 1.5) and the marginInlineEnd (0.75rem)
|
|
@@ -68,6 +71,11 @@ const generateStyle = (componentTheme, props) => {
|
|
|
68
71
|
label: 'checkbox',
|
|
69
72
|
position: 'relative',
|
|
70
73
|
width: '100%',
|
|
74
|
+
// Resolves spacing tokens (or custom CSS values) into a margin shorthand.
|
|
75
|
+
margin: calcSpacingFromShorthand(margin, {
|
|
76
|
+
...sharedTokens.spacing,
|
|
77
|
+
...sharedTokens.legacy.spacing
|
|
78
|
+
}),
|
|
71
79
|
...(inline && {
|
|
72
80
|
display: 'inline-block',
|
|
73
81
|
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', 'size', 'layout'];
|
|
25
|
+
const allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'size', 'layout', 'margin'];
|
|
26
26
|
export { allowedProps };
|
package/lib/Checkbox/v2/props.js
CHANGED
|
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
const allowedProps = exports.allowedProps = ['label', 'id', 'value', 'messages', 'defaultChecked', 'checked', 'onChange', 'onKeyDown', 'onFocus', 'onBlur', 'onMouseOver', 'onMouseOut', 'disabled', 'readOnly', 'indeterminate', 'size', 'variant', 'inline', 'labelPlacement', 'isRequired', 'inputRef'];
|
|
31
|
+
const allowedProps = exports.allowedProps = ['label', 'id', 'value', 'messages', 'defaultChecked', 'checked', 'onChange', 'onKeyDown', 'onFocus', 'onBlur', 'onMouseOver', 'onMouseOut', 'disabled', 'readOnly', 'indeterminate', 'size', 'variant', 'inline', 'labelPlacement', 'isRequired', 'margin', 'inputRef'];
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _emotion = require("@instructure/emotion");
|
|
7
8
|
/*
|
|
8
9
|
* The MIT License (MIT)
|
|
9
10
|
*
|
|
@@ -39,11 +40,12 @@ exports.default = void 0;
|
|
|
39
40
|
* @param {Object} state the state of the component, the style is applied to
|
|
40
41
|
* @return {Object} The final style object, which will be used in the component
|
|
41
42
|
*/
|
|
42
|
-
const generateStyle = (componentTheme, props) => {
|
|
43
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
43
44
|
const {
|
|
44
45
|
inline,
|
|
45
46
|
size,
|
|
46
|
-
variant
|
|
47
|
+
variant,
|
|
48
|
+
margin
|
|
47
49
|
} = props;
|
|
48
50
|
|
|
49
51
|
// toggleFullWidth calculation based on Toggle facade width (1.625rem * 1.5) and the marginInlineEnd (0.75rem)
|
|
@@ -74,6 +76,11 @@ const generateStyle = (componentTheme, props) => {
|
|
|
74
76
|
label: 'checkbox',
|
|
75
77
|
position: 'relative',
|
|
76
78
|
width: '100%',
|
|
79
|
+
// Resolves spacing tokens (or custom CSS values) into a margin shorthand.
|
|
80
|
+
margin: (0, _emotion.calcSpacingFromShorthand)(margin, {
|
|
81
|
+
...sharedTokens.spacing,
|
|
82
|
+
...sharedTokens.legacy.spacing
|
|
83
|
+
}),
|
|
77
84
|
...(inline && {
|
|
78
85
|
display: 'inline-block',
|
|
79
86
|
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', 'size', 'layout'];
|
|
31
|
+
const allowedProps = exports.allowedProps = ['name', 'description', 'defaultValue', 'value', 'onChange', 'disabled', 'readOnly', 'messages', 'children', 'size', 'layout', 'margin'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-checkbox",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.6-snapshot-11",
|
|
4
4
|
"description": " styled HTML input type='checkbox' component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -16,27 +16,27 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
18
|
"keycode": "^2",
|
|
19
|
-
"@instructure/console": "11.7.
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-dom-utils": "11.7.
|
|
23
|
-
"@instructure/ui-form-field": "11.7.
|
|
24
|
-
"@instructure/ui-icons": "11.7.
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/uid": "11.7.
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
19
|
+
"@instructure/console": "11.7.6-snapshot-11",
|
|
20
|
+
"@instructure/shared-types": "11.7.6-snapshot-11",
|
|
21
|
+
"@instructure/emotion": "11.7.6-snapshot-11",
|
|
22
|
+
"@instructure/ui-dom-utils": "11.7.6-snapshot-11",
|
|
23
|
+
"@instructure/ui-form-field": "11.7.6-snapshot-11",
|
|
24
|
+
"@instructure/ui-icons": "11.7.6-snapshot-11",
|
|
25
|
+
"@instructure/ui-themes": "11.7.6-snapshot-11",
|
|
26
|
+
"@instructure/ui-utils": "11.7.6-snapshot-11",
|
|
27
|
+
"@instructure/ui-svg-images": "11.7.6-snapshot-11",
|
|
28
|
+
"@instructure/uid": "11.7.6-snapshot-11",
|
|
29
|
+
"@instructure/ui-view": "11.7.6-snapshot-11",
|
|
30
|
+
"@instructure/ui-react-utils": "11.7.6-snapshot-11"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@testing-library/jest-dom": "^6.9.1",
|
|
34
34
|
"@testing-library/react": "16.3.2",
|
|
35
35
|
"@testing-library/user-event": "^14.6.1",
|
|
36
36
|
"vitest": "^4.1.9",
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-color-utils": "11.7.
|
|
37
|
+
"@instructure/ui-axe-check": "11.7.6-snapshot-11",
|
|
38
|
+
"@instructure/ui-babel-preset": "11.7.6-snapshot-11",
|
|
39
|
+
"@instructure/ui-color-utils": "11.7.6-snapshot-11"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=18 <=19"
|
package/src/Checkbox/v2/props.ts
CHANGED
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
|
|
25
25
|
import type { FormMessage } from '@instructure/ui-form-field/latest'
|
|
26
26
|
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
27
|
-
import type {
|
|
27
|
+
import type {
|
|
28
|
+
WithStyleProps,
|
|
29
|
+
ComponentStyle,
|
|
30
|
+
Spacing
|
|
31
|
+
} from '@instructure/emotion'
|
|
28
32
|
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
29
33
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
30
34
|
|
|
@@ -71,6 +75,12 @@ type CheckboxOwnProps = {
|
|
|
71
75
|
inline?: boolean
|
|
72
76
|
labelPlacement?: 'top' | 'start' | 'end'
|
|
73
77
|
isRequired?: boolean
|
|
78
|
+
/**
|
|
79
|
+
* Valid values are `0`, `none`, `auto`, and Spacing token values,
|
|
80
|
+
* see https://instructure.design/layout-spacing. Apply these values via
|
|
81
|
+
* familiar CSS-like shorthand. For example, `margin="general.spaceMd auto"`.
|
|
82
|
+
*/
|
|
83
|
+
margin?: Spacing
|
|
74
84
|
/**
|
|
75
85
|
* A function that provides a reference to the actual underlying input element
|
|
76
86
|
*/
|
|
@@ -116,6 +126,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
116
126
|
'inline',
|
|
117
127
|
'labelPlacement',
|
|
118
128
|
'isRequired',
|
|
129
|
+
'margin',
|
|
119
130
|
'inputRef'
|
|
120
131
|
]
|
|
121
132
|
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import type { CheckboxProps, CheckboxStyle } from './props'
|
|
26
|
-
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
26
|
+
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
|
|
27
|
+
import { calcSpacingFromShorthand } from '@instructure/emotion'
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* ---
|
|
@@ -38,9 +39,10 @@ import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
|
38
39
|
*/
|
|
39
40
|
const generateStyle = (
|
|
40
41
|
componentTheme: ReturnType<NewComponentTypes['Checkbox']>,
|
|
41
|
-
props: CheckboxProps
|
|
42
|
+
props: CheckboxProps,
|
|
43
|
+
sharedTokens: SharedTokens
|
|
42
44
|
): CheckboxStyle => {
|
|
43
|
-
const { inline, size, variant } = props
|
|
45
|
+
const { inline, size, variant, margin } = props
|
|
44
46
|
|
|
45
47
|
// toggleFullWidth calculation based on Toggle facade width (1.625rem * 1.5) and the marginInlineEnd (0.75rem)
|
|
46
48
|
const toggleFullWidth = `calc(1.625rem * 1.5 + 0.75rem)`
|
|
@@ -82,6 +84,11 @@ const generateStyle = (
|
|
|
82
84
|
label: 'checkbox',
|
|
83
85
|
position: 'relative',
|
|
84
86
|
width: '100%',
|
|
87
|
+
// Resolves spacing tokens (or custom CSS values) into a margin shorthand.
|
|
88
|
+
margin: calcSpacingFromShorthand(margin, {
|
|
89
|
+
...sharedTokens.spacing,
|
|
90
|
+
...sharedTokens.legacy.spacing
|
|
91
|
+
}),
|
|
85
92
|
...(inline && {
|
|
86
93
|
display: 'inline-block',
|
|
87
94
|
verticalAlign: 'middle',
|
|
@@ -12,6 +12,7 @@ type: example
|
|
|
12
12
|
---
|
|
13
13
|
<FormFieldGroup description={<ScreenReaderContent>CheckboxGroup examples</ScreenReaderContent>}>
|
|
14
14
|
<CheckboxGroup name="sports"
|
|
15
|
+
margin="general.spaceMd 0"
|
|
15
16
|
onChange={function (value) { console.log(value) }}
|
|
16
17
|
defaultValue={['football', 'volleyball']}
|
|
17
18
|
description="Select your favorite sports"
|
|
@@ -26,6 +26,7 @@ import { type InputHTMLAttributes } from 'react'
|
|
|
26
26
|
import type { FormMessage } from '@instructure/ui-form-field/latest'
|
|
27
27
|
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
28
28
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
29
|
+
import type { Spacing } from '@instructure/emotion'
|
|
29
30
|
|
|
30
31
|
import { Checkbox } from '../../Checkbox/v2/index.js'
|
|
31
32
|
import type { CheckboxProps } from '../../Checkbox/v2/props'
|
|
@@ -44,6 +45,12 @@ type CheckboxGroupOwnProps = {
|
|
|
44
45
|
messages?: FormMessage[]
|
|
45
46
|
size?: 'small' | 'medium' | 'large'
|
|
46
47
|
layout?: 'stacked' | 'columns' | 'inline'
|
|
48
|
+
/**
|
|
49
|
+
* Valid values are `0`, `none`, `auto`, and Spacing token values,
|
|
50
|
+
* see https://instructure.design/layout-spacing. Apply these values via
|
|
51
|
+
* familiar CSS-like shorthand. For example, `margin="general.spaceMd auto"`.
|
|
52
|
+
*/
|
|
53
|
+
margin?: Spacing
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
type PropKeys = keyof CheckboxGroupOwnProps
|
|
@@ -67,7 +74,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
67
74
|
'messages',
|
|
68
75
|
'children',
|
|
69
76
|
'size',
|
|
70
|
-
'layout'
|
|
77
|
+
'layout',
|
|
78
|
+
'margin'
|
|
71
79
|
]
|
|
72
80
|
|
|
73
81
|
type CheckboxGroupState = {
|