@primer/react 0.0.0-20260915185318 → 0.0.0-20261105032827
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 +124 -4
- package/dist/ActionBar/ActionBar.js +502 -169
- package/dist/ActionBar/index.d.ts +2 -2
- package/dist/ActionList/{ActionList-1ff5220c.css → ActionList-64885d7a.css} +2 -2
- package/dist/ActionList/ActionList-64885d7a.css.map +1 -0
- package/dist/ActionList/ActionList.module.css.js +1 -1
- package/dist/ActionList/Description.js +3 -3
- package/dist/ActionList/Divider.js +1 -1
- package/dist/ActionList/Group.js +16 -17
- package/dist/ActionList/GroupHeadingTrailingAction.js +1 -10
- package/dist/ActionList/Heading.js +1 -1
- package/dist/ActionList/Item.js +123 -122
- package/dist/ActionList/LinkItem.js +4 -4
- package/dist/ActionList/List.js +2 -2
- package/dist/ActionList/Selection.js +6 -6
- package/dist/ActionList/TrailingAction.js +3 -3
- package/dist/ActionList/Visuals.js +9 -9
- package/dist/ActionList/index.d.ts +5 -18
- package/dist/ActionList/shared.d.ts +1 -1
- package/dist/ActionMenu/ActionMenu.js +20 -19
- package/dist/AnchoredOverlay/AnchoredOverlay.js +4 -4
- package/dist/Autocomplete/Autocomplete.js +3 -3
- package/dist/Autocomplete/AutocompleteInput.js +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +111 -106
- package/dist/Autocomplete/AutocompleteOverlay.js +2 -2
- package/dist/Avatar/Avatar.js +1 -1
- package/dist/AvatarStack/{AvatarStack-e6a99916.css → AvatarStack-937ec7c1.css} +2 -2
- package/dist/AvatarStack/{AvatarStack-e6a99916.css.map → AvatarStack-937ec7c1.css.map} +1 -1
- package/dist/AvatarStack/AvatarStack.js +3 -3
- package/dist/AvatarStack/AvatarStack.module.css.js +1 -1
- package/dist/Banner/Banner.js +24 -26
- package/dist/BaseStyles.js +1 -1
- package/dist/Blankslate/Blankslate.js +10 -11
- package/dist/BranchName/BranchName.d.ts +1 -1
- package/dist/BranchName/BranchName.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/Breadcrumbs/Breadcrumbs.js +20 -29
- package/dist/Button/Button.js +1 -1
- package/dist/Button/ButtonBase-c8dab214.css +2 -0
- package/dist/Button/ButtonBase-c8dab214.css.map +1 -0
- package/dist/Button/ButtonBase.js +14 -10
- package/dist/Button/ButtonBase.module.css.js +1 -1
- package/dist/Button/IconButton.js +6 -7
- package/dist/Button/LinkButton.js +1 -1
- package/dist/Button/types.d.ts +2 -2
- package/dist/ButtonGroup/ButtonGroup.js +2 -3
- package/dist/Card/Card.js +17 -18
- package/dist/Card/index.d.ts +1 -1
- package/dist/Checkbox/Checkbox.js +145 -41
- package/dist/CheckboxGroup/CheckboxGroup.js +2 -2
- package/dist/CircleBadge/CircleBadge.js +2 -2
- package/dist/ConfirmationDialog/ConfirmationDialog.js +1 -5
- package/dist/CounterLabel/CounterLabel.js +80 -18
- package/dist/DataTable/DataTable.d.ts +76 -22
- package/dist/DataTable/DataTable.js +239 -73
- package/dist/DataTable/ErrorDialog.js +1 -1
- package/dist/DataTable/Pagination.js +23 -23
- package/dist/DataTable/Table-7f0e985b.css +2 -0
- package/dist/DataTable/Table-7f0e985b.css.map +1 -0
- package/dist/DataTable/Table.d.ts +77 -1
- package/dist/DataTable/Table.js +269 -55
- package/dist/DataTable/Table.module.css.js +8 -5
- package/dist/DataTable/TableBulkActions-aca5618a.css +2 -0
- package/dist/DataTable/TableBulkActions-aca5618a.css.map +1 -0
- package/dist/DataTable/TableBulkActions.d.ts +15 -0
- package/dist/DataTable/TableBulkActions.js +217 -0
- package/dist/DataTable/TableBulkActions.module.css.js +12 -0
- package/dist/DataTable/TableGroup.d.ts +25 -1
- package/dist/DataTable/TableGroup.js +197 -117
- package/dist/DataTable/index.d.ts +8 -4
- package/dist/DataTable/index.js +6 -2
- package/dist/DataTable/row.d.ts +26 -2
- package/dist/DataTable/useTable.js +354 -90
- package/dist/DataTable/utils.d.ts +4 -2
- package/dist/Details/Details.js +4 -6
- package/dist/Dialog/Dialog.js +20 -23
- package/dist/FeatureFlags/DefaultFeatureFlags.js +3 -1
- package/dist/FeatureFlags/FeatureFlagScope.js +1 -0
- package/dist/FeatureFlags/FeatureFlags.js +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +27 -22
- package/dist/FilteredActionList/FilteredActionListInput.d.ts +5 -1
- package/dist/FilteredActionList/FilteredActionListInput.js +61 -40
- package/dist/FilteredActionList/FilteredActionListLoaders.js +10 -11
- package/dist/FilteredActionList/constants.js +2 -0
- package/dist/FilteredActionList/useAnnouncements.js +160 -71
- package/dist/Flash/Flash.js +1 -4
- package/dist/FormControl/FormControl.js +58 -83
- package/dist/FormControl/FormControlCaption.js +1 -1
- package/dist/FormControl/FormControlLabel.js +2 -3
- package/dist/FormControl/FormControlLeadingVisual.js +1 -1
- package/dist/FormControl/_FormControlContext.js +1 -2
- package/dist/FormControl/_FormControlContextProvider.js +5 -0
- package/dist/FormControl/_FormControlValidation.js +1 -1
- package/dist/Header/Header.js +3 -3
- package/dist/Heading/Heading.js +1 -1
- package/dist/Hidden/Hidden.js +1 -1
- package/dist/InlineMessage/InlineMessage.js +12 -13
- package/dist/KeybindingHint/KeybindingHint.js +3 -3
- package/dist/KeybindingHint/components/Chord.js +3 -3
- package/dist/KeybindingHint/components/Key.js +3 -3
- package/dist/KeybindingHint/components/Sequence.js +1 -1
- package/dist/KeybindingHint/platform.js +0 -8
- package/dist/Label/Label.js +1 -1
- package/dist/LabelGroup/LabelGroup.js +18 -18
- package/dist/Link/Link.d.ts +1 -1
- package/dist/Link/Link.js +1 -1
- package/dist/NavList/NavList.d.ts +1 -1
- package/dist/NavList/NavList.js +27 -28
- package/dist/Octicon/Octicon.js +1 -4
- package/dist/Overlay/Overlay.d.ts +2 -0
- package/dist/Overlay/Overlay.js +300 -63
- package/dist/PageHeader/PageHeader.js +21 -21
- package/dist/PageLayout/DragHandle.js +1 -1
- package/dist/PageLayout/PageLayout.js +26 -26
- package/dist/PageLayout/usePaneWidth.js +2 -7
- package/dist/Pagehead/Pagehead.js +1 -1
- package/dist/Pagination/Pagination.js +9 -10
- package/dist/Popover/Popover.js +6 -8
- package/dist/ProgressBar/ProgressBar-ac90a742.css +2 -0
- package/dist/ProgressBar/ProgressBar-ac90a742.css.map +1 -0
- package/dist/ProgressBar/ProgressBar.js +4 -5
- package/dist/ProgressBar/ProgressBar.module.css.js +1 -1
- package/dist/Radio/Radio.js +1 -1
- package/dist/RadioGroup/RadioGroup.js +2 -2
- package/dist/RelativeTime/RelativeTime.js +1 -1
- package/dist/ScrollableRegion/ScrollableRegion.js +1 -1
- package/dist/SegmentedControl/SegmentedControl-99b8e34e.css +2 -0
- package/dist/SegmentedControl/SegmentedControl-99b8e34e.css.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.js +13 -13
- package/dist/SegmentedControl/SegmentedControl.module.css.js +1 -1
- package/dist/SegmentedControl/SegmentedControlAction.js +6 -6
- package/dist/SegmentedControl/SegmentedControlButton.js +9 -10
- package/dist/SegmentedControl/SegmentedControlDivider.js +1 -1
- package/dist/SegmentedControl/SegmentedControlIconButton.js +5 -5
- package/dist/Select/Select.js +11 -11
- package/dist/SelectPanel/SelectPanel.d.ts +1 -1
- package/dist/SelectPanel/SelectPanel.js +117 -68
- package/dist/SelectPanel/SelectPanelMessage.js +5 -5
- package/dist/SideNav.js +2 -2
- package/dist/Skeleton/SkeletonBox-8a6ec314.css +2 -0
- package/dist/Skeleton/SkeletonBox-8a6ec314.css.map +1 -0
- package/dist/Skeleton/SkeletonBox.js +1 -1
- package/dist/Skeleton/SkeletonBox.module.css.js +1 -1
- package/dist/SkeletonAvatar/SkeletonAvatar.js +1 -1
- package/dist/SkeletonText/SkeletonText.js +3 -3
- package/dist/Spinner/Spinner.js +6 -7
- package/dist/SplitPageLayout/SplitPageLayout.js +6 -6
- package/dist/Stack/Stack.js +2 -2
- package/dist/StateLabel/StateLabel.js +2 -2
- package/dist/SubNav/SubNav.js +5 -5
- package/dist/TabNav/TabNav.js +4 -10
- package/dist/Text/Text.d.ts +1 -1
- package/dist/Text/Text.js +1 -1
- package/dist/TextInput/TextInput.js +246 -91
- package/dist/TextInputWithTokens/TextInputWithTokens.js +12 -15
- package/dist/Textarea/Textarea.d.ts +2 -2
- package/dist/Textarea/Textarea.js +7 -7
- package/dist/ThemeProvider.js +1 -2
- package/dist/Timeline/Timeline.js +11 -14
- package/dist/ToggleSwitch/ToggleSwitch.js +20 -21
- package/dist/Token/IssueLabelToken.js +3 -3
- package/dist/Token/Token.js +7 -7
- package/dist/Token/TokenBase.js +1 -1
- package/dist/Token/_RemoveTokenButton.js +115 -21
- package/dist/Token/_TokenTextContainer.js +1 -1
- package/dist/Tooltip/Tooltip.js +98 -20
- package/dist/TooltipV2/Tooltip.js +304 -137
- package/dist/TopicTag/TopicTag.js +2 -3
- package/dist/TopicTag/TopicTagGroup.js +1 -1
- package/dist/TreeView/TreeView.js +52 -59
- package/dist/TreeView/useRovingTabIndex.js +1 -0
- package/dist/TreeView/useTypeahead.js +4 -3
- package/dist/Truncate/Truncate.d.ts +9 -4
- package/dist/Truncate/Truncate.js +92 -16
- package/dist/Truncate/index.d.ts +2 -2
- package/dist/UnderlineNav/UnderlineNav.js +18 -18
- package/dist/UnderlineNav/UnderlineNavItem.js +53 -47
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/_VisuallyHidden.js +1 -1
- package/dist/deprecated/ActionList/Divider.js +1 -1
- package/dist/deprecated/ActionList/Group.js +2 -5
- package/dist/deprecated/ActionList/Header.js +2 -5
- package/dist/deprecated/ActionList/Item.js +18 -21
- package/dist/deprecated/ActionList/List.js +5 -14
- package/dist/deprecated/ActionMenu.js +4 -6
- package/dist/deprecated/DialogV1/Dialog.js +5 -5
- package/dist/deprecated/FilteredSearch/FilteredSearch.js +1 -1
- package/dist/deprecated/UnderlineNav/UnderlineNav.js +4 -4
- package/dist/experimental/IssueLabel/IssueLabel.js +4 -4
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +42 -49
- package/dist/experimental/Tabs/Tabs.js +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +417 -124
- package/dist/experimental/index.d.ts +5 -4
- package/dist/experimental/index.js +1 -1
- package/dist/hooks/useControllableState.js +70 -19
- package/dist/hooks/useMergedRefs.js +0 -12
- package/dist/hooks/useOnOutsideClick.js +48 -21
- package/dist/hooks/useOpenAndCloseFocus.d.ts +3 -1
- package/dist/hooks/useOpenAndCloseFocus.js +28 -16
- package/dist/hooks/useOverlay.d.ts +3 -1
- package/dist/hooks/useOverlay.js +24 -22
- package/dist/hooks/useResponsiveValue.js +0 -5
- package/dist/hooks/useSafeTimeout.js +54 -19
- package/dist/hooks/useSlots.js +0 -48
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/internal/components/ButtonReset.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +9 -9
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +4 -4
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +1 -1
- package/dist/internal/components/ConditionalWrapper.js +2 -2
- package/dist/internal/components/InputLabel.js +4 -5
- package/dist/internal/components/InputValidation.js +4 -4
- package/dist/internal/components/OverflowObserverProvider.js +1 -1
- package/dist/internal/components/TextInputInnerAction.js +7 -8
- package/dist/internal/components/TextInputInnerVisualSlot.js +5 -5
- package/dist/internal/components/TextInputWrapper.d.ts +3 -0
- package/dist/internal/components/TextInputWrapper.js +2 -2
- package/dist/internal/components/ThemeProviderBase.js +3 -3
- package/dist/internal/components/UnderlineTabbedInterface.js +11 -11
- package/dist/internal/components/UnstyledTextInput.js +1 -1
- package/dist/internal/components/ValidationAnimationContainer.js +2 -2
- package/dist/internal/hooks/useDevOnlyEffect.js +3 -8
- package/dist/internal/hooks/useOverflowObserver.js +1 -2
- package/dist/internal/hooks/useThemeProvider.js +3 -3
- package/dist/live-region/Announce.js +1 -1
- package/dist/live-region/AriaAlert.js +1 -1
- package/dist/live-region/AriaStatus.js +1 -1
- package/dist/next/ThemeProvider.js +1 -1
- package/dist/utils/descendant-registry.d.ts +1 -1
- package/dist/utils/descendant-registry.js +94 -82
- package/dist/utils/modern-polymorphic.d.ts +2 -1
- package/dist/utils/modern-polymorphic.js +0 -10
- package/generated/components.json +286 -28
- package/generated/hooks.json +13 -1
- package/package.json +16 -17
- package/dist/ActionList/ActionList-1ff5220c.css.map +0 -1
- package/dist/Button/ButtonBase-b44e29d1.css +0 -2
- package/dist/Button/ButtonBase-b44e29d1.css.map +0 -1
- package/dist/DataTable/Table-50e68700.css +0 -2
- package/dist/DataTable/Table-50e68700.css.map +0 -1
- package/dist/ProgressBar/ProgressBar-e403d83d.css +0 -2
- package/dist/ProgressBar/ProgressBar-e403d83d.css.map +0 -1
- package/dist/SegmentedControl/SegmentedControl-e68d4197.css +0 -2
- package/dist/SegmentedControl/SegmentedControl-e68d4197.css.map +0 -1
- package/dist/Skeleton/SkeletonBox-e078be7c.css +0 -2
- package/dist/Skeleton/SkeletonBox-e078be7c.css.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
1
2
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
2
3
|
import { useProvidedRefOrCreate } from "../hooks/useProvidedRefOrCreate.js";
|
|
3
4
|
import useIsomorphicLayoutEffect from "../utils/useIsomorphicLayoutEffect.js";
|
|
@@ -12,7 +13,46 @@ import { clsx } from "clsx";
|
|
|
12
13
|
/**
|
|
13
14
|
* An accessible, native checkbox component
|
|
14
15
|
*/
|
|
15
|
-
const Checkbox = /*#__PURE__*/ React.forwardRef((
|
|
16
|
+
const Checkbox = /*#__PURE__*/ React.forwardRef((t0, ref) => {
|
|
17
|
+
const $ = c(44);
|
|
18
|
+
let checked;
|
|
19
|
+
let className;
|
|
20
|
+
let dataComponent;
|
|
21
|
+
let defaultChecked;
|
|
22
|
+
let disabled;
|
|
23
|
+
let indeterminate;
|
|
24
|
+
let onChange;
|
|
25
|
+
let required;
|
|
26
|
+
let rest;
|
|
27
|
+
let validationStatus;
|
|
28
|
+
let value;
|
|
29
|
+
if ($[0] !== t0) {
|
|
30
|
+
({checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, "data-component": dataComponent, ...rest} = t0);
|
|
31
|
+
$[0] = t0;
|
|
32
|
+
$[1] = checked;
|
|
33
|
+
$[2] = className;
|
|
34
|
+
$[3] = dataComponent;
|
|
35
|
+
$[4] = defaultChecked;
|
|
36
|
+
$[5] = disabled;
|
|
37
|
+
$[6] = indeterminate;
|
|
38
|
+
$[7] = onChange;
|
|
39
|
+
$[8] = required;
|
|
40
|
+
$[9] = rest;
|
|
41
|
+
$[10] = validationStatus;
|
|
42
|
+
$[11] = value;
|
|
43
|
+
} else {
|
|
44
|
+
checked = $[1];
|
|
45
|
+
className = $[2];
|
|
46
|
+
dataComponent = $[3];
|
|
47
|
+
defaultChecked = $[4];
|
|
48
|
+
disabled = $[5];
|
|
49
|
+
indeterminate = $[6];
|
|
50
|
+
onChange = $[7];
|
|
51
|
+
required = $[8];
|
|
52
|
+
rest = $[9];
|
|
53
|
+
validationStatus = $[10];
|
|
54
|
+
value = $[11];
|
|
55
|
+
}
|
|
16
56
|
const mergedRefEnabled = useFeatureFlag("primer_react_merged_forwarded_refs");
|
|
17
57
|
const checkboxRef = useRef(null);
|
|
18
58
|
const mergedRef = useMergedRefs(checkboxRef, ref);
|
|
@@ -20,46 +60,110 @@ const Checkbox = /*#__PURE__*/ React.forwardRef(({ checked, className, defaultCh
|
|
|
20
60
|
const readRef = mergedRefEnabled ? checkboxRef : providedOrCreatedRef;
|
|
21
61
|
const appliedRef = mergedRefEnabled ? mergedRef : providedOrCreatedRef;
|
|
22
62
|
const checkboxGroupContext = useContext(CheckboxGroupContext);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
readRef.current
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
let t1;
|
|
64
|
+
if ($[12] !== checkboxGroupContext || $[13] !== indeterminate || $[14] !== onChange || $[15] !== readRef.current) {
|
|
65
|
+
t1 = (e) => {
|
|
66
|
+
checkboxGroupContext.onChange && checkboxGroupContext.onChange(e);
|
|
67
|
+
onChange && onChange(e);
|
|
68
|
+
if (indeterminate && readRef.current) {
|
|
69
|
+
readRef.current.indeterminate = true;
|
|
70
|
+
readRef.current.setAttribute("aria-checked", "mixed");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
$[12] = checkboxGroupContext;
|
|
74
|
+
$[13] = indeterminate;
|
|
75
|
+
$[14] = onChange;
|
|
76
|
+
$[15] = readRef.current;
|
|
77
|
+
$[16] = t1;
|
|
78
|
+
} else t1 = $[16];
|
|
79
|
+
const handleOnChange = t1;
|
|
80
|
+
const t2 = indeterminate ? false : checked;
|
|
81
|
+
const t3 = required ? "true" : "false";
|
|
82
|
+
const t4 = validationStatus === "error" ? "true" : "false";
|
|
83
|
+
let t5;
|
|
84
|
+
if ($[17] !== appliedRef || $[18] !== defaultChecked || $[19] !== disabled || $[20] !== handleOnChange || $[21] !== required || $[22] !== rest || $[23] !== t2 || $[24] !== t3 || $[25] !== t4 || $[26] !== value) {
|
|
85
|
+
t5 = {
|
|
86
|
+
type: "checkbox",
|
|
87
|
+
disabled,
|
|
88
|
+
ref: appliedRef,
|
|
89
|
+
checked: t2,
|
|
90
|
+
defaultChecked,
|
|
91
|
+
required,
|
|
92
|
+
"aria-required": t3,
|
|
93
|
+
"aria-invalid": t4,
|
|
94
|
+
onChange: handleOnChange,
|
|
95
|
+
value,
|
|
96
|
+
name: value,
|
|
97
|
+
...rest
|
|
98
|
+
};
|
|
99
|
+
$[17] = appliedRef;
|
|
100
|
+
$[18] = defaultChecked;
|
|
101
|
+
$[19] = disabled;
|
|
102
|
+
$[20] = handleOnChange;
|
|
103
|
+
$[21] = required;
|
|
104
|
+
$[22] = rest;
|
|
105
|
+
$[23] = t2;
|
|
106
|
+
$[24] = t3;
|
|
107
|
+
$[25] = t4;
|
|
108
|
+
$[26] = value;
|
|
109
|
+
$[27] = t5;
|
|
110
|
+
} else t5 = $[27];
|
|
111
|
+
const inputProps = t5;
|
|
112
|
+
let t6;
|
|
113
|
+
if ($[28] !== indeterminate || $[29] !== readRef.current) {
|
|
114
|
+
t6 = () => {
|
|
115
|
+
if (readRef.current) readRef.current.indeterminate = indeterminate || false;
|
|
116
|
+
};
|
|
117
|
+
$[28] = indeterminate;
|
|
118
|
+
$[29] = readRef.current;
|
|
119
|
+
$[30] = t6;
|
|
120
|
+
} else t6 = $[30];
|
|
121
|
+
let t7;
|
|
122
|
+
if ($[31] !== checked || $[32] !== indeterminate || $[33] !== readRef) {
|
|
123
|
+
t7 = [
|
|
124
|
+
indeterminate,
|
|
125
|
+
checked,
|
|
126
|
+
readRef
|
|
127
|
+
];
|
|
128
|
+
$[31] = checked;
|
|
129
|
+
$[32] = indeterminate;
|
|
130
|
+
$[33] = readRef;
|
|
131
|
+
$[34] = t7;
|
|
132
|
+
} else t7 = $[34];
|
|
133
|
+
useIsomorphicLayoutEffect(t6, t7);
|
|
134
|
+
let t8;
|
|
135
|
+
if ($[35] !== indeterminate || $[36] !== readRef) {
|
|
136
|
+
t8 = () => {
|
|
137
|
+
const { current: checkbox } = readRef;
|
|
138
|
+
if (!checkbox) return;
|
|
139
|
+
if (indeterminate) checkbox.setAttribute("aria-checked", "mixed");
|
|
140
|
+
else checkbox.setAttribute("aria-checked", checkbox.checked ? "true" : "false");
|
|
141
|
+
};
|
|
142
|
+
$[35] = indeterminate;
|
|
143
|
+
$[36] = readRef;
|
|
144
|
+
$[37] = t8;
|
|
145
|
+
} else t8 = $[37];
|
|
146
|
+
useEffect(t8);
|
|
147
|
+
const t9 = dataComponent !== null && dataComponent !== void 0 ? dataComponent : "Checkbox";
|
|
148
|
+
let t10;
|
|
149
|
+
if ($[38] !== className) {
|
|
150
|
+
t10 = clsx(className, shared_module_css_default.Input, Checkbox_module_css_default.Checkbox);
|
|
151
|
+
$[38] = className;
|
|
152
|
+
$[39] = t10;
|
|
153
|
+
} else t10 = $[39];
|
|
154
|
+
let t11;
|
|
155
|
+
if ($[40] !== inputProps || $[41] !== t10 || $[42] !== t9) {
|
|
156
|
+
t11 = /* @__PURE__ */ jsx("input", {
|
|
157
|
+
...inputProps,
|
|
158
|
+
"data-component": t9,
|
|
159
|
+
className: t10
|
|
160
|
+
});
|
|
161
|
+
$[40] = inputProps;
|
|
162
|
+
$[41] = t10;
|
|
163
|
+
$[42] = t9;
|
|
164
|
+
$[43] = t11;
|
|
165
|
+
} else t11 = $[43];
|
|
166
|
+
return t11;
|
|
63
167
|
});
|
|
64
168
|
Checkbox.displayName = "Checkbox";
|
|
65
169
|
Checkbox.__SLOT__ = Symbol("Checkbox");
|
|
@@ -78,7 +78,7 @@ const CheckboxGroup = (t0) => {
|
|
|
78
78
|
} else t4 = $[16];
|
|
79
79
|
let t5;
|
|
80
80
|
if ($[17] !== children || $[18] !== disabled || $[19] !== rest) {
|
|
81
|
-
t5 =
|
|
81
|
+
t5 = /* @__PURE__ */ jsx(CheckboxOrRadioGroup_default, {
|
|
82
82
|
"data-component": "CheckboxGroup",
|
|
83
83
|
disabled,
|
|
84
84
|
...rest,
|
|
@@ -91,7 +91,7 @@ const CheckboxGroup = (t0) => {
|
|
|
91
91
|
} else t5 = $[20];
|
|
92
92
|
let t6;
|
|
93
93
|
if ($[21] !== t4 || $[22] !== t5) {
|
|
94
|
-
t6 =
|
|
94
|
+
t6 = /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, {
|
|
95
95
|
value: t4,
|
|
96
96
|
children: t5
|
|
97
97
|
});
|
|
@@ -50,7 +50,7 @@ const CircleBadge = (t0) => {
|
|
|
50
50
|
}
|
|
51
51
|
let t6;
|
|
52
52
|
if ($[7] !== T0 || $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4 || $[12] !== t5) {
|
|
53
|
-
t6 =
|
|
53
|
+
t6 = /* @__PURE__ */ jsx(T0, {
|
|
54
54
|
...t1,
|
|
55
55
|
"data-component": t2,
|
|
56
56
|
className: t3,
|
|
@@ -77,7 +77,7 @@ const CircleBadgeIcon = (props) => {
|
|
|
77
77
|
} else t0 = $[1];
|
|
78
78
|
let t1;
|
|
79
79
|
if ($[2] !== props || $[3] !== t0) {
|
|
80
|
-
t1 =
|
|
80
|
+
t1 = /* @__PURE__ */ jsx(Octicon, {
|
|
81
81
|
...props,
|
|
82
82
|
"data-component": "CircleBadge.Icon",
|
|
83
83
|
className: t0
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { c } from "../utils/react-compiler-runtime.js";
|
|
2
2
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
3
|
-
import "react";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
//#region src/ConfirmationDialog/ConfirmationDialog.tsx
|
|
6
5
|
/**
|
|
7
|
-
* Props to customize the ConfirmationDialog.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
6
|
* A ConfirmationDialog is a special kind of dialog with more rigid behavior. It
|
|
11
7
|
* is used to confirm a user action. ConfirmationDialogs always have exactly
|
|
12
8
|
* two buttons: one to cancel the action and one to confirm it. No custom
|
|
@@ -84,7 +80,7 @@ const ConfirmationDialog = (props) => {
|
|
|
84
80
|
const footerButtons = t12;
|
|
85
81
|
let t13;
|
|
86
82
|
if ($[18] !== children || $[19] !== className || $[20] !== footerButtons || $[21] !== height || $[22] !== onClose || $[23] !== title || $[24] !== width) {
|
|
87
|
-
t13 =
|
|
83
|
+
t13 = /* @__PURE__ */ jsx(Dialog, {
|
|
88
84
|
"data-component": "ConfirmationDialog",
|
|
89
85
|
onClose,
|
|
90
86
|
title,
|
|
@@ -1,28 +1,90 @@
|
|
|
1
|
+
import { c } from "../utils/react-compiler-runtime.js";
|
|
1
2
|
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
2
3
|
import CounterLabel_module_css_default from "./CounterLabel.module.css.js";
|
|
3
4
|
import { forwardRef } from "react";
|
|
4
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { clsx } from "clsx";
|
|
6
7
|
//#region src/CounterLabel/CounterLabel.tsx
|
|
7
|
-
const CounterLabel = /*#__PURE__*/ forwardRef((
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const CounterLabel = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
|
|
9
|
+
const $ = c(23);
|
|
10
|
+
let children;
|
|
11
|
+
let className;
|
|
12
|
+
let dataComponent;
|
|
13
|
+
let rest;
|
|
14
|
+
let scheme;
|
|
15
|
+
let variant;
|
|
16
|
+
if ($[0] !== t0) {
|
|
17
|
+
({variant, scheme, className, children, "data-component": dataComponent, ...rest} = t0);
|
|
18
|
+
$[0] = t0;
|
|
19
|
+
$[1] = children;
|
|
20
|
+
$[2] = className;
|
|
21
|
+
$[3] = dataComponent;
|
|
22
|
+
$[4] = rest;
|
|
23
|
+
$[5] = scheme;
|
|
24
|
+
$[6] = variant;
|
|
25
|
+
} else {
|
|
26
|
+
children = $[1];
|
|
27
|
+
className = $[2];
|
|
28
|
+
dataComponent = $[3];
|
|
29
|
+
rest = $[4];
|
|
30
|
+
scheme = $[5];
|
|
31
|
+
variant = $[6];
|
|
32
|
+
}
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[7] !== children) {
|
|
35
|
+
t1 = /* @__PURE__ */ jsxs(VisuallyHidden, { children: [
|
|
36
|
+
"\xA0(",
|
|
37
|
+
children,
|
|
38
|
+
")"
|
|
39
|
+
] });
|
|
40
|
+
$[7] = children;
|
|
41
|
+
$[8] = t1;
|
|
42
|
+
} else t1 = $[8];
|
|
43
|
+
const label = t1;
|
|
13
44
|
const inferredVariant = variant || scheme || "secondary";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[9] !== forwardedRef || $[10] !== inferredVariant || $[11] !== rest) {
|
|
47
|
+
t2 = {
|
|
48
|
+
ref: forwardedRef,
|
|
49
|
+
"aria-hidden": "true",
|
|
50
|
+
"data-variant": inferredVariant,
|
|
51
|
+
...rest
|
|
52
|
+
};
|
|
53
|
+
$[9] = forwardedRef;
|
|
54
|
+
$[10] = inferredVariant;
|
|
55
|
+
$[11] = rest;
|
|
56
|
+
$[12] = t2;
|
|
57
|
+
} else t2 = $[12];
|
|
58
|
+
const counterProps = t2;
|
|
59
|
+
const t3 = dataComponent !== null && dataComponent !== void 0 ? dataComponent : "CounterLabel";
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[13] !== className) {
|
|
62
|
+
t4 = clsx(className, CounterLabel_module_css_default.CounterLabel);
|
|
63
|
+
$[13] = className;
|
|
64
|
+
$[14] = t4;
|
|
65
|
+
} else t4 = $[14];
|
|
66
|
+
let t5;
|
|
67
|
+
if ($[15] !== children || $[16] !== counterProps || $[17] !== t3 || $[18] !== t4) {
|
|
68
|
+
t5 = /* @__PURE__ */ jsx("span", {
|
|
69
|
+
...counterProps,
|
|
70
|
+
"data-component": t3,
|
|
71
|
+
className: t4,
|
|
72
|
+
children
|
|
73
|
+
});
|
|
74
|
+
$[15] = children;
|
|
75
|
+
$[16] = counterProps;
|
|
76
|
+
$[17] = t3;
|
|
77
|
+
$[18] = t4;
|
|
78
|
+
$[19] = t5;
|
|
79
|
+
} else t5 = $[19];
|
|
80
|
+
let t6;
|
|
81
|
+
if ($[20] !== label || $[21] !== t5) {
|
|
82
|
+
t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t5, label] });
|
|
83
|
+
$[20] = label;
|
|
84
|
+
$[21] = t5;
|
|
85
|
+
$[22] = t6;
|
|
86
|
+
} else t6 = $[22];
|
|
87
|
+
return t6;
|
|
26
88
|
});
|
|
27
89
|
CounterLabel.displayName = "CounterLabel";
|
|
28
90
|
//#endregion
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { ObjectPaths } from "./utils.js";
|
|
2
|
-
import { UniqueRow } from "./row.js";
|
|
1
|
+
import { IsAny, ObjectPaths } from "./utils.js";
|
|
2
|
+
import { DataTableData, DataTableRowGroup, DataTableRowId, UniqueRow } from "./row.js";
|
|
3
3
|
import { SortDirection } from "./sorting.js";
|
|
4
4
|
import { Column } from "./column.js";
|
|
5
|
-
import
|
|
5
|
+
import { TableBulkActionsProps } from "./TableBulkActions.js";
|
|
6
|
+
import { ReactElement, ReactNode, RefObject } from "react";
|
|
6
7
|
|
|
7
8
|
//#region src/DataTable/DataTable.d.ts
|
|
8
|
-
|
|
9
|
+
interface DataTableBulkActionsContext {
|
|
10
|
+
selectedRows: ReadonlySet<DataTableRowId>;
|
|
11
|
+
selectedCount: number;
|
|
12
|
+
clearSelection: () => void;
|
|
13
|
+
}
|
|
14
|
+
type DataTableBaseProps<Data extends UniqueRow> = {
|
|
9
15
|
/**
|
|
10
16
|
* Provide an id to an element which uniquely describes this table
|
|
11
17
|
*/
|
|
@@ -19,10 +25,6 @@ type DataTableProps<Data extends UniqueRow> = {
|
|
|
19
25
|
* a cell
|
|
20
26
|
*/
|
|
21
27
|
cellPadding?: 'condensed' | 'normal' | 'spacious';
|
|
22
|
-
/**
|
|
23
|
-
* Provide a collection of the rows which will be rendered inside of the table
|
|
24
|
-
*/
|
|
25
|
-
data: Array<Data>;
|
|
26
28
|
/**
|
|
27
29
|
* Provide the columns for the table and the fields in `data` to which they
|
|
28
30
|
* correspond
|
|
@@ -52,25 +54,77 @@ type DataTableProps<Data extends UniqueRow> = {
|
|
|
52
54
|
* @param rowData The row data object for which the ID is being retrieved.
|
|
53
55
|
* @returns The unique identifier for the row, which can be a string or number.
|
|
54
56
|
*/
|
|
55
|
-
getRowId?: (rowData: Data) =>
|
|
57
|
+
getRowId?: (rowData: Data) => DataTableRowId;
|
|
56
58
|
/**
|
|
57
59
|
* Fires every time the user clicks a sortable column header. It reports
|
|
58
60
|
* the column id that is now sorted and the direction after the toggle
|
|
59
61
|
* (never `"NONE"`).
|
|
60
62
|
*/
|
|
61
63
|
onToggleSort?: (columnId: ObjectPaths<Data> | string | number, direction: Exclude<SortDirection, 'NONE'>) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to render controls for selecting rows.
|
|
66
|
+
*/
|
|
67
|
+
rowSelection?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Controls the selected row IDs.
|
|
70
|
+
*/
|
|
71
|
+
selectedRows?: ReadonlySet<DataTableRowId>;
|
|
72
|
+
/**
|
|
73
|
+
* Provides the initially selected row IDs for an uncontrolled table.
|
|
74
|
+
* Uncontrolled selection is intended for static, single-page data.
|
|
75
|
+
*/
|
|
76
|
+
defaultSelectedRows?: ReadonlySet<DataTableRowId>;
|
|
77
|
+
/**
|
|
78
|
+
* Handles changes to the selected row IDs.
|
|
79
|
+
*/
|
|
80
|
+
onSelectionChange?: ({
|
|
81
|
+
selectedRows
|
|
82
|
+
}: {
|
|
83
|
+
selectedRows: Set<DataTableRowId>;
|
|
84
|
+
}) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Determines whether a row can be selected.
|
|
87
|
+
*/
|
|
88
|
+
isRowSelectable?: (row: Data) => boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether groups have disclosure controls. Groups are expanded by default.
|
|
91
|
+
*/
|
|
92
|
+
collapsibleGroups?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Controls the expanded group IDs.
|
|
95
|
+
*/
|
|
96
|
+
expandedGroups?: ReadonlySet<DataTableRowId>;
|
|
97
|
+
/**
|
|
98
|
+
* Initially expanded group IDs. Defaults to all groups in the initial data.
|
|
99
|
+
*/
|
|
100
|
+
defaultExpandedGroups?: ReadonlySet<DataTableRowId>;
|
|
101
|
+
/**
|
|
102
|
+
* Handles requests to change the expanded group IDs.
|
|
103
|
+
*/
|
|
104
|
+
onExpandedGroupsChange?: ({
|
|
105
|
+
expandedGroups
|
|
106
|
+
}: {
|
|
107
|
+
expandedGroups: Set<DataTableRowId>;
|
|
108
|
+
}) => void;
|
|
109
|
+
renderBulkActions?: (context: DataTableBulkActionsContext) => ReactNode;
|
|
110
|
+
bulkActionsProps?: Pick<TableBulkActionsProps, 'aria-label' | 'getSelectedCountLabel'>;
|
|
111
|
+
bulkActionsReturnFocusRef?: RefObject<HTMLElement | null>;
|
|
112
|
+
};
|
|
113
|
+
type DataTableProps<Data extends UniqueRow> = DataTableBaseProps<Data> & {
|
|
114
|
+
/**
|
|
115
|
+
* Provide a collection of rows, row groups, or a mixture of both.
|
|
116
|
+
*/
|
|
117
|
+
data: DataTableData<Data>;
|
|
118
|
+
};
|
|
119
|
+
type DataFromItem<Item> = Item extends DataTableRowGroup<infer Data> ? Data : Item extends UniqueRow ? Item : never;
|
|
120
|
+
type DataFromInput<Input extends DataTableData<UniqueRow>> = IsAny<Input> extends true ? UniqueRow : DataFromItem<Input[number]>;
|
|
121
|
+
type InferredDataTableProps<Input extends DataTableData<UniqueRow>> = DataTableBaseProps<DataFromInput<Input>> & {
|
|
122
|
+
data: Input & DataTableData<DataFromInput<Input>>;
|
|
62
123
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
data,
|
|
69
|
-
initialSortColumn,
|
|
70
|
-
initialSortDirection,
|
|
71
|
-
externalSorting,
|
|
72
|
-
getRowId,
|
|
73
|
-
onToggleSort
|
|
74
|
-
}: DataTableProps<Data>): React.JSX.Element;
|
|
124
|
+
interface DataTableComponent {
|
|
125
|
+
<Data extends UniqueRow>(props: DataTableProps<Data>): ReactElement;
|
|
126
|
+
<Input extends DataTableData<UniqueRow>>(props: InferredDataTableProps<Input>): ReactElement;
|
|
127
|
+
}
|
|
128
|
+
declare const DataTable: DataTableComponent;
|
|
75
129
|
//#endregion
|
|
76
|
-
export { DataTable, DataTableProps };
|
|
130
|
+
export { DataTable, DataTableBulkActionsContext, DataTableProps };
|