@bitrise/bitkit 9.4.1-beta.2 → 9.4.2
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 +7 -2
- package/bitrise.yml +0 -10
- package/lib/cjs/DatePicker/DatePickerDay.js +1 -1
- package/lib/cjs/DatePicker/DatePickerDay.js.map +1 -1
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +2 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esn/DatePicker/DatePickerDay.js +1 -1
- package/lib/esn/DatePicker/DatePickerDay.js.map +1 -1
- package/lib/esn/index.d.ts +0 -1
- package/lib/esn/index.d.ts.map +1 -1
- package/lib/esn/index.js +0 -1
- package/lib/esn/index.js.map +1 -1
- package/lib/esn/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/release.config.js +1 -2
- package/site/components/Documentation/Components/SectionButtons.tsx +1 -80
- package/site/components/Documentation/Documentation.tsx +1 -6
- package/src/DatePicker/DatePickerDay.tsx +1 -1
- package/src/index.ts +0 -4
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.d.ts +0 -22
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.d.ts.map +0 -1
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.js +0 -58
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.js.map +0 -1
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.d.ts +0 -22
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.d.ts.map +0 -1
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.js +0 -15
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.js.map +0 -1
- package/src/ButtonWithDropdown/ButtonWithDropdown.tsx +0 -78
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
/* eslint-disable object-shorthand */
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
Base,
|
|
5
|
-
Button,
|
|
6
|
-
Buttons,
|
|
7
|
-
ColorButton,
|
|
8
|
-
Icon,
|
|
9
|
-
Tab,
|
|
10
|
-
Tabs,
|
|
11
|
-
Text,
|
|
12
|
-
Ribbon,
|
|
13
|
-
ButtonWithDropdown,
|
|
14
|
-
Flex,
|
|
15
|
-
} from '@bitrise/bitkit';
|
|
2
|
+
import { Base, Button, Buttons, ColorButton, Icon, Tab, Tabs, Text, Ribbon } from '@bitrise/bitkit';
|
|
16
3
|
import CodeBlock from '../../CodeBlock/CodeBlock';
|
|
17
4
|
import Section from '../../Section/Section';
|
|
18
5
|
import SectionSubTitle from '../../Section/SectionSubTitle';
|
|
@@ -34,10 +21,6 @@ const SectionButtons = () => {
|
|
|
34
21
|
<Tab active={selectedTab === 3} onClick={() => setSelectedTab(3)}>
|
|
35
22
|
Color Button
|
|
36
23
|
</Tab>
|
|
37
|
-
|
|
38
|
-
<Tab active={selectedTab === 4} onClick={() => setSelectedTab(4)}>
|
|
39
|
-
with dropdown
|
|
40
|
-
</Tab>
|
|
41
24
|
</Tabs>
|
|
42
25
|
|
|
43
26
|
{selectedTab === 1 && (
|
|
@@ -371,68 +354,6 @@ const SectionButtons = () => {
|
|
|
371
354
|
);`}</CodeBlock>
|
|
372
355
|
</>
|
|
373
356
|
)}
|
|
374
|
-
{selectedTab === 4 && (
|
|
375
|
-
<Flex alignChildren="end" direction="horizontal">
|
|
376
|
-
<ButtonWithDropdown
|
|
377
|
-
items={[
|
|
378
|
-
{
|
|
379
|
-
key: '1',
|
|
380
|
-
component: 'button',
|
|
381
|
-
icon: 'Percent',
|
|
382
|
-
content: 'Refer your friends',
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
key: '2',
|
|
386
|
-
component: 'a',
|
|
387
|
-
icon: 'Settings',
|
|
388
|
-
content: 'Account setings',
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
key: '3',
|
|
392
|
-
icon: 'ChangePlan',
|
|
393
|
-
content: 'Change plan',
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
key: '4',
|
|
397
|
-
icon: 'Logout',
|
|
398
|
-
content: 'Log out',
|
|
399
|
-
},
|
|
400
|
-
]}
|
|
401
|
-
>
|
|
402
|
-
<Icon name="Bitbot" />
|
|
403
|
-
<Text>Account</Text>
|
|
404
|
-
</ButtonWithDropdown>
|
|
405
|
-
<ButtonWithDropdown
|
|
406
|
-
items={[
|
|
407
|
-
{
|
|
408
|
-
key: '1',
|
|
409
|
-
component: 'button',
|
|
410
|
-
icon: 'Percent',
|
|
411
|
-
content: 'Refer your friends',
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
key: '2',
|
|
415
|
-
component: 'a',
|
|
416
|
-
icon: 'Settings',
|
|
417
|
-
content: 'Account setings',
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
key: '3',
|
|
421
|
-
icon: 'ChangePlan',
|
|
422
|
-
content: 'Change plan',
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
key: '4',
|
|
426
|
-
icon: 'Logout',
|
|
427
|
-
content: 'Log out',
|
|
428
|
-
},
|
|
429
|
-
]}
|
|
430
|
-
>
|
|
431
|
-
<Icon name="Bitbot" />
|
|
432
|
-
<Text>Account</Text>
|
|
433
|
-
</ButtonWithDropdown>
|
|
434
|
-
</Flex>
|
|
435
|
-
)}
|
|
436
357
|
</Section>
|
|
437
358
|
);
|
|
438
359
|
};
|
|
@@ -41,12 +41,7 @@ const SectionMap = {
|
|
|
41
41
|
},
|
|
42
42
|
Button: {
|
|
43
43
|
Showcase: require('./Components/SectionButtons').default,
|
|
44
|
-
components: [
|
|
45
|
-
documentation.Button,
|
|
46
|
-
documentation.Buttons,
|
|
47
|
-
documentation.ColorButton,
|
|
48
|
-
documentation.ButtonWithDropdown,
|
|
49
|
-
],
|
|
44
|
+
components: [documentation.Button, documentation.Buttons, documentation.ColorButton],
|
|
50
45
|
},
|
|
51
46
|
Card: {
|
|
52
47
|
Showcase: require('./Components/SectionCards').default,
|
|
@@ -63,7 +63,7 @@ const DatePickerDay: React.FunctionComponent<Props> = (props: Props) => {
|
|
|
63
63
|
onClick={isSelectable ? () => onSelect(date) : undefined}
|
|
64
64
|
>
|
|
65
65
|
<Flex alignChildren="middle" className="DatePicker__day-inner" direction="horizontal">
|
|
66
|
-
{isPreviousMonth && daysInPreviousMonth - (dayOfWeek - n)}
|
|
66
|
+
{isPreviousMonth && daysInPreviousMonth - (dayOfWeek - n - 1)}
|
|
67
67
|
{isCurrentMonth && n - dayOfWeek + 1}
|
|
68
68
|
{isNextMonth && n - dayOfWeek - daysInMonth + 1}
|
|
69
69
|
</Flex>
|
package/src/index.ts
CHANGED
|
@@ -23,10 +23,6 @@ export { default as Base, Props as BaseProps, TypeColors, TypeSizes } from './Ba
|
|
|
23
23
|
export { default as Bounds, Props as BoundsProps } from './Bounds/Bounds';
|
|
24
24
|
export { default as Button, Props as ButtonProps } from './Button/Button';
|
|
25
25
|
export { default as Buttons, Props as ButtonsProps } from './Button/Buttons';
|
|
26
|
-
export {
|
|
27
|
-
default as ButtonWithDropdown,
|
|
28
|
-
Props as ButtonWithDropdownProps,
|
|
29
|
-
} from './ButtonWithDropdown/ButtonWithDropdown';
|
|
30
26
|
export { default as Card, Props as CardProps } from './Card/Card';
|
|
31
27
|
export { default as CardButton, Props as CardButtonProps } from './Card/CardButton';
|
|
32
28
|
export { default as CardContent, Props as CardContentProps } from './Card/CardContent';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ButtonProps, DropdownMenuItemProps, PlacementProps, BaseProps } from '@bitrise/bitkit';
|
|
3
|
-
export interface ItemProps extends DropdownMenuItemProps {
|
|
4
|
-
key: string;
|
|
5
|
-
component?: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
href?: string;
|
|
8
|
-
onClick?: (e?: any) => void;
|
|
9
|
-
target?: string;
|
|
10
|
-
content: React.ReactNode;
|
|
11
|
-
textColor?: BaseProps['textColor'];
|
|
12
|
-
}
|
|
13
|
-
export interface Props {
|
|
14
|
-
buttonProps?: ButtonProps;
|
|
15
|
-
children?: React.ReactElement | React.ReactNodeArray;
|
|
16
|
-
dropdownWidth?: string;
|
|
17
|
-
items: ItemProps[];
|
|
18
|
-
placementProps?: PlacementProps;
|
|
19
|
-
}
|
|
20
|
-
declare const ButtonWithDropdown: ({ buttonProps, children, dropdownWidth, items, placementProps }: Props) => JSX.Element;
|
|
21
|
-
export default ButtonWithDropdown;
|
|
22
|
-
//# sourceMappingURL=ButtonWithDropdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.d.ts","sourceRoot":"","sources":["../../../src/ButtonWithDropdown/ButtonWithDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,WAAW,EAGX,qBAAqB,EAIrB,cAAc,EAEd,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,SAAU,SAAQ,qBAAqB;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,KAAK;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,QAAA,MAAM,kBAAkB,oEAAqE,KAAK,KAAG,WAyCpG,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
var React = __importStar(require("react"));
|
|
38
|
-
var bitkit_1 = require("@bitrise/bitkit");
|
|
39
|
-
var ButtonWithDropdown = function (_a) {
|
|
40
|
-
var buttonProps = _a.buttonProps, children = _a.children, dropdownWidth = _a.dropdownWidth, items = _a.items, placementProps = _a.placementProps;
|
|
41
|
-
var _b = React.useState(false), visible = _b[0], setVisible = _b[1];
|
|
42
|
-
var onButtonClick = function () {
|
|
43
|
-
setVisible(!visible);
|
|
44
|
-
};
|
|
45
|
-
return (React.createElement(bitkit_1.PlacementManager, null,
|
|
46
|
-
React.createElement(bitkit_1.PlacementReference, null, function (_a) {
|
|
47
|
-
var ref = _a.ref;
|
|
48
|
-
return (React.createElement(bitkit_1.Button, __assign({ innerRef: ref }, buttonProps, { onClick: onButtonClick }),
|
|
49
|
-
children,
|
|
50
|
-
React.createElement(bitkit_1.Icon, { name: "ChevronDown" })));
|
|
51
|
-
}),
|
|
52
|
-
!(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.disabled) && (React.createElement(bitkit_1.Placement, __assign({ onClose: function () { return setVisible(false); }, placement: "bottom-end", visible: visible }, placementProps), function () { return (React.createElement(bitkit_1.DropdownMenu, { width: dropdownWidth, withArrow: true }, items.map(function (_a) {
|
|
53
|
-
var key = _a.key, component = _a.component, disabled = _a.disabled, href = _a.href, icon = _a.icon, onClick = _a.onClick, target = _a.target, content = _a.content, textColor = _a.textColor;
|
|
54
|
-
return (React.createElement(bitkit_1.DropdownMenuItem, { Component: component || 'button', disabled: disabled, href: href, icon: icon, onClick: onClick, key: key, target: target, textColor: textColor }, content));
|
|
55
|
-
}))); }))));
|
|
56
|
-
};
|
|
57
|
-
exports.default = ButtonWithDropdown;
|
|
58
|
-
//# sourceMappingURL=ButtonWithDropdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.js","sourceRoot":"","sources":["../../../src/ButtonWithDropdown/ButtonWithDropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA+B;AAC/B,0CAYyB;AAqBzB,IAAM,kBAAkB,GAAG,UAAC,EAAsE;QAApE,WAAW,iBAAA,EAAE,QAAQ,cAAA,EAAE,aAAa,mBAAA,EAAE,KAAK,WAAA,EAAE,cAAc,oBAAA;IACjF,IAAA,KAAwB,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAA5C,OAAO,QAAA,EAAE,UAAU,QAAyB,CAAC;IAEpD,IAAM,aAAa,GAAG;QACpB,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,yBAAgB;QACf,oBAAC,2BAAkB,QAChB,UAAC,EAAO;gBAAL,GAAG,SAAA;YAAO,OAAA,CACZ,oBAAC,eAAM,aAAC,QAAQ,EAAE,GAAG,IAAM,WAAW,IAAE,OAAO,EAAE,aAAa;gBAC3D,QAAQ;gBACT,oBAAC,aAAI,IAAC,IAAI,EAAC,aAAa,GAAG,CACpB,CACV;QALa,CAKb,CACkB;QACpB,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,CAAA,IAAI,CACzB,oBAAC,kBAAS,aAAC,OAAO,EAAE,cAAM,OAAA,UAAU,CAAC,KAAK,CAAC,EAAjB,CAAiB,EAAE,SAAS,EAAC,YAAY,EAAC,OAAO,EAAE,OAAO,IAAM,cAAc,GACrG,cAAM,OAAA,CACL,oBAAC,qBAAY,IAAC,KAAK,EAAE,aAAa,EAAE,SAAS,UAC1C,KAAK,CAAC,GAAG,CAAC,UAAC,EAA6E;gBAA3E,GAAG,SAAA,EAAE,SAAS,eAAA,EAAE,QAAQ,cAAA,EAAE,IAAI,UAAA,EAAE,IAAI,UAAA,EAAE,OAAO,aAAA,EAAE,MAAM,YAAA,EAAE,OAAO,aAAA,EAAE,SAAS,eAAA;YAAO,OAAA,CAC5F,oBAAC,yBAAgB,IACf,SAAS,EAAE,SAAS,IAAI,QAAQ,EAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,IAEnB,OAAO,CACS,CACpB;QAb6F,CAa7F,CAAC,CACW,CAChB,EAjBM,CAiBN,CACS,CACb,CACgB,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ButtonProps, DropdownMenuItemProps, PlacementProps, BaseProps } from '@bitrise/bitkit';
|
|
3
|
-
export interface ItemProps extends DropdownMenuItemProps {
|
|
4
|
-
key: string;
|
|
5
|
-
component?: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
href?: string;
|
|
8
|
-
onClick?: (e?: any) => void;
|
|
9
|
-
target?: string;
|
|
10
|
-
content: React.ReactNode;
|
|
11
|
-
textColor?: BaseProps['textColor'];
|
|
12
|
-
}
|
|
13
|
-
export interface Props {
|
|
14
|
-
buttonProps?: ButtonProps;
|
|
15
|
-
children?: React.ReactElement | React.ReactNodeArray;
|
|
16
|
-
dropdownWidth?: string;
|
|
17
|
-
items: ItemProps[];
|
|
18
|
-
placementProps?: PlacementProps;
|
|
19
|
-
}
|
|
20
|
-
declare const ButtonWithDropdown: ({ buttonProps, children, dropdownWidth, items, placementProps }: Props) => JSX.Element;
|
|
21
|
-
export default ButtonWithDropdown;
|
|
22
|
-
//# sourceMappingURL=ButtonWithDropdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.d.ts","sourceRoot":"","sources":["../../../src/ButtonWithDropdown/ButtonWithDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,WAAW,EAGX,qBAAqB,EAIrB,cAAc,EAEd,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,SAAU,SAAQ,qBAAqB;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,KAAK;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,QAAA,MAAM,kBAAkB,oEAAqE,KAAK,KAAG,WAyCpG,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Button, DropdownMenu, DropdownMenuItem, Icon, Placement, PlacementManager, PlacementReference, } from '@bitrise/bitkit';
|
|
3
|
-
const ButtonWithDropdown = ({ buttonProps, children, dropdownWidth, items, placementProps }) => {
|
|
4
|
-
const [visible, setVisible] = React.useState(false);
|
|
5
|
-
const onButtonClick = () => {
|
|
6
|
-
setVisible(!visible);
|
|
7
|
-
};
|
|
8
|
-
return (React.createElement(PlacementManager, null,
|
|
9
|
-
React.createElement(PlacementReference, null, ({ ref }) => (React.createElement(Button, { innerRef: ref, ...buttonProps, onClick: onButtonClick },
|
|
10
|
-
children,
|
|
11
|
-
React.createElement(Icon, { name: "ChevronDown" })))),
|
|
12
|
-
!buttonProps?.disabled && (React.createElement(Placement, { onClose: () => setVisible(false), placement: "bottom-end", visible: visible, ...placementProps }, () => (React.createElement(DropdownMenu, { width: dropdownWidth, withArrow: true }, items.map(({ key, component, disabled, href, icon, onClick, target, content, textColor }) => (React.createElement(DropdownMenuItem, { Component: component || 'button', disabled: disabled, href: href, icon: icon, onClick: onClick, key: key, target: target, textColor: textColor }, content)))))))));
|
|
13
|
-
};
|
|
14
|
-
export default ButtonWithDropdown;
|
|
15
|
-
//# sourceMappingURL=ButtonWithDropdown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWithDropdown.js","sourceRoot":"","sources":["../../../src/ButtonWithDropdown/ButtonWithDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,MAAM,EAEN,YAAY,EACZ,gBAAgB,EAEhB,IAAI,EACJ,SAAS,EACT,gBAAgB,EAEhB,kBAAkB,GAEnB,MAAM,iBAAiB,CAAC;AAqBzB,MAAM,kBAAkB,GAAG,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAS,EAAe,EAAE;IACjH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB;QACf,oBAAC,kBAAkB,QAChB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CACZ,oBAAC,MAAM,IAAC,QAAQ,EAAE,GAAG,KAAM,WAAW,EAAE,OAAO,EAAE,aAAa;YAC3D,QAAQ;YACT,oBAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,CACpB,CACV,CACkB;QACpB,CAAC,WAAW,EAAE,QAAQ,IAAI,CACzB,oBAAC,SAAS,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,SAAS,EAAC,YAAY,EAAC,OAAO,EAAE,OAAO,KAAM,cAAc,IACrG,GAAG,EAAE,CAAC,CACL,oBAAC,YAAY,IAAC,KAAK,EAAE,aAAa,EAAE,SAAS,UAC1C,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAC5F,oBAAC,gBAAgB,IACf,SAAS,EAAE,SAAS,IAAI,QAAQ,EAChC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,IAEnB,OAAO,CACS,CACpB,CAAC,CACW,CAChB,CACS,CACb,CACgB,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Button,
|
|
4
|
-
ButtonProps,
|
|
5
|
-
DropdownMenu,
|
|
6
|
-
DropdownMenuItem,
|
|
7
|
-
DropdownMenuItemProps,
|
|
8
|
-
Icon,
|
|
9
|
-
Placement,
|
|
10
|
-
PlacementManager,
|
|
11
|
-
PlacementProps,
|
|
12
|
-
PlacementReference,
|
|
13
|
-
BaseProps,
|
|
14
|
-
} from '@bitrise/bitkit';
|
|
15
|
-
|
|
16
|
-
export interface ItemProps extends DropdownMenuItemProps {
|
|
17
|
-
key: string;
|
|
18
|
-
component?: string;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
href?: string;
|
|
21
|
-
onClick?: (e?: any) => void;
|
|
22
|
-
target?: string;
|
|
23
|
-
content: React.ReactNode;
|
|
24
|
-
textColor?: BaseProps['textColor'];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface Props {
|
|
28
|
-
buttonProps?: ButtonProps;
|
|
29
|
-
children?: React.ReactElement | React.ReactNodeArray;
|
|
30
|
-
dropdownWidth?: string;
|
|
31
|
-
items: ItemProps[];
|
|
32
|
-
placementProps?: PlacementProps;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const ButtonWithDropdown = ({ buttonProps, children, dropdownWidth, items, placementProps }: Props): JSX.Element => {
|
|
36
|
-
const [visible, setVisible] = React.useState(false);
|
|
37
|
-
|
|
38
|
-
const onButtonClick = () => {
|
|
39
|
-
setVisible(!visible);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<PlacementManager>
|
|
44
|
-
<PlacementReference>
|
|
45
|
-
{({ ref }) => (
|
|
46
|
-
<Button innerRef={ref} {...buttonProps} onClick={onButtonClick}>
|
|
47
|
-
{children}
|
|
48
|
-
<Icon name="ChevronDown" />
|
|
49
|
-
</Button>
|
|
50
|
-
)}
|
|
51
|
-
</PlacementReference>
|
|
52
|
-
{!buttonProps?.disabled && (
|
|
53
|
-
<Placement onClose={() => setVisible(false)} placement="bottom-end" visible={visible} {...placementProps}>
|
|
54
|
-
{() => (
|
|
55
|
-
<DropdownMenu width={dropdownWidth} withArrow>
|
|
56
|
-
{items.map(({ key, component, disabled, href, icon, onClick, target, content, textColor }) => (
|
|
57
|
-
<DropdownMenuItem
|
|
58
|
-
Component={component || 'button'}
|
|
59
|
-
disabled={disabled}
|
|
60
|
-
href={href}
|
|
61
|
-
icon={icon}
|
|
62
|
-
onClick={onClick}
|
|
63
|
-
key={key}
|
|
64
|
-
target={target}
|
|
65
|
-
textColor={textColor}
|
|
66
|
-
>
|
|
67
|
-
{content}
|
|
68
|
-
</DropdownMenuItem>
|
|
69
|
-
))}
|
|
70
|
-
</DropdownMenu>
|
|
71
|
-
)}
|
|
72
|
-
</Placement>
|
|
73
|
-
)}
|
|
74
|
-
</PlacementManager>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default ButtonWithDropdown;
|