@deephaven/components 0.71.1-beta.3 → 0.72.1-alpha-list-view.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button.d.ts +1 -1
- package/dist/SearchInput.css +10 -12
- package/dist/SearchInput.css.map +1 -1
- package/dist/Select.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/spectrum/Heading.d.ts +4 -1
- package/dist/spectrum/Heading.d.ts.map +1 -1
- package/dist/spectrum/Heading.js +5 -3
- package/dist/spectrum/Heading.js.map +1 -1
- package/dist/spectrum/ItemContent.d.ts +15 -0
- package/dist/spectrum/ItemContent.d.ts.map +1 -0
- package/dist/spectrum/{picker/PickerItemContent.js → ItemContent.js} +42 -18
- package/dist/spectrum/ItemContent.js.map +1 -0
- package/dist/spectrum/ItemTooltip.d.ts +12 -0
- package/dist/spectrum/ItemTooltip.d.ts.map +1 -0
- package/dist/spectrum/ItemTooltip.js +30 -0
- package/dist/spectrum/ItemTooltip.js.map +1 -0
- package/dist/spectrum/Text.d.ts +4 -1
- package/dist/spectrum/Text.d.ts.map +1 -1
- package/dist/spectrum/Text.js +5 -4
- package/dist/spectrum/Text.js.map +1 -1
- package/dist/spectrum/View.d.ts +4 -1
- package/dist/spectrum/View.d.ts.map +1 -1
- package/dist/spectrum/View.js +5 -3
- package/dist/spectrum/View.js.map +1 -1
- package/dist/spectrum/collections.d.ts +1 -1
- package/dist/spectrum/collections.d.ts.map +1 -1
- package/dist/spectrum/collections.js +1 -1
- package/dist/spectrum/collections.js.map +1 -1
- package/dist/spectrum/index.d.ts +3 -0
- package/dist/spectrum/index.d.ts.map +1 -1
- package/dist/spectrum/index.js +4 -1
- package/dist/spectrum/index.js.map +1 -1
- package/dist/spectrum/listView/ListView.d.ts +28 -0
- package/dist/spectrum/listView/ListView.d.ts.map +1 -0
- package/dist/spectrum/listView/ListView.js +59 -0
- package/dist/spectrum/listView/ListView.js.map +1 -0
- package/dist/spectrum/listView/index.d.ts +2 -0
- package/dist/spectrum/listView/index.d.ts.map +1 -0
- package/dist/spectrum/listView/index.js +2 -0
- package/dist/spectrum/listView/index.js.map +1 -0
- package/dist/spectrum/picker/Picker.d.ts +6 -6
- package/dist/spectrum/picker/Picker.d.ts.map +1 -1
- package/dist/spectrum/picker/Picker.js +16 -66
- package/dist/spectrum/picker/Picker.js.map +1 -1
- package/dist/spectrum/picker/index.d.ts +0 -1
- package/dist/spectrum/picker/index.d.ts.map +1 -1
- package/dist/spectrum/picker/index.js +0 -1
- package/dist/spectrum/picker/index.js.map +1 -1
- package/dist/spectrum/utils/index.d.ts +5 -0
- package/dist/spectrum/utils/index.d.ts.map +1 -0
- package/dist/spectrum/utils/index.js +5 -0
- package/dist/spectrum/utils/index.js.map +1 -0
- package/dist/spectrum/utils/itemUtils.d.ts +114 -0
- package/dist/spectrum/utils/itemUtils.d.ts.map +1 -0
- package/dist/spectrum/{picker/PickerUtils.js → utils/itemUtils.js} +54 -50
- package/dist/spectrum/utils/itemUtils.js.map +1 -0
- package/dist/spectrum/{utils.d.ts → utils/themeUtils.d.ts} +2 -1
- package/dist/spectrum/utils/themeUtils.d.ts.map +1 -0
- package/dist/spectrum/{utils.js → utils/themeUtils.js} +3 -2
- package/dist/spectrum/utils/themeUtils.js.map +1 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.d.ts +5 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.d.ts.map +1 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.js +34 -0
- package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts +43 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts.map +1 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.js +56 -0
- package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -0
- package/dist/theme/SpectrumThemeProvider.js +1 -1
- package/package.json +8 -7
- package/dist/spectrum/picker/PickerItemContent.d.ts +0 -11
- package/dist/spectrum/picker/PickerItemContent.d.ts.map +0 -1
- package/dist/spectrum/picker/PickerItemContent.js.map +0 -1
- package/dist/spectrum/picker/PickerUtils.d.ts +0 -111
- package/dist/spectrum/picker/PickerUtils.d.ts.map +0 -1
- package/dist/spectrum/picker/PickerUtils.js.map +0 -1
- package/dist/spectrum/utils.d.ts.map +0 -1
- package/dist/spectrum/utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemTooltip.js","names":["isElementOfType","Tooltip","Flex","Text","jsx","_jsx","ItemTooltip","_ref","children","options","Array","isArray","direction","alignItems","filter","node"],"sources":["../../src/spectrum/ItemTooltip.tsx"],"sourcesContent":["import { ReactNode } from 'react';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { TooltipOptions } from './utils';\nimport { Tooltip } from '../popper';\nimport { Flex } from './layout';\nimport { Text } from './Text';\n\nexport interface ItemTooltipProps {\n children: ReactNode;\n options: TooltipOptions;\n}\n\n/**\n * Tooltip for `<Item>` content.\n */\nexport function ItemTooltip({\n children,\n options,\n}: ItemTooltipProps): JSX.Element {\n if (Array.isArray(children)) {\n return (\n <Tooltip options={options}>\n {/* Multiple children scenarios include a `<Text>` node for the label \n and at least 1 of an optional icon or `<Text slot=\"description\">` node.\n In such cases we only show the label and description `<Text>` nodes. */}\n <Flex direction=\"column\" alignItems=\"start\">\n {children.filter(node => isElementOfType(node, Text))}\n </Flex>\n </Tooltip>\n );\n }\n\n return <Tooltip options={options}>{children}</Tooltip>;\n}\n\nexport default ItemTooltip;\n"],"mappings":"AACA,SAASA,eAAe,QAAQ,wBAAwB;AAAC,SAEhDC,OAAO;AAAA,SACPC,IAAI;AAAA,SACJC,IAAI;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAOb;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAAC,IAAA,EAGO;EAAA,IAHN;IAC1BC,QAAQ;IACRC;EACgB,CAAC,GAAAF,IAAA;EACjB,IAAIG,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,EAAE;IAC3B,oBACEH,IAAA,CAACJ,OAAO;MAACQ,OAAO,EAAEA,OAAQ;MAAAD,QAAA,eAIxBH,IAAA,CAACH,IAAI;QAACU,SAAS,EAAC,QAAQ;QAACC,UAAU,EAAC,OAAO;QAAAL,QAAA,EACxCA,QAAQ,CAACM,MAAM,CAACC,IAAI,IAAIf,eAAe,CAACe,IAAI,EAAEZ,IAAI,CAAC;MAAC,CACjD;IAAC,CACA,CAAC;EAEd;EAEA,oBAAOE,IAAA,CAACJ,OAAO;IAACQ,OAAO,EAAEA,OAAQ;IAAAD,QAAA,EAAEA;EAAQ,CAAU,CAAC;AACxD;AAEA,eAAeF,WAAW"}
|
package/dist/spectrum/Text.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type TextProps as SpectrumTextProps } from '@adobe/react-spectrum';
|
|
3
|
+
import type { DOMRefValue } from '@react-types/shared';
|
|
3
4
|
import { type ColorValue } from '../theme/colorUtils';
|
|
4
5
|
export type TextProps = SpectrumTextProps & {
|
|
5
6
|
color?: ColorValue;
|
|
@@ -13,6 +14,8 @@ export type TextProps = SpectrumTextProps & {
|
|
|
13
14
|
* @returns The Text component
|
|
14
15
|
*
|
|
15
16
|
*/
|
|
16
|
-
export declare
|
|
17
|
+
export declare const Text: import("react").ForwardRefExoticComponent<SpectrumTextProps & {
|
|
18
|
+
color?: ColorValue;
|
|
19
|
+
} & import("react").RefAttributes<DOMRefValue<HTMLSpanElement>>>;
|
|
17
20
|
export default Text;
|
|
18
21
|
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/spectrum/Text.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,KAAK,SAAS,IAAI,iBAAiB,EACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG;IAC1C,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/spectrum/Text.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,KAAK,SAAS,IAAI,iBAAiB,EACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG;IAC1C,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI;YAZP,UAAU;gEAyBnB,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
package/dist/spectrum/Text.js
CHANGED
|
@@ -7,7 +7,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
7
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
9
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
10
|
-
import { useMemo } from 'react';
|
|
10
|
+
import { forwardRef, useMemo } from 'react';
|
|
11
11
|
import { Text as SpectrumText } from '@adobe/react-spectrum';
|
|
12
12
|
import { colorValueStyle } from "../theme/colorUtils.js";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -20,8 +20,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
* @returns The Text component
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
export function Text(props) {
|
|
23
|
+
export var Text = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
25
24
|
var {
|
|
26
25
|
color,
|
|
27
26
|
UNSAFE_style
|
|
@@ -31,8 +30,10 @@ export function Text(props) {
|
|
|
31
30
|
color: colorValueStyle(color)
|
|
32
31
|
}), [color, UNSAFE_style]);
|
|
33
32
|
return /*#__PURE__*/_jsx(SpectrumText, _objectSpread(_objectSpread({}, rest), {}, {
|
|
33
|
+
ref: forwardedRef,
|
|
34
34
|
UNSAFE_style: style
|
|
35
35
|
}));
|
|
36
|
-
}
|
|
36
|
+
});
|
|
37
|
+
Text.displayName = 'Text';
|
|
37
38
|
export default Text;
|
|
38
39
|
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","names":["useMemo","Text","SpectrumText","colorValueStyle","jsx","_jsx","props","color","UNSAFE_style","rest","_objectWithoutProperties","_excluded","style","_objectSpread"],"sources":["../../src/spectrum/Text.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport { useMemo } from 'react';\nimport {\n Text as SpectrumText,\n type TextProps as SpectrumTextProps,\n} from '@adobe/react-spectrum';\nimport { type ColorValue, colorValueStyle } from '../theme/colorUtils';\n\nexport type TextProps = SpectrumTextProps & {\n color?: ColorValue;\n};\n\n/**\n * A Text component that re-exports the Spectrum Text component.\n * It overrides ColorValues to accept CSS color strings and custom\n * variable names from our color paletee and semantic colors.\n *\n * @param props The props for the Text component\n * @returns The Text component\n *\n */\
|
|
1
|
+
{"version":3,"file":"Text.js","names":["forwardRef","useMemo","Text","SpectrumText","colorValueStyle","jsx","_jsx","props","forwardedRef","color","UNSAFE_style","rest","_objectWithoutProperties","_excluded","style","_objectSpread","ref","displayName"],"sources":["../../src/spectrum/Text.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport { forwardRef, useMemo } from 'react';\nimport {\n Text as SpectrumText,\n type TextProps as SpectrumTextProps,\n} from '@adobe/react-spectrum';\nimport type { DOMRefValue } from '@react-types/shared';\nimport { type ColorValue, colorValueStyle } from '../theme/colorUtils';\n\nexport type TextProps = SpectrumTextProps & {\n color?: ColorValue;\n};\n\n/**\n * A Text component that re-exports the Spectrum Text component.\n * It overrides ColorValues to accept CSS color strings and custom\n * variable names from our color paletee and semantic colors.\n *\n * @param props The props for the Text component\n * @returns The Text component\n *\n */\nexport const Text = forwardRef<DOMRefValue<HTMLSpanElement>, TextProps>(\n (props, forwardedRef): JSX.Element => {\n const { color, UNSAFE_style, ...rest } = props;\n const style = useMemo(\n () => ({\n ...UNSAFE_style,\n color: colorValueStyle(color),\n }),\n [color, UNSAFE_style]\n );\n\n return <SpectrumText {...rest} ref={forwardedRef} UNSAFE_style={style} />;\n }\n);\n\nText.displayName = 'Text';\n\nexport default Text;\n"],"mappings":";;;;;;;;AAAA;AACA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAC3C,SACEC,IAAI,IAAIC,YAAY,QAEf,uBAAuB;AAAC,SAELC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMJ,IAAI,gBAAGF,UAAU,CAC5B,CAACO,KAAK,EAAEC,YAAY,KAAkB;EACpC,IAAM;MAAEC,KAAK;MAAEC;IAAsB,CAAC,GAAGH,KAAK;IAAdI,IAAI,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA;EAC9C,IAAMC,KAAK,GAAGb,OAAO,CACnB,MAAAc,aAAA,CAAAA,aAAA,KACKL,YAAY;IACfD,KAAK,EAAEL,eAAe,CAACK,KAAK;EAAC,EAC7B,EACF,CAACA,KAAK,EAAEC,YAAY,CACtB,CAAC;EAED,oBAAOJ,IAAA,CAACH,YAAY,EAAAY,aAAA,CAAAA,aAAA,KAAKJ,IAAI;IAAEK,GAAG,EAAER,YAAa;IAACE,YAAY,EAAEI;EAAM,EAAE,CAAC;AAC3E,CACF,CAAC;AAEDZ,IAAI,CAACe,WAAW,GAAG,MAAM;AAEzB,eAAef,IAAI"}
|
package/dist/spectrum/View.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type ViewProps as SpectrumViewProps } from '@adobe/react-spectrum';
|
|
3
|
+
import type { DOMRefValue } from '@react-types/shared';
|
|
3
4
|
import { type ColorValue } from '../theme/colorUtils';
|
|
4
5
|
export type ViewProps = Omit<SpectrumViewProps<6>, 'backgroundColor'> & {
|
|
5
6
|
backgroundColor?: ColorValue;
|
|
@@ -13,6 +14,8 @@ export type ViewProps = Omit<SpectrumViewProps<6>, 'backgroundColor'> & {
|
|
|
13
14
|
* @returns The View component
|
|
14
15
|
*
|
|
15
16
|
*/
|
|
16
|
-
export declare
|
|
17
|
+
export declare const View: import("react").ForwardRefExoticComponent<Omit<SpectrumViewProps<6>, "backgroundColor"> & {
|
|
18
|
+
backgroundColor?: ColorValue;
|
|
19
|
+
} & import("react").RefAttributes<DOMRefValue<HTMLElement>>>;
|
|
17
20
|
export default View;
|
|
18
21
|
//# sourceMappingURL=View.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../src/spectrum/View.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,KAAK,SAAS,IAAI,iBAAiB,EACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG;IACtE,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AAEH,
|
|
1
|
+
{"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../src/spectrum/View.tsx"],"names":[],"mappings":";AAEA,OAAO,EAEL,KAAK,SAAS,IAAI,iBAAiB,EACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,GAAG;IACtE,eAAe,CAAC,EAAE,UAAU,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AAEH,eAAO,MAAM,IAAI;sBAbG,UAAU;4DA0B7B,CAAC;AAIF,eAAe,IAAI,CAAC"}
|
package/dist/spectrum/View.js
CHANGED
|
@@ -7,7 +7,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
7
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
9
|
/* eslint-disable react/jsx-props-no-spreading */
|
|
10
|
-
import { useMemo } from 'react';
|
|
10
|
+
import { forwardRef, useMemo } from 'react';
|
|
11
11
|
import { View as SpectrumView } from '@adobe/react-spectrum';
|
|
12
12
|
import { colorValueStyle } from "../theme/colorUtils.js";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -21,7 +21,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
export
|
|
24
|
+
export var View = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
25
25
|
var {
|
|
26
26
|
backgroundColor,
|
|
27
27
|
UNSAFE_style
|
|
@@ -31,8 +31,10 @@ export function View(props) {
|
|
|
31
31
|
backgroundColor: colorValueStyle(backgroundColor)
|
|
32
32
|
}), [backgroundColor, UNSAFE_style]);
|
|
33
33
|
return /*#__PURE__*/_jsx(SpectrumView, _objectSpread(_objectSpread({}, rest), {}, {
|
|
34
|
+
ref: forwardedRef,
|
|
34
35
|
UNSAFE_style: style
|
|
35
36
|
}));
|
|
36
|
-
}
|
|
37
|
+
});
|
|
38
|
+
View.displayName = 'View';
|
|
37
39
|
export default View;
|
|
38
40
|
//# sourceMappingURL=View.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"View.js","names":["useMemo","View","SpectrumView","colorValueStyle","jsx","_jsx","props","backgroundColor","UNSAFE_style","rest","_objectWithoutProperties","_excluded","style","_objectSpread"],"sources":["../../src/spectrum/View.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport { useMemo } from 'react';\nimport {\n View as SpectrumView,\n type ViewProps as SpectrumViewProps,\n} from '@adobe/react-spectrum';\nimport { type ColorValue, colorValueStyle } from '../theme/colorUtils';\n\nexport type ViewProps = Omit<SpectrumViewProps<6>, 'backgroundColor'> & {\n backgroundColor?: ColorValue;\n};\n\n/**\n * A View component that re-exports the Spectrum View component.\n * However, it overrides ColorValues to accept CSS color strings and\n * our custom variable names from our color paletee and semantic colors.\n *\n * @param props The props for the View component\n * @returns The View component\n *\n */\n\nexport
|
|
1
|
+
{"version":3,"file":"View.js","names":["forwardRef","useMemo","View","SpectrumView","colorValueStyle","jsx","_jsx","props","forwardedRef","backgroundColor","UNSAFE_style","rest","_objectWithoutProperties","_excluded","style","_objectSpread","ref","displayName"],"sources":["../../src/spectrum/View.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport { forwardRef, useMemo } from 'react';\nimport {\n View as SpectrumView,\n type ViewProps as SpectrumViewProps,\n} from '@adobe/react-spectrum';\nimport type { DOMRefValue } from '@react-types/shared';\nimport { type ColorValue, colorValueStyle } from '../theme/colorUtils';\n\nexport type ViewProps = Omit<SpectrumViewProps<6>, 'backgroundColor'> & {\n backgroundColor?: ColorValue;\n};\n\n/**\n * A View component that re-exports the Spectrum View component.\n * However, it overrides ColorValues to accept CSS color strings and\n * our custom variable names from our color paletee and semantic colors.\n *\n * @param props The props for the View component\n * @returns The View component\n *\n */\n\nexport const View = forwardRef<DOMRefValue<HTMLElement>, ViewProps>(\n (props, forwardedRef): JSX.Element => {\n const { backgroundColor, UNSAFE_style, ...rest } = props;\n const style = useMemo(\n () => ({\n ...UNSAFE_style,\n backgroundColor: colorValueStyle(backgroundColor),\n }),\n [backgroundColor, UNSAFE_style]\n );\n\n return <SpectrumView {...rest} ref={forwardedRef} UNSAFE_style={style} />;\n }\n);\n\nView.displayName = 'View';\n\nexport default View;\n"],"mappings":";;;;;;;;AAAA;AACA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAC3C,SACEC,IAAI,IAAIC,YAAY,QAEf,uBAAuB;AAAC,SAELC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,IAAMJ,IAAI,gBAAGF,UAAU,CAC5B,CAACO,KAAK,EAAEC,YAAY,KAAkB;EACpC,IAAM;MAAEC,eAAe;MAAEC;IAAsB,CAAC,GAAGH,KAAK;IAAdI,IAAI,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA;EACxD,IAAMC,KAAK,GAAGb,OAAO,CACnB,MAAAc,aAAA,CAAAA,aAAA,KACKL,YAAY;IACfD,eAAe,EAAEL,eAAe,CAACK,eAAe;EAAC,EACjD,EACF,CAACA,eAAe,EAAEC,YAAY,CAChC,CAAC;EAED,oBAAOJ,IAAA,CAACH,YAAY,EAAAY,aAAA,CAAAA,aAAA,KAAKJ,IAAI;IAAEK,GAAG,EAAER,YAAa;IAACE,YAAY,EAAEI;EAAM,EAAE,CAAC;AAC3E,CACF,CAAC;AAEDZ,IAAI,CAACe,WAAW,GAAG,MAAM;AAEzB,eAAef,IAAI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ActionBar, type SpectrumActionBarProps as ActionBarProps, ActionMenu, type SpectrumActionMenuProps as ActionMenuProps,
|
|
1
|
+
export { ActionBar, type SpectrumActionBarProps as ActionBarProps, ActionMenu, type SpectrumActionMenuProps as ActionMenuProps, MenuTrigger, type SpectrumMenuTriggerProps as MenuTriggerProps, TagGroup, type SpectrumTagGroupProps as TagGroupProps, } from '@adobe/react-spectrum';
|
|
2
2
|
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/spectrum/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,IAAI,cAAc,EAC7C,UAAU,EACV,KAAK,uBAAuB,IAAI,eAAe,EAC/C,
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/spectrum/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,IAAI,cAAc,EAC7C,UAAU,EACV,KAAK,uBAAuB,IAAI,eAAe,EAC/C,WAAW,EACX,KAAK,wBAAwB,IAAI,gBAAgB,EACjD,QAAQ,EACR,KAAK,qBAAqB,IAAI,aAAa,GAC5C,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ActionBar, ActionMenu,
|
|
1
|
+
export { ActionBar, ActionMenu, MenuTrigger, TagGroup } from '@adobe/react-spectrum';
|
|
2
2
|
//# sourceMappingURL=collections.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","names":["ActionBar","ActionMenu","
|
|
1
|
+
{"version":3,"file":"collections.js","names":["ActionBar","ActionMenu","MenuTrigger","TagGroup"],"sources":["../../src/spectrum/collections.ts"],"sourcesContent":["export {\n ActionBar,\n type SpectrumActionBarProps as ActionBarProps,\n ActionMenu,\n type SpectrumActionMenuProps as ActionMenuProps,\n MenuTrigger,\n type SpectrumMenuTriggerProps as MenuTriggerProps,\n TagGroup,\n type SpectrumTagGroupProps as TagGroupProps,\n} from '@adobe/react-spectrum';\n"],"mappings":"AAAA,SACEA,SAAS,EAETC,UAAU,EAEVC,WAAW,EAEXC,QAAQ,QAEH,uBAAuB"}
|
package/dist/spectrum/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './status';
|
|
|
15
15
|
/**
|
|
16
16
|
* Custom DH components wrapping React Spectrum components.
|
|
17
17
|
*/
|
|
18
|
+
export * from './listView';
|
|
18
19
|
export * from './picker';
|
|
19
20
|
export * from './Heading';
|
|
20
21
|
export * from './Text';
|
|
@@ -22,5 +23,7 @@ export * from './View';
|
|
|
22
23
|
/**
|
|
23
24
|
* Custom DH spectrum utils
|
|
24
25
|
*/
|
|
26
|
+
export * from './ItemContent';
|
|
27
|
+
export * from './ItemTooltip';
|
|
25
28
|
export * from './utils';
|
|
26
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/dist/spectrum/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./status.js";
|
|
|
15
15
|
/**
|
|
16
16
|
* Custom DH components wrapping React Spectrum components.
|
|
17
17
|
*/
|
|
18
|
+
export * from "./listView/index.js";
|
|
18
19
|
export * from "./picker/index.js";
|
|
19
20
|
export * from "./Heading.js";
|
|
20
21
|
export * from "./Text.js";
|
|
@@ -22,5 +23,7 @@ export * from "./View.js";
|
|
|
22
23
|
/**
|
|
23
24
|
* Custom DH spectrum utils
|
|
24
25
|
*/
|
|
25
|
-
export * from "./
|
|
26
|
+
export * from "./ItemContent.js";
|
|
27
|
+
export * from "./ItemTooltip.js";
|
|
28
|
+
export * from "./utils/index.js";
|
|
26
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["/**\n * Re-exporting React Spectrum components + props.\n */\nexport * from './buttons';\nexport * from './collections';\nexport * from './content';\nexport * from './dateAndTime';\nexport * from './forms';\nexport * from './layout';\nexport * from './navigation';\nexport * from './overlays';\nexport * from './pickers';\nexport * from './shared';\nexport * from './status';\n\n/**\n * Custom DH components wrapping React Spectrum components.\n */\nexport * from './picker';\nexport * from './Heading';\nexport * from './Text';\nexport * from './View';\n\n/**\n * Custom DH spectrum utils\n */\nexport * from './utils';\n"],"mappings":"AAAA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["/**\n * Re-exporting React Spectrum components + props.\n */\nexport * from './buttons';\nexport * from './collections';\nexport * from './content';\nexport * from './dateAndTime';\nexport * from './forms';\nexport * from './layout';\nexport * from './navigation';\nexport * from './overlays';\nexport * from './pickers';\nexport * from './shared';\nexport * from './status';\n\n/**\n * Custom DH components wrapping React Spectrum components.\n */\nexport * from './listView';\nexport * from './picker';\nexport * from './Heading';\nexport * from './Text';\nexport * from './View';\n\n/**\n * Custom DH spectrum utils\n */\nexport * from './ItemContent';\nexport * from './ItemTooltip';\nexport * from './utils';\n"],"mappings":"AAAA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AACA;AAFA;AAAA;AAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SpectrumListViewProps } from '@adobe/react-spectrum';
|
|
3
|
+
import { ItemElementOrPrimitive, ItemKey, NormalizedItem, TooltipOptions } from '../utils';
|
|
4
|
+
export type ListViewProps = {
|
|
5
|
+
children: ItemElementOrPrimitive | ItemElementOrPrimitive[] | NormalizedItem[];
|
|
6
|
+
/** Can be set to true or a TooltipOptions to enable item tooltips */
|
|
7
|
+
tooltip?: boolean | TooltipOptions;
|
|
8
|
+
selectedKeys?: 'all' | Iterable<ItemKey>;
|
|
9
|
+
defaultSelectedKeys?: 'all' | Iterable<ItemKey>;
|
|
10
|
+
disabledKeys?: Iterable<ItemKey>;
|
|
11
|
+
/**
|
|
12
|
+
* Handler that is called when the selection change.
|
|
13
|
+
* Note that under the hood, this is just an alias for Spectrum's
|
|
14
|
+
* `onSelectionChange`. We are renaming for better consistency with other
|
|
15
|
+
* components.
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (keys: 'all' | Set<ItemKey>) => void;
|
|
18
|
+
/** Handler that is called when the picker is scrolled. */
|
|
19
|
+
onScroll?: (event: Event) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Handler that is called when the selection changes.
|
|
22
|
+
* @deprecated Use `onChange` instead
|
|
23
|
+
*/
|
|
24
|
+
onSelectionChange?: (keys: 'all' | Set<ItemKey>) => void;
|
|
25
|
+
} & Omit<SpectrumListViewProps<NormalizedItem>, 'children' | 'items' | 'selectedKeys' | 'defaultSelectedKeys' | 'disabledKeys' | 'onSelectionChange'>;
|
|
26
|
+
export declare function ListView({ children, tooltip, selectedKeys, defaultSelectedKeys, disabledKeys, UNSAFE_className, onChange, onScroll, onSelectionChange, ...spectrumListViewProps }: ListViewProps): JSX.Element;
|
|
27
|
+
export default ListView;
|
|
28
|
+
//# sourceMappingURL=ListView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../src/spectrum/listView/ListView.tsx"],"names":[],"mappings":";AACA,OAAO,EAEL,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EACL,sBAAsB,EACtB,OAAO,EACP,cAAc,EAGd,cAAc,EAGf,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EACJ,sBAAsB,GACtB,sBAAsB,EAAE,GACxB,cAAc,EAAE,CAAC;IACrB,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzC,mBAAmB,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAEhD,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CAC1D,GAAG,IAAI,CACN,qBAAqB,CAAC,cAAc,CAAC,EACnC,UAAU,GACV,OAAO,GACP,cAAc,GACd,qBAAqB,GACrB,cAAc,GACd,mBAAmB,CACtB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,OAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,QAAyB,EACzB,iBAAiB,EACjB,GAAG,qBAAqB,EACzB,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CA2C7B;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var _excluded = ["children", "tooltip", "selectedKeys", "defaultSelectedKeys", "disabledKeys", "UNSAFE_className", "onChange", "onScroll", "onSelectionChange"];
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import { useMemo } from 'react';
|
|
10
|
+
import { ListView as SpectrumListView } from '@adobe/react-spectrum';
|
|
11
|
+
import { EMPTY_FUNCTION } from '@deephaven/utils';
|
|
12
|
+
import { extractSpectrumHTMLElement, useOnScrollRef } from '@deephaven/react-hooks';
|
|
13
|
+
import cl from 'classnames';
|
|
14
|
+
import { normalizeItemList, normalizeTooltipOptions, useRenderNormalizedItem, useStringifiedMultiSelection } from "../utils/index.js";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
export function ListView(_ref) {
|
|
17
|
+
var {
|
|
18
|
+
children,
|
|
19
|
+
tooltip = true,
|
|
20
|
+
selectedKeys,
|
|
21
|
+
defaultSelectedKeys,
|
|
22
|
+
disabledKeys,
|
|
23
|
+
UNSAFE_className,
|
|
24
|
+
onChange,
|
|
25
|
+
onScroll = EMPTY_FUNCTION,
|
|
26
|
+
onSelectionChange
|
|
27
|
+
} = _ref,
|
|
28
|
+
spectrumListViewProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
var normalizedItems = useMemo(() => normalizeItemList(children), [children]);
|
|
30
|
+
var tooltipOptions = useMemo(() => normalizeTooltipOptions(tooltip, 'bottom'), [tooltip]);
|
|
31
|
+
var renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);
|
|
32
|
+
var {
|
|
33
|
+
selectedStringKeys,
|
|
34
|
+
defaultSelectedStringKeys,
|
|
35
|
+
disabledStringKeys,
|
|
36
|
+
onStringSelectionChange
|
|
37
|
+
} = useStringifiedMultiSelection({
|
|
38
|
+
normalizedItems,
|
|
39
|
+
selectedKeys,
|
|
40
|
+
defaultSelectedKeys,
|
|
41
|
+
disabledKeys,
|
|
42
|
+
onChange: onChange !== null && onChange !== void 0 ? onChange : onSelectionChange
|
|
43
|
+
});
|
|
44
|
+
var scrollRef = useOnScrollRef(onScroll, extractSpectrumHTMLElement);
|
|
45
|
+
return /*#__PURE__*/_jsx(SpectrumListView
|
|
46
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
47
|
+
, _objectSpread(_objectSpread({}, spectrumListViewProps), {}, {
|
|
48
|
+
ref: scrollRef,
|
|
49
|
+
UNSAFE_className: cl('dh-list-view', UNSAFE_className),
|
|
50
|
+
items: normalizedItems,
|
|
51
|
+
selectedKeys: selectedStringKeys,
|
|
52
|
+
defaultSelectedKeys: defaultSelectedStringKeys,
|
|
53
|
+
disabledKeys: disabledStringKeys,
|
|
54
|
+
onSelectionChange: onStringSelectionChange,
|
|
55
|
+
children: renderNormalizedItem
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
export default ListView;
|
|
59
|
+
//# sourceMappingURL=ListView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListView.js","names":["useMemo","ListView","SpectrumListView","EMPTY_FUNCTION","extractSpectrumHTMLElement","useOnScrollRef","cl","normalizeItemList","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedMultiSelection","jsx","_jsx","_ref","children","tooltip","selectedKeys","defaultSelectedKeys","disabledKeys","UNSAFE_className","onChange","onScroll","onSelectionChange","spectrumListViewProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderNormalizedItem","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","scrollRef","_objectSpread","ref","items"],"sources":["../../../src/spectrum/listView/ListView.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport {\n ListView as SpectrumListView,\n SpectrumListViewProps,\n} from '@adobe/react-spectrum';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport {\n extractSpectrumHTMLElement,\n useOnScrollRef,\n} from '@deephaven/react-hooks';\nimport cl from 'classnames';\nimport {\n ItemElementOrPrimitive,\n ItemKey,\n NormalizedItem,\n normalizeItemList,\n normalizeTooltipOptions,\n TooltipOptions,\n useRenderNormalizedItem,\n useStringifiedMultiSelection,\n} from '../utils';\n\nexport type ListViewProps = {\n children:\n | ItemElementOrPrimitive\n | ItemElementOrPrimitive[]\n | NormalizedItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n selectedKeys?: 'all' | Iterable<ItemKey>;\n defaultSelectedKeys?: 'all' | Iterable<ItemKey>;\n disabledKeys?: Iterable<ItemKey>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (keys: 'all' | Set<ItemKey>) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (keys: 'all' | Set<ItemKey>) => void;\n} & Omit<\n SpectrumListViewProps<NormalizedItem>,\n | 'children'\n | 'items'\n | 'selectedKeys'\n | 'defaultSelectedKeys'\n | 'disabledKeys'\n | 'onSelectionChange'\n>;\n\nexport function ListView({\n children,\n tooltip = true,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n UNSAFE_className,\n onChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n ...spectrumListViewProps\n}: ListViewProps): JSX.Element {\n const normalizedItems = useMemo(\n () => normalizeItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip, 'bottom'),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);\n\n const {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n } = useStringifiedMultiSelection({\n normalizedItems,\n selectedKeys,\n defaultSelectedKeys,\n disabledKeys,\n onChange: onChange ?? onSelectionChange,\n });\n\n const scrollRef = useOnScrollRef(onScroll, extractSpectrumHTMLElement);\n\n return (\n <SpectrumListView\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumListViewProps}\n ref={scrollRef}\n UNSAFE_className={cl('dh-list-view', UNSAFE_className)}\n items={normalizedItems}\n selectedKeys={selectedStringKeys}\n defaultSelectedKeys={defaultSelectedStringKeys}\n disabledKeys={disabledStringKeys}\n onSelectionChange={onStringSelectionChange}\n >\n {renderNormalizedItem}\n </SpectrumListView>\n );\n}\n\nexport default ListView;\n"],"mappings":";;;;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SACEC,QAAQ,IAAIC,gBAAgB,QAEvB,uBAAuB;AAC9B,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SACEC,0BAA0B,EAC1BC,cAAc,QACT,wBAAwB;AAC/B,OAAOC,EAAE,MAAM,YAAY;AAAC,SAK1BC,iBAAiB,EACjBC,uBAAuB,EAEvBC,uBAAuB,EACvBC,4BAA4B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAuC9B,OAAO,SAASX,QAAQA,CAAAY,IAAA,EAWO;EAAA,IAXN;MACvBC,QAAQ;MACRC,OAAO,GAAG,IAAI;MACdC,YAAY;MACZC,mBAAmB;MACnBC,YAAY;MACZC,gBAAgB;MAChBC,QAAQ;MACRC,QAAQ,GAAGlB,cAAc;MACzBmB;IAEa,CAAC,GAAAT,IAAA;IADXU,qBAAqB,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA;EAExB,IAAMC,eAAe,GAAG1B,OAAO,CAC7B,MAAMO,iBAAiB,CAACO,QAAQ,CAAC,EACjC,CAACA,QAAQ,CACX,CAAC;EAED,IAAMa,cAAc,GAAG3B,OAAO,CAC5B,MAAMQ,uBAAuB,CAACO,OAAO,EAAE,QAAQ,CAAC,EAChD,CAACA,OAAO,CACV,CAAC;EAED,IAAMa,oBAAoB,GAAGnB,uBAAuB,CAACkB,cAAc,CAAC;EAEpE,IAAM;IACJE,kBAAkB;IAClBC,yBAAyB;IACzBC,kBAAkB;IAClBC;EACF,CAAC,GAAGtB,4BAA4B,CAAC;IAC/BgB,eAAe;IACfV,YAAY;IACZC,mBAAmB;IACnBC,YAAY;IACZE,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIE;EACxB,CAAC,CAAC;EAEF,IAAMW,SAAS,GAAG5B,cAAc,CAACgB,QAAQ,EAAEjB,0BAA0B,CAAC;EAEtE,oBACEQ,IAAA,CAACV;EACC;EAAA,EAAAgC,aAAA,CAAAA,aAAA,KACIX,qBAAqB;IACzBY,GAAG,EAAEF,SAAU;IACfd,gBAAgB,EAAEb,EAAE,CAAC,cAAc,EAAEa,gBAAgB,CAAE;IACvDiB,KAAK,EAAEV,eAAgB;IACvBV,YAAY,EAAEa,kBAAmB;IACjCZ,mBAAmB,EAAEa,yBAA0B;IAC/CZ,YAAY,EAAEa,kBAAmB;IACjCT,iBAAiB,EAAEU,uBAAwB;IAAAlB,QAAA,EAE1Cc;EAAoB,EACL,CAAC;AAEvB;AAEA,eAAe3B,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/listView/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/listView/index.ts"],"sourcesContent":["export * from './ListView';\n"],"mappings":""}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { NormalizedSpectrumPickerProps,
|
|
2
|
+
import { NormalizedSpectrumPickerProps, NormalizedItem, ItemOrSection, TooltipOptions, ItemKey } from '../utils/itemUtils';
|
|
3
3
|
export type PickerProps = {
|
|
4
|
-
children:
|
|
4
|
+
children: ItemOrSection | ItemOrSection[] | NormalizedItem[];
|
|
5
5
|
/** Can be set to true or a TooltipOptions to enable item tooltips */
|
|
6
6
|
tooltip?: boolean | TooltipOptions;
|
|
7
7
|
/** The currently selected key in the collection (controlled). */
|
|
8
|
-
selectedKey?:
|
|
8
|
+
selectedKey?: ItemKey | null;
|
|
9
9
|
/** The initial selected key in the collection (uncontrolled). */
|
|
10
|
-
defaultSelectedKey?:
|
|
10
|
+
defaultSelectedKey?: ItemKey;
|
|
11
11
|
/** Function to retrieve initial scroll position when opening the picker */
|
|
12
12
|
getInitialScrollPosition?: () => Promise<number | null>;
|
|
13
13
|
/**
|
|
@@ -16,14 +16,14 @@ export type PickerProps = {
|
|
|
16
16
|
* `onSelectionChange`. We are renaming for better consistency with other
|
|
17
17
|
* components.
|
|
18
18
|
*/
|
|
19
|
-
onChange?: (key:
|
|
19
|
+
onChange?: (key: ItemKey) => void;
|
|
20
20
|
/** Handler that is called when the picker is scrolled. */
|
|
21
21
|
onScroll?: (event: Event) => void;
|
|
22
22
|
/**
|
|
23
23
|
* Handler that is called when the selection changes.
|
|
24
24
|
* @deprecated Use `onChange` instead
|
|
25
25
|
*/
|
|
26
|
-
onSelectionChange?: (key:
|
|
26
|
+
onSelectionChange?: (key: ItemKey) => void;
|
|
27
27
|
} & Omit<NormalizedSpectrumPickerProps, 'children' | 'items' | 'onSelectionChange' | 'selectedKey' | 'defaultSelectedKey'>;
|
|
28
28
|
/**
|
|
29
29
|
* Picker component for selecting items from a list of items. Items can be
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAcA,OAAO,EAEL,6BAA6B,EAG7B,cAAc,EACd,aAAa,EACb,cAAc,EACd,OAAO,EAER,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,cAAc,EAAE,CAAC;IAC7D,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,iEAAiE;IACjE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2EAA2E;IAC3E,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAElC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,GAKK,IAAI,CACR,6BAA6B,EAC3B,UAAU,GACV,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,oBAAoB,CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAc,EACd,kBAAkB,EAClB,WAAW,EACX,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,QAAyB,EACzB,iBAAiB,EAEjB,gBAAgB,EAChB,GAAG,mBAAmB,EACvB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAqG3B;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -7,35 +7,14 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
7
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
9
|
import { useCallback, useMemo } from 'react';
|
|
10
|
-
import {
|
|
11
|
-
import { getPositionOfSelectedItem, findSpectrumPickerScrollArea,
|
|
10
|
+
import { Picker as SpectrumPicker } from '@adobe/react-spectrum';
|
|
11
|
+
import { getPositionOfSelectedItem, findSpectrumPickerScrollArea, usePopoverOnScrollRef } from '@deephaven/react-hooks';
|
|
12
12
|
import { EMPTY_FUNCTION, PICKER_ITEM_HEIGHT, PICKER_TOP_OFFSET } from '@deephaven/utils';
|
|
13
13
|
import cl from 'classnames';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { Item, Section } from "../shared.js";
|
|
14
|
+
import { isNormalizedSection, normalizeItemList, normalizeTooltipOptions, getItemKey } from "../utils/itemUtils.js";
|
|
15
|
+
import { Section } from "../shared.js";
|
|
16
|
+
import { useRenderNormalizedItem } from "../utils/index.js";
|
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
-
/**
|
|
22
|
-
* Create tooltip content optionally wrapping with a Flex column for array
|
|
23
|
-
* content. This is needed for Items containing description `Text` elements.
|
|
24
|
-
*/
|
|
25
|
-
function createTooltipContent(content) {
|
|
26
|
-
if (typeof content === 'boolean') {
|
|
27
|
-
return String(content);
|
|
28
|
-
}
|
|
29
|
-
if (Array.isArray(content)) {
|
|
30
|
-
return /*#__PURE__*/_jsx(Flex, {
|
|
31
|
-
direction: "column",
|
|
32
|
-
alignItems: "start",
|
|
33
|
-
children: content.filter(node => isElementOfType(node, Text))
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
return content;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
18
|
/**
|
|
40
19
|
* Picker component for selecting items from a list of items. Items can be
|
|
41
20
|
* provided via the `items` prop or as children. Each item can be a string,
|
|
@@ -58,37 +37,9 @@ export function Picker(_ref) {
|
|
|
58
37
|
UNSAFE_className
|
|
59
38
|
} = _ref,
|
|
60
39
|
spectrumPickerProps = _objectWithoutProperties(_ref, _excluded);
|
|
61
|
-
var normalizedItems = useMemo(() =>
|
|
40
|
+
var normalizedItems = useMemo(() => normalizeItemList(children), [children]);
|
|
62
41
|
var tooltipOptions = useMemo(() => normalizeTooltipOptions(tooltip), [tooltip]);
|
|
63
|
-
var
|
|
64
|
-
var _normalizedItem$item$, _normalizedItem$item, _normalizedItem$item$2, _normalizedItem$item2;
|
|
65
|
-
var key = getPickerItemKey(normalizedItem);
|
|
66
|
-
var content = (_normalizedItem$item$ = (_normalizedItem$item = normalizedItem.item) === null || _normalizedItem$item === void 0 ? void 0 : _normalizedItem$item.content) !== null && _normalizedItem$item$ !== void 0 ? _normalizedItem$item$ : '';
|
|
67
|
-
var textValue = (_normalizedItem$item$2 = (_normalizedItem$item2 = normalizedItem.item) === null || _normalizedItem$item2 === void 0 ? void 0 : _normalizedItem$item2.textValue) !== null && _normalizedItem$item$2 !== void 0 ? _normalizedItem$item$2 : '';
|
|
68
|
-
return /*#__PURE__*/_jsx(Item
|
|
69
|
-
// Note that setting the `key` prop explicitly on `Item` elements
|
|
70
|
-
// causes the picker to expect `selectedKey` and `defaultSelectedKey`
|
|
71
|
-
// to be strings. It also passes the stringified value of the key to
|
|
72
|
-
// `onSelectionChange` handlers` regardless of the actual type of the
|
|
73
|
-
// key. We can't really get around setting in order to support Windowed
|
|
74
|
-
// data, so we'll need to do some manual conversion of keys to strings
|
|
75
|
-
// in other places of this component.
|
|
76
|
-
, {
|
|
77
|
-
// The `textValue` prop gets used to provide the content of `<option>`
|
|
78
|
-
// elements that back the Spectrum Picker. These are not visible in the UI,
|
|
79
|
-
// but are used for accessibility purposes, so we set to an arbitrary
|
|
80
|
-
// 'Empty' value so that they are not empty strings.
|
|
81
|
-
textValue: textValue === '' ? 'Empty' : textValue,
|
|
82
|
-
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
83
|
-
children: [/*#__PURE__*/_jsx(PickerItemContent, {
|
|
84
|
-
children: content
|
|
85
|
-
}), tooltipOptions == null || content === '' ? null : /*#__PURE__*/_jsx(Tooltip, {
|
|
86
|
-
options: tooltipOptions,
|
|
87
|
-
children: createTooltipContent(content)
|
|
88
|
-
})]
|
|
89
|
-
})
|
|
90
|
-
}, key);
|
|
91
|
-
}, [tooltipOptions]);
|
|
42
|
+
var renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);
|
|
92
43
|
var getInitialScrollPositionInternal = useCallback(() => getInitialScrollPosition == null ? getPositionOfSelectedItem({
|
|
93
44
|
keyedItems: normalizedItems,
|
|
94
45
|
// TODO: #1890 & deephaven-plugins#371 add support for sections and
|
|
@@ -107,18 +58,17 @@ export function Picker(_ref) {
|
|
|
107
58
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
108
59
|
}, [onOpenChange, popoverOnOpenChange]);
|
|
109
60
|
var onSelectionChangeInternal = useCallback(key => {
|
|
110
|
-
var
|
|
61
|
+
var _getItemKey, _ref2;
|
|
111
62
|
// The `key` arg will always be a string due to us setting the `Item` key
|
|
112
63
|
// prop in `renderItem`. We need to find the matching item to determine
|
|
113
64
|
// the actual key.
|
|
114
|
-
var selectedItem = normalizedItems.find(item => String(
|
|
115
|
-
var actualKey = (
|
|
65
|
+
var selectedItem = normalizedItems.find(item => String(getItemKey(item)) === key);
|
|
66
|
+
var actualKey = (_getItemKey = getItemKey(selectedItem)) !== null && _getItemKey !== void 0 ? _getItemKey : key;
|
|
116
67
|
(_ref2 = onChange !== null && onChange !== void 0 ? onChange : onSelectionChange) === null || _ref2 === void 0 ? void 0 : _ref2(actualKey);
|
|
117
68
|
}, [normalizedItems, onChange, onSelectionChange]);
|
|
118
69
|
return /*#__PURE__*/_jsx(SpectrumPicker
|
|
119
70
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
120
71
|
, _objectSpread(_objectSpread({}, spectrumPickerProps), {}, {
|
|
121
|
-
// The `ref` prop type defined by React Spectrum is incorrect here
|
|
122
72
|
ref: scrollRef,
|
|
123
73
|
onOpenChange: onOpenChangeInternal,
|
|
124
74
|
UNSAFE_className: cl('dh-picker', UNSAFE_className),
|
|
@@ -128,21 +78,21 @@ export function Picker(_ref) {
|
|
|
128
78
|
// ensure that `selectedKey` and `defaultSelectedKey` are strings in order
|
|
129
79
|
// for selection to work.
|
|
130
80
|
,
|
|
131
|
-
selectedKey: selectedKey
|
|
132
|
-
defaultSelectedKey: defaultSelectedKey
|
|
81
|
+
selectedKey: selectedKey == null ? selectedKey : selectedKey.toString(),
|
|
82
|
+
defaultSelectedKey: defaultSelectedKey == null ? defaultSelectedKey : defaultSelectedKey.toString()
|
|
133
83
|
// `onChange` is just an alias for `onSelectionChange`
|
|
134
84
|
,
|
|
135
85
|
onSelectionChange: onSelectionChangeInternal,
|
|
136
86
|
children: itemOrSection => {
|
|
137
|
-
if (
|
|
87
|
+
if (isNormalizedSection(itemOrSection)) {
|
|
138
88
|
var _itemOrSection$item, _itemOrSection$item2;
|
|
139
89
|
return /*#__PURE__*/_jsx(Section, {
|
|
140
90
|
title: (_itemOrSection$item = itemOrSection.item) === null || _itemOrSection$item === void 0 ? void 0 : _itemOrSection$item.title,
|
|
141
91
|
items: (_itemOrSection$item2 = itemOrSection.item) === null || _itemOrSection$item2 === void 0 ? void 0 : _itemOrSection$item2.items,
|
|
142
|
-
children:
|
|
143
|
-
},
|
|
92
|
+
children: renderNormalizedItem
|
|
93
|
+
}, getItemKey(itemOrSection));
|
|
144
94
|
}
|
|
145
|
-
return
|
|
95
|
+
return renderNormalizedItem(itemOrSection);
|
|
146
96
|
}
|
|
147
97
|
}));
|
|
148
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.js","names":["useCallback","useMemo","Flex","Picker","SpectrumPicker","Text","getPositionOfSelectedItem","findSpectrumPickerScrollArea","isElementOfType","usePopoverOnScrollRef","EMPTY_FUNCTION","PICKER_ITEM_HEIGHT","PICKER_TOP_OFFSET","cl","Tooltip","isNormalizedPickerSection","normalizePickerItemList","normalizeTooltipOptions","getPickerItemKey","PickerItemContent","Item","Section","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","createTooltipContent","content","String","Array","isArray","direction","alignItems","children","filter","node","_ref","tooltip","defaultSelectedKey","selectedKey","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderItem","normalizedItem","_normalizedItem$item$","_normalizedItem$item","_normalizedItem$item$2","_normalizedItem$item2","key","item","textValue","options","getInitialScrollPositionInternal","keyedItems","itemHeight","topOffset","ref","scrollRef","popoverOnOpenChange","onOpenChangeInternal","isOpen","onSelectionChangeInternal","_getPickerItemKey","_ref2","selectedItem","find","actualKey","_objectSpread","items","toString","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { Key, ReactNode, useCallback, useMemo } from 'react';\nimport { DOMRef } from '@react-types/shared';\nimport { Flex, Picker as SpectrumPicker, Text } from '@adobe/react-spectrum';\nimport {\n getPositionOfSelectedItem,\n findSpectrumPickerScrollArea,\n isElementOfType,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport {\n EMPTY_FUNCTION,\n PICKER_ITEM_HEIGHT,\n PICKER_TOP_OFFSET,\n} from '@deephaven/utils';\nimport cl from 'classnames';\nimport { Tooltip } from '../../popper';\nimport {\n isNormalizedPickerSection,\n NormalizedSpectrumPickerProps,\n normalizePickerItemList,\n normalizeTooltipOptions,\n NormalizedPickerItem,\n PickerItemOrSection,\n TooltipOptions,\n PickerItemKey,\n getPickerItemKey,\n} from './PickerUtils';\nimport { PickerItemContent } from './PickerItemContent';\nimport { Item, Section } from '../shared';\n\nexport type PickerProps = {\n children:\n | PickerItemOrSection\n | PickerItemOrSection[]\n | NormalizedPickerItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n /** The currently selected key in the collection (controlled). */\n selectedKey?: PickerItemKey | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: PickerItemKey;\n /** Function to retrieve initial scroll position when opening the picker */\n getInitialScrollPosition?: () => Promise<number | null>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: PickerItemKey) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: PickerItemKey) => void;\n} /*\n * Support remaining SpectrumPickerProps.\n * Note that `selectedKey`, `defaultSelectedKey`, and `onSelectionChange` are\n * re-defined above to account for boolean types which aren't included in the\n * React `Key` type, but are actually supported by the Spectrum Picker component.\n */ & Omit<\n NormalizedSpectrumPickerProps,\n | 'children'\n | 'items'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n>;\n\n/**\n * Create tooltip content optionally wrapping with a Flex column for array\n * content. This is needed for Items containing description `Text` elements.\n */\nfunction createTooltipContent(content: ReactNode) {\n if (typeof content === 'boolean') {\n return String(content);\n }\n\n if (Array.isArray(content)) {\n return (\n <Flex direction=\"column\" alignItems=\"start\">\n {content.filter(node => isElementOfType(node, Text))}\n </Flex>\n );\n }\n\n return content;\n}\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `items` prop or as children. Each item can be a string,\n * number, boolean, or a Spectrum <Item> element. The remaining props are just\n * pass through props for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n children,\n tooltip = true,\n defaultSelectedKey,\n selectedKey,\n getInitialScrollPosition,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n // eslint-disable-next-line camelcase\n UNSAFE_className,\n ...spectrumPickerProps\n}: PickerProps): JSX.Element {\n const normalizedItems = useMemo(\n () => normalizePickerItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderItem = useCallback(\n (normalizedItem: NormalizedPickerItem) => {\n const key = getPickerItemKey(normalizedItem);\n const content = normalizedItem.item?.content ?? '';\n const textValue = normalizedItem.item?.textValue ?? '';\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other places of this component.\n key={key as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // 'Empty' value so that they are not empty strings.\n textValue={textValue === '' ? 'Empty' : textValue}\n >\n <>\n <PickerItemContent>{content}</PickerItemContent>\n {tooltipOptions == null || content === '' ? null : (\n <Tooltip options={tooltipOptions}>\n {createTooltipContent(content)}\n </Tooltip>\n )}\n </>\n </Item>\n );\n },\n [tooltipOptions]\n );\n\n const getInitialScrollPositionInternal = useCallback(\n () =>\n getInitialScrollPosition == null\n ? getPositionOfSelectedItem({\n keyedItems: normalizedItems,\n // TODO: #1890 & deephaven-plugins#371 add support for sections and\n // items with descriptions since they impact the height calculations\n itemHeight: PICKER_ITEM_HEIGHT,\n selectedKey,\n topOffset: PICKER_TOP_OFFSET,\n })\n : getInitialScrollPosition(),\n [getInitialScrollPosition, normalizedItems, selectedKey]\n );\n\n const { ref: scrollRef, onOpenChange: popoverOnOpenChange } =\n usePopoverOnScrollRef(\n findSpectrumPickerScrollArea,\n onScroll,\n getInitialScrollPositionInternal\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n const onSelectionChangeInternal = useCallback(\n (key: PickerItemKey): void => {\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getPickerItemKey(item)) === key\n );\n\n const actualKey = getPickerItemKey(selectedItem) ?? key;\n\n (onChange ?? onSelectionChange)?.(actualKey);\n },\n [normalizedItems, onChange, onSelectionChange]\n );\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n // The `ref` prop type defined by React Spectrum is incorrect here\n ref={scrollRef as unknown as DOMRef<HTMLDivElement>}\n onOpenChange={onOpenChangeInternal}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n items={normalizedItems}\n // Spectrum Picker treats keys as strings if the `key` prop is explicitly\n // set on `Item` elements. Since we do this in `renderItem`, we need to\n // ensure that `selectedKey` and `defaultSelectedKey` are strings in order\n // for selection to work.\n selectedKey={selectedKey?.toString()}\n defaultSelectedKey={defaultSelectedKey?.toString()}\n // `onChange` is just an alias for `onSelectionChange`\n onSelectionChange={\n onSelectionChangeInternal as NormalizedSpectrumPickerProps['onSelectionChange']\n }\n >\n {itemOrSection => {\n if (isNormalizedPickerSection(itemOrSection)) {\n return (\n <Section\n key={getPickerItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderItem}\n </Section>\n );\n }\n\n return renderItem(itemOrSection);\n }}\n </SpectrumPicker>\n );\n}\n\nexport default Picker;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Picker.js","names":["useCallback","useMemo","Picker","SpectrumPicker","getPositionOfSelectedItem","findSpectrumPickerScrollArea","usePopoverOnScrollRef","EMPTY_FUNCTION","PICKER_ITEM_HEIGHT","PICKER_TOP_OFFSET","cl","isNormalizedSection","normalizeItemList","normalizeTooltipOptions","getItemKey","Section","useRenderNormalizedItem","jsx","_jsx","_ref","children","tooltip","defaultSelectedKey","selectedKey","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderNormalizedItem","getInitialScrollPositionInternal","keyedItems","itemHeight","topOffset","ref","scrollRef","popoverOnOpenChange","onOpenChangeInternal","isOpen","onSelectionChangeInternal","key","_getItemKey","_ref2","selectedItem","find","item","String","actualKey","_objectSpread","items","toString","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { DOMRef } from '@react-types/shared';\nimport { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport {\n getPositionOfSelectedItem,\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport {\n EMPTY_FUNCTION,\n PICKER_ITEM_HEIGHT,\n PICKER_TOP_OFFSET,\n} from '@deephaven/utils';\nimport cl from 'classnames';\nimport {\n isNormalizedSection,\n NormalizedSpectrumPickerProps,\n normalizeItemList,\n normalizeTooltipOptions,\n NormalizedItem,\n ItemOrSection,\n TooltipOptions,\n ItemKey,\n getItemKey,\n} from '../utils/itemUtils';\nimport { Section } from '../shared';\nimport { useRenderNormalizedItem } from '../utils';\n\nexport type PickerProps = {\n children: ItemOrSection | ItemOrSection[] | NormalizedItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n /** Function to retrieve initial scroll position when opening the picker */\n getInitialScrollPosition?: () => Promise<number | null>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: ItemKey) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: ItemKey) => void;\n} /*\n * Support remaining SpectrumPickerProps.\n * Note that `selectedKey`, `defaultSelectedKey`, and `onSelectionChange` are\n * re-defined above to account for boolean types which aren't included in the\n * React `Key` type, but are actually supported by the Spectrum Picker component.\n */ & Omit<\n NormalizedSpectrumPickerProps,\n | 'children'\n | 'items'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n>;\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `items` prop or as children. Each item can be a string,\n * number, boolean, or a Spectrum <Item> element. The remaining props are just\n * pass through props for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n children,\n tooltip = true,\n defaultSelectedKey,\n selectedKey,\n getInitialScrollPosition,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n // eslint-disable-next-line camelcase\n UNSAFE_className,\n ...spectrumPickerProps\n}: PickerProps): JSX.Element {\n const normalizedItems = useMemo(\n () => normalizeItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);\n\n const getInitialScrollPositionInternal = useCallback(\n () =>\n getInitialScrollPosition == null\n ? getPositionOfSelectedItem({\n keyedItems: normalizedItems,\n // TODO: #1890 & deephaven-plugins#371 add support for sections and\n // items with descriptions since they impact the height calculations\n itemHeight: PICKER_ITEM_HEIGHT,\n selectedKey,\n topOffset: PICKER_TOP_OFFSET,\n })\n : getInitialScrollPosition(),\n [getInitialScrollPosition, normalizedItems, selectedKey]\n );\n\n const { ref: scrollRef, onOpenChange: popoverOnOpenChange } =\n usePopoverOnScrollRef(\n findSpectrumPickerScrollArea,\n onScroll,\n getInitialScrollPositionInternal\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n const onSelectionChangeInternal = useCallback(\n (key: ItemKey): void => {\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getItemKey(item)) === key\n );\n\n const actualKey = getItemKey(selectedItem) ?? key;\n\n (onChange ?? onSelectionChange)?.(actualKey);\n },\n [normalizedItems, onChange, onSelectionChange]\n );\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n ref={scrollRef as unknown as DOMRef<HTMLDivElement>}\n onOpenChange={onOpenChangeInternal}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n items={normalizedItems}\n // Spectrum Picker treats keys as strings if the `key` prop is explicitly\n // set on `Item` elements. Since we do this in `renderItem`, we need to\n // ensure that `selectedKey` and `defaultSelectedKey` are strings in order\n // for selection to work.\n selectedKey={selectedKey == null ? selectedKey : selectedKey.toString()}\n defaultSelectedKey={\n defaultSelectedKey == null\n ? defaultSelectedKey\n : defaultSelectedKey.toString()\n }\n // `onChange` is just an alias for `onSelectionChange`\n onSelectionChange={\n onSelectionChangeInternal as NormalizedSpectrumPickerProps['onSelectionChange']\n }\n >\n {itemOrSection => {\n if (isNormalizedSection(itemOrSection)) {\n return (\n <Section\n key={getItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderNormalizedItem}\n </Section>\n );\n }\n\n return renderNormalizedItem(itemOrSection);\n }}\n </SpectrumPicker>\n );\n}\n\nexport default Picker;\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|