@primer/components 0.0.0-202182921545 → 0.0.0-2021829233555

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.
@@ -117,13 +117,13 @@ const ConfirmationDialog = props => {
117
117
  }, [onClose]);
118
118
  const cancelButton = {
119
119
  content: cancelButtonContent,
120
- onClick: onCancelButtonClick
120
+ onClick: onCancelButtonClick,
121
+ autoFocus: true
121
122
  };
122
123
  const confirmButton = {
123
124
  content: confirmButtonContent,
124
125
  buttonType: confirmButtonType,
125
- onClick: onConfirmButtonClick,
126
- autoFocus: true
126
+ onClick: onConfirmButtonClick
127
127
  };
128
128
  const footerButtons = [cancelButton, confirmButton];
129
129
  return /*#__PURE__*/_react.default.createElement(_Dialog.Dialog, {
@@ -19,11 +19,6 @@ export declare type DialogButtonProps = ButtonProps & {
19
19
  * focus this button automatically when the dialog appears.
20
20
  */
21
21
  autoFocus?: boolean;
22
- /**
23
- * A reference to the rendered Button’s DOM node, used together with
24
- * `autoFocus` for `focusTrap`’s `initialFocus`.
25
- */
26
- ref?: React.RefObject<HTMLButtonElement>;
27
22
  };
28
23
  /**
29
24
  * Props to customize the rendering of the Dialog.
@@ -141,19 +141,10 @@ const _Dialog = /*#__PURE__*/_react.default.forwardRef((props, forwardedRef) =>
141
141
  onClose,
142
142
  role = 'dialog',
143
143
  width = 'xlarge',
144
- height = 'auto',
145
- footerButtons = []
144
+ height = 'auto'
146
145
  } = props;
147
146
  const dialogLabelId = (0, _ssr.useSSRSafeId)();
148
147
  const dialogDescriptionId = (0, _ssr.useSSRSafeId)();
149
- const autoFocusedFooterButtonRef = (0, _react.useRef)(null);
150
-
151
- for (const footerButton of footerButtons) {
152
- if (footerButton.autoFocus) {
153
- footerButton.ref = autoFocusedFooterButtonRef;
154
- }
155
- }
156
-
157
148
  const defaultedProps = { ...props,
158
149
  title,
159
150
  subtitle,
@@ -166,8 +157,7 @@ const _Dialog = /*#__PURE__*/_react.default.forwardRef((props, forwardedRef) =>
166
157
  const backdropRef = (0, _react.useRef)(null);
167
158
  (0, _useFocusTrap.useFocusTrap)({
168
159
  containerRef: dialogRef,
169
- restoreFocusOnCleanUp: true,
170
- initialFocusRef: autoFocusedFooterButtonRef
160
+ restoreFocusOnCleanUp: true
171
161
  });
172
162
  (0, _hooks.useOnEscapePress)(event => {
173
163
  onClose('escape');
@@ -222,9 +212,7 @@ const buttonTypes = {
222
212
  const Buttons = ({
223
213
  buttons
224
214
  }) => {
225
- var _buttons$find;
226
-
227
- const autoFocusRef = (0, _hooks.useProvidedRefOrCreate)((_buttons$find = buttons.find(button => button.autoFocus)) === null || _buttons$find === void 0 ? void 0 : _buttons$find.ref);
215
+ const autoFocusRef = (0, _react.useRef)(null);
228
216
  let autoFocusCount = 0;
229
217
  const [hasRendered, setHasRendered] = (0, _react.useState)(0);
230
218
  (0, _react.useEffect)(() => {
@@ -236,7 +224,7 @@ const Buttons = ({
236
224
  } else {
237
225
  setHasRendered(hasRendered + 1);
238
226
  }
239
- }, [autoFocusRef, hasRendered]);
227
+ }, [hasRendered]);
240
228
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, buttons.map((dialogButtonProps, index) => {
241
229
  const {
242
230
  content,
@@ -9,24 +9,7 @@ export namespace theme {
9
9
  export { radii };
10
10
  export { sizes };
11
11
  export { space };
12
- export namespace colorSchemes {
13
- namespace light {
14
- export { lightColors as colors };
15
- export { lightShadows as shadows };
16
- }
17
- namespace dark {
18
- export { darkColors as colors };
19
- export { darkShadows as shadows };
20
- }
21
- namespace dark_dimmed {
22
- export { darkDimmedColors as colors };
23
- export { darkDimmedShadows as shadows };
24
- }
25
- namespace dark_high_contrast {
26
- export { darkHighContrastColors as colors };
27
- export { darkHighContrastShadows as shadows };
28
- }
29
- }
12
+ export { colorSchemes };
30
13
  }
31
14
  declare namespace animation {
32
15
  const easeOutCubic: string;
@@ -39,8 +22,7 @@ declare namespace fonts {
39
22
  }
40
23
  declare const fontSizes: string[];
41
24
  declare namespace fontWeights {
42
- const light_1: number;
43
- export { light_1 as light };
25
+ export const light: number;
44
26
  const normal_1: number;
45
27
  export { normal_1 as normal };
46
28
  export const semibold: number;
@@ -60,44 +42,8 @@ declare namespace sizes {
60
42
  }
61
43
  declare const space: string[];
62
44
  /**
63
- * @type Partial<typeof primitives.colors.light>
45
+ * @type Record<keyof typeof primitives.colors, Record<'colors' | 'shadows', Partial<typeof primitives.colors.light>>
64
46
  */
65
- declare const lightColors: Partial<typeof primitives.colors.light>;
66
- /**
67
- * @type Partial<typeof primitives.colors.light>
68
- */
69
- declare const lightShadows: Partial<typeof primitives.colors.light>;
70
- /**
71
- * @type Partial<typeof primitives.colors.dark>
72
- */
73
- declare const darkColors: Partial<typeof primitives.colors.dark>;
74
- /**
75
- * @type Partial<typeof primitives.colors.dark>
76
- */
77
- declare const darkShadows: Partial<typeof primitives.colors.dark>;
78
- /**
79
- * @type Partial<typeof primitives.colors.dark_dimmed>
80
- */
81
- declare const darkDimmedColors: Partial<typeof primitives.colors.dark_dimmed>;
82
- /**
83
- * @type Partial<typeof primitives.colors.dark_dimmed>
84
- */
85
- declare const darkDimmedShadows: Partial<typeof primitives.colors.dark_dimmed>;
86
- /**
87
- * @type Partial<typeof primitives.colors.dark_dimmed>
88
- */
89
- declare const darkHighContrastColors: Partial<typeof primitives.colors.dark_dimmed>;
90
- /**
91
- * @type Partial<typeof primitives.colors.dark_high_contrast>
92
- */
93
- declare const darkHighContrastShadows: Partial<typeof primitives.colors.dark_high_contrast>;
47
+ declare const colorSchemes: Record<keyof typeof primitives.colors, Record<'colors' | 'shadows', Partial<typeof primitives.colors.light>>>;
94
48
  import { default as primitives } from "@primer/primitives";
95
- declare const light_2: {
96
- colors: {};
97
- shadows: {};
98
- };
99
- declare const dark_1: {
100
- colors: {};
101
- shadows: {};
102
- };
103
49
  export {};