@primer/react 38.42.0-rc.ebd425836 → 38.42.0

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 (44) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/ActionBar/ActionBar.js +498 -162
  3. package/dist/ActionBar/index.d.ts +2 -2
  4. package/dist/ActionList/Group.js +4 -5
  5. package/dist/ActionList/Item.js +2 -2
  6. package/dist/Banner/Banner.js +3 -5
  7. package/dist/Button/ButtonBase.js +3 -2
  8. package/dist/Button/IconButton.js +3 -4
  9. package/dist/Button/types.d.ts +2 -2
  10. package/dist/Card/Card.js +1 -2
  11. package/dist/Checkbox/Checkbox.js +145 -41
  12. package/dist/CounterLabel/CounterLabel.js +80 -18
  13. package/dist/Details/Details.js +2 -4
  14. package/dist/FeatureFlags/FeatureFlagScope.js +1 -0
  15. package/dist/FilteredActionList/constants.js +2 -0
  16. package/dist/FilteredActionList/useAnnouncements.js +148 -81
  17. package/dist/FormControl/FormControlLabel.js +1 -2
  18. package/dist/InlineMessage/InlineMessage.js +1 -2
  19. package/dist/NavList/NavList.js +3 -4
  20. package/dist/Overlay/Overlay.js +299 -64
  21. package/dist/PageLayout/usePaneWidth.js +2 -2
  22. package/dist/Popover/Popover.js +3 -5
  23. package/dist/ProgressBar/ProgressBar.js +1 -2
  24. package/dist/SegmentedControl/SegmentedControlButton.js +1 -2
  25. package/dist/Select/Select.js +2 -2
  26. package/dist/SelectPanel/SelectPanel.d.ts +1 -1
  27. package/dist/SelectPanel/SelectPanel.js +1 -1
  28. package/dist/Spinner/Spinner.js +1 -2
  29. package/dist/TextInput/TextInput.js +242 -87
  30. package/dist/Textarea/Textarea.d.ts +2 -2
  31. package/dist/ToggleSwitch/ToggleSwitch.js +2 -3
  32. package/dist/Tooltip/Tooltip.js +98 -17
  33. package/dist/TooltipV2/Tooltip.js +295 -138
  34. package/dist/TopicTag/TopicTag.js +1 -2
  35. package/dist/Truncate/Truncate.js +87 -14
  36. package/dist/UnderlineNav/UnderlineNavItem.js +2 -4
  37. package/dist/deprecated/ActionList/List.js +1 -1
  38. package/dist/experimental/SelectPanel2/SelectPanel.d.ts +1 -1
  39. package/dist/internal/components/InputLabel.js +1 -2
  40. package/dist/internal/components/TextInputInnerAction.js +1 -2
  41. package/dist/internal/components/TextInputWrapper.d.ts +3 -0
  42. package/dist/internal/hooks/useThemeProvider.js +3 -3
  43. package/generated/components.json +22 -20
  44. package/package.json +12 -13
@@ -54,12 +54,11 @@ function InputLabel(t0) {
54
54
  } else t4 = $[13];
55
55
  let t5;
56
56
  if ($[14] !== children || $[15] !== required || $[16] !== requiredIndicator || $[17] !== requiredText) {
57
- var _requiredText;
58
57
  t5 = required || requiredText ? /* @__PURE__ */ jsxs("span", {
59
58
  className: InputLabel_module_css_default.RequiredText,
60
59
  children: [/* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx("span", {
61
60
  "aria-hidden": requiredIndicator ? void 0 : true,
62
- children: (_requiredText = requiredText) !== null && _requiredText !== void 0 ? _requiredText : "*"
61
+ children: requiredText !== null && requiredText !== void 0 ? requiredText : "*"
63
62
  })]
64
63
  }) : children;
65
64
  $[14] = children;
@@ -94,13 +94,12 @@ const TextInputAction = /*#__PURE__*/ forwardRef((t0, forwardedRef) => {
94
94
  } else t6 = $[17];
95
95
  let t7;
96
96
  if ($[18] !== accessibleLabel || $[19] !== ariaLabel || $[20] !== children || $[21] !== forwardedRef || $[22] !== icon || $[23] !== rest || $[24] !== styleProps || $[25] !== tooltipDirection || $[26] !== variant) {
97
- var _tooltipDirection;
98
97
  t7 = /* @__PURE__ */ jsx("span", {
99
98
  className: t6,
100
99
  "data-component": "TextInput.Action",
101
100
  children: icon && !children && ariaLabel ? /* @__PURE__ */ jsx(IconButton, {
102
101
  ...accessibleLabel,
103
- tooltipDirection: (_tooltipDirection = tooltipDirection) !== null && _tooltipDirection !== void 0 ? _tooltipDirection : "s",
102
+ tooltipDirection: tooltipDirection !== null && tooltipDirection !== void 0 ? tooltipDirection : "s",
104
103
  variant,
105
104
  type: "button",
106
105
  icon,
@@ -5,6 +5,9 @@ import React, { ComponentProps } from "react";
5
5
  type TextInputSizes = 'small' | 'medium' | 'large';
6
6
  type StyledTextInputBaseWrapperProps = {
7
7
  block?: boolean;
8
+ /**
9
+ * @deprecated Omit this prop to use the default background.
10
+ */
8
11
  contrast?: boolean;
9
12
  disabled?: boolean;
10
13
  hasTrailingAction?: boolean;
@@ -53,7 +53,7 @@ function useThemeProvider(props) {
53
53
  }
54
54
  function subscribeToSystemColorMode(callback) {
55
55
  var _window, _window$matchMedia;
56
- const media = (_window = window) === null || _window === void 0 ? void 0 : (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-color-scheme: dark)");
56
+ const media = (_window = window) === null || _window === void 0 || (_window$matchMedia = _window.matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-color-scheme: dark)");
57
57
  media === null || media === void 0 || media.addEventListener("change", callback);
58
58
  return () => media === null || media === void 0 ? void 0 : media.removeEventListener("change", callback);
59
59
  }
@@ -64,8 +64,8 @@ function _temp() {
64
64
  return "day";
65
65
  }
66
66
  function getSystemColorMode() {
67
- var _window2, _window2$matchMedia, _window2$matchMedia$c;
68
- return (_window2 = window) !== null && _window2 !== void 0 && (_window2$matchMedia = _window2.matchMedia) !== null && _window2$matchMedia !== void 0 && (_window2$matchMedia$c = _window2$matchMedia.call(_window2, "(prefers-color-scheme: dark)")) !== null && _window2$matchMedia$c !== void 0 && _window2$matchMedia$c.matches ? "night" : "day";
67
+ var _window2, _window2$matchMedia;
68
+ return (_window2 = window) !== null && _window2 !== void 0 && (_window2$matchMedia = _window2.matchMedia) !== null && _window2$matchMedia !== void 0 && (_window2$matchMedia = _window2$matchMedia.call(_window2, "(prefers-color-scheme: dark)")) !== null && _window2$matchMedia !== void 0 && _window2$matchMedia.matches ? "night" : "day";
69
69
  }
70
70
  //#endregion
71
71
  export { useThemeProvider };
@@ -10,7 +10,7 @@
10
10
  "stories": [
11
11
  {
12
12
  "id": "experimental-components-actionbar--default",
13
- "code": "() => (\n <ActionBar aria-label=\"Toolbar\">\n <ActionBar.IconButton\n icon={BoldIcon}\n aria-label=\"Bold\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={ItalicIcon}\n aria-label=\"Italic\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={CodeIcon}\n aria-label=\"Code\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={LinkIcon}\n aria-label=\"Link\"\n ></ActionBar.IconButton>\n <ActionBar.Divider />\n <ActionBar.IconButton\n icon={FileAddedIcon}\n aria-label=\"File Added\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={SearchIcon}\n aria-label=\"Search\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={QuoteIcon}\n aria-label=\"Insert Quote\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={ListUnorderedIcon}\n aria-label=\"Unordered List\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={ListOrderedIcon}\n aria-label=\"Ordered List\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={TasklistIcon}\n aria-label=\"Task List\"\n onClick={() => alert('Task List clicked')}\n ></ActionBar.IconButton>\n </ActionBar>\n)"
13
+ "code": "() => (\n <ActionBar aria-label=\"Toolbar\">\n <ActionBar.IconButton\n icon={<BoldIcon />}\n aria-label=\"Bold\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<ItalicIcon />}\n aria-label=\"Italic\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<CodeIcon />}\n aria-label=\"Code\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<LinkIcon />}\n aria-label=\"Link\"\n ></ActionBar.IconButton>\n <ActionBar.Divider />\n <ActionBar.IconButton\n icon={<FileAddedIcon />}\n aria-label=\"File Added\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<SearchIcon />}\n aria-label=\"Search\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<QuoteIcon />}\n aria-label=\"Insert Quote\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<ListUnorderedIcon />}\n aria-label=\"Unordered List\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<ListOrderedIcon />}\n aria-label=\"Ordered List\"\n ></ActionBar.IconButton>\n <ActionBar.IconButton\n icon={<TasklistIcon />}\n aria-label=\"Task List\"\n onClick={() => alert('Task List clicked')}\n ></ActionBar.IconButton>\n </ActionBar>\n)"
14
14
  }
15
15
  ],
16
16
  "importPath": "@primer/react",
@@ -2003,63 +2003,63 @@
2003
2003
  "stories": [
2004
2004
  {
2005
2005
  "id": "components-iconbutton--default",
2006
- "code": "() => <IconButton icon={HeartIcon} aria-label=\"Favorite\" />"
2006
+ "code": "() => <IconButton icon={<HeartIcon />} aria-label=\"Favorite\" />"
2007
2007
  },
2008
2008
  {
2009
2009
  "id": "components-iconbutton-features--primary",
2010
- "code": "() => <IconButton icon={HeartIcon} variant=\"primary\" aria-label=\"Favorite\" />"
2010
+ "code": "() => (\n <IconButton icon={<HeartIcon />} variant=\"primary\" aria-label=\"Favorite\" />\n)"
2011
2011
  },
2012
2012
  {
2013
2013
  "id": "components-iconbutton-features--danger",
2014
- "code": "() => <IconButton icon={HeartIcon} variant=\"danger\" aria-label=\"Favorite\" />"
2014
+ "code": "() => (\n <IconButton icon={<HeartIcon />} variant=\"danger\" aria-label=\"Favorite\" />\n)"
2015
2015
  },
2016
2016
  {
2017
2017
  "id": "components-iconbutton-features--invisible",
2018
- "code": "() => <IconButton icon={HeartIcon} variant=\"invisible\" aria-label=\"Favorite\" />"
2018
+ "code": "() => (\n <IconButton icon={<HeartIcon />} variant=\"invisible\" aria-label=\"Favorite\" />\n)"
2019
2019
  },
2020
2020
  {
2021
2021
  "id": "components-iconbutton-features--disabled",
2022
- "code": "() => <IconButton disabled icon={HeartIcon} aria-label=\"Favorite\" />"
2022
+ "code": "() => <IconButton disabled icon={<HeartIcon />} aria-label=\"Favorite\" />"
2023
2023
  },
2024
2024
  {
2025
2025
  "id": "components-iconbutton-features--small",
2026
- "code": "() => <IconButton size=\"small\" icon={HeartIcon} aria-label=\"Favorite\" />"
2026
+ "code": "() => <IconButton size=\"small\" icon={<HeartIcon />} aria-label=\"Favorite\" />"
2027
2027
  },
2028
2028
  {
2029
2029
  "id": "components-iconbutton-features--medium",
2030
- "code": "() => <IconButton size=\"medium\" icon={HeartIcon} aria-label=\"Favorite\" />"
2030
+ "code": "() => <IconButton size=\"medium\" icon={<HeartIcon />} aria-label=\"Favorite\" />"
2031
2031
  },
2032
2032
  {
2033
2033
  "id": "components-iconbutton-features--large",
2034
- "code": "() => <IconButton size=\"large\" icon={HeartIcon} aria-label=\"Favorite\" />"
2034
+ "code": "() => <IconButton size=\"large\" icon={<HeartIcon />} aria-label=\"Favorite\" />"
2035
2035
  },
2036
2036
  {
2037
2037
  "id": "components-iconbutton-features--with-description",
2038
- "code": "() => (\n <IconButton\n icon={InboxIcon}\n aria-label=\"Notifications\"\n description=\"You have no unread notifications.\"\n />\n)"
2038
+ "code": "() => (\n <IconButton\n icon={<InboxIcon />}\n aria-label=\"Notifications\"\n description=\"You have no unread notifications.\"\n />\n)"
2039
2039
  },
2040
2040
  {
2041
2041
  "id": "components-iconbutton-features--external-tooltip",
2042
- "code": "() => (\n <Tooltip\n text=\"this is a supportive description for icon button\"\n direction=\"se\"\n >\n <IconButton icon={HeartIcon} aria-label=\"HeartIcon\" />\n </Tooltip>\n)"
2042
+ "code": "() => (\n <Tooltip\n text=\"this is a supportive description for icon button\"\n direction=\"se\"\n >\n <IconButton icon={<HeartIcon />} aria-label=\"HeartIcon\" />\n </Tooltip>\n)"
2043
2043
  },
2044
2044
  {
2045
2045
  "id": "components-iconbutton-features--as-a-menu-anchor",
2046
- "code": "() => (\n <ActionMenu>\n <ActionMenu.Anchor>\n <IconButton icon={ChevronDownIcon} aria-label=\"Something\" />\n </ActionMenu.Anchor>\n\n <ActionMenu.Overlay width=\"medium\">\n <ActionList>\n <ActionList.Item onSelect={() => alert('Copy link clicked')}>\n Copy link\n <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>\n </ActionList.Item>\n <ActionList.Item onSelect={() => alert('Quote reply clicked')}>\n Quote reply\n <ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual>\n </ActionList.Item>\n <ActionList.Item onSelect={() => alert('Edit comment clicked')}>\n Edit comment\n <ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual>\n </ActionList.Item>\n <ActionList.Divider />\n <ActionList.Item\n variant=\"danger\"\n onSelect={() => alert('Delete file clicked')}\n >\n Delete file\n <ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual>\n </ActionList.Item>\n </ActionList>\n </ActionMenu.Overlay>\n </ActionMenu>\n)"
2046
+ "code": "() => (\n <ActionMenu>\n <ActionMenu.Anchor>\n <IconButton icon={<ChevronDownIcon />} aria-label=\"Something\" />\n </ActionMenu.Anchor>\n\n <ActionMenu.Overlay width=\"medium\">\n <ActionList>\n <ActionList.Item onSelect={() => alert('Copy link clicked')}>\n Copy link\n <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>\n </ActionList.Item>\n <ActionList.Item onSelect={() => alert('Quote reply clicked')}>\n Quote reply\n <ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual>\n </ActionList.Item>\n <ActionList.Item onSelect={() => alert('Edit comment clicked')}>\n Edit comment\n <ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual>\n </ActionList.Item>\n <ActionList.Divider />\n <ActionList.Item\n variant=\"danger\"\n onSelect={() => alert('Delete file clicked')}\n >\n Delete file\n <ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual>\n </ActionList.Item>\n </ActionList>\n </ActionMenu.Overlay>\n </ActionMenu>\n)"
2047
2047
  },
2048
2048
  {
2049
2049
  "id": "components-iconbutton-features--loading",
2050
- "code": "() => (\n <IconButton loading icon={HeartIcon} variant=\"primary\" aria-label=\"Primary\" />\n)"
2050
+ "code": "() => (\n <IconButton\n loading\n icon={<HeartIcon />}\n variant=\"primary\"\n aria-label=\"Primary\"\n />\n)"
2051
2051
  },
2052
2052
  {
2053
2053
  "id": "components-iconbutton-features--loading-trigger",
2054
- "code": "() => {\n const [isLoading, setIsLoading] = useState(false)\n const handleClick = () => {\n setIsLoading(true)\n setTimeout(() => {\n setIsLoading(false)\n }, 3000)\n }\n return (\n <IconButton\n loading={isLoading}\n onClick={handleClick}\n icon={DownloadIcon}\n aria-label=\"Download\"\n />\n )\n}"
2054
+ "code": "() => {\n const [isLoading, setIsLoading] = useState(false)\n const handleClick = () => {\n setIsLoading(true)\n setTimeout(() => {\n setIsLoading(false)\n }, 3000)\n }\n return (\n <IconButton\n loading={isLoading}\n onClick={handleClick}\n icon={<DownloadIcon />}\n aria-label=\"Download\"\n />\n )\n}"
2055
2055
  },
2056
2056
  {
2057
2057
  "id": "components-iconbutton-features--keybinding-hint-on-description",
2058
- "code": "() => (\n <IconButton\n icon={InboxIcon}\n aria-label=\"Notifications\"\n description=\"You have unread notifications\"\n keybindingHint=\"G+N\"\n />\n)"
2058
+ "code": "() => (\n <IconButton\n icon={<InboxIcon />}\n aria-label=\"Notifications\"\n description=\"You have unread notifications\"\n keybindingHint=\"G+N\"\n />\n)"
2059
2059
  },
2060
2060
  {
2061
2061
  "id": "components-iconbutton-features--keybinding-hint",
2062
- "code": "() => <IconButton icon={BoldIcon} aria-label=\"Bold\" keybindingHint=\"Mod+B\" />"
2062
+ "code": "() => (\n <IconButton icon={<BoldIcon />} aria-label=\"Bold\" keybindingHint=\"Mod+B\" />\n)"
2063
2063
  }
2064
2064
  ],
2065
2065
  "importPath": "@primer/react",
@@ -2100,9 +2100,9 @@
2100
2100
  },
2101
2101
  {
2102
2102
  "name": "icon",
2103
- "type": "Component",
2103
+ "type": "React.ReactNode | React.ComponentType<IconProps> | React.ExoticComponent<IconProps>",
2104
2104
  "defaultValue": "",
2105
- "description": "provide an octicon. It will be placed in the center of the button"
2105
+ "description": "Provide an icon component or React node. It will be placed in the center of the button. Use a React element when passing an icon from a Server Component."
2106
2106
  },
2107
2107
  {
2108
2108
  "name": "aria-label",
@@ -8048,7 +8048,8 @@
8048
8048
  "name": "contrast",
8049
8049
  "type": "boolean",
8050
8050
  "defaultValue": "false",
8051
- "description": "Changes background color to a higher contrast color"
8051
+ "deprecated": true,
8052
+ "description": "Deprecated. Omit this prop to use the default background."
8052
8053
  },
8053
8054
  {
8054
8055
  "name": "size",
@@ -8398,7 +8399,8 @@
8398
8399
  "name": "contrast",
8399
8400
  "type": "boolean",
8400
8401
  "defaultValue": "false",
8401
- "description": "Changes background color to a higher contrast color"
8402
+ "deprecated": true,
8403
+ "description": "Deprecated. Omit this prop to use the default background."
8402
8404
  },
8403
8405
  {
8404
8406
  "name": "validationStatus",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@primer/react",
3
3
  "type": "module",
4
- "version": "38.42.0-rc.ebd425836",
4
+ "version": "38.42.0",
5
5
  "description": "An implementation of GitHub's Primer Design System using React",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -94,14 +94,16 @@
94
94
  },
95
95
  "devDependencies": {
96
96
  "@actions/core": "1.11.1",
97
- "@babel/cli": "7.28.6",
98
- "@babel/core": "7.29.6",
99
- "@babel/parser": "7.29.0",
100
- "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
101
- "@babel/plugin-proposal-optional-chaining": "7.21.0",
102
- "@babel/plugin-transform-modules-commonjs": "7.28.6",
103
- "@babel/preset-react": "7.28.5",
104
- "@babel/preset-typescript": "7.28.5",
97
+ "@babel/cli": "8.0.6",
98
+ "@babel/core": "8.0.6",
99
+ "@babel/generator": "8.0.6",
100
+ "@babel/parser": "8.0.6",
101
+ "@babel/plugin-transform-nullish-coalescing-operator": "8.0.1",
102
+ "@babel/plugin-transform-optional-chaining": "8.0.5",
103
+ "@babel/plugin-transform-modules-commonjs": "8.0.1",
104
+ "@babel/preset-react": "8.0.1",
105
+ "@babel/preset-typescript": "8.0.1",
106
+ "@babel/types": "8.0.6",
105
107
  "@figma/code-connect": "1.3.2",
106
108
  "@primer/css": "^21.5.1",
107
109
  "@primer/doc-gen": "^0.0.1",
@@ -118,7 +120,6 @@
118
120
  "@testing-library/react": "^16.3.0",
119
121
  "@testing-library/react-hooks": "^8.0.1",
120
122
  "@testing-library/user-event": "^14.5.2",
121
- "@types/babel__core": "^7.20.5",
122
123
  "@types/lodash.groupby": "4.6.9",
123
124
  "@types/lodash.isempty": "4.4.9",
124
125
  "@types/lodash.isobject": "3.0.9",
@@ -131,13 +132,11 @@
131
132
  "afterframe": "^1.0.2",
132
133
  "ajv": "8.18.0",
133
134
  "axe-core": "4.9.1",
134
- "babel-core": "7.0.0-bridge.0",
135
135
  "babel-plugin-add-react-displayname": "0.0.5",
136
136
  "babel-plugin-dev-expression": "0.2.3",
137
137
  "babel-plugin-macros": "3.1.0",
138
138
  "babel-plugin-open-source": "1.3.4",
139
139
  "babel-plugin-transform-replace-expressions": "0.2.0",
140
- "babel-polyfill": "6.26.0",
141
140
  "chalk": "^5.4.1",
142
141
  "change-case": "5.4.4",
143
142
  "concurrently": "9.1.2",
@@ -166,7 +165,7 @@
166
165
  "react-is": "18.3.1",
167
166
  "recast": "0.23.7",
168
167
  "rimraf": "5.0.5",
169
- "rolldown": "^1.2.11",
168
+ "rolldown": "^1.2.12",
170
169
  "rolldown-plugin-dts": "^0.26.0",
171
170
  "rolldown-plugin-import-css": "^0.0.0",
172
171
  "rolldown-plugin-preserve-directives": "^0.0.0",