@neo4j-ndl/react 4.9.7 → 4.9.9
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/icon-button-base/IconButtonBase.js +2 -1
- package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/cjs/select/Overrides.js +82 -8
- package/lib/cjs/select/Overrides.js.map +1 -1
- package/lib/esm/icon-button-base/IconButtonBase.js +2 -1
- package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
- package/lib/esm/select/Overrides.js +82 -8
- package/lib/esm/select/Overrides.js.map +1 -1
- package/lib/types/select/Overrides.d.ts +1 -1
- package/lib/types/select/Overrides.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -41,6 +41,7 @@ const utils_1 = require("../_common/utils");
|
|
|
41
41
|
const loading_spinner_1 = require("../loading-spinner");
|
|
42
42
|
const tooltip_1 = require("../tooltip");
|
|
43
43
|
const IconButtonBase = (_a) => {
|
|
44
|
+
var _b;
|
|
44
45
|
var { children, as, iconButtonVariant = 'default', isLoading = false, isDisabled = false, size = 'medium', isFloating = false,
|
|
45
46
|
// Does not have a default value to avoid setting aria-pressed to true if not explicitly set
|
|
46
47
|
isActive = undefined, description, tooltipProps, className, style, variant = 'neutral', htmlAttributes, onClick, ref } = _a, restProps = __rest(_a, ["children", "as", "iconButtonVariant", "isLoading", "isDisabled", "size", "isFloating", "isActive", "description", "tooltipProps", "className", "style", "variant", "htmlAttributes", "onClick", "ref"]);
|
|
@@ -82,7 +83,7 @@ const IconButtonBase = (_a) => {
|
|
|
82
83
|
return ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, Object.assign({ hoverDelay: {
|
|
83
84
|
close: 0,
|
|
84
85
|
open: 500,
|
|
85
|
-
} }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, {
|
|
86
|
+
}, isDisabled: description === null || isDisabled, type: "simple" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { children: [(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ type: "button", onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, "aria-label": description, "aria-pressed": isActive, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-icon-btn-inner", children: isLoading ? ((0, jsx_runtime_1.jsx)(loading_spinner_1.LoadingSpinner, { size: "small" })) : ((0, jsx_runtime_1.jsx)("div", { className: "ndl-icon", children: children })) }) })) })), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: description !== null && description !== void 0 ? description : (_b = tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content) === null || _b === void 0 ? void 0 : _b.children }))] })));
|
|
86
87
|
};
|
|
87
88
|
exports.IconButtonBase = IconButtonBase;
|
|
88
89
|
//# sourceMappingURL=IconButtonBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButtonBase.js","sourceRoot":"","sources":["../../../src/icon-button-base/IconButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAOpC,4CAAwD;AAExD,wDAAoD;AACpD,wCAAqC;AA8C9B,MAAM,cAAc,GAAG,CAAyC,EAmBtB,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"IconButtonBase.js","sourceRoot":"","sources":["../../../src/icon-button-base/IconButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAOpC,4CAAwD;AAExD,wDAAoD;AACpD,wCAAqC;AA8C9B,MAAM,cA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AAW,cAAX,WAAW,GAAI,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,0CAAE,QAAQ,IAC/B,KACV,CACX,CAAC;AACJ,CAAC,CAAC;AAzGW,QAAA,cAAc,kBAyGzB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type TooltipObjectProps,\n} from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport { type ButtonSizes } from '../button';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Tooltip } from '../tooltip';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\nexport type IconButtonBaseProps = {\n children?: React.ReactNode;\n\n /** If the icon button is in disabled state */\n isDisabled?: boolean;\n\n /** If the button is doing something Async, it will display a loading spinner */\n isLoading?: boolean;\n\n /** Size of button */\n size?: ButtonSizes;\n\n /** If the button is in floating state */\n isFloating?: boolean;\n\n /** Active - used for open context menus for example */\n isActive?: boolean;\n\n /** A string that will be shown as a tooltip when hovering over the button it also acts as an aria-label- {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label} */\n description: string | null;\n\n /** Variant of the button */\n variant?: 'neutral' | 'danger';\n\n /** Variant of the button */\n iconButtonVariant?: 'default' | 'clean';\n\n /**\n * Props for the tooltip component.\n */\n tooltipProps?: TooltipObjectProps;\n\n /** Click handler */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n};\n\nexport const IconButtonBase = <T extends React.ElementType = 'button'>({\n children,\n as,\n iconButtonVariant = 'default',\n isLoading = false,\n isDisabled = false,\n size = 'medium',\n isFloating = false,\n // Does not have a default value to avoid setting aria-pressed to true if not explicitly set\n isActive = undefined,\n description,\n tooltipProps,\n className,\n style,\n variant = 'neutral',\n htmlAttributes,\n onClick,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, IconButtonBaseProps>) => {\n const Component: React.ElementType = as ?? 'button';\n\n const isInteractable = !isDisabled && !isLoading;\n\n const isClean = iconButtonVariant === 'clean';\n const isDanger = variant === 'danger';\n\n const classes = classNames('ndl-icon-btn', className, {\n 'ndl-active': Boolean(isActive),\n 'ndl-clean': isClean,\n 'ndl-danger': isDanger,\n 'ndl-disabled': isDisabled,\n 'ndl-floating': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-loading': isLoading,\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n if (isClean && isFloating) {\n throw new Error(\n 'BaseIconButton: Cannot use isFloating and iconButtonVariant=\"clean\" at the same time.',\n );\n }\n\n if (!description && !htmlAttributes?.['aria-label']) {\n needleWarningMessage(\n 'Icon buttons do not have text, be sure to include a description or an aria-label for screen readers link: https://dequeuniversity.com/rules/axe/4.4/button-name?application=axeAPI',\n );\n }\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!isInteractable) {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <Tooltip\n hoverDelay={{\n close: 0,\n open: 500,\n }}\n isDisabled={description === null || isDisabled}\n type=\"simple\"\n {...tooltipProps?.root}\n >\n <Tooltip.Trigger {...tooltipProps?.trigger} hasButtonWrapper>\n <Component\n type=\"button\"\n onClick={handleClick}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n aria-label={description}\n aria-pressed={isActive}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-icon-btn-inner\">\n {isLoading ? (\n <LoadingSpinner size=\"small\" />\n ) : (\n <div className=\"ndl-icon\">{children}</div>\n )}\n </div>\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n {description ?? tooltipProps?.content?.children}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n"]}
|
|
@@ -43,6 +43,53 @@ const checkbox_1 = require("../checkbox");
|
|
|
43
43
|
const icons_1 = require("../icons");
|
|
44
44
|
const tag_1 = require("../tag");
|
|
45
45
|
const theme_1 = require("../theme");
|
|
46
|
+
/**
|
|
47
|
+
* React-select triggers control/indicator interactions on mouseDown which breaks WCAG 2.5.2 Pointer Cancellation.
|
|
48
|
+
* This helper shifts mouseDown to mouseUp to allow users to cancel by dragging away.
|
|
49
|
+
*/
|
|
50
|
+
const shiftMouseDownToMouseUp = (innerProps, stopPropagation = false) => {
|
|
51
|
+
const baseProps = innerProps !== null && innerProps !== void 0 ? innerProps : {};
|
|
52
|
+
const maybeStopPropagation = (e) => stopPropagation && e.stopPropagation();
|
|
53
|
+
return Object.assign(Object.assign({}, baseProps), { onMouseDown: (e) => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
maybeStopPropagation(e);
|
|
56
|
+
}, onMouseUp: (e) => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
(_a = baseProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(baseProps, e);
|
|
59
|
+
(_b = baseProps.onMouseDown) === null || _b === void 0 ? void 0 : _b.call(baseProps, e);
|
|
60
|
+
maybeStopPropagation(e);
|
|
61
|
+
}, onTouchEnd: (e) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
(_a = baseProps.onTouchEnd) === null || _a === void 0 ? void 0 : _a.call(baseProps, e);
|
|
64
|
+
(_b = baseProps.onMouseDown) === null || _b === void 0 ? void 0 : _b.call(baseProps, e);
|
|
65
|
+
maybeStopPropagation(e);
|
|
66
|
+
}, onTouchStart: (e) => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
maybeStopPropagation(e);
|
|
69
|
+
} });
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* React-select triggers option selection on click which fires on mouseDown.
|
|
73
|
+
* This helper shifts the click handler to mouseUp/touchEnd to allow users to cancel by dragging away.
|
|
74
|
+
*/
|
|
75
|
+
const shiftOptionClickToMouseUp = (innerProps) => {
|
|
76
|
+
const baseProps = innerProps !== null && innerProps !== void 0 ? innerProps : {};
|
|
77
|
+
return Object.assign(Object.assign({}, baseProps), {
|
|
78
|
+
// Remove onClick to prevent double-execution (onMouseUp already calls it, and browser would fire click after mouseup)
|
|
79
|
+
onClick: undefined, onMouseDown: (event) => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
}, onMouseUp: (event) => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
(_a = baseProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(baseProps, event);
|
|
84
|
+
(_b = baseProps.onClick) === null || _b === void 0 ? void 0 : _b.call(baseProps, event);
|
|
85
|
+
}, onTouchEnd: (event) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
(_a = baseProps.onTouchEnd) === null || _a === void 0 ? void 0 : _a.call(baseProps, event);
|
|
88
|
+
(_b = baseProps.onClick) === null || _b === void 0 ? void 0 : _b.call(baseProps, event);
|
|
89
|
+
}, onTouchStart: (event) => {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
} });
|
|
92
|
+
};
|
|
46
93
|
const DropdownIndicatorCurrying = ({ size, }) => function Component(props) {
|
|
47
94
|
const classes = (0, classnames_1.default)('ndl-select-dropdown-indicator', {
|
|
48
95
|
'ndl-disabled': props.isDisabled,
|
|
@@ -52,7 +99,9 @@ const DropdownIndicatorCurrying = ({ size, }) => function Component(props) {
|
|
|
52
99
|
'ndl-medium': size === 'medium',
|
|
53
100
|
'ndl-small': size === 'small',
|
|
54
101
|
});
|
|
55
|
-
|
|
102
|
+
// stopPropagation so that we prevent the control from also toggling the menu (double-toggle)
|
|
103
|
+
const indicatorInnerProps = shiftMouseDownToMouseUp(props.innerProps, true);
|
|
104
|
+
return ((0, jsx_runtime_1.jsx)(react_select_1.components.DropdownIndicator, Object.assign({}, props, { className: classes, innerProps: indicatorInnerProps, children: (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIconOutline, { className: "ndl-select-icon", style: {
|
|
56
105
|
transform: props.selectProps.menuIsOpen
|
|
57
106
|
? 'rotate(180deg)'
|
|
58
107
|
: 'rotate(0deg)',
|
|
@@ -61,7 +110,7 @@ const DropdownIndicatorCurrying = ({ size, }) => function Component(props) {
|
|
|
61
110
|
};
|
|
62
111
|
exports.DropdownIndicatorCurrying = DropdownIndicatorCurrying;
|
|
63
112
|
const CustomClearIndication = ({ size, }) => function Component(_a) {
|
|
64
|
-
var { className } = _a, restProps = __rest(_a, ["className"]);
|
|
113
|
+
var { className, innerProps } = _a, restProps = __rest(_a, ["className", "innerProps"]);
|
|
65
114
|
const classes = (0, classnames_1.default)('ndl-select-clear', className, {
|
|
66
115
|
'ndl-focused': restProps.isFocused,
|
|
67
116
|
'ndl-is-multi': restProps.isMulti,
|
|
@@ -69,7 +118,26 @@ const CustomClearIndication = ({ size, }) => function Component(_a) {
|
|
|
69
118
|
'ndl-medium': size === 'medium',
|
|
70
119
|
'ndl-small': size === 'small',
|
|
71
120
|
});
|
|
72
|
-
|
|
121
|
+
const handleClear = () => {
|
|
122
|
+
var _a;
|
|
123
|
+
(_a = restProps.clearValue) === null || _a === void 0 ? void 0 : _a.call(restProps);
|
|
124
|
+
};
|
|
125
|
+
// Stop propagation to prevent react-select's keyboard handling.
|
|
126
|
+
const handleKeyDown = (event) => {
|
|
127
|
+
var _a, _b;
|
|
128
|
+
if (event.key === '') {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
}
|
|
131
|
+
event.stopPropagation();
|
|
132
|
+
(_b = (_a = event.nativeEvent).stopImmediatePropagation) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
133
|
+
};
|
|
134
|
+
// Prevent react-select's default clear-on-mousedown/touchend behavior.
|
|
135
|
+
const preventAndStop = (e) => {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
e.stopPropagation();
|
|
138
|
+
};
|
|
139
|
+
const safeInnerProps = Object.assign(Object.assign({}, innerProps), { 'aria-hidden': undefined, onMouseDown: preventAndStop, onTouchEnd: preventAndStop });
|
|
140
|
+
return ((0, jsx_runtime_1.jsxs)(react_select_1.components.ClearIndicator, Object.assign({ className: classes, innerProps: safeInnerProps }, restProps, { children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "ndl-select-clear-button", onClick: handleClear, onKeyDown: handleKeyDown, "aria-label": "Clear selection", children: (0, jsx_runtime_1.jsx)(icons_1.XMarkIconOutline, {}) }), (0, jsx_runtime_1.jsx)("div", { className: "ndl-select-divider" })] })));
|
|
73
141
|
};
|
|
74
142
|
exports.CustomClearIndication = CustomClearIndication;
|
|
75
143
|
const CustomMultiValue = ({ size, }) => function Component(_a) {
|
|
@@ -118,7 +186,8 @@ const CustomControl = ({ size, isClean, errorText, }) => function Component(_a)
|
|
|
118
186
|
'ndl-medium': size === 'medium',
|
|
119
187
|
'ndl-small': size === 'small',
|
|
120
188
|
});
|
|
121
|
-
|
|
189
|
+
const controlInnerProps = shiftMouseDownToMouseUp(restProps.innerProps);
|
|
190
|
+
return ((0, jsx_runtime_1.jsx)(react_select_1.components.Control, Object.assign({}, restProps, { className: classes, innerProps: controlInnerProps, children: children })));
|
|
122
191
|
};
|
|
123
192
|
exports.CustomControl = CustomControl;
|
|
124
193
|
const CustomIndicatorsContainer = ({ size, }) => function Component(_a) {
|
|
@@ -215,19 +284,24 @@ const CustomOption = ({ size, }) => function Component(_a) {
|
|
|
215
284
|
'ndl-selected': restProps.isSelected,
|
|
216
285
|
'ndl-small': size === 'small',
|
|
217
286
|
});
|
|
218
|
-
|
|
287
|
+
const optionInnerProps = shiftOptionClickToMouseUp(restProps.innerProps);
|
|
288
|
+
return ((0, jsx_runtime_1.jsxs)(react_select_1.components.Option, Object.assign({}, restProps, { className: classes, innerProps: optionInnerProps, children: [restProps.isMulti === true && ((0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { isChecked: restProps.isSelected, ariaLabel: restProps.label, isDisabled: restProps.isDisabled, htmlAttributes: {
|
|
219
289
|
'aria-hidden': true,
|
|
220
290
|
disabled: true,
|
|
221
291
|
onPointerDown: (e) => {
|
|
222
|
-
var _a, _b;
|
|
223
292
|
e.preventDefault();
|
|
293
|
+
},
|
|
294
|
+
onPointerUp: (e) => {
|
|
295
|
+
var _a, _b;
|
|
224
296
|
(_b = (_a = restProps.innerProps).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
225
297
|
},
|
|
226
|
-
|
|
298
|
+
onTouchEnd: (e) => {
|
|
227
299
|
var _a, _b;
|
|
228
|
-
e.preventDefault();
|
|
229
300
|
(_b = (_a = restProps.innerProps).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
230
301
|
},
|
|
302
|
+
onTouchStart: (e) => {
|
|
303
|
+
e.preventDefault();
|
|
304
|
+
},
|
|
231
305
|
role: 'presentation',
|
|
232
306
|
tabIndex: -1,
|
|
233
307
|
} })), children] })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overrides.js","sourceRoot":"","sources":["../../../src/select/Overrides.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AACzC,4DAAoC;AACpC,+CAcsB;AAMtB,0CAAuC;AACvC,oCAAoE;AACpE,gCAA6B;AAC7B,oCAA0C;AAGnC,MAAM,yBAAyB,GAAG,CAIvC,EACA,IAAI,GACsD,EAAE,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I;oBACnB,QAAQ,EAAE,IAAI;oBACd,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE;;wBACnB,CAAC,CAAC,cAAc,EAAE,CAAC;wBACnB,MAAA,MAAA,SAAS,CAAC,UAAU,EAAC,OAAO,mDAAG,CAAC,CAAC,CAAC;oBACpC,CAAC;oBACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;;wBAClB,CAAC,CAAC,cAAc,EAAE,CAAC;wBACnB,MAAA,MAAA,SAAS,CAAC,UAAU,EAAC,OAAO,mDAC1B,CAA4D,CAC7D,CAAC;oBACJ,CAAC;oBACD,IAAI,EAAE,cAAc;oBACpB,QAAQ,EAAE,CAAC,CAAC;iBACb,GACD,CACH,EACA,QAAQ,KACS,CACrB,CAAC;AACJ,CAAC,CAAC;AAjDS,QAAA,YAAY,gBAiDrB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport {\n type ClearIndicatorProps,\n components,\n type ControlProps,\n type DropdownIndicatorProps,\n type GroupBase,\n type IndicatorsContainerProps,\n type InputProps,\n type MenuProps,\n type MultiValueProps,\n type OptionProps,\n type PlaceholderProps,\n type SingleValueProps,\n type ValueContainerProps,\n} from 'react-select';\nimport {\n type MenuListProps,\n type MenuPortalProps,\n} from 'react-select/dist/declarations/src/components/Menu';\n\nimport { Checkbox } from '../checkbox';\nimport { ChevronDownIconOutline, XMarkIconOutline } from '../icons';\nimport { Tag } from '../tag';\nimport { useNeedleTheme } from '../theme';\nimport { type SelectOverrideCustomProps } from './types';\n\nexport const DropdownIndicatorCurrying = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component(\n props: DropdownIndicatorProps<OptionType, IsMulti, GroupType>,\n ) {\n const classes = classNames('ndl-select-dropdown-indicator', {\n 'ndl-disabled': props.isDisabled,\n 'ndl-focused': props.isFocused,\n 'ndl-is-multi': props.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n return (\n <components.DropdownIndicator {...props} className={classes}>\n <ChevronDownIconOutline\n className=\"ndl-select-icon\"\n style={{\n transform: props.selectProps.menuIsOpen\n ? 'rotate(180deg)'\n : 'rotate(0deg)',\n transitionDuration: tokens.motion.duration.quick,\n }}\n />\n </components.DropdownIndicator>\n );\n };\n\nexport const CustomClearIndication = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n className,\n ...restProps\n }: ClearIndicatorProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-clear', className, {\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.ClearIndicator {...restProps} className={classes}>\n <div>\n <XMarkIconOutline />\n <div className=\"ndl-select-divider\" />\n </div>\n </components.ClearIndicator>\n );\n };\n\nexport const CustomMultiValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MultiValueProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-multi-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MultiValueContainer\n {...restProps}\n innerProps={{\n className: classes,\n }}\n >\n <Tag\n size={size}\n onClick={(e) => {\n e.preventDefault();\n restProps.removeProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n }}\n htmlAttributes={{\n onMouseDown: (e) => e.preventDefault(),\n }}\n >\n {children}\n </Tag>\n </components.MultiValueContainer>\n );\n };\n\nexport const CustomPlaceholder = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: PlaceholderProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-placeholder', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Placeholder {...restProps} className={classes}>\n {children}\n </components.Placeholder>\n );\n };\n\nexport const CustomControl = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n isClean,\n errorText,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: ControlProps) {\n const classes = classNames('ndl-select-control', className, {\n 'ndl-clean': isClean,\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-has-error': !!errorText,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n return (\n <components.Control {...restProps} className={classes}>\n {children}\n </components.Control>\n );\n };\n\nexport const CustomIndicatorsContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: IndicatorsContainerProps) {\n const classes = classNames('ndl-select-indicators-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.IndicatorsContainer {...restProps} className={classes}>\n {children}\n </components.IndicatorsContainer>\n );\n };\n\nexport const CustomValueContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: ValueContainerProps) {\n const classes = classNames('ndl-select-value-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.ValueContainer {...restProps} className={classes}>\n {children}\n </components.ValueContainer>\n );\n };\n\nexport const CustomInput = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: InputProps) {\n const classes = classNames('ndl-select-input', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.Input {...restProps} className={classes} />;\n };\n\nexport const CustomSingleValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: SingleValueProps) {\n const classes = classNames('ndl-select-single-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.SingleValue {...restProps} className={classes} />;\n };\n\n/** Overrides that are part of the popover menu */\n\nexport const CustomMenu = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: MenuProps) {\n const { themeClassName } = useNeedleTheme();\n const classes = classNames('ndl-select-menu', className, themeClassName, {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Menu {...restProps} className={classes}>\n {children}\n </components.Menu>\n );\n };\n\nexport const CustomMenuPortal = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuPortalProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-portal', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuPortal {...restProps} className={classes}>\n {children}\n </components.MenuPortal>\n );\n };\n\nexport const CustomMenuList = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuListProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-list', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuList {...restProps} className={classes}>\n {children}\n </components.MenuList>\n );\n };\n\nexport const CustomOption = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: OptionProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-option', {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-selected': restProps.isSelected,\n 'ndl-small': size === 'small',\n });\n return (\n <components.Option {...restProps} className={classes}>\n {restProps.isMulti === true && (\n <Checkbox\n isChecked={restProps.isSelected}\n ariaLabel={restProps.label}\n isDisabled={restProps.isDisabled}\n htmlAttributes={{\n 'aria-hidden': true,\n disabled: true,\n onPointerDown: (e) => {\n e.preventDefault();\n restProps.innerProps.onClick?.(e);\n },\n onTouchStart: (e) => {\n e.preventDefault();\n restProps.innerProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n },\n role: 'presentation',\n tabIndex: -1,\n }}\n />\n )}\n {children}\n </components.Option>\n );\n };\n"]}
|
|
1
|
+
{"version":3,"file":"Overrides.js","sourceRoot":"","sources":["../../../src/select/Overrides.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,0CAAyC;AACzC,4DAAoC;AACpC,+CAcsB;AAMtB,0CAAuC;AACvC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AAS,CAAC,UAAU;QACpC,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEzE,OAAO,CACL,wBAAC,yBAAU,CAAC,MAAM,oBACZ,SAAS,IACb,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,gBAAgB,aAE3B,SAAS,CAAC,OAAO,KAAK,IAAI,IAAI,CAC7B,uBAAC,mBAAQ,IACP,SAAS,EAAE,SAAS,CAAC,UAAU,EAC/B,SAAS,EAAE,SAAS,CAAC,KAAK,EAC1B,UAAU,EAAE,SAAS,CAAC,UAAU,EAChC,cAAc,EAAE;oBACd,aAAa,EAAE,IAAI;oBACnB,QAAQ,EAAE,IAAI;oBACd,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE;wBACnB,CAAC,CAAC,cAAc,EAAE,CAAC;oBACrB,CAAC;oBACD,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;;wBACjB,MAAA,MAAA,SAAS,CAAC,UAAU,EAAC,OAAO,mDAAG,CAAC,CAAC,CAAC;oBACpC,CAAC;oBACD,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE;;wBAChB,MAAA,MAAA,SAAS,CAAC,UAAU,EAAC,OAAO,mDAC1B,CAA4D,CAC7D,CAAC;oBACJ,CAAC;oBACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;wBAClB,CAAC,CAAC,cAAc,EAAE,CAAC;oBACrB,CAAC;oBACD,IAAI,EAAE,cAAc;oBACpB,QAAQ,EAAE,CAAC,CAAC;iBACb,GACD,CACH,EACA,QAAQ,KACS,CACrB,CAAC;AACJ,CAAC,CAAC;AA3DS,QAAA,YAAY,gBA2DrB","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport {\n type ClearIndicatorProps,\n components,\n type ControlProps,\n type DropdownIndicatorProps,\n type GroupBase,\n type IndicatorsContainerProps,\n type InputProps,\n type MenuProps,\n type MultiValueProps,\n type OptionProps,\n type PlaceholderProps,\n type SingleValueProps,\n type ValueContainerProps,\n} from 'react-select';\nimport {\n type MenuListProps,\n type MenuPortalProps,\n} from 'react-select/dist/declarations/src/components/Menu';\n\nimport { Checkbox } from '../checkbox';\nimport { ChevronDownIconOutline, XMarkIconOutline } from '../icons';\nimport { Tag } from '../tag';\nimport { useNeedleTheme } from '../theme';\nimport { type SelectOverrideCustomProps } from './types';\n\n/**\n * React-select triggers control/indicator interactions on mouseDown which breaks WCAG 2.5.2 Pointer Cancellation.\n * This helper shifts mouseDown to mouseUp to allow users to cancel by dragging away.\n */\nconst shiftMouseDownToMouseUp = (\n innerProps?: React.HTMLAttributes<HTMLDivElement>,\n stopPropagation = false,\n): React.HTMLAttributes<HTMLDivElement> => {\n const baseProps = innerProps ?? {};\n const maybeStopPropagation = (e: React.SyntheticEvent) =>\n stopPropagation && e.stopPropagation();\n\n return {\n ...baseProps,\n onMouseDown: (e) => {\n e.preventDefault();\n maybeStopPropagation(e);\n },\n onMouseUp: (e) => {\n baseProps.onMouseUp?.(e);\n baseProps.onMouseDown?.(e);\n maybeStopPropagation(e);\n },\n onTouchEnd: (e) => {\n baseProps.onTouchEnd?.(e);\n baseProps.onMouseDown?.(e as unknown as React.MouseEvent<HTMLDivElement>);\n maybeStopPropagation(e);\n },\n onTouchStart: (e) => {\n e.preventDefault();\n maybeStopPropagation(e);\n },\n };\n};\n\n/**\n * React-select triggers option selection on click which fires on mouseDown.\n * This helper shifts the click handler to mouseUp/touchEnd to allow users to cancel by dragging away.\n */\nconst shiftOptionClickToMouseUp = (\n innerProps?: React.HTMLAttributes<HTMLDivElement>,\n): React.HTMLAttributes<HTMLDivElement> => {\n const baseProps = innerProps ?? {};\n\n return {\n ...baseProps,\n // Remove onClick to prevent double-execution (onMouseUp already calls it, and browser would fire click after mouseup)\n onClick: undefined,\n onMouseDown: (event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n },\n onMouseUp: (event: React.MouseEvent<HTMLDivElement>) => {\n baseProps.onMouseUp?.(event);\n baseProps.onClick?.(event);\n },\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => {\n baseProps.onTouchEnd?.(event);\n baseProps.onClick?.(event as unknown as React.MouseEvent<HTMLDivElement>);\n },\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n },\n };\n};\n\nexport const DropdownIndicatorCurrying = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component(\n props: DropdownIndicatorProps<OptionType, IsMulti, GroupType>,\n ) {\n const classes = classNames('ndl-select-dropdown-indicator', {\n 'ndl-disabled': props.isDisabled,\n 'ndl-focused': props.isFocused,\n 'ndl-is-multi': props.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n // stopPropagation so that we prevent the control from also toggling the menu (double-toggle)\n const indicatorInnerProps = shiftMouseDownToMouseUp(props.innerProps, true);\n\n return (\n <components.DropdownIndicator\n {...props}\n className={classes}\n innerProps={indicatorInnerProps}\n >\n <ChevronDownIconOutline\n className=\"ndl-select-icon\"\n style={{\n transform: props.selectProps.menuIsOpen\n ? 'rotate(180deg)'\n : 'rotate(0deg)',\n transitionDuration: tokens.motion.duration.quick,\n }}\n />\n </components.DropdownIndicator>\n );\n };\n\nexport const CustomClearIndication = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n className,\n innerProps,\n ...restProps\n }: ClearIndicatorProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-clear', className, {\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n const handleClear = () => {\n restProps.clearValue?.();\n };\n\n // Stop propagation to prevent react-select's keyboard handling.\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === '') {\n event.preventDefault();\n }\n event.stopPropagation();\n event.nativeEvent.stopImmediatePropagation?.();\n };\n\n // Prevent react-select's default clear-on-mousedown/touchend behavior.\n const preventAndStop = (e: React.SyntheticEvent) => {\n e.preventDefault();\n e.stopPropagation();\n };\n\n const safeInnerProps: typeof innerProps = {\n ...innerProps,\n 'aria-hidden': undefined, // Remove to allow focusable button inside\n onMouseDown: preventAndStop,\n onTouchEnd: preventAndStop,\n };\n\n return (\n <components.ClearIndicator\n className={classes}\n innerProps={safeInnerProps}\n {...restProps}\n >\n <button\n type=\"button\"\n className=\"ndl-select-clear-button\"\n onClick={handleClear}\n onKeyDown={handleKeyDown}\n aria-label=\"Clear selection\"\n >\n <XMarkIconOutline />\n </button>\n <div className=\"ndl-select-divider\" />\n </components.ClearIndicator>\n );\n };\n\nexport const CustomMultiValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MultiValueProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-multi-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MultiValueContainer\n {...restProps}\n innerProps={{\n className: classes,\n }}\n >\n <Tag\n size={size}\n onClick={(e) => {\n e.preventDefault();\n restProps.removeProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n }}\n htmlAttributes={{\n onMouseDown: (e) => e.preventDefault(),\n }}\n >\n {children}\n </Tag>\n </components.MultiValueContainer>\n );\n };\n\nexport const CustomPlaceholder = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: PlaceholderProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-placeholder', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Placeholder {...restProps} className={classes}>\n {children}\n </components.Placeholder>\n );\n };\n\nexport const CustomControl = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n isClean,\n errorText,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: ControlProps) {\n const classes = classNames('ndl-select-control', className, {\n 'ndl-clean': isClean,\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-has-error': !!errorText,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n const controlInnerProps = shiftMouseDownToMouseUp(restProps.innerProps);\n\n return (\n <components.Control\n {...restProps}\n className={classes}\n innerProps={controlInnerProps}\n >\n {children}\n </components.Control>\n );\n };\n\nexport const CustomIndicatorsContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: IndicatorsContainerProps) {\n const classes = classNames('ndl-select-indicators-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.IndicatorsContainer {...restProps} className={classes}>\n {children}\n </components.IndicatorsContainer>\n );\n };\n\nexport const CustomValueContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: ValueContainerProps) {\n const classes = classNames('ndl-select-value-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.ValueContainer {...restProps} className={classes}>\n {children}\n </components.ValueContainer>\n );\n };\n\nexport const CustomInput = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: InputProps) {\n const classes = classNames('ndl-select-input', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.Input {...restProps} className={classes} />;\n };\n\nexport const CustomSingleValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: SingleValueProps) {\n const classes = classNames('ndl-select-single-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.SingleValue {...restProps} className={classes} />;\n };\n\n/** Overrides that are part of the popover menu */\n\nexport const CustomMenu = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: MenuProps) {\n const { themeClassName } = useNeedleTheme();\n const classes = classNames('ndl-select-menu', className, themeClassName, {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Menu {...restProps} className={classes}>\n {children}\n </components.Menu>\n );\n };\n\nexport const CustomMenuPortal = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuPortalProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-portal', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuPortal {...restProps} className={classes}>\n {children}\n </components.MenuPortal>\n );\n };\n\nexport const CustomMenuList = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuListProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-list', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuList {...restProps} className={classes}>\n {children}\n </components.MenuList>\n );\n };\n\nexport const CustomOption = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: OptionProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-option', {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-selected': restProps.isSelected,\n 'ndl-small': size === 'small',\n });\n const optionInnerProps = shiftOptionClickToMouseUp(restProps.innerProps);\n\n return (\n <components.Option\n {...restProps}\n className={classes}\n innerProps={optionInnerProps}\n >\n {restProps.isMulti === true && (\n <Checkbox\n isChecked={restProps.isSelected}\n ariaLabel={restProps.label}\n isDisabled={restProps.isDisabled}\n htmlAttributes={{\n 'aria-hidden': true,\n disabled: true,\n onPointerDown: (e) => {\n e.preventDefault();\n },\n onPointerUp: (e) => {\n restProps.innerProps.onClick?.(e);\n },\n onTouchEnd: (e) => {\n restProps.innerProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n },\n onTouchStart: (e) => {\n e.preventDefault();\n },\n role: 'presentation',\n tabIndex: -1,\n }}\n />\n )}\n {children}\n </components.Option>\n );\n };\n"]}
|
|
@@ -35,6 +35,7 @@ import { needleWarningMessage } from '../_common/utils';
|
|
|
35
35
|
import { LoadingSpinner } from '../loading-spinner';
|
|
36
36
|
import { Tooltip } from '../tooltip';
|
|
37
37
|
export const IconButtonBase = (_a) => {
|
|
38
|
+
var _b;
|
|
38
39
|
var { children, as, iconButtonVariant = 'default', isLoading = false, isDisabled = false, size = 'medium', isFloating = false,
|
|
39
40
|
// Does not have a default value to avoid setting aria-pressed to true if not explicitly set
|
|
40
41
|
isActive = undefined, description, tooltipProps, className, style, variant = 'neutral', htmlAttributes, onClick, ref } = _a, restProps = __rest(_a, ["children", "as", "iconButtonVariant", "isLoading", "isDisabled", "size", "isFloating", "isActive", "description", "tooltipProps", "className", "style", "variant", "htmlAttributes", "onClick", "ref"]);
|
|
@@ -76,6 +77,6 @@ export const IconButtonBase = (_a) => {
|
|
|
76
77
|
return (_jsxs(Tooltip, Object.assign({ hoverDelay: {
|
|
77
78
|
close: 0,
|
|
78
79
|
open: 500,
|
|
79
|
-
} }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, {
|
|
80
|
+
}, isDisabled: description === null || isDisabled, type: "simple" }, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.root, { children: [_jsx(Tooltip.Trigger, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.trigger, { hasButtonWrapper: true, children: _jsx(Component, Object.assign({ type: "button", onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, "aria-label": description, "aria-pressed": isActive, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: _jsx("div", { className: "ndl-icon-btn-inner", children: isLoading ? (_jsx(LoadingSpinner, { size: "small" })) : (_jsx("div", { className: "ndl-icon", children: children })) }) })) })), _jsx(Tooltip.Content, Object.assign({}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content, { children: description !== null && description !== void 0 ? description : (_b = tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content) === null || _b === void 0 ? void 0 : _b.children }))] })));
|
|
80
81
|
};
|
|
81
82
|
//# sourceMappingURL=IconButtonBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButtonBase.js","sourceRoot":"","sources":["../../../src/icon-button-base/IconButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA8CrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAyC,EAmBtB,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"IconButtonBase.js","sourceRoot":"","sources":["../../../src/icon-button-base/IconButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA8CrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAyC,EAmBtB,EAAE,EAAE;;QAnBkB,EACrE,QAAQ,EACR,EAAE,EACF,iBAAiB,GAAG,SAAS,EAC7B,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK;IAClB,4FAA4F;IAC5F,QAAQ,GAAG,SAAS,EACpB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,GAAG,SAAS,EACnB,cAAc,EACd,OAAO,EACP,GAAG,OAE4C,EAD5C,SAAS,cAlByD,wMAmBtE,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,QAAQ,CAAC;IAEpD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WAAW,KAAK,IAAI,IAAI,UAAU,EAC9C,IAAI,EAAC,QAAQ,IACT,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,eAEtB,KAAC,OAAO,CAAC,OAAO,oBAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,IAAE,gBAAgB,kBAC1D,KAAC,SAAS,kBACR,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,mBACL,CAAC,cAAc,gBAClB,WAAW,kBACT,QAAQ,EACtB,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAElB,cAAK,SAAS,EAAC,oBAAoB,YAChC,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,cAAc,IAAC,IAAI,EAAC,OAAO,GAAG,CAChC,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,UAAU,YAAE,QAAQ,GAAO,CAC3C,GACG,IACI,IACI,EAClB,KAAC,OAAO,CAAC,OAAO,oBAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,cACvC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,OAAO,0CAAE,QAAQ,IAC/B,KACV,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type TooltipObjectProps,\n} from '../_common/types';\nimport { needleWarningMessage } from '../_common/utils';\nimport { type ButtonSizes } from '../button';\nimport { LoadingSpinner } from '../loading-spinner';\nimport { Tooltip } from '../tooltip';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\nexport type IconButtonBaseProps = {\n children?: React.ReactNode;\n\n /** If the icon button is in disabled state */\n isDisabled?: boolean;\n\n /** If the button is doing something Async, it will display a loading spinner */\n isLoading?: boolean;\n\n /** Size of button */\n size?: ButtonSizes;\n\n /** If the button is in floating state */\n isFloating?: boolean;\n\n /** Active - used for open context menus for example */\n isActive?: boolean;\n\n /** A string that will be shown as a tooltip when hovering over the button it also acts as an aria-label- {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label} */\n description: string | null;\n\n /** Variant of the button */\n variant?: 'neutral' | 'danger';\n\n /** Variant of the button */\n iconButtonVariant?: 'default' | 'clean';\n\n /**\n * Props for the tooltip component.\n */\n tooltipProps?: TooltipObjectProps;\n\n /** Click handler */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n};\n\nexport const IconButtonBase = <T extends React.ElementType = 'button'>({\n children,\n as,\n iconButtonVariant = 'default',\n isLoading = false,\n isDisabled = false,\n size = 'medium',\n isFloating = false,\n // Does not have a default value to avoid setting aria-pressed to true if not explicitly set\n isActive = undefined,\n description,\n tooltipProps,\n className,\n style,\n variant = 'neutral',\n htmlAttributes,\n onClick,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, IconButtonBaseProps>) => {\n const Component: React.ElementType = as ?? 'button';\n\n const isInteractable = !isDisabled && !isLoading;\n\n const isClean = iconButtonVariant === 'clean';\n const isDanger = variant === 'danger';\n\n const classes = classNames('ndl-icon-btn', className, {\n 'ndl-active': Boolean(isActive),\n 'ndl-clean': isClean,\n 'ndl-danger': isDanger,\n 'ndl-disabled': isDisabled,\n 'ndl-floating': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-loading': isLoading,\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n if (isClean && isFloating) {\n throw new Error(\n 'BaseIconButton: Cannot use isFloating and iconButtonVariant=\"clean\" at the same time.',\n );\n }\n\n if (!description && !htmlAttributes?.['aria-label']) {\n needleWarningMessage(\n 'Icon buttons do not have text, be sure to include a description or an aria-label for screen readers link: https://dequeuniversity.com/rules/axe/4.4/button-name?application=axeAPI',\n );\n }\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!isInteractable) {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <Tooltip\n hoverDelay={{\n close: 0,\n open: 500,\n }}\n isDisabled={description === null || isDisabled}\n type=\"simple\"\n {...tooltipProps?.root}\n >\n <Tooltip.Trigger {...tooltipProps?.trigger} hasButtonWrapper>\n <Component\n type=\"button\"\n onClick={handleClick}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n aria-label={description}\n aria-pressed={isActive}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-icon-btn-inner\">\n {isLoading ? (\n <LoadingSpinner size=\"small\" />\n ) : (\n <div className=\"ndl-icon\">{children}</div>\n )}\n </div>\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n {description ?? tooltipProps?.content?.children}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n"]}
|
|
@@ -37,6 +37,53 @@ import { Checkbox } from '../checkbox';
|
|
|
37
37
|
import { ChevronDownIconOutline, XMarkIconOutline } from '../icons';
|
|
38
38
|
import { Tag } from '../tag';
|
|
39
39
|
import { useNeedleTheme } from '../theme';
|
|
40
|
+
/**
|
|
41
|
+
* React-select triggers control/indicator interactions on mouseDown which breaks WCAG 2.5.2 Pointer Cancellation.
|
|
42
|
+
* This helper shifts mouseDown to mouseUp to allow users to cancel by dragging away.
|
|
43
|
+
*/
|
|
44
|
+
const shiftMouseDownToMouseUp = (innerProps, stopPropagation = false) => {
|
|
45
|
+
const baseProps = innerProps !== null && innerProps !== void 0 ? innerProps : {};
|
|
46
|
+
const maybeStopPropagation = (e) => stopPropagation && e.stopPropagation();
|
|
47
|
+
return Object.assign(Object.assign({}, baseProps), { onMouseDown: (e) => {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
maybeStopPropagation(e);
|
|
50
|
+
}, onMouseUp: (e) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
(_a = baseProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(baseProps, e);
|
|
53
|
+
(_b = baseProps.onMouseDown) === null || _b === void 0 ? void 0 : _b.call(baseProps, e);
|
|
54
|
+
maybeStopPropagation(e);
|
|
55
|
+
}, onTouchEnd: (e) => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
(_a = baseProps.onTouchEnd) === null || _a === void 0 ? void 0 : _a.call(baseProps, e);
|
|
58
|
+
(_b = baseProps.onMouseDown) === null || _b === void 0 ? void 0 : _b.call(baseProps, e);
|
|
59
|
+
maybeStopPropagation(e);
|
|
60
|
+
}, onTouchStart: (e) => {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
maybeStopPropagation(e);
|
|
63
|
+
} });
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* React-select triggers option selection on click which fires on mouseDown.
|
|
67
|
+
* This helper shifts the click handler to mouseUp/touchEnd to allow users to cancel by dragging away.
|
|
68
|
+
*/
|
|
69
|
+
const shiftOptionClickToMouseUp = (innerProps) => {
|
|
70
|
+
const baseProps = innerProps !== null && innerProps !== void 0 ? innerProps : {};
|
|
71
|
+
return Object.assign(Object.assign({}, baseProps), {
|
|
72
|
+
// Remove onClick to prevent double-execution (onMouseUp already calls it, and browser would fire click after mouseup)
|
|
73
|
+
onClick: undefined, onMouseDown: (event) => {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
}, onMouseUp: (event) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
(_a = baseProps.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(baseProps, event);
|
|
78
|
+
(_b = baseProps.onClick) === null || _b === void 0 ? void 0 : _b.call(baseProps, event);
|
|
79
|
+
}, onTouchEnd: (event) => {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
(_a = baseProps.onTouchEnd) === null || _a === void 0 ? void 0 : _a.call(baseProps, event);
|
|
82
|
+
(_b = baseProps.onClick) === null || _b === void 0 ? void 0 : _b.call(baseProps, event);
|
|
83
|
+
}, onTouchStart: (event) => {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
} });
|
|
86
|
+
};
|
|
40
87
|
export const DropdownIndicatorCurrying = ({ size, }) => function Component(props) {
|
|
41
88
|
const classes = classNames('ndl-select-dropdown-indicator', {
|
|
42
89
|
'ndl-disabled': props.isDisabled,
|
|
@@ -46,7 +93,9 @@ export const DropdownIndicatorCurrying = ({ size, }) => function Component(props
|
|
|
46
93
|
'ndl-medium': size === 'medium',
|
|
47
94
|
'ndl-small': size === 'small',
|
|
48
95
|
});
|
|
49
|
-
|
|
96
|
+
// stopPropagation so that we prevent the control from also toggling the menu (double-toggle)
|
|
97
|
+
const indicatorInnerProps = shiftMouseDownToMouseUp(props.innerProps, true);
|
|
98
|
+
return (_jsx(components.DropdownIndicator, Object.assign({}, props, { className: classes, innerProps: indicatorInnerProps, children: _jsx(ChevronDownIconOutline, { className: "ndl-select-icon", style: {
|
|
50
99
|
transform: props.selectProps.menuIsOpen
|
|
51
100
|
? 'rotate(180deg)'
|
|
52
101
|
: 'rotate(0deg)',
|
|
@@ -54,7 +103,7 @@ export const DropdownIndicatorCurrying = ({ size, }) => function Component(props
|
|
|
54
103
|
} }) })));
|
|
55
104
|
};
|
|
56
105
|
export const CustomClearIndication = ({ size, }) => function Component(_a) {
|
|
57
|
-
var { className } = _a, restProps = __rest(_a, ["className"]);
|
|
106
|
+
var { className, innerProps } = _a, restProps = __rest(_a, ["className", "innerProps"]);
|
|
58
107
|
const classes = classNames('ndl-select-clear', className, {
|
|
59
108
|
'ndl-focused': restProps.isFocused,
|
|
60
109
|
'ndl-is-multi': restProps.isMulti,
|
|
@@ -62,7 +111,26 @@ export const CustomClearIndication = ({ size, }) => function Component(_a) {
|
|
|
62
111
|
'ndl-medium': size === 'medium',
|
|
63
112
|
'ndl-small': size === 'small',
|
|
64
113
|
});
|
|
65
|
-
|
|
114
|
+
const handleClear = () => {
|
|
115
|
+
var _a;
|
|
116
|
+
(_a = restProps.clearValue) === null || _a === void 0 ? void 0 : _a.call(restProps);
|
|
117
|
+
};
|
|
118
|
+
// Stop propagation to prevent react-select's keyboard handling.
|
|
119
|
+
const handleKeyDown = (event) => {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
if (event.key === '') {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
}
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
(_b = (_a = event.nativeEvent).stopImmediatePropagation) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
126
|
+
};
|
|
127
|
+
// Prevent react-select's default clear-on-mousedown/touchend behavior.
|
|
128
|
+
const preventAndStop = (e) => {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
};
|
|
132
|
+
const safeInnerProps = Object.assign(Object.assign({}, innerProps), { 'aria-hidden': undefined, onMouseDown: preventAndStop, onTouchEnd: preventAndStop });
|
|
133
|
+
return (_jsxs(components.ClearIndicator, Object.assign({ className: classes, innerProps: safeInnerProps }, restProps, { children: [_jsx("button", { type: "button", className: "ndl-select-clear-button", onClick: handleClear, onKeyDown: handleKeyDown, "aria-label": "Clear selection", children: _jsx(XMarkIconOutline, {}) }), _jsx("div", { className: "ndl-select-divider" })] })));
|
|
66
134
|
};
|
|
67
135
|
export const CustomMultiValue = ({ size, }) => function Component(_a) {
|
|
68
136
|
var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
|
|
@@ -108,7 +176,8 @@ export const CustomControl = ({ size, isClean, errorText, }) => function Compone
|
|
|
108
176
|
'ndl-medium': size === 'medium',
|
|
109
177
|
'ndl-small': size === 'small',
|
|
110
178
|
});
|
|
111
|
-
|
|
179
|
+
const controlInnerProps = shiftMouseDownToMouseUp(restProps.innerProps);
|
|
180
|
+
return (_jsx(components.Control, Object.assign({}, restProps, { className: classes, innerProps: controlInnerProps, children: children })));
|
|
112
181
|
};
|
|
113
182
|
export const CustomIndicatorsContainer = ({ size, }) => function Component(_a) {
|
|
114
183
|
var { children, className } = _a, restProps = __rest(_a, ["children", "className"]);
|
|
@@ -197,19 +266,24 @@ export const CustomOption = ({ size, }) => function Component(_a) {
|
|
|
197
266
|
'ndl-selected': restProps.isSelected,
|
|
198
267
|
'ndl-small': size === 'small',
|
|
199
268
|
});
|
|
200
|
-
|
|
269
|
+
const optionInnerProps = shiftOptionClickToMouseUp(restProps.innerProps);
|
|
270
|
+
return (_jsxs(components.Option, Object.assign({}, restProps, { className: classes, innerProps: optionInnerProps, children: [restProps.isMulti === true && (_jsx(Checkbox, { isChecked: restProps.isSelected, ariaLabel: restProps.label, isDisabled: restProps.isDisabled, htmlAttributes: {
|
|
201
271
|
'aria-hidden': true,
|
|
202
272
|
disabled: true,
|
|
203
273
|
onPointerDown: (e) => {
|
|
204
|
-
var _a, _b;
|
|
205
274
|
e.preventDefault();
|
|
275
|
+
},
|
|
276
|
+
onPointerUp: (e) => {
|
|
277
|
+
var _a, _b;
|
|
206
278
|
(_b = (_a = restProps.innerProps).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
207
279
|
},
|
|
208
|
-
|
|
280
|
+
onTouchEnd: (e) => {
|
|
209
281
|
var _a, _b;
|
|
210
|
-
e.preventDefault();
|
|
211
282
|
(_b = (_a = restProps.innerProps).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
212
283
|
},
|
|
284
|
+
onTouchStart: (e) => {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
},
|
|
213
287
|
role: 'presentation',
|
|
214
288
|
tabIndex: -1,
|
|
215
289
|
} })), children] })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overrides.js","sourceRoot":"","sources":["../../../src/select/Overrides.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAEL,UAAU,GAYX,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAIvC,EACA,IAAI,GACsD,EAAE,EAAE,CAC9D,SAAS,SAAS,CAChB,KAA6D;IAE7D,MAAM,OAAO,GAAG,UAAU,CAAC,+BAA+B,EAAE;QAC1D,cAAc,EAAE,KAAK,CAAC,UAAU;QAChC,aAAa,EAAE,KAAK,CAAC,SAAS;QAC9B,cAAc,EAAE,KAAK,CAAC,OAAO;QAC7B,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,YAAY,EAAE,IAAI,KAAK,QAAQ;QAC/B,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,UAAU,CAAC,iBAAiB,oBAAK,KAAK,IAAE,SAAS,EAAE,OAAO,YACzD,KAAC,sBAAsB,IACrB,SAAS,EAAC,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AI,KAAK,OAAO;QAC7B,YAAY,EAAE,IAAI,KAAK,QAAQ;QAC/B,cAAc,EAAE,SAAS,CAAC,UAAU;QACpC,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IACH,OAAO,CACL,MAAC,UAAU,CAAC,MAAM,oBAAK,SAAS,IAAE,SAAS,EAAE,OAAO,aACjD,SAAS,CAAC,OAAO,KAAK,IAAI,IAAI,CAC7B,KAAC,QAAQ,IACP,SAAS,EAAE,SAAS,CAAC,UAAU,EAC/B,SAAS,EAAE,SAAS,CAAC,KAAK,EAC1B,UAAU,EAAE,SAAS,CAAC,UAAU,EAChC,cAAc,EAAE;oBACd,aAAa,EAAE,IAAI;oBACnB,QAAQ,EAAE,IAAI;oBACd,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE;;wBACnB,CAAC,CAAC,cAAc,EAAE,CAAC;wBACnB,MAAA,MAAA,SAAS,CAAC,UAAU,EAAC,OAAO,mDAAG,CAAC,CAAC,CAAC;oBACpC,CAAC;oBACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;;wBAClB,CAAC,CAAC,cAAc,EAAE,CAAC;wBACnB,MAAA,MAAA,SAAS,CAAC,UAAU,EAAC,OAAO,mDAC1B,CAA4D,CAC7D,CAAC;oBACJ,CAAC;oBACD,IAAI,EAAE,cAAc;oBACpB,QAAQ,EAAE,CAAC,CAAC;iBACb,GACD,CACH,EACA,QAAQ,KACS,CACrB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport {\n type ClearIndicatorProps,\n components,\n type ControlProps,\n type DropdownIndicatorProps,\n type GroupBase,\n type IndicatorsContainerProps,\n type InputProps,\n type MenuProps,\n type MultiValueProps,\n type OptionProps,\n type PlaceholderProps,\n type SingleValueProps,\n type ValueContainerProps,\n} from 'react-select';\nimport {\n type MenuListProps,\n type MenuPortalProps,\n} from 'react-select/dist/declarations/src/components/Menu';\n\nimport { Checkbox } from '../checkbox';\nimport { ChevronDownIconOutline, XMarkIconOutline } from '../icons';\nimport { Tag } from '../tag';\nimport { useNeedleTheme } from '../theme';\nimport { type SelectOverrideCustomProps } from './types';\n\nexport const DropdownIndicatorCurrying = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component(\n props: DropdownIndicatorProps<OptionType, IsMulti, GroupType>,\n ) {\n const classes = classNames('ndl-select-dropdown-indicator', {\n 'ndl-disabled': props.isDisabled,\n 'ndl-focused': props.isFocused,\n 'ndl-is-multi': props.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n return (\n <components.DropdownIndicator {...props} className={classes}>\n <ChevronDownIconOutline\n className=\"ndl-select-icon\"\n style={{\n transform: props.selectProps.menuIsOpen\n ? 'rotate(180deg)'\n : 'rotate(0deg)',\n transitionDuration: tokens.motion.duration.quick,\n }}\n />\n </components.DropdownIndicator>\n );\n };\n\nexport const CustomClearIndication = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n className,\n ...restProps\n }: ClearIndicatorProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-clear', className, {\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.ClearIndicator {...restProps} className={classes}>\n <div>\n <XMarkIconOutline />\n <div className=\"ndl-select-divider\" />\n </div>\n </components.ClearIndicator>\n );\n };\n\nexport const CustomMultiValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MultiValueProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-multi-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MultiValueContainer\n {...restProps}\n innerProps={{\n className: classes,\n }}\n >\n <Tag\n size={size}\n onClick={(e) => {\n e.preventDefault();\n restProps.removeProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n }}\n htmlAttributes={{\n onMouseDown: (e) => e.preventDefault(),\n }}\n >\n {children}\n </Tag>\n </components.MultiValueContainer>\n );\n };\n\nexport const CustomPlaceholder = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: PlaceholderProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-placeholder', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Placeholder {...restProps} className={classes}>\n {children}\n </components.Placeholder>\n );\n };\n\nexport const CustomControl = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n isClean,\n errorText,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: ControlProps) {\n const classes = classNames('ndl-select-control', className, {\n 'ndl-clean': isClean,\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-has-error': !!errorText,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n return (\n <components.Control {...restProps} className={classes}>\n {children}\n </components.Control>\n );\n };\n\nexport const CustomIndicatorsContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: IndicatorsContainerProps) {\n const classes = classNames('ndl-select-indicators-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.IndicatorsContainer {...restProps} className={classes}>\n {children}\n </components.IndicatorsContainer>\n );\n };\n\nexport const CustomValueContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: ValueContainerProps) {\n const classes = classNames('ndl-select-value-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.ValueContainer {...restProps} className={classes}>\n {children}\n </components.ValueContainer>\n );\n };\n\nexport const CustomInput = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: InputProps) {\n const classes = classNames('ndl-select-input', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.Input {...restProps} className={classes} />;\n };\n\nexport const CustomSingleValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: SingleValueProps) {\n const classes = classNames('ndl-select-single-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.SingleValue {...restProps} className={classes} />;\n };\n\n/** Overrides that are part of the popover menu */\n\nexport const CustomMenu = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: MenuProps) {\n const { themeClassName } = useNeedleTheme();\n const classes = classNames('ndl-select-menu', className, themeClassName, {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Menu {...restProps} className={classes}>\n {children}\n </components.Menu>\n );\n };\n\nexport const CustomMenuPortal = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuPortalProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-portal', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuPortal {...restProps} className={classes}>\n {children}\n </components.MenuPortal>\n );\n };\n\nexport const CustomMenuList = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuListProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-list', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuList {...restProps} className={classes}>\n {children}\n </components.MenuList>\n );\n };\n\nexport const CustomOption = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: OptionProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-option', {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-selected': restProps.isSelected,\n 'ndl-small': size === 'small',\n });\n return (\n <components.Option {...restProps} className={classes}>\n {restProps.isMulti === true && (\n <Checkbox\n isChecked={restProps.isSelected}\n ariaLabel={restProps.label}\n isDisabled={restProps.isDisabled}\n htmlAttributes={{\n 'aria-hidden': true,\n disabled: true,\n onPointerDown: (e) => {\n e.preventDefault();\n restProps.innerProps.onClick?.(e);\n },\n onTouchStart: (e) => {\n e.preventDefault();\n restProps.innerProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n },\n role: 'presentation',\n tabIndex: -1,\n }}\n />\n )}\n {children}\n </components.Option>\n );\n };\n"]}
|
|
1
|
+
{"version":3,"file":"Overrides.js","sourceRoot":"","sources":["../../../src/select/Overrides.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAEL,UAAU,GAYX,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG1C;;;GAGG;AACH,MAAM,uBAAuB,GAAG,CAC9B,UAAiD,EACjD,eAAe,GAAG,KAAK,EACe,EAAE;IACxC,MAAM,SAAS,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC;IACnC,MAAM,oBAAoB,GAAG,CAAC,CAAuB,EAAE,EAAE,CACvD,eAAe,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEzC,uCACK,SAAS,KACZ,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;YACjB,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,oBAAoB,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;;YACf,MAAA,SAAS,CAAC,SAAS,0DAAG,CAAC,CAAC,CAAC;YACzB,MAAA,SAAS,CAAC,WAAW,0DAAG,CA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,EAAE,CAAC;oBACrB,CAAC;oBACD,IAAI,EAAE,cAAc;oBACpB,QAAQ,EAAE,CAAC,CAAC;iBACb,GACD,CACH,EACA,QAAQ,KACS,CACrB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport {\n type ClearIndicatorProps,\n components,\n type ControlProps,\n type DropdownIndicatorProps,\n type GroupBase,\n type IndicatorsContainerProps,\n type InputProps,\n type MenuProps,\n type MultiValueProps,\n type OptionProps,\n type PlaceholderProps,\n type SingleValueProps,\n type ValueContainerProps,\n} from 'react-select';\nimport {\n type MenuListProps,\n type MenuPortalProps,\n} from 'react-select/dist/declarations/src/components/Menu';\n\nimport { Checkbox } from '../checkbox';\nimport { ChevronDownIconOutline, XMarkIconOutline } from '../icons';\nimport { Tag } from '../tag';\nimport { useNeedleTheme } from '../theme';\nimport { type SelectOverrideCustomProps } from './types';\n\n/**\n * React-select triggers control/indicator interactions on mouseDown which breaks WCAG 2.5.2 Pointer Cancellation.\n * This helper shifts mouseDown to mouseUp to allow users to cancel by dragging away.\n */\nconst shiftMouseDownToMouseUp = (\n innerProps?: React.HTMLAttributes<HTMLDivElement>,\n stopPropagation = false,\n): React.HTMLAttributes<HTMLDivElement> => {\n const baseProps = innerProps ?? {};\n const maybeStopPropagation = (e: React.SyntheticEvent) =>\n stopPropagation && e.stopPropagation();\n\n return {\n ...baseProps,\n onMouseDown: (e) => {\n e.preventDefault();\n maybeStopPropagation(e);\n },\n onMouseUp: (e) => {\n baseProps.onMouseUp?.(e);\n baseProps.onMouseDown?.(e);\n maybeStopPropagation(e);\n },\n onTouchEnd: (e) => {\n baseProps.onTouchEnd?.(e);\n baseProps.onMouseDown?.(e as unknown as React.MouseEvent<HTMLDivElement>);\n maybeStopPropagation(e);\n },\n onTouchStart: (e) => {\n e.preventDefault();\n maybeStopPropagation(e);\n },\n };\n};\n\n/**\n * React-select triggers option selection on click which fires on mouseDown.\n * This helper shifts the click handler to mouseUp/touchEnd to allow users to cancel by dragging away.\n */\nconst shiftOptionClickToMouseUp = (\n innerProps?: React.HTMLAttributes<HTMLDivElement>,\n): React.HTMLAttributes<HTMLDivElement> => {\n const baseProps = innerProps ?? {};\n\n return {\n ...baseProps,\n // Remove onClick to prevent double-execution (onMouseUp already calls it, and browser would fire click after mouseup)\n onClick: undefined,\n onMouseDown: (event: React.MouseEvent<HTMLDivElement>) => {\n event.preventDefault();\n },\n onMouseUp: (event: React.MouseEvent<HTMLDivElement>) => {\n baseProps.onMouseUp?.(event);\n baseProps.onClick?.(event);\n },\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => {\n baseProps.onTouchEnd?.(event);\n baseProps.onClick?.(event as unknown as React.MouseEvent<HTMLDivElement>);\n },\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n },\n };\n};\n\nexport const DropdownIndicatorCurrying = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component(\n props: DropdownIndicatorProps<OptionType, IsMulti, GroupType>,\n ) {\n const classes = classNames('ndl-select-dropdown-indicator', {\n 'ndl-disabled': props.isDisabled,\n 'ndl-focused': props.isFocused,\n 'ndl-is-multi': props.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n // stopPropagation so that we prevent the control from also toggling the menu (double-toggle)\n const indicatorInnerProps = shiftMouseDownToMouseUp(props.innerProps, true);\n\n return (\n <components.DropdownIndicator\n {...props}\n className={classes}\n innerProps={indicatorInnerProps}\n >\n <ChevronDownIconOutline\n className=\"ndl-select-icon\"\n style={{\n transform: props.selectProps.menuIsOpen\n ? 'rotate(180deg)'\n : 'rotate(0deg)',\n transitionDuration: tokens.motion.duration.quick,\n }}\n />\n </components.DropdownIndicator>\n );\n };\n\nexport const CustomClearIndication = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n className,\n innerProps,\n ...restProps\n }: ClearIndicatorProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-clear', className, {\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n const handleClear = () => {\n restProps.clearValue?.();\n };\n\n // Stop propagation to prevent react-select's keyboard handling.\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === '') {\n event.preventDefault();\n }\n event.stopPropagation();\n event.nativeEvent.stopImmediatePropagation?.();\n };\n\n // Prevent react-select's default clear-on-mousedown/touchend behavior.\n const preventAndStop = (e: React.SyntheticEvent) => {\n e.preventDefault();\n e.stopPropagation();\n };\n\n const safeInnerProps: typeof innerProps = {\n ...innerProps,\n 'aria-hidden': undefined, // Remove to allow focusable button inside\n onMouseDown: preventAndStop,\n onTouchEnd: preventAndStop,\n };\n\n return (\n <components.ClearIndicator\n className={classes}\n innerProps={safeInnerProps}\n {...restProps}\n >\n <button\n type=\"button\"\n className=\"ndl-select-clear-button\"\n onClick={handleClear}\n onKeyDown={handleKeyDown}\n aria-label=\"Clear selection\"\n >\n <XMarkIconOutline />\n </button>\n <div className=\"ndl-select-divider\" />\n </components.ClearIndicator>\n );\n };\n\nexport const CustomMultiValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MultiValueProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-multi-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MultiValueContainer\n {...restProps}\n innerProps={{\n className: classes,\n }}\n >\n <Tag\n size={size}\n onClick={(e) => {\n e.preventDefault();\n restProps.removeProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n }}\n htmlAttributes={{\n onMouseDown: (e) => e.preventDefault(),\n }}\n >\n {children}\n </Tag>\n </components.MultiValueContainer>\n );\n };\n\nexport const CustomPlaceholder = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: PlaceholderProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames('ndl-select-placeholder', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Placeholder {...restProps} className={classes}>\n {children}\n </components.Placeholder>\n );\n };\n\nexport const CustomControl = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n isClean,\n errorText,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: ControlProps) {\n const classes = classNames('ndl-select-control', className, {\n 'ndl-clean': isClean,\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-has-error': !!errorText,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n\n const controlInnerProps = shiftMouseDownToMouseUp(restProps.innerProps);\n\n return (\n <components.Control\n {...restProps}\n className={classes}\n innerProps={controlInnerProps}\n >\n {children}\n </components.Control>\n );\n };\n\nexport const CustomIndicatorsContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: IndicatorsContainerProps) {\n const classes = classNames('ndl-select-indicators-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.IndicatorsContainer {...restProps} className={classes}>\n {children}\n </components.IndicatorsContainer>\n );\n };\n\nexport const CustomValueContainer = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: ValueContainerProps) {\n const classes = classNames('ndl-select-value-container', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.ValueContainer {...restProps} className={classes}>\n {children}\n </components.ValueContainer>\n );\n };\n\nexport const CustomInput = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: InputProps) {\n const classes = classNames('ndl-select-input', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.Input {...restProps} className={classes} />;\n };\n\nexport const CustomSingleValue = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ className, ...restProps }: SingleValueProps) {\n const classes = classNames('ndl-select-single-value', className, {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return <components.SingleValue {...restProps} className={classes} />;\n };\n\n/** Overrides that are part of the popover menu */\n\nexport const CustomMenu = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({ children, className, ...restProps }: MenuProps) {\n const { themeClassName } = useNeedleTheme();\n const classes = classNames('ndl-select-menu', className, themeClassName, {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.Menu {...restProps} className={classes}>\n {children}\n </components.Menu>\n );\n };\n\nexport const CustomMenuPortal = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuPortalProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-portal', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuPortal {...restProps} className={classes}>\n {children}\n </components.MenuPortal>\n );\n };\n\nexport const CustomMenuList = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: MenuListProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-menu-list', {\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-small': size === 'small',\n });\n return (\n <components.MenuList {...restProps} className={classes}>\n {children}\n </components.MenuList>\n );\n };\n\nexport const CustomOption = <\n OptionType,\n IsMulti extends boolean = false,\n GroupType extends GroupBase<OptionType> = GroupBase<OptionType>,\n>({\n size,\n}: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) =>\n function Component({\n children,\n className,\n ...restProps\n }: OptionProps<OptionType, IsMulti, GroupType>) {\n const classes = classNames(className, 'ndl-select-option', {\n 'ndl-disabled': restProps.isDisabled,\n 'ndl-focused': restProps.isFocused,\n 'ndl-is-multi': restProps.isMulti,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-selected': restProps.isSelected,\n 'ndl-small': size === 'small',\n });\n const optionInnerProps = shiftOptionClickToMouseUp(restProps.innerProps);\n\n return (\n <components.Option\n {...restProps}\n className={classes}\n innerProps={optionInnerProps}\n >\n {restProps.isMulti === true && (\n <Checkbox\n isChecked={restProps.isSelected}\n ariaLabel={restProps.label}\n isDisabled={restProps.isDisabled}\n htmlAttributes={{\n 'aria-hidden': true,\n disabled: true,\n onPointerDown: (e) => {\n e.preventDefault();\n },\n onPointerUp: (e) => {\n restProps.innerProps.onClick?.(e);\n },\n onTouchEnd: (e) => {\n restProps.innerProps.onClick?.(\n e as unknown as React.MouseEvent<HTMLDivElement, MouseEvent>,\n );\n },\n onTouchStart: (e) => {\n e.preventDefault();\n },\n role: 'presentation',\n tabIndex: -1,\n }}\n />\n )}\n {children}\n </components.Option>\n );\n };\n"]}
|
|
@@ -22,7 +22,7 @@ import { type ClearIndicatorProps, type ControlProps, type DropdownIndicatorProp
|
|
|
22
22
|
import { type MenuListProps, type MenuPortalProps } from 'react-select/dist/declarations/src/components/Menu';
|
|
23
23
|
import { type SelectOverrideCustomProps } from './types';
|
|
24
24
|
export declare const DropdownIndicatorCurrying: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ size, }: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) => (props: DropdownIndicatorProps<OptionType, IsMulti, GroupType>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export declare const CustomClearIndication: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ size, }: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) => ({ className, ...restProps }: ClearIndicatorProps<OptionType, IsMulti, GroupType>) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const CustomClearIndication: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ size, }: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) => ({ className, innerProps, ...restProps }: ClearIndicatorProps<OptionType, IsMulti, GroupType>) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
export declare const CustomMultiValue: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ size, }: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) => ({ children, className, ...restProps }: MultiValueProps<OptionType, IsMulti, GroupType>) => import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
export declare const CustomPlaceholder: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ size, }: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) => ({ children, className, ...restProps }: PlaceholderProps<OptionType, IsMulti, GroupType>) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export declare const CustomControl: <OptionType, IsMulti extends boolean = false, GroupType extends GroupBase<OptionType> = GroupBase<OptionType>>({ size, isClean, errorText, }: SelectOverrideCustomProps<OptionType, IsMulti, GroupType>) => ({ children, className, ...restProps }: ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Overrides.d.ts","sourceRoot":"","sources":["../../../src/select/Overrides.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,oDAAoD,CAAC;AAM5D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Overrides.d.ts","sourceRoot":"","sources":["../../../src/select/Overrides.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.9",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@tanstack/react-table": "8.21.3",
|
|
86
86
|
"react": ">=19.0.0",
|
|
87
87
|
"react-dom": ">=19.0.0",
|
|
88
|
-
"@neo4j-ndl/base": "^4.9.
|
|
88
|
+
"@neo4j-ndl/base": "^4.9.3"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@dnd-kit/core": "6.3.1",
|