@primer/react 36.7.2 → 36.8.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 (59) hide show
  1. package/dist/browser.esm.js +2 -2
  2. package/dist/browser.esm.js.map +1 -1
  3. package/dist/browser.umd.js +3 -3
  4. package/dist/browser.umd.js.map +1 -1
  5. package/lib/ActionList/Group.d.ts +1 -1
  6. package/lib/ActionList/Group.d.ts.map +1 -1
  7. package/lib/ActionList/Group.js +3 -3
  8. package/lib/ActionList/Heading.js +2 -2
  9. package/lib/ActionList/Item.js +2 -3
  10. package/lib/ActionList/LinkItem.js +0 -71
  11. package/lib/ActionList/List.d.ts +1 -26
  12. package/lib/ActionList/List.d.ts.map +1 -1
  13. package/lib/ActionList/List.js +2 -3
  14. package/lib/ActionList/Selection.d.ts +1 -1
  15. package/lib/ActionList/Selection.d.ts.map +1 -1
  16. package/lib/ActionList/Selection.js +2 -2
  17. package/lib/ActionList/index.d.ts +2 -2
  18. package/lib/ActionList/index.d.ts.map +1 -1
  19. package/lib/ActionList/shared.d.ts +22 -0
  20. package/lib/ActionList/shared.d.ts.map +1 -1
  21. package/lib/ActionList/shared.js +3 -0
  22. package/lib/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  23. package/lib/ButtonGroup/ButtonGroup.js +1 -1
  24. package/lib/Dialog/Dialog.d.ts +5 -0
  25. package/lib/Dialog/Dialog.d.ts.map +1 -1
  26. package/lib/Dialog/Dialog.js +24 -9
  27. package/lib/LabelGroup/LabelGroup.d.ts.map +1 -1
  28. package/lib/LabelGroup/LabelGroup.js +2 -65
  29. package/lib/drafts/MarkdownEditor/Toolbar.d.ts +2 -2
  30. package/lib/drafts/MarkdownEditor/Toolbar.d.ts.map +1 -1
  31. package/lib/drafts/MarkdownEditor/Toolbar.js +13 -42
  32. package/lib/drafts/MarkdownEditor/_SavedReplies.js +2 -2
  33. package/lib/drafts/MarkdownEditor/_ToolbarButton.d.ts +4 -0
  34. package/lib/drafts/MarkdownEditor/_ToolbarButton.d.ts.map +1 -0
  35. package/lib/drafts/MarkdownEditor/_ToolbarButton.js +42 -0
  36. package/lib/drafts/MarkdownEditor/index.js +2 -1
  37. package/lib-esm/ActionList/Group.d.ts +1 -1
  38. package/lib-esm/ActionList/Group.js +1 -1
  39. package/lib-esm/ActionList/Heading.js +1 -1
  40. package/lib-esm/ActionList/Item.js +1 -2
  41. package/lib-esm/ActionList/LinkItem.js +0 -71
  42. package/lib-esm/ActionList/List.d.ts +1 -26
  43. package/lib-esm/ActionList/List.js +2 -2
  44. package/lib-esm/ActionList/Selection.d.ts +1 -1
  45. package/lib-esm/ActionList/Selection.js +1 -1
  46. package/lib-esm/ActionList/index.d.ts +2 -2
  47. package/lib-esm/ActionList/shared.d.ts +22 -0
  48. package/lib-esm/ActionList/shared.js +3 -1
  49. package/lib-esm/ButtonGroup/ButtonGroup.js +1 -1
  50. package/lib-esm/Dialog/Dialog.d.ts +5 -0
  51. package/lib-esm/Dialog/Dialog.js +24 -9
  52. package/lib-esm/LabelGroup/LabelGroup.js +2 -65
  53. package/lib-esm/drafts/MarkdownEditor/Toolbar.d.ts +2 -2
  54. package/lib-esm/drafts/MarkdownEditor/Toolbar.js +2 -31
  55. package/lib-esm/drafts/MarkdownEditor/_SavedReplies.js +1 -1
  56. package/lib-esm/drafts/MarkdownEditor/_ToolbarButton.d.ts +4 -0
  57. package/lib-esm/drafts/MarkdownEditor/_ToolbarButton.js +36 -0
  58. package/lib-esm/drafts/MarkdownEditor/index.js +2 -1
  59. package/package.json +1 -1
@@ -5,44 +5,15 @@ var octiconsReact = require('@primer/octicons-react');
5
5
  var React = require('react');
6
6
  var utils = require('@primer/behaviors/utils');
7
7
  var Box = require('../../Box/Box.js');
8
- var IconButton = require('../../Button/IconButton.js');
9
- require('@styled-system/css');
10
- require('deepmerge');
11
- require('../../ThemeProvider.js');
12
- require('../../Button/types.js');
13
- require('../../utils/defaultSxProp.js');
14
- require('../../CounterLabel/CounterLabel.js');
15
- require('../../Button/Button.js');
16
8
  var useFocusZone = require('../../hooks/useFocusZone.js');
17
9
  var _MarkdownEditorContext = require('./_MarkdownEditorContext.js');
18
10
  var _SavedReplies = require('./_SavedReplies.js');
11
+ var _ToolbarButton = require('./_ToolbarButton.js');
19
12
 
20
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
21
14
 
22
15
  var React__default = /*#__PURE__*/_interopDefault(React);
23
16
 
24
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
- const ToolbarButton = /*#__PURE__*/React.forwardRef((props, ref) => {
26
- const {
27
- disabled,
28
- condensed
29
- } = React.useContext(_MarkdownEditorContext.MarkdownEditorContext);
30
- return /*#__PURE__*/React__default.default.createElement(IconButton.IconButton, _extends({
31
- ref: ref,
32
- size: condensed ? 'small' : 'medium',
33
- variant: "invisible",
34
- disabled: disabled
35
- // Prevent focus leaving input:
36
- ,
37
- onMouseDown: e => e.preventDefault()
38
- }, props, {
39
- sx: {
40
- color: 'fg.muted',
41
- ...props.sx
42
- }
43
- }));
44
- });
45
- ToolbarButton.displayName = 'MarkdownEditor.ToolbarButton';
46
17
  const Divider = () => {
47
18
  return /*#__PURE__*/React__default.default.createElement(Box, {
48
19
  sx: {
@@ -62,77 +33,77 @@ const DefaultToolbarButtons = /*#__PURE__*/React.memo(() => {
62
33
  const cmdOrCtrl = utils.isMacOS() ? 'Cmd' : 'Ctrl';
63
34
 
64
35
  // Important: do not replace `() => ref.current?.format()` with `ref.current?.format` - it will refer to an outdated ref.current!
65
- return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
36
+ return /*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
66
37
  onClick: () => {
67
38
  var _formattingToolsRef$c;
68
39
  return (_formattingToolsRef$c = formattingToolsRef.current) === null || _formattingToolsRef$c === void 0 ? void 0 : _formattingToolsRef$c.header();
69
40
  },
70
41
  icon: octiconsReact.HeadingIcon,
71
42
  "aria-label": "Add header text"
72
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
43
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
73
44
  onClick: () => {
74
45
  var _formattingToolsRef$c2;
75
46
  return (_formattingToolsRef$c2 = formattingToolsRef.current) === null || _formattingToolsRef$c2 === void 0 ? void 0 : _formattingToolsRef$c2.bold();
76
47
  },
77
48
  icon: octiconsReact.BoldIcon,
78
49
  "aria-label": `Bold (${cmdOrCtrl} + B)`
79
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
50
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
80
51
  onClick: () => {
81
52
  var _formattingToolsRef$c3;
82
53
  return (_formattingToolsRef$c3 = formattingToolsRef.current) === null || _formattingToolsRef$c3 === void 0 ? void 0 : _formattingToolsRef$c3.italic();
83
54
  },
84
55
  icon: octiconsReact.ItalicIcon,
85
56
  "aria-label": `Italic (${cmdOrCtrl} + I)`
86
- })), /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(Divider, null), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
57
+ })), /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(Divider, null), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
87
58
  onClick: () => {
88
59
  var _formattingToolsRef$c4;
89
60
  return (_formattingToolsRef$c4 = formattingToolsRef.current) === null || _formattingToolsRef$c4 === void 0 ? void 0 : _formattingToolsRef$c4.quote();
90
61
  },
91
62
  icon: octiconsReact.QuoteIcon,
92
63
  "aria-label": `Insert a quote (${cmdOrCtrl} + Shift + .)`
93
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
64
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
94
65
  onClick: () => {
95
66
  var _formattingToolsRef$c5;
96
67
  return (_formattingToolsRef$c5 = formattingToolsRef.current) === null || _formattingToolsRef$c5 === void 0 ? void 0 : _formattingToolsRef$c5.code();
97
68
  },
98
69
  icon: octiconsReact.CodeIcon,
99
70
  "aria-label": `Insert code (${cmdOrCtrl} + E)`
100
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
71
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
101
72
  onClick: () => {
102
73
  var _formattingToolsRef$c6;
103
74
  return (_formattingToolsRef$c6 = formattingToolsRef.current) === null || _formattingToolsRef$c6 === void 0 ? void 0 : _formattingToolsRef$c6.link();
104
75
  },
105
76
  icon: octiconsReact.LinkIcon,
106
77
  "aria-label": `Add a link (${cmdOrCtrl} + K)`
107
- })), /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(Divider, null), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
78
+ })), /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(Divider, null), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
108
79
  onClick: () => {
109
80
  var _formattingToolsRef$c7;
110
81
  return (_formattingToolsRef$c7 = formattingToolsRef.current) === null || _formattingToolsRef$c7 === void 0 ? void 0 : _formattingToolsRef$c7.unorderedList();
111
82
  },
112
83
  icon: octiconsReact.ListUnorderedIcon,
113
84
  "aria-label": `Add a bulleted list (${cmdOrCtrl} + 8)`
114
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
85
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
115
86
  onClick: () => {
116
87
  var _formattingToolsRef$c8;
117
88
  return (_formattingToolsRef$c8 = formattingToolsRef.current) === null || _formattingToolsRef$c8 === void 0 ? void 0 : _formattingToolsRef$c8.orderedList();
118
89
  },
119
90
  icon: octiconsReact.ListOrderedIcon,
120
91
  "aria-label": `Add a numbered list (${cmdOrCtrl} + Shift + 7)`
121
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
92
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
122
93
  onClick: () => {
123
94
  var _formattingToolsRef$c9;
124
95
  return (_formattingToolsRef$c9 = formattingToolsRef.current) === null || _formattingToolsRef$c9 === void 0 ? void 0 : _formattingToolsRef$c9.taskList();
125
96
  },
126
97
  icon: octiconsReact.TasklistIcon,
127
98
  "aria-label": `Add a task list (${cmdOrCtrl} + Shift + L)`
128
- })), !condensed && /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(Divider, null), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
99
+ })), !condensed && /*#__PURE__*/React__default.default.createElement(Box, null, /*#__PURE__*/React__default.default.createElement(Divider, null), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
129
100
  onClick: () => {
130
101
  var _formattingToolsRef$c10;
131
102
  return (_formattingToolsRef$c10 = formattingToolsRef.current) === null || _formattingToolsRef$c10 === void 0 ? void 0 : _formattingToolsRef$c10.mention();
132
103
  },
133
104
  icon: octiconsReact.MentionIcon,
134
105
  "aria-label": "Mention a user or team (@)"
135
- }), /*#__PURE__*/React__default.default.createElement(ToolbarButton, {
106
+ }), /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, {
136
107
  onClick: () => {
137
108
  var _formattingToolsRef$c11;
138
109
  return (_formattingToolsRef$c11 = formattingToolsRef.current) === null || _formattingToolsRef$c11 === void 0 ? void 0 : _formattingToolsRef$c11.reference();
@@ -177,7 +148,7 @@ const Toolbar = ({
177
148
  Toolbar.displayName = "Toolbar";
178
149
  Toolbar.displayName = 'MarkdownEditor.Toolbar';
179
150
 
151
+ exports.ToolbarButton = _ToolbarButton.ToolbarButton;
180
152
  exports.CoreToolbar = CoreToolbar;
181
153
  exports.DefaultToolbarButtons = DefaultToolbarButtons;
182
154
  exports.Toolbar = Toolbar;
183
- exports.ToolbarButton = ToolbarButton;
@@ -3,7 +3,7 @@
3
3
  var octiconsReact = require('@primer/octicons-react');
4
4
  var React = require('react');
5
5
  var SelectPanel = require('../../SelectPanel/SelectPanel.js');
6
- var Toolbar = require('./Toolbar.js');
6
+ var _ToolbarButton = require('./_ToolbarButton.js');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
@@ -61,7 +61,7 @@ const SavedRepliesButton = () => {
61
61
  }
62
62
  };
63
63
  return items ? /*#__PURE__*/React__default.default.createElement(SelectPanel.SelectPanel, {
64
- renderAnchor: props => /*#__PURE__*/React__default.default.createElement(Toolbar.ToolbarButton, _extends({}, props, {
64
+ renderAnchor: props => /*#__PURE__*/React__default.default.createElement(_ToolbarButton.ToolbarButton, _extends({}, props, {
65
65
  icon: octiconsReact.ReplyIcon,
66
66
  "aria-label": "Add saved reply (Ctrl + .)",
67
67
  "aria-labelledby": undefined
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { IconButtonProps } from '../../Button';
3
+ export declare const ToolbarButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
4
+ //# sourceMappingURL=_ToolbarButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_ToolbarButton.d.ts","sourceRoot":"","sources":["../../../src/drafts/MarkdownEditor/_ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAA;AACnD,OAAO,EAAa,eAAe,EAAC,MAAM,cAAc,CAAA;AAGxD,eAAO,MAAM,aAAa,2FAexB,CAAA"}
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var IconButton = require('../../Button/IconButton.js');
5
+ require('../../Box/Box.js');
6
+ require('@styled-system/css');
7
+ require('deepmerge');
8
+ require('../../ThemeProvider.js');
9
+ require('../../Button/types.js');
10
+ require('../../utils/defaultSxProp.js');
11
+ require('../../CounterLabel/CounterLabel.js');
12
+ require('../../Button/Button.js');
13
+ var _MarkdownEditorContext = require('./_MarkdownEditorContext.js');
14
+
15
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ var React__default = /*#__PURE__*/_interopDefault(React);
18
+
19
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20
+ const ToolbarButton = /*#__PURE__*/React.forwardRef((props, ref) => {
21
+ const {
22
+ disabled,
23
+ condensed
24
+ } = React.useContext(_MarkdownEditorContext.MarkdownEditorContext);
25
+ return /*#__PURE__*/React__default.default.createElement(IconButton.IconButton, _extends({
26
+ ref: ref,
27
+ size: condensed ? 'small' : 'medium',
28
+ variant: "invisible",
29
+ disabled: disabled
30
+ // Prevent focus leaving input:
31
+ ,
32
+ onMouseDown: e => e.preventDefault()
33
+ }, props, {
34
+ sx: {
35
+ color: 'fg.muted',
36
+ ...props.sx
37
+ }
38
+ }));
39
+ });
40
+ ToolbarButton.displayName = 'MarkdownEditor.ToolbarButton';
41
+
42
+ exports.ToolbarButton = ToolbarButton;
@@ -5,6 +5,7 @@ var Toolbar = require('./Toolbar.js');
5
5
  var Actions = require('./Actions.js');
6
6
  var Footer = require('./Footer.js');
7
7
  var Label = require('./Label.js');
8
+ var _ToolbarButton = require('./_ToolbarButton.js');
8
9
 
9
10
  /** @deprecated Will be removed in v37 (https://github.com/primer/react/issues/3604) */
10
11
  const MarkdownEditor = Object.assign(MarkdownEditor$1, {
@@ -20,7 +21,7 @@ const MarkdownEditor = Object.assign(MarkdownEditor$1, {
20
21
  * A custom toolbar button. This takes `IconButton` props. Every toolbar button should
21
22
  * have an `aria-label` defined.
22
23
  */
23
- ToolbarButton: Toolbar.ToolbarButton,
24
+ ToolbarButton: _ToolbarButton.ToolbarButton,
24
25
  /**
25
26
  * The full set of default toolbar buttons. This is all the basic formatting tools in a
26
27
  * standardized order.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { SxProp } from '../sx';
3
- import { ActionListProps } from './List';
3
+ import { type ActionListProps } from './shared';
4
4
  import { AriaRole } from '../utils/types';
5
5
  import type { ActionListHeadingProps } from './Heading';
6
6
  export type ActionListGroupProps = {
@@ -3,7 +3,7 @@ import { useId } from '../hooks/useId.js';
3
3
  import Box from '../Box/Box.js';
4
4
  import '@styled-system/css';
5
5
  import merge from 'deepmerge';
6
- import { ListContext } from './List.js';
6
+ import { ListContext } from './shared.js';
7
7
  import Heading from '../Heading/Heading.js';
8
8
  import { useSlots } from '../hooks/useSlots.js';
9
9
  import { defaultSxProp } from '../utils/defaultSxProp.js';
@@ -6,7 +6,7 @@ import '@primer/behaviors/utils';
6
6
  import '@primer/behaviors';
7
7
  import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
8
8
  import Heading$1 from '../Heading/Heading.js';
9
- import { ListContext } from './List.js';
9
+ import { ListContext } from './shared.js';
10
10
  import VisuallyHidden from '../_VisuallyHidden.js';
11
11
  import { ActionListContainerContext } from './ActionListContainerContext.js';
12
12
  import { invariant } from '../utils/invariant.js';
@@ -11,9 +11,8 @@ import { defaultSxProp } from '../utils/defaultSxProp.js';
11
11
  import { ActionListContainerContext } from './ActionListContainerContext.js';
12
12
  import { Description } from './Description.js';
13
13
  import { GroupContext } from './Group.js';
14
- import { ListContext } from './List.js';
14
+ import { ListContext, TEXT_ROW_HEIGHT, getVariantStyles, ItemContext } from './shared.js';
15
15
  import { Selection } from './Selection.js';
16
- import { TEXT_ROW_HEIGHT, getVariantStyles, ItemContext } from './shared.js';
17
16
  import { LeadingVisual, TrailingVisual } from './Visuals.js';
18
17
  import merge from 'deepmerge';
19
18
 
@@ -3,78 +3,7 @@ import Link from '../Link/Link.js';
3
3
  import '@styled-system/css';
4
4
  import merge from 'deepmerge';
5
5
  import { Item } from './Item.js';
6
- import '../theme.js';
7
- import '../constants.js';
8
- import '../BaseStyles.js';
9
- import '../ThemeProvider.js';
10
6
  import Box from '../Box/Box.js';
11
- import '../Button/types.js';
12
- import '../utils/defaultSxProp.js';
13
- import '../CounterLabel/CounterLabel.js';
14
- import '../Button/Button.js';
15
- import '../PageLayout/PageLayout.js';
16
- import '../SplitPageLayout/SplitPageLayout.js';
17
- import '@primer/behaviors/utils';
18
- import '../ConfirmationDialog/ConfirmationDialog.js';
19
- import '@primer/behaviors';
20
- import '../hooks/useMedia.js';
21
- import '../Radio/Radio.js';
22
- import './index.js';
23
- import '../ActionMenu/ActionMenu.js';
24
- import '../AnchoredOverlay/AnchoredOverlay.js';
25
- import '../Autocomplete/Autocomplete.js';
26
- import '../Avatar/Avatar.js';
27
- import '../AvatarPair/AvatarPair.js';
28
- import '../AvatarStack/AvatarStack.js';
29
- import '../BranchName/BranchName.js';
30
- import '../Breadcrumbs/Breadcrumbs.js';
31
- import '../ButtonGroup/ButtonGroup.js';
32
- import '../Caret.js';
33
- import '../CircleOcticon/CircleOcticon.js';
34
- import '../CheckboxGroup/CheckboxGroup.js';
35
- import '../CircleBadge/CircleBadge.js';
36
- import '../Details/Details.js';
37
- import '../Dialog.js';
38
- import '../Flash/Flash.js';
39
- import '../FormControl/_FormControlContext.js';
40
- import '../FormControl/FormControl.js';
41
- import '../Header/Header.js';
42
- import '../Heading/Heading.js';
43
- import '../Label/Label.js';
44
- import '../LabelGroup/LabelGroup.js';
45
- import '../NavList/NavList.js';
46
- import '../Octicon/Octicon.js';
47
- import '../Overlay/Overlay.js';
48
- import '../Pagehead/Pagehead.js';
49
- import '../Pagination/Pagination.js';
50
- import '../PointerBox/PointerBox.js';
51
- import '../Popover/Popover.js';
52
- import 'react-dom';
53
- import '../ProgressBar/index.js';
54
- import '../RadioGroup/RadioGroup.js';
55
- import '../RelativeTime/RelativeTime.js';
56
- import '../SegmentedControl/SegmentedControl.js';
57
- import '../Select.js';
58
- import '../SelectPanel/SelectPanel.js';
59
- import '../SideNav.js';
60
- import '../Spinner/Spinner.js';
61
- import '../StateLabel/StateLabel.js';
62
- import '../SubNav/SubNav.js';
63
- import '../ToggleSwitch/ToggleSwitch.js';
64
- import '../TabNav/TabNav.js';
65
- import '../TextInput/TextInput.js';
66
- import '../TextInputWithTokens/TextInputWithTokens.js';
67
- import '../Text/Text.js';
68
- import '../Timeline/Timeline.js';
69
- import '../Token/Token.js';
70
- import '../Token/IssueLabelToken.js';
71
- import '../Token/AvatarToken.js';
72
- import '../Tooltip/Tooltip.js';
73
- import '../Truncate/Truncate.js';
74
- import '../Checkbox/Checkbox.js';
75
- import '../Textarea/Textarea.js';
76
- import '../TreeView/TreeView.js';
77
- import '../UnderlineNav/index.js';
78
7
 
79
8
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
80
9
 
@@ -1,29 +1,4 @@
1
- import React from 'react';
2
1
  import { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
3
- import { SxProp } from '../sx';
4
- import { AriaRole } from '../utils/types';
5
- export type ActionListProps = React.PropsWithChildren<{
6
- /**
7
- * `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges
8
- */
9
- variant?: 'inset' | 'full';
10
- /**
11
- * Whether multiple Items or a single Item can be selected.
12
- */
13
- selectionVariant?: 'single' | 'multiple';
14
- /**
15
- * Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
16
- */
17
- showDividers?: boolean;
18
- /**
19
- * The ARIA role describing the function of `List` component. `listbox` or `menu` are a common values.
20
- */
21
- role?: AriaRole;
22
- }> & SxProp;
23
- type ContextProps = Pick<ActionListProps, 'variant' | 'selectionVariant' | 'showDividers' | 'role'> & {
24
- headingId?: string;
25
- };
26
- export declare const ListContext: React.Context<ContextProps>;
2
+ import { type ActionListProps } from './shared';
27
3
  export declare const List: PolymorphicForwardRefComponent<"ul", ActionListProps>;
28
- export {};
29
4
  //# sourceMappingURL=List.d.ts.map
@@ -6,10 +6,10 @@ import { defaultSxProp } from '../utils/defaultSxProp.js';
6
6
  import { useSlots } from '../hooks/useSlots.js';
7
7
  import { Heading } from './Heading.js';
8
8
  import { useId } from '../hooks/useId.js';
9
+ import { ListContext } from './shared.js';
9
10
  import merge from 'deepmerge';
10
11
 
11
12
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
12
- const ListContext = /*#__PURE__*/React.createContext({});
13
13
  const ListBox = styled.ul.withConfig({
14
14
  displayName: "List__ListBox",
15
15
  componentId: "sc-1x7olzq-0"
@@ -59,4 +59,4 @@ const List = /*#__PURE__*/React.forwardRef(({
59
59
  });
60
60
  List.displayName = 'ActionList';
61
61
 
62
- export { List, ListContext };
62
+ export { List };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ActionListItemProps } from './shared';
2
+ import { type ActionListItemProps } from './shared';
3
3
  type SelectionProps = Pick<ActionListItemProps, 'selected'>;
4
4
  export declare const Selection: React.FC<React.PropsWithChildren<SelectionProps>>;
5
5
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CheckIcon } from '@primer/octicons-react';
3
- import { ListContext } from './List.js';
4
3
  import { GroupContext } from './Group.js';
4
+ import { ListContext } from './shared.js';
5
5
  import { LeadingVisualContainer } from './Visuals.js';
6
6
  import Box from '../Box/Box.js';
7
7
 
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export type { ActionListProps } from './List';
2
+ export type { ActionListProps } from './shared';
3
3
  export type { ActionListGroupProps } from './Group';
4
4
  export type { ActionListItemProps } from './shared';
5
5
  export type { ActionListLinkItemProps } from './LinkItem';
@@ -10,7 +10,7 @@ export type { ActionListHeadingProps } from './Heading';
10
10
  /**
11
11
  * Collection of list-related components.
12
12
  */
13
- export declare const ActionList: import("../utils/polymorphic").ForwardRefComponent<"ul", import("./List").ActionListProps> & {
13
+ export declare const ActionList: import("../utils/polymorphic").ForwardRefComponent<"ul", import("./shared").ActionListProps> & {
14
14
  /** Collects related `Items` in an `ActionList`. */
15
15
  Group: import("react").FC<import("react").PropsWithChildren<import("./Group").ActionListGroupProps>>;
16
16
  /** An actionable or selectable `Item` */
@@ -75,5 +75,27 @@ export declare const getVariantStyles: (variant: ActionListItemProps['variant'],
75
75
  hoverColor: string;
76
76
  };
77
77
  export declare const TEXT_ROW_HEIGHT = "20px";
78
+ export type ActionListProps = React.PropsWithChildren<{
79
+ /**
80
+ * `inset` children are offset (vertically and horizontally) from `List`’s edges, `full` children are flush (vertically and horizontally) with `List` edges
81
+ */
82
+ variant?: 'inset' | 'full';
83
+ /**
84
+ * Whether multiple Items or a single Item can be selected.
85
+ */
86
+ selectionVariant?: 'single' | 'multiple';
87
+ /**
88
+ * Display a divider above each `Item` in this `List` when it does not follow a `Header` or `Divider`.
89
+ */
90
+ showDividers?: boolean;
91
+ /**
92
+ * The ARIA role describing the function of `List` component. `listbox` or `menu` are a common values.
93
+ */
94
+ role?: AriaRole;
95
+ }> & SxProp;
96
+ type ContextProps = Pick<ActionListProps, 'variant' | 'selectionVariant' | 'showDividers' | 'role'> & {
97
+ headingId?: string;
98
+ };
99
+ export declare const ListContext: React.Context<ContextProps>;
78
100
  export {};
79
101
  //# sourceMappingURL=shared.d.ts.map
@@ -35,4 +35,6 @@ const getVariantStyles = (variant, disabled, inactive) => {
35
35
  };
36
36
  const TEXT_ROW_HEIGHT = '20px'; // custom value off the scale
37
37
 
38
- export { ItemContext, TEXT_ROW_HEIGHT, getVariantStyles };
38
+ const ListContext = /*#__PURE__*/React.createContext({});
39
+
40
+ export { ItemContext, ListContext, TEXT_ROW_HEIGHT, getVariantStyles };
@@ -5,6 +5,6 @@ import sx from '../sx.js';
5
5
  const ButtonGroup = styled.div.withConfig({
6
6
  displayName: "ButtonGroup",
7
7
  componentId: "sc-1gxhls1-0"
8
- })(["display:inline-flex;vertical-align:middle;isolation:isolate;&& > *{margin-inline-end:-1px;position:relative;border-radius:0;:first-child{border-top-left-radius:", ";border-bottom-left-radius:", ";}:last-child{border-top-right-radius:", ";border-bottom-right-radius:", ";}:focus,:active,:hover{z-index:1;}}", ";"], get('radii.2'), get('radii.2'), get('radii.2'), get('radii.2'), sx);
8
+ })(["display:inline-flex;vertical-align:middle;isolation:isolate;&& > [type='button'],&& > span[role='tooltip'] > [type='button']{margin-inline-end:-1px;position:relative;border-radius:0;:focus,:active,:hover{z-index:1;}}&& > [type='button']:first-child,&& > span[role='tooltip']:first-of-type > [type='button']{border-top-left-radius:", ";border-bottom-left-radius:", ";}&& > [type='button']:last-of-type,&& > span[role='tooltip']:last-of-type > [type='button']{border-top-right-radius:", ";border-bottom-right-radius:", ";}", ";"], get('radii.2'), get('radii.2'), get('radii.2'), get('radii.2'), sx);
9
9
 
10
10
  export { ButtonGroup as default };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ButtonProps } from '../Button';
3
3
  import { SxProp } from '../sx';
4
+ import { ResponsiveValue } from '../hooks/useResponsiveValue';
4
5
  /**
5
6
  * Props that characterize a button to be rendered into the footer of
6
7
  * a Dialog.
@@ -95,6 +96,10 @@ export interface DialogProps extends SxProp {
95
96
  * auto: variable based on contents
96
97
  */
97
98
  height?: DialogHeight;
99
+ /**
100
+ * The position of the dialog
101
+ */
102
+ position?: 'center' | 'left' | 'right' | ResponsiveValue<'left' | 'right' | 'bottom' | 'fullscreen' | 'center'>;
98
103
  }
99
104
  /**
100
105
  * Props that are passed to a component that serves as a dialog header
@@ -25,8 +25,6 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
25
25
 
26
26
  /* Dialog Version 2 */
27
27
 
28
- const ANIMATION_DURATION = '200ms';
29
-
30
28
  /**
31
29
  * Props that characterize a button to be rendered into the footer of
32
30
  * a Dialog.
@@ -43,7 +41,7 @@ const ANIMATION_DURATION = '200ms';
43
41
  const Backdrop = styled('div').withConfig({
44
42
  displayName: "Dialog__Backdrop",
45
43
  componentId: "sc-uaxjsn-0"
46
- })(["position:fixed;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center;background-color:", ";animation:dialog-backdrop-appear ", " ", ";@keyframes dialog-backdrop-appear{0%{opacity:0;}100%{opacity:1;}}"], get('colors.primer.canvas.backdrop'), ANIMATION_DURATION, get('animation.easeOutCubic'));
44
+ })(["position:fixed;top:0;left:0;bottom:0;right:0;display:flex;align-items:center;justify-content:center;background-color:", ";animation:dialog-backdrop-appear 200ms ", ";&[data-position-regular='center']{align-items:center;justify-content:center;}&[data-position-regular='left']{align-items:center;justify-content:flex-start;}&[data-position-regular='right']{align-items:center;justify-content:flex-end;}.DialogOverflowWrapper{flex-grow:1;}@media (max-width:767px){&[data-position-narrow='center']{align-items:center;justify-content:center;}&[data-position-narrow='bottom']{align-items:end;justify-content:center;}}@keyframes dialog-backdrop-appear{0%{opacity:0;}100%{opacity:1;}}"], get('colors.primer.canvas.backdrop'), get('animation.easeOutCubic'));
47
45
  const heightMap = {
48
46
  small: '480px',
49
47
  large: '640px',
@@ -58,13 +56,19 @@ const widthMap = {
58
56
  const StyledDialog = styled.div.withConfig({
59
57
  displayName: "Dialog__StyledDialog",
60
58
  componentId: "sc-uaxjsn-1"
61
- })(["display:flex;flex-direction:column;background-color:", ";box-shadow:", ";min-width:296px;max-width:calc(100vw - 64px);max-height:calc(100vh - 64px);width:", ";height:", ";border-radius:12px;opacity:1;animation:overlay--dialog-appear ", " ", ";@keyframes overlay--dialog-appear{0%{opacity:0;transform:scale(0.5);}100%{opacity:1;transform:scale(1);}}", ";"], get('colors.canvas.overlay'), get('shadows.overlay.shadow'), props => {
59
+ })(["display:flex;flex-direction:column;background-color:", ";box-shadow:", ";width:", ";height:", ";min-width:296px;max-width:calc(100vw - 64px);max-height:calc(100vh - 64px);border-radius:12px;opacity:1;@media screen and (prefers-reduced-motion:no-preference){animation:Overlay--motion-scaleFade 0.2s cubic-bezier(0.33,1,0.68,1) 0s 1 normal none running;}&[data-position-regular='center']{border-radius:var(--borderRadius-large,0.75rem);@media screen and (prefers-reduced-motion:no-preference){animation:Overlay--motion-scaleFade 0.2s cubic-bezier(0.33,1,0.68,1) 0s 1 normal none running;}}&[data-position-regular='left']{height:100vh;max-height:unset;border-radius:var(--borderRadius-large,0.75rem);border-top-left-radius:0;border-bottom-left-radius:0;@media screen and (prefers-reduced-motion:no-preference){animation:Overlay--motion-slideInRight 0.25s cubic-bezier(0.33,1,0.68,1) 0s 1 normal none running;}}&[data-position-regular='right']{height:100vh;max-height:unset;border-radius:var(--borderRadius-large,0.75rem);border-top-right-radius:0;border-bottom-right-radius:0;@media screen and (prefers-reduced-motion:no-preference){animation:Overlay--motion-slideInLeft 0.25s cubic-bezier(0.33,1,0.68,1) 0s 1 normal none running;}}@media (max-width:767px){&[data-position-narrow='center']{border-radius:var(--borderRadius-large,0.75rem);width:", ";height:", ";}&[data-position-narrow='bottom']{width:100vw;height:auto;max-width:100vw;max-height:calc(100vh - 64px);border-radius:var(--borderRadius-large,0.75rem);border-bottom-right-radius:0;border-bottom-left-radius:0;@media screen and (prefers-reduced-motion:no-preference){animation:Overlay--motion-slideUp 0.25s cubic-bezier(0.33,1,0.68,1) 0s 1 normal none running;}}&[data-position-narrow='fullscreen']{width:100%;max-width:100vw;height:100%;max-height:100vh;border-radius:unset !important;flex-grow:1;@media screen and (prefers-reduced-motion:no-preference){animation:Overlay--motion-scaleFade 0.2s cubic-bezier(0.33,1,0.68,1) 0s 1 normal none running;}}}@keyframes Overlay--motion-scaleFade{0%{opacity:0;transform:scale(0.5);}100%{opacity:1;transform:scale(1);}}@keyframes Overlay--motion-slideUp{from{transform:translateY(100%);}}@keyframes Overlay--motion-slideInRight{from{transform:translateX(-100%);}}@keyframes Overlay--motion-slideInLeft{from{transform:translateX(100%);}}", ";"], get('colors.canvas.overlay'), get('shadows.overlay.shadow'), props => {
62
60
  var _props$width;
63
61
  return widthMap[(_props$width = props.width) !== null && _props$width !== void 0 ? _props$width : 'xlarge'];
64
62
  }, props => {
65
63
  var _props$height;
66
64
  return heightMap[(_props$height = props.height) !== null && _props$height !== void 0 ? _props$height : 'auto'];
67
- }, ANIMATION_DURATION, get('animation.easeOutCubic'), sx);
65
+ }, props => {
66
+ var _props$width2;
67
+ return widthMap[(_props$width2 = props.width) !== null && _props$width2 !== void 0 ? _props$width2 : 'xlarge'];
68
+ }, props => {
69
+ var _props$height2;
70
+ return heightMap[(_props$height2 = props.height) !== null && _props$height2 !== void 0 ? _props$height2 : 'auto'];
71
+ }, sx);
68
72
  const DefaultHeader = ({
69
73
  dialogLabelId,
70
74
  title,
@@ -113,6 +117,10 @@ const DefaultFooter = ({
113
117
  buttons: footerButtons
114
118
  })) : null;
115
119
  };
120
+ const defaultPosition = {
121
+ narrow: 'center',
122
+ regular: 'center'
123
+ };
116
124
  const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
117
125
  const {
118
126
  title = 'Dialog',
@@ -125,6 +133,7 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
125
133
  width = 'xlarge',
126
134
  height = 'auto',
127
135
  footerButtons = [],
136
+ position = defaultPosition,
128
137
  sx
129
138
  } = props;
130
139
  const dialogLabelId = useId();
@@ -171,18 +180,24 @@ const _Dialog = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
171
180
  const header = (renderHeader !== null && renderHeader !== void 0 ? renderHeader : DefaultHeader)(defaultedProps);
172
181
  const body = (renderBody !== null && renderBody !== void 0 ? renderBody : DefaultBody)(defaultedProps);
173
182
  const footer = (renderFooter !== null && renderFooter !== void 0 ? renderFooter : DefaultFooter)(defaultedProps);
174
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Backdrop, {
183
+ const positionDataAttributes = typeof position === 'string' ? {
184
+ 'data-position-regular': position
185
+ } : Object.fromEntries(Object.entries(position).map(([key, value]) => {
186
+ return [`data-position-${key}`, value];
187
+ }));
188
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(Backdrop, _extends({
175
189
  ref: backdropRef
176
- }, /*#__PURE__*/React.createElement(StyledDialog, {
190
+ }, positionDataAttributes), /*#__PURE__*/React.createElement(StyledDialog, _extends({
177
191
  width: width,
178
192
  height: height,
179
193
  ref: dialogRef,
180
194
  role: role,
181
195
  "aria-labelledby": dialogLabelId,
182
196
  "aria-describedby": dialogDescriptionId,
183
- "aria-modal": true,
197
+ "aria-modal": true
198
+ }, positionDataAttributes, {
184
199
  sx: sx
185
- }, header, /*#__PURE__*/React.createElement(ScrollableRegion, {
200
+ }), header, /*#__PURE__*/React.createElement(ScrollableRegion, {
186
201
  "aria-labelledby": dialogLabelId,
187
202
  className: "DialogOverflowWrapper"
188
203
  }, body), footer))));