@autoguru/overdrive 4.25.2 → 4.26.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/dist/components/DropDown/DropDown.d.ts +3 -1
- package/dist/components/DropDown/DropDown.d.ts.map +1 -1
- package/dist/components/DropDown/DropDown.js +3 -2
- package/dist/components/DropDown/DropDownOption.css.d.ts +1 -0
- package/dist/components/DropDown/DropDownOption.css.d.ts.map +1 -1
- package/dist/components/DropDown/DropDownOption.css.js +4 -0
- package/dist/components/DropDown/DropDownOption.d.ts.map +1 -1
- package/dist/components/DropDown/DropDownOption.js +11 -3
- package/dist/components/DropDown/DropDownOptionsList.css.js +1 -1
- package/dist/components/DropDown/stories.js +15 -4
- package/package.json +1 -1
|
@@ -10,14 +10,16 @@ export interface Props extends ButtonProps, FlyoutProps {
|
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
label: string;
|
|
12
12
|
icon?: IconType;
|
|
13
|
+
isOpen?: boolean;
|
|
13
14
|
onClick?: ComponentProps<typeof Button>['onClick'];
|
|
14
15
|
}
|
|
15
|
-
export declare const DropDown: ({ children: options, label, icon, alignment, onClick: incomingOnClick, ...buttonProps }: {
|
|
16
|
+
export declare const DropDown: ({ children: options, label, icon, alignment, isOpen: incomingIsOpen, onClick: incomingOnClick, ...buttonProps }: {
|
|
16
17
|
[x: string]: any;
|
|
17
18
|
children: any;
|
|
18
19
|
label: any;
|
|
19
20
|
icon?: React.ReactElement<React.SVGAttributes<SVGElement>, "svg"> | undefined;
|
|
20
21
|
alignment?: EPositionerAlignment | undefined;
|
|
22
|
+
isOpen: any;
|
|
21
23
|
onClick: any;
|
|
22
24
|
}) => JSX.Element;
|
|
23
25
|
export default DropDown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropDown.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,iB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Q,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["children", "label", "icon", "alignment", "onClick"];
|
|
5
|
+
const _excluded = ["children", "label", "icon", "alignment", "isOpen", "onClick"];
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
import { ChevronDownIcon } from '@autoguru/icons';
|
|
@@ -23,12 +23,13 @@ export const DropDown = _ref => {
|
|
|
23
23
|
label,
|
|
24
24
|
icon = ChevronDownIcon,
|
|
25
25
|
alignment = EPositionerAlignment.BOTTOM_LEFT,
|
|
26
|
+
isOpen: incomingIsOpen,
|
|
26
27
|
onClick: incomingOnClick
|
|
27
28
|
} = _ref,
|
|
28
29
|
buttonProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
30
|
const buttonRef = useRef(null);
|
|
30
31
|
const menuRef = useRef(null);
|
|
31
|
-
const [isOpen, setIsOpen] = useState(
|
|
32
|
+
const [isOpen, setIsOpen] = useState(incomingIsOpen);
|
|
32
33
|
const onMenuClick = useCallback(event => {
|
|
33
34
|
if (typeof incomingOnClick === 'function') incomingOnClick(event);
|
|
34
35
|
setIsOpen(!isOpen);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropDownOption.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDownOption.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAOf,CAAC;
|
|
1
|
+
{"version":3,"file":"DropDownOption.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDownOption.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAOf,CAAC;AACH,eAAO,MAAM,QAAQ,QAGnB,CAAC;AACH,eAAO,MAAM,MAAM,QAWjB,CAAC"}
|
|
@@ -11,6 +11,10 @@ export const root = style({
|
|
|
11
11
|
backgroundColor: vars.colours.background.light
|
|
12
12
|
}
|
|
13
13
|
}, "root");
|
|
14
|
+
export const disabled = style({
|
|
15
|
+
cursor: 'not-allowed',
|
|
16
|
+
opacity: '0.3'
|
|
17
|
+
}, "disabled");
|
|
14
18
|
export const action = style({
|
|
15
19
|
transition: "opacity 0.3s ".concat(vars.animation.easing.standard, " 0.1s"),
|
|
16
20
|
willChange: 'transform',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropDownOption.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDownOption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"DropDownOption.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDownOption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1D,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAG7B,OAAO,EAAE,IAAI,EAAiB,MAAM,SAAS,CAAC;AAI9C,UAAU,KACT,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACjE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,KAAK,CA0CnD,CAAC"}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["label", "icon", "className", "display", "iconColour", "is"];
|
|
5
|
+
const _excluded = ["label", "icon", "className", "disabled", "display", "iconColour", "is", "alignItems", "width"];
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import * as React from 'react';
|
|
9
10
|
import { Box } from "../Box/index.js";
|
|
10
11
|
import { Icon } from "../Icon/index.js";
|
|
@@ -18,17 +19,24 @@ export const DropDownOption = _ref => {
|
|
|
18
19
|
label,
|
|
19
20
|
icon,
|
|
20
21
|
className,
|
|
22
|
+
disabled = false,
|
|
21
23
|
display = 'flex',
|
|
22
24
|
iconColour = 'dark',
|
|
23
|
-
is = 'button'
|
|
25
|
+
is = 'button',
|
|
26
|
+
alignItems = 'space-between',
|
|
27
|
+
width = 'full'
|
|
24
28
|
} = _ref,
|
|
25
29
|
boxProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
30
|
const colourStyles = useTextStyles({
|
|
27
31
|
colour: iconColour
|
|
28
32
|
});
|
|
29
33
|
return _jsx(Box, _objectSpread(_objectSpread({
|
|
30
|
-
className:
|
|
34
|
+
className: clsx(styles.root, className, {
|
|
35
|
+
[styles.disabled]: disabled
|
|
36
|
+
})
|
|
31
37
|
}, boxProps), {}, {
|
|
38
|
+
width: width,
|
|
39
|
+
alignItems: alignItems,
|
|
32
40
|
display: display,
|
|
33
41
|
paddingX: "3",
|
|
34
42
|
paddingY: "2",
|
|
@@ -4,7 +4,7 @@ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
|
4
4
|
__vanilla_filescope__.setFileScope("lib/components/DropDown/DropDownOptionsList.css.ts", "@autoguru/overdrive");
|
|
5
5
|
import { style } from '@vanilla-extract/css';
|
|
6
6
|
export const root = style({
|
|
7
|
-
minWidth:
|
|
7
|
+
minWidth: 200
|
|
8
8
|
}, "root");
|
|
9
9
|
export const list = style({
|
|
10
10
|
maxHeight: 300
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
import { DownloadIcon, SettingsIcon, TrashCanOutlineIcon } from '@autoguru/icons';
|
|
6
|
+
import { DownloadIcon, SettingsIcon, SquareEditOutlineIcon, TrashCanOutlineIcon } from '@autoguru/icons';
|
|
7
7
|
import { action } from '@storybook/addon-actions';
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import { Fragment } from 'react';
|
|
@@ -60,15 +60,25 @@ const option2 = _jsx(DropDownOption, {
|
|
|
60
60
|
label: "Delete",
|
|
61
61
|
icon: TrashCanOutlineIcon
|
|
62
62
|
});
|
|
63
|
+
const optionDisabled = _jsx(DropDownOption, {
|
|
64
|
+
disabled: true,
|
|
65
|
+
label: "Edit",
|
|
66
|
+
icon: SquareEditOutlineIcon
|
|
67
|
+
});
|
|
63
68
|
const standardProps = {
|
|
64
69
|
label: 'Attachment',
|
|
65
70
|
children: _jsxs(_Fragment, {
|
|
66
|
-
children: [option1,
|
|
71
|
+
children: [option1, option1, optionDisabled]
|
|
67
72
|
}),
|
|
68
73
|
onClick
|
|
69
74
|
};
|
|
70
75
|
export const primary = Template.bind(standardProps);
|
|
71
76
|
primary.args = standardProps;
|
|
77
|
+
const withOpenMenuProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
78
|
+
isOpen: true
|
|
79
|
+
});
|
|
80
|
+
export const withOpenMenu = Template.bind(withOpenMenuProps);
|
|
81
|
+
withOpenMenu.args = withOpenMenuProps;
|
|
72
82
|
const secondaryProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
73
83
|
variant: 'secondary'
|
|
74
84
|
});
|
|
@@ -88,12 +98,13 @@ export const roundedSecondary = Template.bind(roundedSecondaryProps);
|
|
|
88
98
|
roundedSecondary.args = roundedSecondaryProps;
|
|
89
99
|
const withCustomIconProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
90
100
|
variant: 'secondary',
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
icon: SettingsIcon,
|
|
102
|
+
isOpen: true
|
|
93
103
|
});
|
|
94
104
|
export const withCustomIcon = Template.bind(withCustomIconProps);
|
|
95
105
|
withCustomIcon.args = withCustomIconProps;
|
|
96
106
|
const withManyOptionsProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
107
|
+
isOpen: true,
|
|
97
108
|
children: _jsx(_Fragment, {
|
|
98
109
|
children: Array.from({
|
|
99
110
|
length: 99
|