@primer/components 0.0.0-2021108142649 → 0.0.0-2021108143211

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @primer/components
2
2
 
3
- ## 0.0.0-2021108142649
3
+ ## 0.0.0-2021108143211
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -1,32 +1,11 @@
1
1
  import React from 'react';
2
2
  import { SxProp } from '../sx';
3
+ import { HeaderProps } from './Header';
3
4
  import { ListProps } from './List';
4
- export declare type GroupProps = {
5
- /**
6
- * Style variations. Usage is discretionary.
7
- *
8
- * - `"filled"` - Superimposed on a background, offset from nearby content
9
- * - `"subtle"` - Relatively less offset from nearby content
10
- */
11
- variant?: 'subtle' | 'filled';
12
- /**
13
- * Primary text which names a `Group`.
14
- */
15
- title?: string;
16
- /**
17
- * Secondary text which provides additional information about a `Group`.
18
- */
19
- auxiliaryText?: string;
20
- } & SxProp & {
21
- /**
22
- * Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
23
- */
5
+ export declare type GroupProps = HeaderProps & SxProp & {
24
6
  selectionVariant?: ListProps['selectionVariant'] | false;
25
7
  };
26
8
  declare type ContextProps = Pick<GroupProps, 'selectionVariant'>;
27
9
  export declare const GroupContext: React.Context<ContextProps>;
28
10
  export declare const Group: React.FC<GroupProps>;
29
- export declare type HeaderProps = Pick<GroupProps, 'variant' | 'title' | 'auxiliaryText'> & {
30
- labelId: string;
31
- };
32
11
  export {};
@@ -7,11 +7,9 @@ exports.Group = exports.GroupContext = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _ssr = require("@react-aria/ssr");
11
-
12
10
  var _Box = _interopRequireDefault(require("../Box"));
13
11
 
14
- var _List = require("./List");
12
+ var _Header = require("./Header");
15
13
 
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
15
 
@@ -23,13 +21,12 @@ exports.GroupContext = GroupContext;
23
21
 
24
22
  const Group = ({
25
23
  title,
26
- variant = 'subtle',
24
+ variant,
27
25
  auxiliaryText,
28
26
  selectionVariant,
29
27
  sx = {},
30
28
  ...props
31
29
  }) => {
32
- const labelId = (0, _ssr.useSSRSafeId)();
33
30
  return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
34
31
  as: "li",
35
32
  sx: {
@@ -40,11 +37,10 @@ const Group = ({
40
37
  // hide the ::marker inserted by browser's stylesheet
41
38
  ...sx
42
39
  }
43
- }, props), title && /*#__PURE__*/_react.default.createElement(Header, {
40
+ }, props), title && /*#__PURE__*/_react.default.createElement(_Header.Header, {
44
41
  title: title,
45
42
  variant: variant,
46
- auxiliaryText: auxiliaryText,
47
- labelId: labelId
43
+ auxiliaryText: auxiliaryText
48
44
  }), /*#__PURE__*/_react.default.createElement(GroupContext.Provider, {
49
45
  value: {
50
46
  selectionVariant
@@ -53,52 +49,9 @@ const Group = ({
53
49
  as: "ul",
54
50
  sx: {
55
51
  paddingInlineStart: 0
56
- },
57
- "aria-labelledby": title ? labelId : undefined
52
+ }
58
53
  }, props.children)));
59
54
  };
60
55
 
61
56
  exports.Group = Group;
62
- Group.displayName = "Group";
63
-
64
- /**
65
- * Displays the name and description of a `Group`.
66
- *
67
- * For visual presentation only. It's hidden from screen readers.
68
- */
69
- const Header = ({
70
- variant,
71
- title,
72
- auxiliaryText,
73
- labelId,
74
- ...props
75
- }) => {
76
- const {
77
- variant: listVariant
78
- } = _react.default.useContext(_List.ListContext);
79
-
80
- const styles = {
81
- paddingY: '6px',
82
- paddingX: listVariant === 'full' ? 2 : 3,
83
- fontSize: 0,
84
- fontWeight: 'bold',
85
- color: 'fg.muted',
86
- ...(variant === 'filled' && {
87
- backgroundColor: 'canvas.subtle',
88
- marginX: 0,
89
- marginBottom: 2,
90
- borderTop: '1px solid',
91
- borderBottom: '1px solid',
92
- borderColor: 'neutral.muted'
93
- })
94
- };
95
- return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
96
- sx: styles,
97
- role: "heading",
98
- "aria-hidden": "true"
99
- }, props), /*#__PURE__*/_react.default.createElement("span", {
100
- id: labelId
101
- }, title), auxiliaryText && /*#__PURE__*/_react.default.createElement("span", null, auxiliaryText));
102
- };
103
-
104
- Header.displayName = "Header";
57
+ Group.displayName = "Group";
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { SxProp } from '../sx';
3
+ /**
4
+ * Contract for props passed to the `Header` component.
5
+ */
6
+ export declare type HeaderProps = {
7
+ /**
8
+ * Style variations. Usage is discretionary.
9
+ *
10
+ * - `"filled"` - Superimposed on a background, offset from nearby content
11
+ * - `"subtle"` - Relatively less offset from nearby content
12
+ */
13
+ variant?: 'subtle' | 'filled';
14
+ /**
15
+ * Primary text which names a `Group`.
16
+ */
17
+ title?: string;
18
+ /**
19
+ * Secondary text which provides additional information about a `Group`.
20
+ */
21
+ auxiliaryText?: string;
22
+ } & SxProp;
23
+ /**
24
+ * Displays the name and description of a `Group`.
25
+ */
26
+ export declare const Header: ({ variant, title, auxiliaryText, sx, ...props }: HeaderProps) => JSX.Element;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Header = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _Box = _interopRequireDefault(require("../Box"));
11
+
12
+ var _List = require("./List");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _extends() { _extends = Object.assign || 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); }
17
+
18
+ /**
19
+ * Displays the name and description of a `Group`.
20
+ */
21
+ const Header = ({
22
+ variant = 'subtle',
23
+ title,
24
+ auxiliaryText,
25
+ sx = {},
26
+ ...props
27
+ }) => {
28
+ const {
29
+ variant: listVariant
30
+ } = _react.default.useContext(_List.ListContext);
31
+
32
+ const styles = {
33
+ paddingY: '6px',
34
+ paddingX: listVariant === 'full' ? 2 : 3,
35
+ fontSize: 0,
36
+ fontWeight: 'bold',
37
+ color: 'fg.muted',
38
+ ...(variant === 'filled' && {
39
+ backgroundColor: 'canvas.subtle',
40
+ marginX: 0,
41
+ marginBottom: 2,
42
+ borderTop: '1px solid',
43
+ borderBottom: '1px solid',
44
+ borderColor: 'neutral.muted'
45
+ }),
46
+ ...sx
47
+ };
48
+ return /*#__PURE__*/_react.default.createElement(_Box.default, _extends({
49
+ sx: styles,
50
+ role: "heading"
51
+ }, props), title, auxiliaryText && /*#__PURE__*/_react.default.createElement("span", null, auxiliaryText));
52
+ };
53
+
54
+ exports.Header = Header;
55
+ Header.displayName = "Header";
@@ -186,8 +186,8 @@ const Item = /*#__PURE__*/_react.default.forwardRef(({
186
186
  "aria-selected": selected,
187
187
  "aria-disabled": disabled ? true : undefined,
188
188
  tabIndex: disabled ? undefined : -1,
189
- "aria-labelledby": labelId,
190
- "aria-describedby": [slots.InlineDescription && inlineDescriptionId, slots.BlockDescription && blockDescriptionId].filter(Boolean).join(' ')
189
+ "aria-labelledby": `${labelId} ${slots.InlineDescription ? inlineDescriptionId : ''}`,
190
+ "aria-describedby": slots.BlockDescription ? blockDescriptionId : undefined
191
191
  }, props), /*#__PURE__*/_react.default.createElement(_PrivateItemWrapper, null, /*#__PURE__*/_react.default.createElement(_Selection.Selection, {
192
192
  selected: selected,
193
193
  disabled: disabled
@@ -1,32 +1,11 @@
1
1
  import React from 'react';
2
2
  import { SxProp } from '../sx';
3
+ import { HeaderProps } from './Header';
3
4
  import { ListProps } from './List';
4
- export declare type GroupProps = {
5
- /**
6
- * Style variations. Usage is discretionary.
7
- *
8
- * - `"filled"` - Superimposed on a background, offset from nearby content
9
- * - `"subtle"` - Relatively less offset from nearby content
10
- */
11
- variant?: 'subtle' | 'filled';
12
- /**
13
- * Primary text which names a `Group`.
14
- */
15
- title?: string;
16
- /**
17
- * Secondary text which provides additional information about a `Group`.
18
- */
19
- auxiliaryText?: string;
20
- } & SxProp & {
21
- /**
22
- * Whether multiple Items or a single Item can be selected in the Group. Overrides value on ActionList root.
23
- */
5
+ export declare type GroupProps = HeaderProps & SxProp & {
24
6
  selectionVariant?: ListProps['selectionVariant'] | false;
25
7
  };
26
8
  declare type ContextProps = Pick<GroupProps, 'selectionVariant'>;
27
9
  export declare const GroupContext: React.Context<ContextProps>;
28
10
  export declare const Group: React.FC<GroupProps>;
29
- export declare type HeaderProps = Pick<GroupProps, 'variant' | 'title' | 'auxiliaryText'> & {
30
- labelId: string;
31
- };
32
11
  export {};
@@ -1,19 +1,17 @@
1
1
  function _extends() { _extends = Object.assign || 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); }
2
2
 
3
3
  import React from 'react';
4
- import { useSSRSafeId } from '@react-aria/ssr';
5
4
  import Box from '../Box';
6
- import { ListContext } from './List';
5
+ import { Header } from './Header';
7
6
  export const GroupContext = /*#__PURE__*/React.createContext({});
8
7
  export const Group = ({
9
8
  title,
10
- variant = 'subtle',
9
+ variant,
11
10
  auxiliaryText,
12
11
  selectionVariant,
13
12
  sx = {},
14
13
  ...props
15
14
  }) => {
16
- const labelId = useSSRSafeId();
17
15
  return /*#__PURE__*/React.createElement(Box, _extends({
18
16
  as: "li",
19
17
  sx: {
@@ -27,8 +25,7 @@ export const Group = ({
27
25
  }, props), title && /*#__PURE__*/React.createElement(Header, {
28
26
  title: title,
29
27
  variant: variant,
30
- auxiliaryText: auxiliaryText,
31
- labelId: labelId
28
+ auxiliaryText: auxiliaryText
32
29
  }), /*#__PURE__*/React.createElement(GroupContext.Provider, {
33
30
  value: {
34
31
  selectionVariant
@@ -37,49 +34,7 @@ export const Group = ({
37
34
  as: "ul",
38
35
  sx: {
39
36
  paddingInlineStart: 0
40
- },
41
- "aria-labelledby": title ? labelId : undefined
37
+ }
42
38
  }, props.children)));
43
39
  };
44
- Group.displayName = "Group";
45
-
46
- /**
47
- * Displays the name and description of a `Group`.
48
- *
49
- * For visual presentation only. It's hidden from screen readers.
50
- */
51
- const Header = ({
52
- variant,
53
- title,
54
- auxiliaryText,
55
- labelId,
56
- ...props
57
- }) => {
58
- const {
59
- variant: listVariant
60
- } = React.useContext(ListContext);
61
- const styles = {
62
- paddingY: '6px',
63
- paddingX: listVariant === 'full' ? 2 : 3,
64
- fontSize: 0,
65
- fontWeight: 'bold',
66
- color: 'fg.muted',
67
- ...(variant === 'filled' && {
68
- backgroundColor: 'canvas.subtle',
69
- marginX: 0,
70
- marginBottom: 2,
71
- borderTop: '1px solid',
72
- borderBottom: '1px solid',
73
- borderColor: 'neutral.muted'
74
- })
75
- };
76
- return /*#__PURE__*/React.createElement(Box, _extends({
77
- sx: styles,
78
- role: "heading",
79
- "aria-hidden": "true"
80
- }, props), /*#__PURE__*/React.createElement("span", {
81
- id: labelId
82
- }, title), auxiliaryText && /*#__PURE__*/React.createElement("span", null, auxiliaryText));
83
- };
84
-
85
- Header.displayName = "Header";
40
+ Group.displayName = "Group";
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { SxProp } from '../sx';
3
+ /**
4
+ * Contract for props passed to the `Header` component.
5
+ */
6
+ export declare type HeaderProps = {
7
+ /**
8
+ * Style variations. Usage is discretionary.
9
+ *
10
+ * - `"filled"` - Superimposed on a background, offset from nearby content
11
+ * - `"subtle"` - Relatively less offset from nearby content
12
+ */
13
+ variant?: 'subtle' | 'filled';
14
+ /**
15
+ * Primary text which names a `Group`.
16
+ */
17
+ title?: string;
18
+ /**
19
+ * Secondary text which provides additional information about a `Group`.
20
+ */
21
+ auxiliaryText?: string;
22
+ } & SxProp;
23
+ /**
24
+ * Displays the name and description of a `Group`.
25
+ */
26
+ export declare const Header: ({ variant, title, auxiliaryText, sx, ...props }: HeaderProps) => JSX.Element;
@@ -0,0 +1,44 @@
1
+ function _extends() { _extends = Object.assign || 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); }
2
+
3
+ import React from 'react';
4
+ import Box from '../Box';
5
+ import { ListContext } from './List';
6
+ /**
7
+ * Contract for props passed to the `Header` component.
8
+ */
9
+
10
+ /**
11
+ * Displays the name and description of a `Group`.
12
+ */
13
+ export const Header = ({
14
+ variant = 'subtle',
15
+ title,
16
+ auxiliaryText,
17
+ sx = {},
18
+ ...props
19
+ }) => {
20
+ const {
21
+ variant: listVariant
22
+ } = React.useContext(ListContext);
23
+ const styles = {
24
+ paddingY: '6px',
25
+ paddingX: listVariant === 'full' ? 2 : 3,
26
+ fontSize: 0,
27
+ fontWeight: 'bold',
28
+ color: 'fg.muted',
29
+ ...(variant === 'filled' && {
30
+ backgroundColor: 'canvas.subtle',
31
+ marginX: 0,
32
+ marginBottom: 2,
33
+ borderTop: '1px solid',
34
+ borderBottom: '1px solid',
35
+ borderColor: 'neutral.muted'
36
+ }),
37
+ ...sx
38
+ };
39
+ return /*#__PURE__*/React.createElement(Box, _extends({
40
+ sx: styles,
41
+ role: "heading"
42
+ }, props), title, auxiliaryText && /*#__PURE__*/React.createElement("span", null, auxiliaryText));
43
+ };
44
+ Header.displayName = "Header";
@@ -155,8 +155,8 @@ export const Item = /*#__PURE__*/React.forwardRef(({
155
155
  "aria-selected": selected,
156
156
  "aria-disabled": disabled ? true : undefined,
157
157
  tabIndex: disabled ? undefined : -1,
158
- "aria-labelledby": labelId,
159
- "aria-describedby": [slots.InlineDescription && inlineDescriptionId, slots.BlockDescription && blockDescriptionId].filter(Boolean).join(' ')
158
+ "aria-labelledby": `${labelId} ${slots.InlineDescription ? inlineDescriptionId : ''}`,
159
+ "aria-describedby": slots.BlockDescription ? blockDescriptionId : undefined
160
160
  }, props), /*#__PURE__*/React.createElement(_PrivateItemWrapper, null, /*#__PURE__*/React.createElement(Selection, {
161
161
  selected: selected,
162
162
  disabled: disabled
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/components",
3
- "version": "0.0.0-2021108142649",
3
+ "version": "0.0.0-2021108143211",
4
4
  "description": "Primer react components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",