@pingux/astro 2.49.0 → 2.50.0-alpha.1
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/Breadcrumbs/Breadcrumb.styles.d.ts +61 -0
- package/lib/cjs/components/Breadcrumbs/BreadcrumbItem.d.ts +11 -0
- package/lib/cjs/components/Breadcrumbs/BreadcrumbItem.js +4 -22
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.js +7 -23
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.d.ts +6 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.stories.js +3 -4
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/lib/cjs/components/Breadcrumbs/Breadcrumbs.test.js +3 -2
- package/lib/cjs/components/Breadcrumbs/index.d.ts +2 -0
- package/lib/cjs/components/Button/Button.stories.js +11 -0
- package/lib/cjs/components/Button/Buttons.styles.d.ts +256 -212
- package/lib/cjs/components/Button/Buttons.styles.js +10 -6
- package/lib/cjs/types/breadCrumbs.d.ts +31 -0
- package/lib/cjs/types/breadCrumbs.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +38 -27
- package/lib/cjs/types/item.d.ts +2 -0
- package/lib/components/Breadcrumbs/BreadcrumbItem.js +6 -24
- package/lib/components/Breadcrumbs/Breadcrumbs.js +9 -25
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +3 -4
- package/lib/components/Breadcrumbs/Breadcrumbs.test.js +3 -2
- package/lib/components/Button/Button.stories.js +11 -0
- package/lib/components/Button/Buttons.styles.js +10 -6
- package/lib/types/breadCrumbs.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +1 -1
@@ -0,0 +1,31 @@
|
|
1
|
+
import { type ElementType } from 'react';
|
2
|
+
import { TestingAttributes } from './shared/test';
|
3
|
+
import { BoxProps } from './box';
|
4
|
+
import { IconProps } from './icon';
|
5
|
+
export interface breadCrumbsProps extends BoxProps, TestingAttributes {
|
6
|
+
/** The icon to render in between each node. */
|
7
|
+
icon?: ElementType;
|
8
|
+
/** Props object passed along to the Icon component. */
|
9
|
+
iconProps?: IconProps;
|
10
|
+
/** Whether the Breadcrumbs are disabled. */
|
11
|
+
isDisabled?: boolean;
|
12
|
+
/** Defines a string value that labels the current element. */
|
13
|
+
'aria-label'?: string;
|
14
|
+
/** Called when an item is acted upon (usually selection via press). */
|
15
|
+
/** (key: Key) => void. */
|
16
|
+
onAction?: (key: unknown) => void;
|
17
|
+
}
|
18
|
+
export interface breadCrumbItemProps extends BoxProps, TestingAttributes {
|
19
|
+
actionKey?: string;
|
20
|
+
/** Whether the breadcrumb item represents the current page. */
|
21
|
+
isCurrent?: boolean;
|
22
|
+
/** The HTML element used to render the breadcrumb link, e.g. 'a', or 'span'.
|
23
|
+
* Also can be passed 'Button', 'Icon', 'IconButton', 'Text' - will be used
|
24
|
+
* appropriate component from Astro library.
|
25
|
+
* */
|
26
|
+
elementType?: string | ElementType;
|
27
|
+
/** Whether the breadcrumb item is disabled. */
|
28
|
+
isDisabled?: boolean;
|
29
|
+
onAction?: (key: unknown) => void;
|
30
|
+
onPress?: () => void;
|
31
|
+
}
|
package/lib/cjs/types/index.d.ts
CHANGED
package/lib/cjs/types/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29;
|
3
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19, _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30;
|
4
4
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
5
5
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
6
6
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
@@ -40,8 +40,19 @@ _forEachInstanceProperty(_context3 = _Object$keys(_bracket)).call(_context3, fun
|
|
40
40
|
}
|
41
41
|
});
|
42
42
|
});
|
43
|
+
var _breadCrumbs = require("./breadCrumbs");
|
44
|
+
_forEachInstanceProperty(_context4 = _Object$keys(_breadCrumbs)).call(_context4, function (key) {
|
45
|
+
if (key === "default" || key === "__esModule") return;
|
46
|
+
if (key in exports && exports[key] === _breadCrumbs[key]) return;
|
47
|
+
_Object$defineProperty(exports, key, {
|
48
|
+
enumerable: true,
|
49
|
+
get: function get() {
|
50
|
+
return _breadCrumbs[key];
|
51
|
+
}
|
52
|
+
});
|
53
|
+
});
|
43
54
|
var _button = require("./button");
|
44
|
-
_forEachInstanceProperty(
|
55
|
+
_forEachInstanceProperty(_context5 = _Object$keys(_button)).call(_context5, function (key) {
|
45
56
|
if (key === "default" || key === "__esModule") return;
|
46
57
|
if (key in exports && exports[key] === _button[key]) return;
|
47
58
|
_Object$defineProperty(exports, key, {
|
@@ -52,7 +63,7 @@ _forEachInstanceProperty(_context4 = _Object$keys(_button)).call(_context4, func
|
|
52
63
|
});
|
53
64
|
});
|
54
65
|
var _buttonBar = require("./buttonBar");
|
55
|
-
_forEachInstanceProperty(
|
66
|
+
_forEachInstanceProperty(_context6 = _Object$keys(_buttonBar)).call(_context6, function (key) {
|
56
67
|
if (key === "default" || key === "__esModule") return;
|
57
68
|
if (key in exports && exports[key] === _buttonBar[key]) return;
|
58
69
|
_Object$defineProperty(exports, key, {
|
@@ -63,7 +74,7 @@ _forEachInstanceProperty(_context5 = _Object$keys(_buttonBar)).call(_context5, f
|
|
63
74
|
});
|
64
75
|
});
|
65
76
|
var _card = require("./card");
|
66
|
-
_forEachInstanceProperty(
|
77
|
+
_forEachInstanceProperty(_context7 = _Object$keys(_card)).call(_context7, function (key) {
|
67
78
|
if (key === "default" || key === "__esModule") return;
|
68
79
|
if (key in exports && exports[key] === _card[key]) return;
|
69
80
|
_Object$defineProperty(exports, key, {
|
@@ -74,7 +85,7 @@ _forEachInstanceProperty(_context6 = _Object$keys(_card)).call(_context6, functi
|
|
74
85
|
});
|
75
86
|
});
|
76
87
|
var _fieldHelperText = require("./fieldHelperText");
|
77
|
-
_forEachInstanceProperty(
|
88
|
+
_forEachInstanceProperty(_context8 = _Object$keys(_fieldHelperText)).call(_context8, function (key) {
|
78
89
|
if (key === "default" || key === "__esModule") return;
|
79
90
|
if (key in exports && exports[key] === _fieldHelperText[key]) return;
|
80
91
|
_Object$defineProperty(exports, key, {
|
@@ -85,7 +96,7 @@ _forEachInstanceProperty(_context7 = _Object$keys(_fieldHelperText)).call(_conte
|
|
85
96
|
});
|
86
97
|
});
|
87
98
|
var _helpHint = require("./helpHint");
|
88
|
-
_forEachInstanceProperty(
|
99
|
+
_forEachInstanceProperty(_context9 = _Object$keys(_helpHint)).call(_context9, function (key) {
|
89
100
|
if (key === "default" || key === "__esModule") return;
|
90
101
|
if (key in exports && exports[key] === _helpHint[key]) return;
|
91
102
|
_Object$defineProperty(exports, key, {
|
@@ -96,7 +107,7 @@ _forEachInstanceProperty(_context8 = _Object$keys(_helpHint)).call(_context8, fu
|
|
96
107
|
});
|
97
108
|
});
|
98
109
|
var _icon = require("./icon");
|
99
|
-
_forEachInstanceProperty(
|
110
|
+
_forEachInstanceProperty(_context10 = _Object$keys(_icon)).call(_context10, function (key) {
|
100
111
|
if (key === "default" || key === "__esModule") return;
|
101
112
|
if (key in exports && exports[key] === _icon[key]) return;
|
102
113
|
_Object$defineProperty(exports, key, {
|
@@ -107,7 +118,7 @@ _forEachInstanceProperty(_context9 = _Object$keys(_icon)).call(_context9, functi
|
|
107
118
|
});
|
108
119
|
});
|
109
120
|
var _iconBadge = require("./iconBadge");
|
110
|
-
_forEachInstanceProperty(
|
121
|
+
_forEachInstanceProperty(_context11 = _Object$keys(_iconBadge)).call(_context11, function (key) {
|
111
122
|
if (key === "default" || key === "__esModule") return;
|
112
123
|
if (key in exports && exports[key] === _iconBadge[key]) return;
|
113
124
|
_Object$defineProperty(exports, key, {
|
@@ -118,7 +129,7 @@ _forEachInstanceProperty(_context10 = _Object$keys(_iconBadge)).call(_context10,
|
|
118
129
|
});
|
119
130
|
});
|
120
131
|
var _iconButton = require("./iconButton");
|
121
|
-
_forEachInstanceProperty(
|
132
|
+
_forEachInstanceProperty(_context12 = _Object$keys(_iconButton)).call(_context12, function (key) {
|
122
133
|
if (key === "default" || key === "__esModule") return;
|
123
134
|
if (key in exports && exports[key] === _iconButton[key]) return;
|
124
135
|
_Object$defineProperty(exports, key, {
|
@@ -129,7 +140,7 @@ _forEachInstanceProperty(_context11 = _Object$keys(_iconButton)).call(_context11
|
|
129
140
|
});
|
130
141
|
});
|
131
142
|
var _input = require("./input");
|
132
|
-
_forEachInstanceProperty(
|
143
|
+
_forEachInstanceProperty(_context13 = _Object$keys(_input)).call(_context13, function (key) {
|
133
144
|
if (key === "default" || key === "__esModule") return;
|
134
145
|
if (key in exports && exports[key] === _input[key]) return;
|
135
146
|
_Object$defineProperty(exports, key, {
|
@@ -140,7 +151,7 @@ _forEachInstanceProperty(_context12 = _Object$keys(_input)).call(_context12, fun
|
|
140
151
|
});
|
141
152
|
});
|
142
153
|
var _item = require("./item");
|
143
|
-
_forEachInstanceProperty(
|
154
|
+
_forEachInstanceProperty(_context14 = _Object$keys(_item)).call(_context14, function (key) {
|
144
155
|
if (key === "default" || key === "__esModule") return;
|
145
156
|
if (key in exports && exports[key] === _item[key]) return;
|
146
157
|
_Object$defineProperty(exports, key, {
|
@@ -151,7 +162,7 @@ _forEachInstanceProperty(_context13 = _Object$keys(_item)).call(_context13, func
|
|
151
162
|
});
|
152
163
|
});
|
153
164
|
var _link = require("./link");
|
154
|
-
_forEachInstanceProperty(
|
165
|
+
_forEachInstanceProperty(_context15 = _Object$keys(_link)).call(_context15, function (key) {
|
155
166
|
if (key === "default" || key === "__esModule") return;
|
156
167
|
if (key in exports && exports[key] === _link[key]) return;
|
157
168
|
_Object$defineProperty(exports, key, {
|
@@ -162,7 +173,7 @@ _forEachInstanceProperty(_context14 = _Object$keys(_link)).call(_context14, func
|
|
162
173
|
});
|
163
174
|
});
|
164
175
|
var _listItem = require("./listItem");
|
165
|
-
_forEachInstanceProperty(
|
176
|
+
_forEachInstanceProperty(_context16 = _Object$keys(_listItem)).call(_context16, function (key) {
|
166
177
|
if (key === "default" || key === "__esModule") return;
|
167
178
|
if (key in exports && exports[key] === _listItem[key]) return;
|
168
179
|
_Object$defineProperty(exports, key, {
|
@@ -173,7 +184,7 @@ _forEachInstanceProperty(_context15 = _Object$keys(_listItem)).call(_context15,
|
|
173
184
|
});
|
174
185
|
});
|
175
186
|
var _loader = require("./loader");
|
176
|
-
_forEachInstanceProperty(
|
187
|
+
_forEachInstanceProperty(_context17 = _Object$keys(_loader)).call(_context17, function (key) {
|
177
188
|
if (key === "default" || key === "__esModule") return;
|
178
189
|
if (key in exports && exports[key] === _loader[key]) return;
|
179
190
|
_Object$defineProperty(exports, key, {
|
@@ -184,7 +195,7 @@ _forEachInstanceProperty(_context16 = _Object$keys(_loader)).call(_context16, fu
|
|
184
195
|
});
|
185
196
|
});
|
186
197
|
var _menu = require("./menu");
|
187
|
-
_forEachInstanceProperty(
|
198
|
+
_forEachInstanceProperty(_context18 = _Object$keys(_menu)).call(_context18, function (key) {
|
188
199
|
if (key === "default" || key === "__esModule") return;
|
189
200
|
if (key in exports && exports[key] === _menu[key]) return;
|
190
201
|
_Object$defineProperty(exports, key, {
|
@@ -195,7 +206,7 @@ _forEachInstanceProperty(_context17 = _Object$keys(_menu)).call(_context17, func
|
|
195
206
|
});
|
196
207
|
});
|
197
208
|
var _menuItem = require("./menuItem");
|
198
|
-
_forEachInstanceProperty(
|
209
|
+
_forEachInstanceProperty(_context19 = _Object$keys(_menuItem)).call(_context19, function (key) {
|
199
210
|
if (key === "default" || key === "__esModule") return;
|
200
211
|
if (key in exports && exports[key] === _menuItem[key]) return;
|
201
212
|
_Object$defineProperty(exports, key, {
|
@@ -206,7 +217,7 @@ _forEachInstanceProperty(_context18 = _Object$keys(_menuItem)).call(_context18,
|
|
206
217
|
});
|
207
218
|
});
|
208
219
|
var _overlayPanel = require("./overlayPanel");
|
209
|
-
_forEachInstanceProperty(
|
220
|
+
_forEachInstanceProperty(_context20 = _Object$keys(_overlayPanel)).call(_context20, function (key) {
|
210
221
|
if (key === "default" || key === "__esModule") return;
|
211
222
|
if (key in exports && exports[key] === _overlayPanel[key]) return;
|
212
223
|
_Object$defineProperty(exports, key, {
|
@@ -217,7 +228,7 @@ _forEachInstanceProperty(_context19 = _Object$keys(_overlayPanel)).call(_context
|
|
217
228
|
});
|
218
229
|
});
|
219
230
|
var _popoverContainer = require("./popoverContainer");
|
220
|
-
_forEachInstanceProperty(
|
231
|
+
_forEachInstanceProperty(_context21 = _Object$keys(_popoverContainer)).call(_context21, function (key) {
|
221
232
|
if (key === "default" || key === "__esModule") return;
|
222
233
|
if (key in exports && exports[key] === _popoverContainer[key]) return;
|
223
234
|
_Object$defineProperty(exports, key, {
|
@@ -228,7 +239,7 @@ _forEachInstanceProperty(_context20 = _Object$keys(_popoverContainer)).call(_con
|
|
228
239
|
});
|
229
240
|
});
|
230
241
|
var _popoverMenu = require("./popoverMenu");
|
231
|
-
_forEachInstanceProperty(
|
242
|
+
_forEachInstanceProperty(_context22 = _Object$keys(_popoverMenu)).call(_context22, function (key) {
|
232
243
|
if (key === "default" || key === "__esModule") return;
|
233
244
|
if (key in exports && exports[key] === _popoverMenu[key]) return;
|
234
245
|
_Object$defineProperty(exports, key, {
|
@@ -239,7 +250,7 @@ _forEachInstanceProperty(_context21 = _Object$keys(_popoverMenu)).call(_context2
|
|
239
250
|
});
|
240
251
|
});
|
241
252
|
var _requirementsList = require("./requirementsList");
|
242
|
-
_forEachInstanceProperty(
|
253
|
+
_forEachInstanceProperty(_context23 = _Object$keys(_requirementsList)).call(_context23, function (key) {
|
243
254
|
if (key === "default" || key === "__esModule") return;
|
244
255
|
if (key in exports && exports[key] === _requirementsList[key]) return;
|
245
256
|
_Object$defineProperty(exports, key, {
|
@@ -250,7 +261,7 @@ _forEachInstanceProperty(_context22 = _Object$keys(_requirementsList)).call(_con
|
|
250
261
|
});
|
251
262
|
});
|
252
263
|
var _rockerButtonGroup = require("./rockerButtonGroup");
|
253
|
-
_forEachInstanceProperty(
|
264
|
+
_forEachInstanceProperty(_context24 = _Object$keys(_rockerButtonGroup)).call(_context24, function (key) {
|
254
265
|
if (key === "default" || key === "__esModule") return;
|
255
266
|
if (key in exports && exports[key] === _rockerButtonGroup[key]) return;
|
256
267
|
_Object$defineProperty(exports, key, {
|
@@ -261,7 +272,7 @@ _forEachInstanceProperty(_context23 = _Object$keys(_rockerButtonGroup)).call(_co
|
|
261
272
|
});
|
262
273
|
});
|
263
274
|
var _scrollBox = require("./scrollBox");
|
264
|
-
_forEachInstanceProperty(
|
275
|
+
_forEachInstanceProperty(_context25 = _Object$keys(_scrollBox)).call(_context25, function (key) {
|
265
276
|
if (key === "default" || key === "__esModule") return;
|
266
277
|
if (key in exports && exports[key] === _scrollBox[key]) return;
|
267
278
|
_Object$defineProperty(exports, key, {
|
@@ -272,7 +283,7 @@ _forEachInstanceProperty(_context24 = _Object$keys(_scrollBox)).call(_context24,
|
|
272
283
|
});
|
273
284
|
});
|
274
285
|
var _separator = require("./separator");
|
275
|
-
_forEachInstanceProperty(
|
286
|
+
_forEachInstanceProperty(_context26 = _Object$keys(_separator)).call(_context26, function (key) {
|
276
287
|
if (key === "default" || key === "__esModule") return;
|
277
288
|
if (key in exports && exports[key] === _separator[key]) return;
|
278
289
|
_Object$defineProperty(exports, key, {
|
@@ -283,7 +294,7 @@ _forEachInstanceProperty(_context25 = _Object$keys(_separator)).call(_context25,
|
|
283
294
|
});
|
284
295
|
});
|
285
296
|
var _shared = require("./shared");
|
286
|
-
_forEachInstanceProperty(
|
297
|
+
_forEachInstanceProperty(_context27 = _Object$keys(_shared)).call(_context27, function (key) {
|
287
298
|
if (key === "default" || key === "__esModule") return;
|
288
299
|
if (key in exports && exports[key] === _shared[key]) return;
|
289
300
|
_Object$defineProperty(exports, key, {
|
@@ -294,7 +305,7 @@ _forEachInstanceProperty(_context26 = _Object$keys(_shared)).call(_context26, fu
|
|
294
305
|
});
|
295
306
|
});
|
296
307
|
var _table = require("./table");
|
297
|
-
_forEachInstanceProperty(
|
308
|
+
_forEachInstanceProperty(_context28 = _Object$keys(_table)).call(_context28, function (key) {
|
298
309
|
if (key === "default" || key === "__esModule") return;
|
299
310
|
if (key in exports && exports[key] === _table[key]) return;
|
300
311
|
_Object$defineProperty(exports, key, {
|
@@ -305,7 +316,7 @@ _forEachInstanceProperty(_context27 = _Object$keys(_table)).call(_context27, fun
|
|
305
316
|
});
|
306
317
|
});
|
307
318
|
var _text = require("./text");
|
308
|
-
_forEachInstanceProperty(
|
319
|
+
_forEachInstanceProperty(_context29 = _Object$keys(_text)).call(_context29, function (key) {
|
309
320
|
if (key === "default" || key === "__esModule") return;
|
310
321
|
if (key in exports && exports[key] === _text[key]) return;
|
311
322
|
_Object$defineProperty(exports, key, {
|
@@ -316,7 +327,7 @@ _forEachInstanceProperty(_context28 = _Object$keys(_text)).call(_context28, func
|
|
316
327
|
});
|
317
328
|
});
|
318
329
|
var _tooltipTrigger = require("./tooltipTrigger");
|
319
|
-
_forEachInstanceProperty(
|
330
|
+
_forEachInstanceProperty(_context30 = _Object$keys(_tooltipTrigger)).call(_context30, function (key) {
|
320
331
|
if (key === "default" || key === "__esModule") return;
|
321
332
|
if (key in exports && exports[key] === _tooltipTrigger[key]) return;
|
322
333
|
_Object$defineProperty(exports, key, {
|
package/lib/cjs/types/item.d.ts
CHANGED
@@ -12,11 +12,10 @@ var _excluded = ["children", "elementType", "onAction", "actionKey", "isCurrent"
|
|
12
12
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
13
13
|
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; }
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
|
-
import React, { forwardRef, Fragment, useCallback,
|
15
|
+
import React, { forwardRef, Fragment, useCallback, useMemo } from 'react';
|
16
16
|
import { mergeProps, useBreadcrumbItem } from 'react-aria';
|
17
17
|
import { omit } from 'lodash/object';
|
18
|
-
import
|
19
|
-
import { usePropWarning } from '../../hooks';
|
18
|
+
import { useLocalOrForwardRef, usePropWarning } from '../../hooks';
|
20
19
|
import { Box, Button, IconButton, Link, Text } from '../../index';
|
21
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
22
21
|
export var ELEMENT_TYPE = {
|
@@ -33,15 +32,11 @@ var BreadcrumbItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
32
|
actionKey = props.actionKey,
|
34
33
|
isCurrent = props.isCurrent,
|
35
34
|
others = _objectWithoutProperties(props, _excluded);
|
36
|
-
var itemRef =
|
35
|
+
var itemRef = useLocalOrForwardRef(ref);
|
37
36
|
usePropWarning(props, 'disabled', 'isDisabled');
|
38
|
-
/* istanbul ignore next */
|
39
|
-
useImperativeHandle(ref, function () {
|
40
|
-
return itemRef.current;
|
41
|
-
});
|
42
37
|
var _useBreadcrumbItem = useBreadcrumbItem(_objectSpread({}, props), itemRef),
|
43
38
|
itemProps = _useBreadcrumbItem.itemProps;
|
44
|
-
var
|
39
|
+
var BreadcrumbItemElementType = useMemo(function () {
|
45
40
|
switch (elementType) {
|
46
41
|
case ELEMENT_TYPE.BUTTON:
|
47
42
|
return Button;
|
@@ -79,23 +74,10 @@ var BreadcrumbItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
79
74
|
}, elementProps);
|
80
75
|
return ___EmotionJSX(Box, {
|
81
76
|
as: "li",
|
82
|
-
className: isCurrent
|
77
|
+
className: isCurrent ? 'is-current' : '',
|
83
78
|
variant: "variants.breadcrumb.containerLi"
|
84
|
-
}, ___EmotionJSX(
|
79
|
+
}, ___EmotionJSX(BreadcrumbItemElementType, elementVariantProps, children));
|
85
80
|
});
|
86
|
-
BreadcrumbItem.propTypes = {
|
87
|
-
actionKey: PropTypes.string,
|
88
|
-
/** Whether the breadcrumb item represents the current page. */
|
89
|
-
isCurrent: PropTypes.bool,
|
90
|
-
/** The HTML element used to render the breadcrumb link, e.g. 'a', or 'span'.
|
91
|
-
* Also can be passed 'Button', 'Icon', 'IconButton', 'Text' - will be used
|
92
|
-
* appropriate component from Astro library.
|
93
|
-
* */
|
94
|
-
elementType: PropTypes.elementType,
|
95
|
-
/** Whether the breadcrumb item is disabled. */
|
96
|
-
isDisabled: PropTypes.bool,
|
97
|
-
onAction: PropTypes.func
|
98
|
-
};
|
99
81
|
BreadcrumbItem.defaultProps = {
|
100
82
|
elementType: 'Link'
|
101
83
|
};
|
@@ -4,10 +4,9 @@ var _excluded = ["children", "icon", "iconProps", "onAction"];
|
|
4
4
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
5
5
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
6
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
7
|
-
import React, { forwardRef, useCallback
|
7
|
+
import React, { forwardRef, useCallback } from 'react';
|
8
8
|
import { mergeProps, useBreadcrumbs } from 'react-aria';
|
9
|
-
import
|
10
|
-
import { usePropWarning } from '../../hooks';
|
9
|
+
import { useLocalOrForwardRef, usePropWarning } from '../../hooks';
|
11
10
|
import { Box, Icon } from '../../index';
|
12
11
|
import BreadcrumbItem from './BreadcrumbItem';
|
13
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -17,20 +16,17 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
16
|
iconProps = props.iconProps,
|
18
17
|
onAction = props.onAction,
|
19
18
|
others = _objectWithoutProperties(props, _excluded);
|
19
|
+
|
20
20
|
// the following filters undefined values passed as a child
|
21
21
|
var filteredChildren = _Array$isArray(children) ? _filterInstanceProperty(children).call(children, function (child) {
|
22
22
|
return child;
|
23
23
|
}) : children;
|
24
24
|
var _useBreadcrumbs = useBreadcrumbs(props),
|
25
25
|
wrapperProps = _useBreadcrumbs.navProps;
|
26
|
-
var breadcrumbsRef =
|
26
|
+
var breadcrumbsRef = useLocalOrForwardRef(ref);
|
27
27
|
usePropWarning(props, 'disabled', 'isDisabled');
|
28
|
-
/* istanbul ignore next */
|
29
|
-
useImperativeHandle(ref, function () {
|
30
|
-
return breadcrumbsRef.current;
|
31
|
-
});
|
32
28
|
var createBreadcrumb = useCallback(function (child, idx) {
|
33
|
-
var isCurrentItem = _Array$isArray(filteredChildren) && filteredChildren.length > 1 ? idx === children.length - 1 : true;
|
29
|
+
var isCurrentItem = idx && _Array$isArray(children) && _Array$isArray(filteredChildren) && filteredChildren.length > 1 ? idx === children.length - 1 : true;
|
34
30
|
return ___EmotionJSX(React.Fragment, {
|
35
31
|
key: "li-".concat(child.key)
|
36
32
|
}, ___EmotionJSX(BreadcrumbItem, _extends({
|
@@ -40,14 +36,15 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
40
36
|
onAction: onAction
|
41
37
|
}, child.props), child.props.children), icon && !isCurrentItem && ___EmotionJSX(Icon, _extends({
|
42
38
|
"aria-hidden": "true",
|
43
|
-
icon: icon,
|
44
39
|
mx: 5,
|
45
40
|
size: "xs",
|
46
41
|
title: {
|
47
42
|
name: 'Breadcrumb Separator'
|
48
43
|
}
|
49
|
-
}, iconProps
|
50
|
-
|
44
|
+
}, iconProps, {
|
45
|
+
icon: icon
|
46
|
+
})));
|
47
|
+
}, [_Array$isArray(children) && children.length, filteredChildren, icon, iconProps, onAction]);
|
51
48
|
return ___EmotionJSX("nav", {
|
52
49
|
"aria-label": "Breadcrumb"
|
53
50
|
}, ___EmotionJSX(Box, _extends({
|
@@ -57,18 +54,5 @@ var Breadcrumbs = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
57
54
|
variant: "variants.breadcrumb.containerOl"
|
58
55
|
}, mergeProps(wrapperProps, others)), _Array$isArray(filteredChildren) ? _mapInstanceProperty(filteredChildren).call(filteredChildren, createBreadcrumb) : createBreadcrumb(children)));
|
59
56
|
});
|
60
|
-
Breadcrumbs.propTypes = {
|
61
|
-
/** The icon to render in between each node. */
|
62
|
-
icon: PropTypes.elementType,
|
63
|
-
/** Props object passed along to the Icon component. */
|
64
|
-
iconProps: PropTypes.shape({}),
|
65
|
-
/** Whether the Breadcrumbs are disabled. */
|
66
|
-
isDisabled: PropTypes.bool,
|
67
|
-
/** Defines a string value that labels the current element. */
|
68
|
-
'aria-label': PropTypes.string,
|
69
|
-
/** Called when an item is acted upon (usually selection via press). */
|
70
|
-
/** (key: Key) => void. */
|
71
|
-
onAction: PropTypes.func
|
72
|
-
};
|
73
57
|
Breadcrumbs.displayName = 'Breadcrumbs';
|
74
58
|
export default Breadcrumbs;
|
@@ -6,7 +6,7 @@ import { action } from '@storybook/addon-actions';
|
|
6
6
|
import { withDesign } from 'storybook-addon-designs';
|
7
7
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
8
8
|
import { Box, Breadcrumbs } from '../../index';
|
9
|
-
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks
|
9
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
10
10
|
import BreadcrumbsReadme from './Breadcrumbs.mdx';
|
11
11
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
12
|
export default {
|
@@ -41,9 +41,8 @@ export var Default = function Default(args) {
|
|
41
41
|
var onAction = function onAction(key) {
|
42
42
|
return action("onPress ".concat(key));
|
43
43
|
};
|
44
|
-
return ___EmotionJSX(Breadcrumbs, _extends({
|
45
|
-
onAction: onAction
|
46
|
-
}, args, {
|
44
|
+
return ___EmotionJSX(Breadcrumbs, _extends({}, args, {
|
45
|
+
onAction: onAction,
|
47
46
|
icon: ChevronRightIcon
|
48
47
|
}), ___EmotionJSX(Item, {
|
49
48
|
"aria-label": "home",
|
@@ -51,10 +51,11 @@ test('should render nodes from the children', function () {
|
|
51
51
|
test('should render correct amount of icons', function () {
|
52
52
|
getComponent({
|
53
53
|
iconProps: {
|
54
|
-
'data-testid': testIconId
|
54
|
+
'data-testid': testIconId,
|
55
|
+
icon: ChevronRightIcon
|
55
56
|
}
|
56
57
|
});
|
57
|
-
expect(screen.getAllByTestId(testIconId).length).toBe(testItemsArr.length -
|
58
|
+
expect(screen.getAllByTestId(testIconId).length).toBe(testItemsArr.length - 2);
|
58
59
|
});
|
59
60
|
test('breadcrumbItem should render breadcrumbItem as a Text component when appropriate elementType passed', function () {
|
60
61
|
getComponent({}, {
|
@@ -104,6 +104,17 @@ export var TextIconButton = function TextIconButton() {
|
|
104
104
|
title: {
|
105
105
|
name: 'Add Circle Icon'
|
106
106
|
}
|
107
|
+
}), "Button Text"), ___EmotionJSX(Button, {
|
108
|
+
mb: "sm",
|
109
|
+
variant: "primaryWithIcon"
|
110
|
+
}, ___EmotionJSX(Icon, {
|
111
|
+
icon: PlusIcon,
|
112
|
+
mr: "xs",
|
113
|
+
color: "white",
|
114
|
+
size: 20,
|
115
|
+
title: {
|
116
|
+
name: 'Add Circle Icon'
|
117
|
+
}
|
107
118
|
}), "Button Text"), ___EmotionJSX(Button, {
|
108
119
|
mb: "sm",
|
109
120
|
mr: "auto",
|
@@ -83,6 +83,9 @@ var withIcon = _objectSpread(_objectSpread({}, base), {}, {
|
|
83
83
|
'&.is-pressed': _objectSpread({}, defaultActive),
|
84
84
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
85
85
|
});
|
86
|
+
var primaryWithIcon = _objectSpread(_objectSpread({}, primary), {}, {
|
87
|
+
padding: '10px 15px 10px 10px'
|
88
|
+
});
|
86
89
|
var success = _objectSpread(_objectSpread({}, base), {}, {
|
87
90
|
display: 'inline-flex',
|
88
91
|
bg: 'success.bright',
|
@@ -274,6 +277,8 @@ var exampleText = _objectSpread(_objectSpread({}, base), {}, {
|
|
274
277
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
275
278
|
});
|
276
279
|
export default {
|
280
|
+
colorBlock: colorBlock,
|
281
|
+
colorBlockPrimary: colorBlockPrimary,
|
277
282
|
critical: critical,
|
278
283
|
"default": _objectSpread(_objectSpread({}, base), {}, {
|
279
284
|
bg: 'white',
|
@@ -283,18 +288,17 @@ export default {
|
|
283
288
|
'&.is-pressed': _objectSpread({}, defaultActive),
|
284
289
|
'&.is-focused': _objectSpread({}, defaultFocus)
|
285
290
|
}),
|
291
|
+
exampleText: exampleText,
|
286
292
|
filter: filter,
|
287
293
|
headerBar: headerBar,
|
288
294
|
inline: inline,
|
289
295
|
inlinePrimary: inlinePrimary,
|
296
|
+
inlinePrimaryWithIcon: inlinePrimaryWithIcon,
|
297
|
+
inlineWithIcon: inlineWithIcon,
|
290
298
|
link: link,
|
291
299
|
primary: primary,
|
300
|
+
primaryWithIcon: primaryWithIcon,
|
292
301
|
quiet: quiet,
|
293
302
|
success: success,
|
294
|
-
|
295
|
-
colorBlockPrimary: colorBlockPrimary,
|
296
|
-
exampleText: exampleText,
|
297
|
-
withIcon: withIcon,
|
298
|
-
inlineWithIcon: inlineWithIcon,
|
299
|
-
inlinePrimaryWithIcon: inlinePrimaryWithIcon
|
303
|
+
withIcon: withIcon
|
300
304
|
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/types/index.js
CHANGED