@pingux/astro 2.25.0-alpha.3 → 2.26.0-alpha.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.
- package/lib/cjs/components/AccordionGroup/Accordion.styles.js +8 -5
- package/lib/cjs/components/AccordionGroup/AccordionGroup.js +8 -4
- package/lib/cjs/components/AccordionGroup/AccordionGroup.stories.js +44 -7
- package/lib/cjs/components/AccordionGroup/AccordionGroup.test.js +52 -0
- package/lib/cjs/components/AccordionItem/AccordionItem.js +18 -3
- package/lib/cjs/components/Text/Text.styles.d.ts +138 -94
- package/lib/cjs/components/Text/Text.styles.js +35 -22
- package/lib/cjs/utils/designUtils/figmaLinks.js +2 -1
- package/lib/components/AccordionGroup/Accordion.styles.js +6 -4
- package/lib/components/AccordionGroup/AccordionGroup.js +8 -4
- package/lib/components/AccordionGroup/AccordionGroup.stories.js +42 -6
- package/lib/components/AccordionGroup/AccordionGroup.test.js +52 -0
- package/lib/components/AccordionItem/AccordionItem.js +16 -2
- package/lib/components/Text/Text.styles.js +35 -22
- package/lib/utils/designUtils/figmaLinks.js +2 -1
- package/package.json +1 -1
@@ -12,7 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
12
12
|
_Object$defineProperty(exports, "__esModule", {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
exports["default"] = void 0;
|
15
|
+
exports.hoveredState = exports["default"] = void 0;
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
17
17
|
var _Buttons = require("../Button/Buttons.styles");
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
@@ -44,6 +44,12 @@ var body = {
|
|
44
44
|
display: 'flex'
|
45
45
|
}
|
46
46
|
};
|
47
|
+
var hoveredState = {
|
48
|
+
'&.is-hovered': {
|
49
|
+
color: 'active'
|
50
|
+
}
|
51
|
+
};
|
52
|
+
exports.hoveredState = hoveredState;
|
47
53
|
var header = _objectSpread(_objectSpread({}, _Buttons.base), {}, {
|
48
54
|
display: 'inline-flex',
|
49
55
|
bg: 'transparent',
|
@@ -51,14 +57,11 @@ var header = _objectSpread(_objectSpread({}, _Buttons.base), {}, {
|
|
51
57
|
padding: '0 5px',
|
52
58
|
flexGrow: 0,
|
53
59
|
fontWeight: 700,
|
54
|
-
'&.is-hovered': {
|
55
|
-
color: 'active'
|
56
|
-
},
|
57
60
|
'&.is-pressed': {
|
58
61
|
color: 'accent.20'
|
59
62
|
},
|
60
63
|
'&.is-focused': _objectSpread({}, _Buttons.defaultFocus)
|
61
|
-
});
|
64
|
+
}, hoveredState);
|
62
65
|
var _default = {
|
63
66
|
title: title,
|
64
67
|
accordion: accordion,
|
@@ -30,7 +30,7 @@ var _index = require("../../index");
|
|
30
30
|
var _isIterable = require("../../utils/devUtils/props/isIterable");
|
31
31
|
var _AccordionItem = _interopRequireDefault(require("../AccordionItem"));
|
32
32
|
var _react2 = require("@emotion/react");
|
33
|
-
var _excluded = ["defaultExpandedKeys", "expandedKeys", "onExpandedChange"],
|
33
|
+
var _excluded = ["defaultExpandedKeys", "expandedKeys", "labelHeadingTag", "onExpandedChange"],
|
34
34
|
_excluded2 = ["onFocus"];
|
35
35
|
/**
|
36
36
|
* Console Warning: "Cannot update a component (`Unknown`)...`"
|
@@ -45,6 +45,7 @@ var AccordionGroup = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
45
45
|
var _context;
|
46
46
|
var defaultExpandedKeys = props.defaultExpandedKeys,
|
47
47
|
expandedKeys = props.expandedKeys,
|
48
|
+
labelHeadingTag = props.labelHeadingTag,
|
48
49
|
onExpandedChange = props.onExpandedChange,
|
49
50
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
50
51
|
var state = (0, _reactStately.useTreeState)(props);
|
@@ -71,9 +72,10 @@ var AccordionGroup = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
71
72
|
ref: accordionRef
|
72
73
|
}, (0, _utils.mergeProps)(theseProps, others)), (0, _map["default"])(_context = (0, _from["default"])(state.collection)).call(_context, function (item) {
|
73
74
|
return (0, _react2.jsx)(_AccordionItem["default"], {
|
74
|
-
|
75
|
+
"data-id": item['data-id'],
|
75
76
|
item: item,
|
76
|
-
|
77
|
+
key: item.key,
|
78
|
+
labelHeadingTag: labelHeadingTag
|
77
79
|
}, item.props.children);
|
78
80
|
})));
|
79
81
|
});
|
@@ -92,7 +94,9 @@ AccordionGroup.propTypes = {
|
|
92
94
|
/** The initial expanded keys in the collection (uncontrolled). */
|
93
95
|
defaultExpandedKeys: _isIterable.isIterableProp,
|
94
96
|
/** Id of the selected element */
|
95
|
-
id: _propTypes["default"].string
|
97
|
+
id: _propTypes["default"].string,
|
98
|
+
/** HTML header element wrapping the label */
|
99
|
+
labelHeadingTag: _AccordionItem["default"].propTypes.labelHeadingTag
|
96
100
|
};
|
97
101
|
AccordionGroup.displayName = 'AccordionGroup';
|
98
102
|
var _default = AccordionGroup;
|
@@ -8,14 +8,16 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
8
8
|
_Object$defineProperty(exports, "__esModule", {
|
9
9
|
value: true
|
10
10
|
});
|
11
|
-
exports["default"] = exports.UncontrolledExpanded = exports.Multiple = exports.DisabledItems = exports.Default = exports.CustomPresentation = exports.ControlledExpanded = void 0;
|
11
|
+
exports["default"] = exports.UncontrolledExpanded = exports.Multiple = exports.DisabledItems = exports.DifferentLevels = exports.Default = exports.CustomPresentation = exports.ControlledExpanded = void 0;
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
13
14
|
var _react = _interopRequireWildcard(require("react"));
|
14
15
|
var _reactStately = require("react-stately");
|
15
16
|
var _storybookAddonDesigns = require("storybook-addon-designs");
|
16
17
|
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
17
18
|
var _index = require("../../index");
|
18
19
|
var _figmaLinks = require("../../utils/designUtils/figmaLinks.js");
|
20
|
+
var _AccordionItem = require("../AccordionItem/AccordionItem");
|
19
21
|
var _AccordionGroup = _interopRequireDefault(require("./AccordionGroup.mdx"));
|
20
22
|
var _react2 = require("@emotion/react");
|
21
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -86,12 +88,18 @@ var _default = {
|
|
86
88
|
control: {
|
87
89
|
type: 'none'
|
88
90
|
}
|
91
|
+
},
|
92
|
+
labelHeadingTag: {
|
93
|
+
control: 'radio',
|
94
|
+
options: _AccordionItem.validHeadingTags
|
89
95
|
}
|
90
96
|
}
|
91
97
|
};
|
92
98
|
exports["default"] = _default;
|
93
99
|
var Default = function Default(args) {
|
94
|
-
return (0, _react2.jsx)(_index.AccordionGroup,
|
100
|
+
return (0, _react2.jsx)(_index.AccordionGroup, (0, _extends2["default"])({
|
101
|
+
labelHeadingTag: "h3"
|
102
|
+
}, args), (0, _react2.jsx)(_reactStately.Item, {
|
95
103
|
key: "accordionKey",
|
96
104
|
textValue: "accordionKey",
|
97
105
|
label: "Accordion Label",
|
@@ -105,6 +113,30 @@ Default.parameters = {
|
|
105
113
|
url: _figmaLinks.FIGMA_LINKS.accordionGroup["default"]
|
106
114
|
}
|
107
115
|
};
|
116
|
+
var DifferentLevels = function DifferentLevels() {
|
117
|
+
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.AccordionGroup, {
|
118
|
+
labelHeadingTag: "h3"
|
119
|
+
}, (0, _react2.jsx)(_reactStately.Item, {
|
120
|
+
key: "accordionLabelH3Key",
|
121
|
+
textValue: "accordionLabelH3Key",
|
122
|
+
label: "Accordion Label H3",
|
123
|
+
"data-id": "accordionItem"
|
124
|
+
}, (0, _react2.jsx)(_index.Text, null, "Render me!"))), (0, _react2.jsx)(_index.AccordionGroup, {
|
125
|
+
labelHeadingTag: "h2"
|
126
|
+
}, (0, _react2.jsx)(_reactStately.Item, {
|
127
|
+
key: "accordionLabelH2Key",
|
128
|
+
textValue: "accordionLabelH2Key",
|
129
|
+
label: "Accordion Label H2",
|
130
|
+
"data-id": "accordionItem"
|
131
|
+
}, (0, _react2.jsx)(_index.Text, null, "Render me!"))));
|
132
|
+
};
|
133
|
+
exports.DifferentLevels = DifferentLevels;
|
134
|
+
DifferentLevels.parameters = {
|
135
|
+
design: {
|
136
|
+
type: 'figma',
|
137
|
+
url: _figmaLinks.FIGMA_LINKS.accordionGroup.differentLevels
|
138
|
+
}
|
139
|
+
};
|
108
140
|
var Multiple = function Multiple() {
|
109
141
|
return (
|
110
142
|
/*
|
@@ -115,7 +147,8 @@ var Multiple = function Multiple() {
|
|
115
147
|
* ];
|
116
148
|
*/
|
117
149
|
(0, _react2.jsx)(_index.AccordionGroup, {
|
118
|
-
items: itemArray
|
150
|
+
items: itemArray,
|
151
|
+
labelHeadingTag: "h3"
|
119
152
|
}, function (item) {
|
120
153
|
return (0, _react2.jsx)(_reactStately.Item, {
|
121
154
|
key: item.key,
|
@@ -146,7 +179,8 @@ var ControlledExpanded = function ControlledExpanded() {
|
|
146
179
|
(0, _react2.jsx)(_index.AccordionGroup, {
|
147
180
|
onExpandedChange: setExpandedKeys,
|
148
181
|
expandedKeys: expandedKeys,
|
149
|
-
items: itemArray
|
182
|
+
items: itemArray,
|
183
|
+
labelHeadingTag: "h3"
|
150
184
|
}, function (item) {
|
151
185
|
return (0, _react2.jsx)(_reactStately.Item, {
|
152
186
|
key: item.key,
|
@@ -168,7 +202,8 @@ var UncontrolledExpanded = function UncontrolledExpanded() {
|
|
168
202
|
*/
|
169
203
|
(0, _react2.jsx)(_index.AccordionGroup, {
|
170
204
|
defaultExpandedKeys: ['t1'],
|
171
|
-
items: itemArray
|
205
|
+
items: itemArray,
|
206
|
+
labelHeadingTag: "h3"
|
172
207
|
}, function (item) {
|
173
208
|
return (0, _react2.jsx)(_reactStately.Item, {
|
174
209
|
key: item.key,
|
@@ -190,7 +225,8 @@ var DisabledItems = function DisabledItems() {
|
|
190
225
|
*/
|
191
226
|
(0, _react2.jsx)(_index.AccordionGroup, {
|
192
227
|
disabledKeys: ['t1', 't3'],
|
193
|
-
items: itemArrayDisabled
|
228
|
+
items: itemArrayDisabled,
|
229
|
+
labelHeadingTag: "h3"
|
194
230
|
}, function (item) {
|
195
231
|
return (0, _react2.jsx)(_reactStately.Item, {
|
196
232
|
key: item.key,
|
@@ -211,7 +247,8 @@ var CustomPresentation = function CustomPresentation() {
|
|
211
247
|
];
|
212
248
|
*/
|
213
249
|
(0, _react2.jsx)(_index.AccordionGroup, {
|
214
|
-
items: itemArrayDisabled
|
250
|
+
items: itemArrayDisabled,
|
251
|
+
labelHeadingTag: "h3"
|
215
252
|
}, function (item) {
|
216
253
|
return (0, _react2.jsx)(_reactStately.Item, {
|
217
254
|
key: item.key,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
4
5
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
5
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
6
7
|
var _react = _interopRequireDefault(require("react"));
|
@@ -9,6 +10,7 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
9
10
|
var _index = require("../../index");
|
10
11
|
var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
|
11
12
|
var _testWrapper = require("../../utils/testUtils/testWrapper");
|
13
|
+
var _AccordionItem = require("../AccordionItem/AccordionItem");
|
12
14
|
var _Text = _interopRequireDefault(require("../Text"));
|
13
15
|
var _ = _interopRequireDefault(require("."));
|
14
16
|
var _react2 = require("@emotion/react");
|
@@ -353,4 +355,54 @@ test('accordion works if there are multiple, controlled on the same implementati
|
|
353
355
|
expect(secondSelectedItem).toHaveAttribute('aria-expanded', 'true');
|
354
356
|
_userEvent["default"].click(secondSelectedItem);
|
355
357
|
expect(secondSelectedItem).toHaveAttribute('aria-expanded', 'false');
|
358
|
+
});
|
359
|
+
|
360
|
+
// get the last char of heading tag and convert to number, 'h1' => 1
|
361
|
+
var getLabelHeadingLevel = function getLabelHeadingLevel(labelHeading) {
|
362
|
+
return Number((0, _slice["default"])(labelHeading).call(labelHeading, -1));
|
363
|
+
};
|
364
|
+
test('when labelHeadingTag is h1, the label is rendered as an h1 tag', function () {
|
365
|
+
var h1Tag = _AccordionItem.validHeadingTags[0];
|
366
|
+
getComponent({
|
367
|
+
labelHeadingTag: h1Tag
|
368
|
+
});
|
369
|
+
_testWrapper.screen.getAllByRole('heading', {
|
370
|
+
level: getLabelHeadingLevel(h1Tag)
|
371
|
+
});
|
372
|
+
});
|
373
|
+
test('when labelHeadingTag is h2, the label is rendered as an h2 tag', function () {
|
374
|
+
var h2Tag = _AccordionItem.validHeadingTags[1];
|
375
|
+
getComponent({
|
376
|
+
labelHeadingTag: h2Tag
|
377
|
+
});
|
378
|
+
_testWrapper.screen.getAllByRole('heading', {
|
379
|
+
level: getLabelHeadingLevel(h2Tag)
|
380
|
+
});
|
381
|
+
});
|
382
|
+
test('when labelHeadingTag is h3, the label is rendered as an h3 tag', function () {
|
383
|
+
var h3Tag = _AccordionItem.validHeadingTags[2];
|
384
|
+
getComponent({
|
385
|
+
labelHeadingTag: h3Tag
|
386
|
+
});
|
387
|
+
_testWrapper.screen.getAllByRole('heading', {
|
388
|
+
level: getLabelHeadingLevel(h3Tag)
|
389
|
+
});
|
390
|
+
});
|
391
|
+
test('when labelHeadingTag is h4, the label is rendered as an h4 tag', function () {
|
392
|
+
var h4Tag = _AccordionItem.validHeadingTags[3];
|
393
|
+
getComponent({
|
394
|
+
labelHeadingTag: h4Tag
|
395
|
+
});
|
396
|
+
_testWrapper.screen.getAllByRole('heading', {
|
397
|
+
level: getLabelHeadingLevel(h4Tag)
|
398
|
+
});
|
399
|
+
});
|
400
|
+
test('when labelHeadingTag is uppercase, the label is rendered', function () {
|
401
|
+
var h4Tag = _AccordionItem.validHeadingTags[3].toUpperCase();
|
402
|
+
getComponent({
|
403
|
+
labelHeadingTag: h4Tag
|
404
|
+
});
|
405
|
+
_testWrapper.screen.getAllByRole('heading', {
|
406
|
+
level: getLabelHeadingLevel(h4Tag)
|
407
|
+
});
|
356
408
|
});
|
@@ -8,7 +8,10 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
8
8
|
_Object$defineProperty(exports, "__esModule", {
|
9
9
|
value: true
|
10
10
|
});
|
11
|
-
exports["default"] = void 0;
|
11
|
+
exports.validHeadingTags = exports["default"] = void 0;
|
12
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
13
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
14
|
+
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
12
15
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
13
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
14
17
|
var _react = _interopRequireWildcard(require("react"));
|
@@ -23,13 +26,18 @@ var _themeUi = require("theme-ui");
|
|
23
26
|
var _AccordionContext = require("../../context/AccordionContext");
|
24
27
|
var _hooks = require("../../hooks");
|
25
28
|
var _index = require("../../index");
|
29
|
+
var _Accordion = require("../AccordionGroup/Accordion.styles");
|
26
30
|
var _react2 = require("@emotion/react");
|
31
|
+
var _context;
|
27
32
|
var _excluded = ["label", "children", "textValue", "containerProps", "buttonProps", "regionProps"];
|
28
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
29
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
35
|
+
var validHeadingTags = ['h1', 'h2', 'h3', 'h4'];
|
36
|
+
exports.validHeadingTags = validHeadingTags;
|
30
37
|
var AccordionItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
31
38
|
var className = props.className,
|
32
|
-
item = props.item
|
39
|
+
item = props.item,
|
40
|
+
labelHeadingTag = props.labelHeadingTag;
|
33
41
|
var _item$props = item.props,
|
34
42
|
label = _item$props.label,
|
35
43
|
children = _item$props.children,
|
@@ -75,6 +83,8 @@ var AccordionItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
75
83
|
}),
|
76
84
|
buttonClasses = _useStatusClasses2.classNames;
|
77
85
|
var ariaLabel = props['aria-label'] || item.props.label;
|
86
|
+
var isValidHeadingTag = (0, _includes["default"])(validHeadingTags).call(validHeadingTags, labelHeadingTag === null || labelHeadingTag === void 0 ? void 0 : labelHeadingTag.toLowerCase());
|
87
|
+
var validLabelHeadingTag = isValidHeadingTag ? labelHeadingTag === null || labelHeadingTag === void 0 ? void 0 : labelHeadingTag.toLowerCase() : 'span';
|
78
88
|
return (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
|
79
89
|
variant: "accordion.accordion",
|
80
90
|
className: itemClasses
|
@@ -89,8 +99,10 @@ var AccordionItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
89
99
|
variant: "variants.accordion.header",
|
90
100
|
className: buttonClasses
|
91
101
|
}, (0, _reactAria.mergeProps)(hoverProps, accordionButtonProps, raButtonProps, buttonProps, focusProps)), (0, _react2.jsx)(_index.Text, {
|
102
|
+
as: validLabelHeadingTag,
|
92
103
|
className: buttonClasses,
|
93
|
-
variant:
|
104
|
+
variant: validLabelHeadingTag,
|
105
|
+
sx: _Accordion.hoveredState
|
94
106
|
}, item.props.label), (0, _react2.jsx)(_index.Box, {
|
95
107
|
as: "span",
|
96
108
|
ml: "5px"
|
@@ -107,6 +119,9 @@ var AccordionItem = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
107
119
|
});
|
108
120
|
AccordionItem.propTypes = {
|
109
121
|
'aria-label': _propTypes["default"].string,
|
122
|
+
labelHeadingTag: _propTypes["default"].oneOf((0, _concat["default"])(_context = []).call(_context, validHeadingTags, (0, _map["default"])(validHeadingTags).call(validHeadingTags, function (heading) {
|
123
|
+
return heading.toUpperCase();
|
124
|
+
}))),
|
110
125
|
item: _propTypes["default"].shape({
|
111
126
|
key: _propTypes["default"].string,
|
112
127
|
rendered: _propTypes["default"].node,
|
@@ -13,25 +13,25 @@ export declare const wordWrap: {
|
|
13
13
|
wordBreak: string;
|
14
14
|
};
|
15
15
|
export declare const text: {
|
16
|
-
|
17
|
-
|
18
|
-
fontSize: string;
|
16
|
+
inputValue: {
|
17
|
+
fontWeight: number;
|
19
18
|
color: string;
|
20
19
|
fontFamily: string;
|
21
|
-
overflowWrap: string;
|
22
20
|
};
|
23
|
-
|
21
|
+
itemTitle: {
|
22
|
+
fontSize: string;
|
23
|
+
fontWeight: number;
|
24
24
|
color: string;
|
25
25
|
fontFamily: string;
|
26
|
-
fontWeight: number;
|
27
26
|
display: string;
|
28
27
|
overflowWrap: string;
|
29
28
|
maxWidth: string;
|
30
29
|
wordWrap: string;
|
31
30
|
wordBreak: string;
|
32
31
|
};
|
33
|
-
|
32
|
+
itemSubtitle: {
|
34
33
|
fontSize: string;
|
34
|
+
fontWeight: number;
|
35
35
|
color: string;
|
36
36
|
fontFamily: string;
|
37
37
|
display: string;
|
@@ -40,125 +40,150 @@ export declare const text: {
|
|
40
40
|
wordWrap: string;
|
41
41
|
wordBreak: string;
|
42
42
|
};
|
43
|
-
|
43
|
+
label: {
|
44
44
|
fontSize: string;
|
45
|
-
fontWeight: number;
|
46
45
|
color: string;
|
47
46
|
fontFamily: string;
|
47
|
+
fontWeight: number;
|
48
48
|
display: string;
|
49
49
|
overflowWrap: string;
|
50
50
|
maxWidth: string;
|
51
51
|
wordWrap: string;
|
52
52
|
wordBreak: string;
|
53
53
|
};
|
54
|
-
|
54
|
+
listTitle: {
|
55
|
+
textOverflow: string;
|
56
|
+
overflow: string;
|
57
|
+
whiteSpace: string;
|
55
58
|
fontSize: string;
|
56
59
|
fontWeight: number;
|
57
60
|
color: string;
|
58
|
-
fontFamily: string;
|
59
|
-
lineHeight: string;
|
60
61
|
display: string;
|
61
62
|
overflowWrap: string;
|
62
63
|
maxWidth: string;
|
63
64
|
wordWrap: string;
|
64
65
|
wordBreak: string;
|
65
66
|
};
|
66
|
-
|
67
|
+
listSubtitle: {
|
68
|
+
textOverflow: string;
|
69
|
+
overflow: string;
|
70
|
+
whiteSpace: string;
|
67
71
|
fontSize: string;
|
68
72
|
fontWeight: number;
|
69
73
|
color: string;
|
70
|
-
fontFamily: string;
|
71
|
-
lineHeight: string;
|
72
74
|
display: string;
|
73
75
|
overflowWrap: string;
|
74
76
|
maxWidth: string;
|
75
77
|
wordWrap: string;
|
76
78
|
wordBreak: string;
|
77
79
|
};
|
78
|
-
|
80
|
+
listViewItemSubtext: {
|
81
|
+
textOverflow: string;
|
82
|
+
overflow: string;
|
83
|
+
whiteSpace: string;
|
84
|
+
alignSelf: string;
|
85
|
+
fontSize: string;
|
86
|
+
mt: string;
|
79
87
|
color: string;
|
80
|
-
textTransform: string;
|
81
88
|
fontFamily: string;
|
89
|
+
fontWeight: number;
|
82
90
|
display: string;
|
83
91
|
overflowWrap: string;
|
84
92
|
maxWidth: string;
|
85
93
|
wordWrap: string;
|
86
94
|
wordBreak: string;
|
87
95
|
};
|
88
|
-
|
96
|
+
listViewItemText: {
|
97
|
+
textOverflow: string;
|
98
|
+
overflow: string;
|
99
|
+
whiteSpace: string;
|
100
|
+
alignSelf: string;
|
89
101
|
fontSize: string;
|
90
|
-
fontWeight: number;
|
91
102
|
color: string;
|
92
|
-
textTransform: string;
|
93
|
-
display: string;
|
94
103
|
fontFamily: string;
|
95
|
-
overflowWrap: string;
|
96
|
-
};
|
97
|
-
H1: {
|
98
104
|
fontWeight: number;
|
99
|
-
lineHeight: string;
|
100
|
-
fontSize: string;
|
101
|
-
color: string;
|
102
|
-
fontFamily: string;
|
103
105
|
display: string;
|
104
106
|
overflowWrap: string;
|
105
107
|
maxWidth: string;
|
106
108
|
wordWrap: string;
|
107
109
|
wordBreak: string;
|
108
110
|
};
|
109
|
-
|
111
|
+
placeholder: {
|
110
112
|
fontWeight: number;
|
111
|
-
|
113
|
+
color: string;
|
114
|
+
fontFamily: string;
|
115
|
+
};
|
116
|
+
panelHeaderSubtext: {
|
117
|
+
alignSelf: string;
|
112
118
|
fontSize: string;
|
119
|
+
mt: string;
|
113
120
|
color: string;
|
114
121
|
fontFamily: string;
|
122
|
+
fontWeight: number;
|
115
123
|
display: string;
|
116
124
|
overflowWrap: string;
|
117
125
|
maxWidth: string;
|
118
126
|
wordWrap: string;
|
119
127
|
wordBreak: string;
|
120
128
|
};
|
121
|
-
|
122
|
-
|
123
|
-
lineHeight: string;
|
129
|
+
panelHeaderText: {
|
130
|
+
alignSelf: string;
|
124
131
|
fontSize: string;
|
125
132
|
color: string;
|
126
133
|
fontFamily: string;
|
134
|
+
fontWeight: number;
|
127
135
|
display: string;
|
128
136
|
overflowWrap: string;
|
129
137
|
maxWidth: string;
|
130
138
|
wordWrap: string;
|
131
139
|
wordBreak: string;
|
132
140
|
};
|
133
|
-
|
141
|
+
sectionTitle: {
|
134
142
|
fontSize: string;
|
135
143
|
fontWeight: number;
|
136
144
|
color: string;
|
137
145
|
fontFamily: string;
|
138
|
-
lineHeight: string;
|
139
146
|
display: string;
|
140
147
|
overflowWrap: string;
|
141
148
|
maxWidth: string;
|
142
149
|
wordWrap: string;
|
143
150
|
wordBreak: string;
|
144
151
|
};
|
145
|
-
|
146
|
-
fontWeight: number;
|
152
|
+
subtitle: {
|
147
153
|
color: string;
|
148
154
|
fontFamily: string;
|
155
|
+
fontWeight: number;
|
156
|
+
display: string;
|
157
|
+
overflowWrap: string;
|
158
|
+
maxWidth: string;
|
159
|
+
wordWrap: string;
|
160
|
+
wordBreak: string;
|
149
161
|
};
|
150
|
-
|
162
|
+
tabLabel: {
|
151
163
|
fontSize: string;
|
152
164
|
fontWeight: number;
|
165
|
+
mb: string;
|
166
|
+
lineHeight: string;
|
153
167
|
color: string;
|
154
|
-
|
168
|
+
height: string;
|
169
|
+
'.is-selected &, .is-hovered &': {
|
170
|
+
color: string;
|
171
|
+
};
|
172
|
+
'.is-selected &': {
|
173
|
+
color: string;
|
174
|
+
mb: number;
|
175
|
+
};
|
176
|
+
'.is-disabled &': {
|
177
|
+
color: string;
|
178
|
+
};
|
155
179
|
display: string;
|
156
180
|
overflowWrap: string;
|
157
181
|
maxWidth: string;
|
158
182
|
wordWrap: string;
|
159
183
|
wordBreak: string;
|
184
|
+
fontFamily: string;
|
160
185
|
};
|
161
|
-
|
186
|
+
tableHeader: {
|
162
187
|
fontSize: string;
|
163
188
|
fontWeight: number;
|
164
189
|
color: string;
|
@@ -169,105 +194,115 @@ export declare const text: {
|
|
169
194
|
wordWrap: string;
|
170
195
|
wordBreak: string;
|
171
196
|
};
|
172
|
-
|
197
|
+
tableData: {
|
173
198
|
fontSize: string;
|
199
|
+
fontWeight: number;
|
174
200
|
color: string;
|
175
201
|
fontFamily: string;
|
176
|
-
fontWeight: number;
|
177
202
|
display: string;
|
178
203
|
overflowWrap: string;
|
179
204
|
maxWidth: string;
|
180
205
|
wordWrap: string;
|
181
206
|
wordBreak: string;
|
182
207
|
};
|
183
|
-
|
208
|
+
textEllipsis: {
|
184
209
|
textOverflow: string;
|
185
210
|
overflow: string;
|
186
211
|
whiteSpace: string;
|
212
|
+
};
|
213
|
+
title: {
|
187
214
|
fontSize: string;
|
188
215
|
fontWeight: number;
|
189
216
|
color: string;
|
217
|
+
fontFamily: string;
|
190
218
|
display: string;
|
191
219
|
overflowWrap: string;
|
192
220
|
maxWidth: string;
|
193
221
|
wordWrap: string;
|
194
222
|
wordBreak: string;
|
195
223
|
};
|
196
|
-
|
197
|
-
|
198
|
-
overflow: string;
|
199
|
-
whiteSpace: string;
|
200
|
-
fontSize: string;
|
224
|
+
H1: {
|
225
|
+
lineHeight: string;
|
201
226
|
fontWeight: number;
|
227
|
+
fontSize: string;
|
202
228
|
color: string;
|
229
|
+
fontFamily: string;
|
203
230
|
display: string;
|
204
231
|
overflowWrap: string;
|
205
232
|
maxWidth: string;
|
206
233
|
wordWrap: string;
|
207
234
|
wordBreak: string;
|
208
235
|
};
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
whiteSpace: string;
|
213
|
-
alignSelf: string;
|
236
|
+
H2: {
|
237
|
+
lineHeight: string;
|
238
|
+
fontWeight: number;
|
214
239
|
fontSize: string;
|
215
|
-
mt: string;
|
216
240
|
color: string;
|
217
241
|
fontFamily: string;
|
218
|
-
fontWeight: number;
|
219
242
|
display: string;
|
220
243
|
overflowWrap: string;
|
221
244
|
maxWidth: string;
|
222
245
|
wordWrap: string;
|
223
246
|
wordBreak: string;
|
224
247
|
};
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
whiteSpace: string;
|
229
|
-
alignSelf: string;
|
248
|
+
H3: {
|
249
|
+
lineHeight: string;
|
250
|
+
fontWeight: number;
|
230
251
|
fontSize: string;
|
231
252
|
color: string;
|
232
253
|
fontFamily: string;
|
233
|
-
fontWeight: number;
|
234
254
|
display: string;
|
235
255
|
overflowWrap: string;
|
236
256
|
maxWidth: string;
|
237
257
|
wordWrap: string;
|
238
258
|
wordBreak: string;
|
239
259
|
};
|
240
|
-
|
260
|
+
H4: {
|
261
|
+
lineHeight: string;
|
262
|
+
fontSize: string;
|
241
263
|
fontWeight: number;
|
242
264
|
color: string;
|
243
265
|
fontFamily: string;
|
266
|
+
display: string;
|
267
|
+
overflowWrap: string;
|
268
|
+
maxWidth: string;
|
269
|
+
wordWrap: string;
|
270
|
+
wordBreak: string;
|
244
271
|
};
|
245
|
-
|
246
|
-
|
272
|
+
h1: {
|
273
|
+
fontWeight: number;
|
247
274
|
fontSize: string;
|
248
|
-
mt: string;
|
249
275
|
color: string;
|
250
276
|
fontFamily: string;
|
251
|
-
fontWeight: number;
|
252
277
|
display: string;
|
253
278
|
overflowWrap: string;
|
254
279
|
maxWidth: string;
|
255
280
|
wordWrap: string;
|
256
281
|
wordBreak: string;
|
257
282
|
};
|
258
|
-
|
259
|
-
|
283
|
+
h2: {
|
284
|
+
fontWeight: number;
|
260
285
|
fontSize: string;
|
261
286
|
color: string;
|
262
287
|
fontFamily: string;
|
288
|
+
display: string;
|
289
|
+
overflowWrap: string;
|
290
|
+
maxWidth: string;
|
291
|
+
wordWrap: string;
|
292
|
+
wordBreak: string;
|
293
|
+
};
|
294
|
+
h3: {
|
263
295
|
fontWeight: number;
|
296
|
+
fontSize: string;
|
297
|
+
color: string;
|
298
|
+
fontFamily: string;
|
264
299
|
display: string;
|
265
300
|
overflowWrap: string;
|
266
301
|
maxWidth: string;
|
267
302
|
wordWrap: string;
|
268
303
|
wordBreak: string;
|
269
304
|
};
|
270
|
-
|
305
|
+
h4: {
|
271
306
|
fontSize: string;
|
272
307
|
fontWeight: number;
|
273
308
|
color: string;
|
@@ -278,7 +313,14 @@ export declare const text: {
|
|
278
313
|
wordWrap: string;
|
279
314
|
wordBreak: string;
|
280
315
|
};
|
281
|
-
|
316
|
+
base: {
|
317
|
+
display: string;
|
318
|
+
fontSize: string;
|
319
|
+
color: string;
|
320
|
+
fontFamily: string;
|
321
|
+
overflowWrap: string;
|
322
|
+
};
|
323
|
+
bodyStrong: {
|
282
324
|
color: string;
|
283
325
|
fontFamily: string;
|
284
326
|
fontWeight: number;
|
@@ -288,31 +330,17 @@ export declare const text: {
|
|
288
330
|
wordWrap: string;
|
289
331
|
wordBreak: string;
|
290
332
|
};
|
291
|
-
|
333
|
+
bodyWeak: {
|
292
334
|
fontSize: string;
|
293
|
-
fontWeight: number;
|
294
|
-
mb: string;
|
295
|
-
lineHeight: string;
|
296
335
|
color: string;
|
297
|
-
|
298
|
-
'.is-selected &, .is-hovered &': {
|
299
|
-
color: string;
|
300
|
-
};
|
301
|
-
'.is-selected &': {
|
302
|
-
color: string;
|
303
|
-
mb: number;
|
304
|
-
};
|
305
|
-
'.is-disabled &': {
|
306
|
-
color: string;
|
307
|
-
};
|
336
|
+
fontFamily: string;
|
308
337
|
display: string;
|
309
338
|
overflowWrap: string;
|
310
339
|
maxWidth: string;
|
311
340
|
wordWrap: string;
|
312
341
|
wordBreak: string;
|
313
|
-
fontFamily: string;
|
314
342
|
};
|
315
|
-
|
343
|
+
buttonLabel: {
|
316
344
|
fontSize: string;
|
317
345
|
fontWeight: number;
|
318
346
|
color: string;
|
@@ -323,31 +351,47 @@ export declare const text: {
|
|
323
351
|
wordWrap: string;
|
324
352
|
wordBreak: string;
|
325
353
|
};
|
326
|
-
|
354
|
+
buttonTitle: {
|
327
355
|
fontSize: string;
|
328
356
|
fontWeight: number;
|
329
357
|
color: string;
|
330
358
|
fontFamily: string;
|
359
|
+
lineHeight: string;
|
331
360
|
display: string;
|
332
361
|
overflowWrap: string;
|
333
362
|
maxWidth: string;
|
334
363
|
wordWrap: string;
|
335
364
|
wordBreak: string;
|
336
365
|
};
|
337
|
-
|
338
|
-
textOverflow: string;
|
339
|
-
overflow: string;
|
340
|
-
whiteSpace: string;
|
341
|
-
};
|
342
|
-
title: {
|
366
|
+
buttonSubtitle: {
|
343
367
|
fontSize: string;
|
344
368
|
fontWeight: number;
|
345
369
|
color: string;
|
346
370
|
fontFamily: string;
|
371
|
+
lineHeight: string;
|
372
|
+
display: string;
|
373
|
+
overflowWrap: string;
|
374
|
+
maxWidth: string;
|
375
|
+
wordWrap: string;
|
376
|
+
wordBreak: string;
|
377
|
+
};
|
378
|
+
capsLabel: {
|
379
|
+
color: string;
|
380
|
+
textTransform: string;
|
381
|
+
fontFamily: string;
|
347
382
|
display: string;
|
348
383
|
overflowWrap: string;
|
349
384
|
maxWidth: string;
|
350
385
|
wordWrap: string;
|
351
386
|
wordBreak: string;
|
352
387
|
};
|
388
|
+
environmentBreadcrumb: {
|
389
|
+
fontSize: string;
|
390
|
+
fontWeight: number;
|
391
|
+
color: string;
|
392
|
+
textTransform: string;
|
393
|
+
display: string;
|
394
|
+
fontFamily: string;
|
395
|
+
overflowWrap: string;
|
396
|
+
};
|
353
397
|
};
|
@@ -98,7 +98,38 @@ var listViewItemSubtext = _objectSpread(_objectSpread({}, subtitle), {}, {
|
|
98
98
|
fontSize: 'sm',
|
99
99
|
mt: '1px'
|
100
100
|
});
|
101
|
-
var
|
101
|
+
var hTags = {
|
102
|
+
h1: _objectSpread(_objectSpread({}, title), {}, {
|
103
|
+
fontWeight: 3
|
104
|
+
}),
|
105
|
+
h2: _objectSpread(_objectSpread({}, sectionTitle), {}, {
|
106
|
+
fontWeight: 3
|
107
|
+
}),
|
108
|
+
h3: _objectSpread(_objectSpread({}, itemTitle), {}, {
|
109
|
+
fontWeight: 3
|
110
|
+
}),
|
111
|
+
h4: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
112
|
+
fontSize: 'sm',
|
113
|
+
fontWeight: 3,
|
114
|
+
color: 'text.primary',
|
115
|
+
fontFamily: 'standard'
|
116
|
+
})
|
117
|
+
};
|
118
|
+
var HTags = {
|
119
|
+
H1: _objectSpread(_objectSpread({}, hTags.h1), {}, {
|
120
|
+
lineHeight: '28px'
|
121
|
+
}),
|
122
|
+
H2: _objectSpread(_objectSpread({}, hTags.h2), {}, {
|
123
|
+
lineHeight: '21px'
|
124
|
+
}),
|
125
|
+
H3: _objectSpread(_objectSpread({}, hTags.h3), {}, {
|
126
|
+
lineHeight: '18px'
|
127
|
+
}),
|
128
|
+
H4: _objectSpread(_objectSpread({}, hTags.h4), {}, {
|
129
|
+
lineHeight: '16px'
|
130
|
+
})
|
131
|
+
};
|
132
|
+
var text = _objectSpread(_objectSpread(_objectSpread({
|
102
133
|
base: base,
|
103
134
|
bodyStrong: bodyStrong,
|
104
135
|
bodyWeak: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
@@ -131,26 +162,8 @@ var text = {
|
|
131
162
|
textTransform: 'uppercase',
|
132
163
|
fontFamily: 'standard'
|
133
164
|
}),
|
134
|
-
environmentBreadcrumb: environmentBreadcrumb
|
135
|
-
|
136
|
-
fontWeight: 3,
|
137
|
-
lineHeight: '28px'
|
138
|
-
}),
|
139
|
-
H2: _objectSpread(_objectSpread({}, sectionTitle), {}, {
|
140
|
-
fontWeight: 3,
|
141
|
-
lineHeight: '21px'
|
142
|
-
}),
|
143
|
-
H3: _objectSpread(_objectSpread({}, itemTitle), {}, {
|
144
|
-
fontWeight: 3,
|
145
|
-
lineHeight: '18px'
|
146
|
-
}),
|
147
|
-
H4: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
148
|
-
fontSize: 'sm',
|
149
|
-
fontWeight: 3,
|
150
|
-
color: 'text.primary',
|
151
|
-
fontFamily: 'standard',
|
152
|
-
lineHeight: '16px'
|
153
|
-
}),
|
165
|
+
environmentBreadcrumb: environmentBreadcrumb
|
166
|
+
}, hTags), HTags), {}, {
|
154
167
|
inputValue: {
|
155
168
|
fontWeight: 1,
|
156
169
|
color: 'text.primary',
|
@@ -205,5 +218,5 @@ var text = {
|
|
205
218
|
}),
|
206
219
|
textEllipsis: textEllipsis,
|
207
220
|
title: title
|
208
|
-
};
|
221
|
+
});
|
209
222
|
exports.text = text;
|
@@ -7,7 +7,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.FIGMA_LINKS = void 0;
|
8
8
|
var FIGMA_LINKS = {
|
9
9
|
accordionGroup: {
|
10
|
-
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=446-1808&t=8Wwd3tIBh3GEjCJB-0'
|
10
|
+
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=446-1808&t=8Wwd3tIBh3GEjCJB-0',
|
11
|
+
differentLevels: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=446%3A1949&mode=dev'
|
11
12
|
},
|
12
13
|
attributeMappings: {
|
13
14
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=15076%3A33905&mode=dev',
|
@@ -37,6 +37,11 @@ var body = {
|
|
37
37
|
display: 'flex'
|
38
38
|
}
|
39
39
|
};
|
40
|
+
export var hoveredState = {
|
41
|
+
'&.is-hovered': {
|
42
|
+
color: 'active'
|
43
|
+
}
|
44
|
+
};
|
40
45
|
var header = _objectSpread(_objectSpread({}, base), {}, {
|
41
46
|
display: 'inline-flex',
|
42
47
|
bg: 'transparent',
|
@@ -44,14 +49,11 @@ var header = _objectSpread(_objectSpread({}, base), {}, {
|
|
44
49
|
padding: '0 5px',
|
45
50
|
flexGrow: 0,
|
46
51
|
fontWeight: 700,
|
47
|
-
'&.is-hovered': {
|
48
|
-
color: 'active'
|
49
|
-
},
|
50
52
|
'&.is-pressed': {
|
51
53
|
color: 'accent.20'
|
52
54
|
},
|
53
55
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
54
|
-
});
|
56
|
+
}, hoveredState);
|
55
57
|
export default {
|
56
58
|
title: title,
|
57
59
|
accordion: accordion,
|
@@ -9,7 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["defaultExpandedKeys", "expandedKeys", "onExpandedChange"],
|
12
|
+
var _excluded = ["defaultExpandedKeys", "expandedKeys", "labelHeadingTag", "onExpandedChange"],
|
13
13
|
_excluded2 = ["onFocus"];
|
14
14
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
15
15
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
@@ -35,6 +35,7 @@ var AccordionGroup = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
35
35
|
var _context;
|
36
36
|
var defaultExpandedKeys = props.defaultExpandedKeys,
|
37
37
|
expandedKeys = props.expandedKeys,
|
38
|
+
labelHeadingTag = props.labelHeadingTag,
|
38
39
|
onExpandedChange = props.onExpandedChange,
|
39
40
|
others = _objectWithoutProperties(props, _excluded);
|
40
41
|
var state = useTreeState(props);
|
@@ -61,9 +62,10 @@ var AccordionGroup = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
61
62
|
ref: accordionRef
|
62
63
|
}, mergeProps(theseProps, others)), _mapInstanceProperty(_context = _Array$from(state.collection)).call(_context, function (item) {
|
63
64
|
return ___EmotionJSX(AccordionItem, {
|
64
|
-
|
65
|
+
"data-id": item['data-id'],
|
65
66
|
item: item,
|
66
|
-
|
67
|
+
key: item.key,
|
68
|
+
labelHeadingTag: labelHeadingTag
|
67
69
|
}, item.props.children);
|
68
70
|
})));
|
69
71
|
});
|
@@ -82,7 +84,9 @@ AccordionGroup.propTypes = {
|
|
82
84
|
/** The initial expanded keys in the collection (uncontrolled). */
|
83
85
|
defaultExpandedKeys: isIterableProp,
|
84
86
|
/** Id of the selected element */
|
85
|
-
id: PropTypes.string
|
87
|
+
id: PropTypes.string,
|
88
|
+
/** HTML header element wrapping the label */
|
89
|
+
labelHeadingTag: AccordionItem.propTypes.labelHeadingTag
|
86
90
|
};
|
87
91
|
AccordionGroup.displayName = 'AccordionGroup';
|
88
92
|
export default AccordionGroup;
|
@@ -1,10 +1,12 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
3
|
import React, { useState } from 'react';
|
3
4
|
import { Item } from 'react-stately';
|
4
5
|
import { withDesign } from 'storybook-addon-designs';
|
5
6
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
6
7
|
import { AccordionGroup, Button, Text, TextField } from '../../index';
|
7
8
|
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks.js';
|
9
|
+
import { validHeadingTags } from '../AccordionItem/AccordionItem';
|
8
10
|
import AccordionReadme from './AccordionGroup.mdx';
|
9
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
12
|
var itemArray = [{
|
@@ -73,11 +75,17 @@ export default {
|
|
73
75
|
control: {
|
74
76
|
type: 'none'
|
75
77
|
}
|
78
|
+
},
|
79
|
+
labelHeadingTag: {
|
80
|
+
control: 'radio',
|
81
|
+
options: validHeadingTags
|
76
82
|
}
|
77
83
|
}
|
78
84
|
};
|
79
85
|
export var Default = function Default(args) {
|
80
|
-
return ___EmotionJSX(AccordionGroup,
|
86
|
+
return ___EmotionJSX(AccordionGroup, _extends({
|
87
|
+
labelHeadingTag: "h3"
|
88
|
+
}, args), ___EmotionJSX(Item, {
|
81
89
|
key: "accordionKey",
|
82
90
|
textValue: "accordionKey",
|
83
91
|
label: "Accordion Label",
|
@@ -90,6 +98,29 @@ Default.parameters = {
|
|
90
98
|
url: FIGMA_LINKS.accordionGroup["default"]
|
91
99
|
}
|
92
100
|
};
|
101
|
+
export var DifferentLevels = function DifferentLevels() {
|
102
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(AccordionGroup, {
|
103
|
+
labelHeadingTag: "h3"
|
104
|
+
}, ___EmotionJSX(Item, {
|
105
|
+
key: "accordionLabelH3Key",
|
106
|
+
textValue: "accordionLabelH3Key",
|
107
|
+
label: "Accordion Label H3",
|
108
|
+
"data-id": "accordionItem"
|
109
|
+
}, ___EmotionJSX(Text, null, "Render me!"))), ___EmotionJSX(AccordionGroup, {
|
110
|
+
labelHeadingTag: "h2"
|
111
|
+
}, ___EmotionJSX(Item, {
|
112
|
+
key: "accordionLabelH2Key",
|
113
|
+
textValue: "accordionLabelH2Key",
|
114
|
+
label: "Accordion Label H2",
|
115
|
+
"data-id": "accordionItem"
|
116
|
+
}, ___EmotionJSX(Text, null, "Render me!"))));
|
117
|
+
};
|
118
|
+
DifferentLevels.parameters = {
|
119
|
+
design: {
|
120
|
+
type: 'figma',
|
121
|
+
url: FIGMA_LINKS.accordionGroup.differentLevels
|
122
|
+
}
|
123
|
+
};
|
93
124
|
export var Multiple = function Multiple() {
|
94
125
|
return (
|
95
126
|
/*
|
@@ -100,7 +131,8 @@ export var Multiple = function Multiple() {
|
|
100
131
|
* ];
|
101
132
|
*/
|
102
133
|
___EmotionJSX(AccordionGroup, {
|
103
|
-
items: itemArray
|
134
|
+
items: itemArray,
|
135
|
+
labelHeadingTag: "h3"
|
104
136
|
}, function (item) {
|
105
137
|
return ___EmotionJSX(Item, {
|
106
138
|
key: item.key,
|
@@ -130,7 +162,8 @@ export var ControlledExpanded = function ControlledExpanded() {
|
|
130
162
|
___EmotionJSX(AccordionGroup, {
|
131
163
|
onExpandedChange: setExpandedKeys,
|
132
164
|
expandedKeys: expandedKeys,
|
133
|
-
items: itemArray
|
165
|
+
items: itemArray,
|
166
|
+
labelHeadingTag: "h3"
|
134
167
|
}, function (item) {
|
135
168
|
return ___EmotionJSX(Item, {
|
136
169
|
key: item.key,
|
@@ -151,7 +184,8 @@ export var UncontrolledExpanded = function UncontrolledExpanded() {
|
|
151
184
|
*/
|
152
185
|
___EmotionJSX(AccordionGroup, {
|
153
186
|
defaultExpandedKeys: ['t1'],
|
154
|
-
items: itemArray
|
187
|
+
items: itemArray,
|
188
|
+
labelHeadingTag: "h3"
|
155
189
|
}, function (item) {
|
156
190
|
return ___EmotionJSX(Item, {
|
157
191
|
key: item.key,
|
@@ -172,7 +206,8 @@ export var DisabledItems = function DisabledItems() {
|
|
172
206
|
*/
|
173
207
|
___EmotionJSX(AccordionGroup, {
|
174
208
|
disabledKeys: ['t1', 't3'],
|
175
|
-
items: itemArrayDisabled
|
209
|
+
items: itemArrayDisabled,
|
210
|
+
labelHeadingTag: "h3"
|
176
211
|
}, function (item) {
|
177
212
|
return ___EmotionJSX(Item, {
|
178
213
|
key: item.key,
|
@@ -192,7 +227,8 @@ export var CustomPresentation = function CustomPresentation() {
|
|
192
227
|
];
|
193
228
|
*/
|
194
229
|
___EmotionJSX(AccordionGroup, {
|
195
|
-
items: itemArrayDisabled
|
230
|
+
items: itemArrayDisabled,
|
231
|
+
labelHeadingTag: "h3"
|
196
232
|
}, function (item) {
|
197
233
|
return ___EmotionJSX(Item, {
|
198
234
|
key: item.key,
|
@@ -1,11 +1,13 @@
|
|
1
1
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
3
4
|
import React from 'react';
|
4
5
|
import { Item } from 'react-stately';
|
5
6
|
import userEvent from '@testing-library/user-event';
|
6
7
|
import { Box, Button, Menu, OverlayPanel, PopoverMenu, TextField } from '../../index';
|
7
8
|
import axeTest from '../../utils/testUtils/testAxe';
|
8
9
|
import { act, fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
10
|
+
import { validHeadingTags } from '../AccordionItem/AccordionItem';
|
9
11
|
import Text from '../Text';
|
10
12
|
import AccordionGroup from '.';
|
11
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -350,4 +352,54 @@ test('accordion works if there are multiple, controlled on the same implementati
|
|
350
352
|
expect(secondSelectedItem).toHaveAttribute('aria-expanded', 'true');
|
351
353
|
userEvent.click(secondSelectedItem);
|
352
354
|
expect(secondSelectedItem).toHaveAttribute('aria-expanded', 'false');
|
355
|
+
});
|
356
|
+
|
357
|
+
// get the last char of heading tag and convert to number, 'h1' => 1
|
358
|
+
var getLabelHeadingLevel = function getLabelHeadingLevel(labelHeading) {
|
359
|
+
return Number(_sliceInstanceProperty(labelHeading).call(labelHeading, -1));
|
360
|
+
};
|
361
|
+
test('when labelHeadingTag is h1, the label is rendered as an h1 tag', function () {
|
362
|
+
var h1Tag = validHeadingTags[0];
|
363
|
+
getComponent({
|
364
|
+
labelHeadingTag: h1Tag
|
365
|
+
});
|
366
|
+
screen.getAllByRole('heading', {
|
367
|
+
level: getLabelHeadingLevel(h1Tag)
|
368
|
+
});
|
369
|
+
});
|
370
|
+
test('when labelHeadingTag is h2, the label is rendered as an h2 tag', function () {
|
371
|
+
var h2Tag = validHeadingTags[1];
|
372
|
+
getComponent({
|
373
|
+
labelHeadingTag: h2Tag
|
374
|
+
});
|
375
|
+
screen.getAllByRole('heading', {
|
376
|
+
level: getLabelHeadingLevel(h2Tag)
|
377
|
+
});
|
378
|
+
});
|
379
|
+
test('when labelHeadingTag is h3, the label is rendered as an h3 tag', function () {
|
380
|
+
var h3Tag = validHeadingTags[2];
|
381
|
+
getComponent({
|
382
|
+
labelHeadingTag: h3Tag
|
383
|
+
});
|
384
|
+
screen.getAllByRole('heading', {
|
385
|
+
level: getLabelHeadingLevel(h3Tag)
|
386
|
+
});
|
387
|
+
});
|
388
|
+
test('when labelHeadingTag is h4, the label is rendered as an h4 tag', function () {
|
389
|
+
var h4Tag = validHeadingTags[3];
|
390
|
+
getComponent({
|
391
|
+
labelHeadingTag: h4Tag
|
392
|
+
});
|
393
|
+
screen.getAllByRole('heading', {
|
394
|
+
level: getLabelHeadingLevel(h4Tag)
|
395
|
+
});
|
396
|
+
});
|
397
|
+
test('when labelHeadingTag is uppercase, the label is rendered', function () {
|
398
|
+
var h4Tag = validHeadingTags[3].toUpperCase();
|
399
|
+
getComponent({
|
400
|
+
labelHeadingTag: h4Tag
|
401
|
+
});
|
402
|
+
screen.getAllByRole('heading', {
|
403
|
+
level: getLabelHeadingLevel(h4Tag)
|
404
|
+
});
|
353
405
|
});
|
@@ -1,6 +1,10 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
3
|
+
var _context;
|
3
4
|
var _excluded = ["label", "children", "textValue", "containerProps", "buttonProps", "regionProps"];
|
5
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
6
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
7
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
4
8
|
import React, { forwardRef, useContext, useImperativeHandle, useRef } from 'react';
|
5
9
|
import { mergeProps, useButton } from 'react-aria';
|
6
10
|
import MenuDown from '@pingux/mdi-react/MenuDownIcon';
|
@@ -13,10 +17,13 @@ import { Button as ThemeUIButton } from 'theme-ui';
|
|
13
17
|
import { AccordionContext } from '../../context/AccordionContext';
|
14
18
|
import { useStatusClasses } from '../../hooks';
|
15
19
|
import { Box, Icon, Text } from '../../index';
|
20
|
+
import { hoveredState } from '../AccordionGroup/Accordion.styles';
|
16
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
|
+
export var validHeadingTags = ['h1', 'h2', 'h3', 'h4'];
|
17
23
|
var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
18
24
|
var className = props.className,
|
19
|
-
item = props.item
|
25
|
+
item = props.item,
|
26
|
+
labelHeadingTag = props.labelHeadingTag;
|
20
27
|
var _item$props = item.props,
|
21
28
|
label = _item$props.label,
|
22
29
|
children = _item$props.children,
|
@@ -62,6 +69,8 @@ var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
62
69
|
}),
|
63
70
|
buttonClasses = _useStatusClasses2.classNames;
|
64
71
|
var ariaLabel = props['aria-label'] || item.props.label;
|
72
|
+
var isValidHeadingTag = _includesInstanceProperty(validHeadingTags).call(validHeadingTags, labelHeadingTag === null || labelHeadingTag === void 0 ? void 0 : labelHeadingTag.toLowerCase());
|
73
|
+
var validLabelHeadingTag = isValidHeadingTag ? labelHeadingTag === null || labelHeadingTag === void 0 ? void 0 : labelHeadingTag.toLowerCase() : 'span';
|
65
74
|
return ___EmotionJSX(Box, _extends({
|
66
75
|
variant: "accordion.accordion",
|
67
76
|
className: itemClasses
|
@@ -76,8 +85,10 @@ var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
76
85
|
variant: "variants.accordion.header",
|
77
86
|
className: buttonClasses
|
78
87
|
}, mergeProps(hoverProps, accordionButtonProps, raButtonProps, buttonProps, focusProps)), ___EmotionJSX(Text, {
|
88
|
+
as: validLabelHeadingTag,
|
79
89
|
className: buttonClasses,
|
80
|
-
variant:
|
90
|
+
variant: validLabelHeadingTag,
|
91
|
+
sx: hoveredState
|
81
92
|
}, item.props.label), ___EmotionJSX(Box, {
|
82
93
|
as: "span",
|
83
94
|
ml: "5px"
|
@@ -94,6 +105,9 @@ var AccordionItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
105
|
});
|
95
106
|
AccordionItem.propTypes = {
|
96
107
|
'aria-label': PropTypes.string,
|
108
|
+
labelHeadingTag: PropTypes.oneOf(_concatInstanceProperty(_context = []).call(_context, validHeadingTags, _mapInstanceProperty(validHeadingTags).call(validHeadingTags, function (heading) {
|
109
|
+
return heading.toUpperCase();
|
110
|
+
}))),
|
97
111
|
item: PropTypes.shape({
|
98
112
|
key: PropTypes.string,
|
99
113
|
rendered: PropTypes.node,
|
@@ -89,7 +89,38 @@ var listViewItemSubtext = _objectSpread(_objectSpread({}, subtitle), {}, {
|
|
89
89
|
fontSize: 'sm',
|
90
90
|
mt: '1px'
|
91
91
|
});
|
92
|
-
|
92
|
+
var hTags = {
|
93
|
+
h1: _objectSpread(_objectSpread({}, title), {}, {
|
94
|
+
fontWeight: 3
|
95
|
+
}),
|
96
|
+
h2: _objectSpread(_objectSpread({}, sectionTitle), {}, {
|
97
|
+
fontWeight: 3
|
98
|
+
}),
|
99
|
+
h3: _objectSpread(_objectSpread({}, itemTitle), {}, {
|
100
|
+
fontWeight: 3
|
101
|
+
}),
|
102
|
+
h4: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
103
|
+
fontSize: 'sm',
|
104
|
+
fontWeight: 3,
|
105
|
+
color: 'text.primary',
|
106
|
+
fontFamily: 'standard'
|
107
|
+
})
|
108
|
+
};
|
109
|
+
var HTags = {
|
110
|
+
H1: _objectSpread(_objectSpread({}, hTags.h1), {}, {
|
111
|
+
lineHeight: '28px'
|
112
|
+
}),
|
113
|
+
H2: _objectSpread(_objectSpread({}, hTags.h2), {}, {
|
114
|
+
lineHeight: '21px'
|
115
|
+
}),
|
116
|
+
H3: _objectSpread(_objectSpread({}, hTags.h3), {}, {
|
117
|
+
lineHeight: '18px'
|
118
|
+
}),
|
119
|
+
H4: _objectSpread(_objectSpread({}, hTags.h4), {}, {
|
120
|
+
lineHeight: '16px'
|
121
|
+
})
|
122
|
+
};
|
123
|
+
export var text = _objectSpread(_objectSpread(_objectSpread({
|
93
124
|
base: base,
|
94
125
|
bodyStrong: bodyStrong,
|
95
126
|
bodyWeak: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
@@ -122,26 +153,8 @@ export var text = {
|
|
122
153
|
textTransform: 'uppercase',
|
123
154
|
fontFamily: 'standard'
|
124
155
|
}),
|
125
|
-
environmentBreadcrumb: environmentBreadcrumb
|
126
|
-
|
127
|
-
fontWeight: 3,
|
128
|
-
lineHeight: '28px'
|
129
|
-
}),
|
130
|
-
H2: _objectSpread(_objectSpread({}, sectionTitle), {}, {
|
131
|
-
fontWeight: 3,
|
132
|
-
lineHeight: '21px'
|
133
|
-
}),
|
134
|
-
H3: _objectSpread(_objectSpread({}, itemTitle), {}, {
|
135
|
-
fontWeight: 3,
|
136
|
-
lineHeight: '18px'
|
137
|
-
}),
|
138
|
-
H4: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
139
|
-
fontSize: 'sm',
|
140
|
-
fontWeight: 3,
|
141
|
-
color: 'text.primary',
|
142
|
-
fontFamily: 'standard',
|
143
|
-
lineHeight: '16px'
|
144
|
-
}),
|
156
|
+
environmentBreadcrumb: environmentBreadcrumb
|
157
|
+
}, hTags), HTags), {}, {
|
145
158
|
inputValue: {
|
146
159
|
fontWeight: 1,
|
147
160
|
color: 'text.primary',
|
@@ -196,4 +209,4 @@ export var text = {
|
|
196
209
|
}),
|
197
210
|
textEllipsis: textEllipsis,
|
198
211
|
title: title
|
199
|
-
};
|
212
|
+
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export var FIGMA_LINKS = {
|
2
2
|
accordionGroup: {
|
3
|
-
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=446-1808&t=8Wwd3tIBh3GEjCJB-0'
|
3
|
+
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=446-1808&t=8Wwd3tIBh3GEjCJB-0',
|
4
|
+
differentLevels: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=446%3A1949&mode=dev'
|
4
5
|
},
|
5
6
|
attributeMappings: {
|
6
7
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=15076%3A33905&mode=dev',
|