@primer/react 0.0.0-20260223172608 → 0.0.0-20260223174351
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 +26 -2
- package/dist/ActionList/ActionList-c04a02d6.css +2 -0
- package/dist/ActionList/ActionList-c04a02d6.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/ActionList/Item.d.ts.map +1 -1
- package/dist/ActionList/Item.js +1 -0
- package/dist/Autocomplete/Autocomplete.js +76 -159
- package/dist/Autocomplete/AutocompleteMenu.js +128 -333
- package/dist/Autocomplete/AutocompleteOverlay.js +49 -130
- package/dist/Banner/Banner.js +64 -238
- package/dist/Blankslate/{Blankslate-f5a9755a.css → Blankslate-a039d79a.css} +2 -2
- package/dist/Blankslate/Blankslate-a039d79a.css.map +1 -0
- package/dist/Blankslate/Blankslate.module.css.js +1 -1
- package/dist/Button/Button.js +11 -34
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/Checkbox/Checkbox.js +55 -163
- package/dist/Dialog/Dialog.js +105 -347
- package/dist/FilteredActionList/FilteredActionList.d.ts +16 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +147 -42
- package/dist/PageLayout/PageLayout-3444a142.css +2 -0
- package/dist/PageLayout/PageLayout-3444a142.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +72 -2
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +750 -1235
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/usePaneWidth.d.ts +18 -6
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +126 -112
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -1
- package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
- package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
- package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.d.ts.map +1 -1
- package/dist/Text/Text.js +10 -13
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +324 -88
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +11 -4
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +3 -2
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +59 -164
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/styles.d.ts +16 -0
- package/dist/UnderlineNav/styles.d.ts.map +1 -0
- package/dist/UnderlineNav/styles.js +19 -0
- package/dist/experimental/SelectPanel2/SelectPanel.js +209 -593
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.d.ts.map +1 -1
- package/dist/hooks/useRefObjectAsForwardedRef.js +10 -2
- package/dist/hooks/useScrollFlash.d.ts.map +1 -1
- package/dist/hooks/useScrollFlash.js +14 -22
- package/dist/hooks/useSlots.d.ts +50 -6
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +114 -36
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +60 -66
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/utils/environment.js +9 -0
- package/generated/components.json +197 -5
- package/package.json +3 -3
- package/dist/ActionList/ActionList-f4ac3b54.css +0 -2
- package/dist/ActionList/ActionList-f4ac3b54.css.map +0 -1
- package/dist/Blankslate/Blankslate-f5a9755a.css.map +0 -1
- package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
- package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNav-f506fb23.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-f506fb23.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-db9dc5d0.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-be1a162c.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-be1a162c.css.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import React, { forwardRef } from 'react';
|
|
3
2
|
import { ButtonBase } from './ButtonBase.js';
|
|
4
3
|
import { TooltipContext, Tooltip } from '../TooltipV2/Tooltip.js';
|
|
@@ -7,158 +6,70 @@ import classes from './ButtonBase.module.css.js';
|
|
|
7
6
|
import { clsx } from 'clsx';
|
|
8
7
|
import { jsx } from 'react/jsx-runtime';
|
|
9
8
|
|
|
10
|
-
const IconButton = /*#__PURE__*/forwardRef((
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
icon: Icon,
|
|
25
|
-
"aria-label": ariaLabel,
|
|
26
|
-
description,
|
|
27
|
-
disabled,
|
|
28
|
-
tooltipDirection,
|
|
29
|
-
unsafeDisableTooltip: t1,
|
|
30
|
-
keyshortcuts,
|
|
31
|
-
keybindingHint,
|
|
32
|
-
className,
|
|
33
|
-
...props
|
|
34
|
-
} = t0);
|
|
35
|
-
$[0] = t0;
|
|
36
|
-
$[1] = Icon;
|
|
37
|
-
$[2] = ariaLabel;
|
|
38
|
-
$[3] = className;
|
|
39
|
-
$[4] = description;
|
|
40
|
-
$[5] = disabled;
|
|
41
|
-
$[6] = keybindingHint;
|
|
42
|
-
$[7] = keyshortcuts;
|
|
43
|
-
$[8] = props;
|
|
44
|
-
$[9] = t1;
|
|
45
|
-
$[10] = tooltipDirection;
|
|
46
|
-
} else {
|
|
47
|
-
Icon = $[1];
|
|
48
|
-
ariaLabel = $[2];
|
|
49
|
-
className = $[3];
|
|
50
|
-
description = $[4];
|
|
51
|
-
disabled = $[5];
|
|
52
|
-
keybindingHint = $[6];
|
|
53
|
-
keyshortcuts = $[7];
|
|
54
|
-
props = $[8];
|
|
55
|
-
t1 = $[9];
|
|
56
|
-
tooltipDirection = $[10];
|
|
57
|
-
}
|
|
58
|
-
const unsafeDisableTooltip = t1 === undefined ? false : t1;
|
|
9
|
+
const IconButton = /*#__PURE__*/forwardRef(({
|
|
10
|
+
icon: Icon,
|
|
11
|
+
'aria-label': ariaLabel,
|
|
12
|
+
description,
|
|
13
|
+
disabled,
|
|
14
|
+
tooltipDirection,
|
|
15
|
+
// This is planned to be a temporary prop until the default tooltip on icon buttons are fully rolled out.
|
|
16
|
+
unsafeDisableTooltip = false,
|
|
17
|
+
keyshortcuts,
|
|
18
|
+
keybindingHint,
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}, forwardedRef) => {
|
|
22
|
+
// If the icon button is already wrapped in a tooltip, do not add one.
|
|
59
23
|
const {
|
|
60
24
|
tooltipId
|
|
61
|
-
} = React.useContext(TooltipContext);
|
|
25
|
+
} = React.useContext(TooltipContext); // Tooltip v2
|
|
62
26
|
const {
|
|
63
27
|
tooltipId: tooltipIdV1
|
|
64
|
-
} = React.useContext(TooltipContext$1);
|
|
28
|
+
} = React.useContext(TooltipContext$1); // Tooltip v1
|
|
29
|
+
|
|
65
30
|
const {
|
|
66
|
-
|
|
67
|
-
|
|
31
|
+
'aria-expanded': isExpanded,
|
|
32
|
+
'aria-haspopup': hasPopup
|
|
68
33
|
} = props;
|
|
69
34
|
const hasExternalTooltip = tooltipId || tooltipIdV1;
|
|
70
|
-
|
|
71
|
-
|
|
35
|
+
|
|
36
|
+
// If the button has an active "popup" (like a menu), we don't want to show the tooltip.
|
|
37
|
+
// This is mostly for `ActionMenu`, but could be applicable elsewhere.
|
|
38
|
+
const hasActivePopup = (isExpanded === true || isExpanded === 'true') && hasPopup === 'true';
|
|
39
|
+
const withoutTooltip = unsafeDisableTooltip || disabled || ariaLabel === undefined || ariaLabel === '' || hasExternalTooltip;
|
|
72
40
|
if (withoutTooltip) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
icon: Icon,
|
|
85
|
-
className: t2,
|
|
86
|
-
"data-component": "IconButton",
|
|
87
|
-
type: "button",
|
|
88
|
-
"aria-label": ariaLabel,
|
|
89
|
-
disabled: disabled,
|
|
90
|
-
...props,
|
|
91
|
-
ref: forwardedRef
|
|
92
|
-
});
|
|
93
|
-
$[13] = Icon;
|
|
94
|
-
$[14] = ariaLabel;
|
|
95
|
-
$[15] = disabled;
|
|
96
|
-
$[16] = forwardedRef;
|
|
97
|
-
$[17] = props;
|
|
98
|
-
$[18] = t2;
|
|
99
|
-
$[19] = t3;
|
|
100
|
-
} else {
|
|
101
|
-
t3 = $[19];
|
|
102
|
-
}
|
|
103
|
-
return t3;
|
|
41
|
+
return /*#__PURE__*/jsx(ButtonBase, {
|
|
42
|
+
icon: Icon,
|
|
43
|
+
className: clsx(className, classes.IconButton),
|
|
44
|
+
"data-component": "IconButton",
|
|
45
|
+
type: "button",
|
|
46
|
+
"aria-label": ariaLabel,
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
...props,
|
|
49
|
+
// @ts-expect-error StyledButton wants both Anchor and Button refs
|
|
50
|
+
ref: forwardedRef
|
|
51
|
+
});
|
|
104
52
|
} else {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} else {
|
|
115
|
-
t4 = $[21];
|
|
116
|
-
}
|
|
117
|
-
const t5 = (_keyshortcuts = keyshortcuts) !== null && _keyshortcuts !== void 0 ? _keyshortcuts : undefined;
|
|
118
|
-
const t6 = description ? ariaLabel : undefined;
|
|
119
|
-
let t7;
|
|
120
|
-
if ($[22] !== Icon || $[23] !== props || $[24] !== t4 || $[25] !== t5 || $[26] !== t6) {
|
|
121
|
-
t7 = /*#__PURE__*/jsx(ButtonBase, {
|
|
53
|
+
const tooltipText = description !== null && description !== void 0 ? description : ariaLabel;
|
|
54
|
+
return /*#__PURE__*/jsx(Tooltip, {
|
|
55
|
+
ref: forwardedRef,
|
|
56
|
+
text: tooltipText,
|
|
57
|
+
type: description ? undefined : 'label',
|
|
58
|
+
direction: tooltipDirection,
|
|
59
|
+
keybindingHint: keybindingHint !== null && keybindingHint !== void 0 ? keybindingHint : keyshortcuts,
|
|
60
|
+
_privateDisableTooltip: hasActivePopup,
|
|
61
|
+
children: /*#__PURE__*/jsx(ButtonBase, {
|
|
122
62
|
icon: Icon,
|
|
123
|
-
className:
|
|
63
|
+
className: clsx(className, classes.IconButton),
|
|
124
64
|
"data-component": "IconButton",
|
|
125
65
|
type: "button",
|
|
126
|
-
"aria-keyshortcuts":
|
|
127
|
-
|
|
66
|
+
"aria-keyshortcuts": keyshortcuts !== null && keyshortcuts !== void 0 ? keyshortcuts : undefined
|
|
67
|
+
// If description is provided, we will use the tooltip to describe the button, so we need to keep the aria-label to label the button.
|
|
68
|
+
,
|
|
69
|
+
"aria-label": description ? ariaLabel : undefined,
|
|
128
70
|
...props
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
$[23] = props;
|
|
132
|
-
$[24] = t4;
|
|
133
|
-
$[25] = t5;
|
|
134
|
-
$[26] = t6;
|
|
135
|
-
$[27] = t7;
|
|
136
|
-
} else {
|
|
137
|
-
t7 = $[27];
|
|
138
|
-
}
|
|
139
|
-
let t8;
|
|
140
|
-
if ($[28] !== forwardedRef || $[29] !== hasActivePopup || $[30] !== t2 || $[31] !== t3 || $[32] !== t7 || $[33] !== tooltipDirection || $[34] !== tooltipText) {
|
|
141
|
-
t8 = /*#__PURE__*/jsx(Tooltip, {
|
|
142
|
-
ref: forwardedRef,
|
|
143
|
-
text: tooltipText,
|
|
144
|
-
type: t2,
|
|
145
|
-
direction: tooltipDirection,
|
|
146
|
-
keybindingHint: t3,
|
|
147
|
-
_privateDisableTooltip: hasActivePopup,
|
|
148
|
-
children: t7
|
|
149
|
-
});
|
|
150
|
-
$[28] = forwardedRef;
|
|
151
|
-
$[29] = hasActivePopup;
|
|
152
|
-
$[30] = t2;
|
|
153
|
-
$[31] = t3;
|
|
154
|
-
$[32] = t7;
|
|
155
|
-
$[33] = tooltipDirection;
|
|
156
|
-
$[34] = tooltipText;
|
|
157
|
-
$[35] = t8;
|
|
158
|
-
} else {
|
|
159
|
-
t8 = $[35];
|
|
160
|
-
}
|
|
161
|
-
return t8;
|
|
71
|
+
})
|
|
72
|
+
});
|
|
162
73
|
}
|
|
163
74
|
});
|
|
164
75
|
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { forwardRef } from 'react';
|
|
3
2
|
import { ButtonBase } from './ButtonBase.js';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
|
-
const LinkButton = /*#__PURE__*/forwardRef((
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$[0] = t0;
|
|
18
|
-
$[1] = children;
|
|
19
|
-
$[2] = props;
|
|
20
|
-
$[3] = t1;
|
|
21
|
-
} else {
|
|
22
|
-
children = $[1];
|
|
23
|
-
props = $[2];
|
|
24
|
-
t1 = $[3];
|
|
25
|
-
}
|
|
26
|
-
const Component = t1 === undefined ? "a" : t1;
|
|
27
|
-
let t2;
|
|
28
|
-
if ($[4] !== Component || $[5] !== children || $[6] !== forwardedRef || $[7] !== props) {
|
|
29
|
-
t2 = /*#__PURE__*/jsx(ButtonBase, {
|
|
30
|
-
as: Component,
|
|
31
|
-
ref: forwardedRef,
|
|
32
|
-
...props,
|
|
33
|
-
children: children
|
|
34
|
-
});
|
|
35
|
-
$[4] = Component;
|
|
36
|
-
$[5] = children;
|
|
37
|
-
$[6] = forwardedRef;
|
|
38
|
-
$[7] = props;
|
|
39
|
-
$[8] = t2;
|
|
40
|
-
} else {
|
|
41
|
-
t2 = $[8];
|
|
42
|
-
}
|
|
43
|
-
return t2;
|
|
5
|
+
const LinkButton = /*#__PURE__*/forwardRef(({
|
|
6
|
+
children,
|
|
7
|
+
as: Component = 'a',
|
|
8
|
+
...props
|
|
9
|
+
}, forwardedRef) => {
|
|
10
|
+
return /*#__PURE__*/jsx(ButtonBase, {
|
|
11
|
+
as: Component,
|
|
12
|
+
ref: forwardedRef,
|
|
13
|
+
...props,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
44
16
|
});
|
|
45
17
|
|
|
46
18
|
export { LinkButton };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
1
|
import { clsx } from 'clsx';
|
|
3
2
|
import React, { useContext, useEffect } from 'react';
|
|
4
3
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
@@ -11,170 +10,63 @@ import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
|
11
10
|
/**
|
|
12
11
|
* An accessible, native checkbox component
|
|
13
12
|
*/
|
|
14
|
-
const Checkbox = /*#__PURE__*/React.forwardRef((
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
checked,
|
|
29
|
-
className,
|
|
30
|
-
defaultChecked,
|
|
31
|
-
indeterminate,
|
|
32
|
-
disabled,
|
|
33
|
-
onChange,
|
|
34
|
-
required,
|
|
35
|
-
validationStatus,
|
|
36
|
-
value,
|
|
37
|
-
...rest
|
|
38
|
-
} = t0);
|
|
39
|
-
$[0] = t0;
|
|
40
|
-
$[1] = checked;
|
|
41
|
-
$[2] = className;
|
|
42
|
-
$[3] = defaultChecked;
|
|
43
|
-
$[4] = disabled;
|
|
44
|
-
$[5] = indeterminate;
|
|
45
|
-
$[6] = onChange;
|
|
46
|
-
$[7] = required;
|
|
47
|
-
$[8] = rest;
|
|
48
|
-
$[9] = validationStatus;
|
|
49
|
-
$[10] = value;
|
|
50
|
-
} else {
|
|
51
|
-
checked = $[1];
|
|
52
|
-
className = $[2];
|
|
53
|
-
defaultChecked = $[3];
|
|
54
|
-
disabled = $[4];
|
|
55
|
-
indeterminate = $[5];
|
|
56
|
-
onChange = $[6];
|
|
57
|
-
required = $[7];
|
|
58
|
-
rest = $[8];
|
|
59
|
-
validationStatus = $[9];
|
|
60
|
-
value = $[10];
|
|
61
|
-
}
|
|
13
|
+
const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
14
|
+
checked,
|
|
15
|
+
className,
|
|
16
|
+
defaultChecked,
|
|
17
|
+
indeterminate,
|
|
18
|
+
disabled,
|
|
19
|
+
onChange,
|
|
20
|
+
required,
|
|
21
|
+
validationStatus,
|
|
22
|
+
value,
|
|
23
|
+
...rest
|
|
24
|
+
}, ref
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
) => {
|
|
62
27
|
const checkboxRef = useProvidedRefOrCreate(ref);
|
|
63
28
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
$[23] = value;
|
|
106
|
-
$[24] = t5;
|
|
107
|
-
} else {
|
|
108
|
-
t5 = $[24];
|
|
109
|
-
}
|
|
110
|
-
const inputProps = t5;
|
|
111
|
-
let t6;
|
|
112
|
-
if ($[25] !== checkboxRef || $[26] !== indeterminate) {
|
|
113
|
-
t6 = () => {
|
|
114
|
-
if (checkboxRef.current) {
|
|
115
|
-
checkboxRef.current.indeterminate = indeterminate || false;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
$[25] = checkboxRef;
|
|
119
|
-
$[26] = indeterminate;
|
|
120
|
-
$[27] = t6;
|
|
121
|
-
} else {
|
|
122
|
-
t6 = $[27];
|
|
123
|
-
}
|
|
124
|
-
let t7;
|
|
125
|
-
if ($[28] !== checkboxRef || $[29] !== checked || $[30] !== indeterminate) {
|
|
126
|
-
t7 = [indeterminate, checked, checkboxRef];
|
|
127
|
-
$[28] = checkboxRef;
|
|
128
|
-
$[29] = checked;
|
|
129
|
-
$[30] = indeterminate;
|
|
130
|
-
$[31] = t7;
|
|
131
|
-
} else {
|
|
132
|
-
t7 = $[31];
|
|
133
|
-
}
|
|
134
|
-
useIsomorphicLayoutEffect(t6, t7);
|
|
135
|
-
let t8;
|
|
136
|
-
if ($[32] !== checkboxRef || $[33] !== indeterminate) {
|
|
137
|
-
t8 = () => {
|
|
138
|
-
const {
|
|
139
|
-
current: checkbox
|
|
140
|
-
} = checkboxRef;
|
|
141
|
-
if (!checkbox) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (indeterminate) {
|
|
145
|
-
checkbox.setAttribute("aria-checked", "mixed");
|
|
146
|
-
} else {
|
|
147
|
-
checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
$[32] = checkboxRef;
|
|
151
|
-
$[33] = indeterminate;
|
|
152
|
-
$[34] = t8;
|
|
153
|
-
} else {
|
|
154
|
-
t8 = $[34];
|
|
155
|
-
}
|
|
156
|
-
useEffect(t8);
|
|
157
|
-
let t9;
|
|
158
|
-
if ($[35] !== className) {
|
|
159
|
-
t9 = clsx(className, sharedClasses.Input, classes.Checkbox);
|
|
160
|
-
$[35] = className;
|
|
161
|
-
$[36] = t9;
|
|
162
|
-
} else {
|
|
163
|
-
t9 = $[36];
|
|
164
|
-
}
|
|
165
|
-
let t10;
|
|
166
|
-
if ($[37] !== inputProps || $[38] !== t9) {
|
|
167
|
-
t10 = /*#__PURE__*/jsx("input", {
|
|
168
|
-
...inputProps,
|
|
169
|
-
className: t9
|
|
170
|
-
});
|
|
171
|
-
$[37] = inputProps;
|
|
172
|
-
$[38] = t9;
|
|
173
|
-
$[39] = t10;
|
|
174
|
-
} else {
|
|
175
|
-
t10 = $[39];
|
|
176
|
-
}
|
|
177
|
-
return t10;
|
|
29
|
+
const handleOnChange = e => {
|
|
30
|
+
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
31
|
+
onChange && onChange(e);
|
|
32
|
+
};
|
|
33
|
+
const inputProps = {
|
|
34
|
+
type: 'checkbox',
|
|
35
|
+
disabled,
|
|
36
|
+
ref: checkboxRef,
|
|
37
|
+
checked: indeterminate ? false : checked,
|
|
38
|
+
defaultChecked,
|
|
39
|
+
required,
|
|
40
|
+
['aria-required']: required ? 'true' : 'false',
|
|
41
|
+
['aria-invalid']: validationStatus === 'error' ? 'true' : 'false',
|
|
42
|
+
onChange: handleOnChange,
|
|
43
|
+
value,
|
|
44
|
+
name: value,
|
|
45
|
+
...rest
|
|
46
|
+
};
|
|
47
|
+
useIsomorphicLayoutEffect(() => {
|
|
48
|
+
if (checkboxRef.current) {
|
|
49
|
+
checkboxRef.current.indeterminate = indeterminate || false;
|
|
50
|
+
}
|
|
51
|
+
}, [indeterminate, checked, checkboxRef]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const {
|
|
54
|
+
current: checkbox
|
|
55
|
+
} = checkboxRef;
|
|
56
|
+
if (!checkbox) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (indeterminate) {
|
|
60
|
+
checkbox.setAttribute('aria-checked', 'mixed');
|
|
61
|
+
} else {
|
|
62
|
+
checkbox.setAttribute('aria-checked', checkbox.checked ? 'true' : 'false');
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// @ts-expect-error inputProp needs a non nullable ref
|
|
66
|
+
return /*#__PURE__*/jsx("input", {
|
|
67
|
+
...inputProps,
|
|
68
|
+
className: clsx(className, sharedClasses.Input, classes.Checkbox)
|
|
69
|
+
});
|
|
178
70
|
});
|
|
179
71
|
Checkbox.displayName = 'Checkbox';
|
|
180
72
|
Checkbox.__SLOT__ = Symbol('Checkbox');
|