@deephaven/components 0.72.0 → 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/Select.d.ts +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 +3 -0
- 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.map +1 -1
- package/dist/spectrum/picker/Picker.js +9 -60
- 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 +2 -0
- package/dist/spectrum/utils/index.d.ts.map +1 -1
- package/dist/spectrum/utils/index.js +2 -0
- package/dist/spectrum/utils/index.js.map +1 -1
- package/dist/spectrum/utils/itemUtils.d.ts +13 -10
- package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
- package/dist/spectrum/utils/itemUtils.js +11 -8
- package/dist/spectrum/utils/itemUtils.js.map +1 -1
- 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/package.json +7 -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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { ItemContent } from "../ItemContent.js";
|
|
3
|
+
import { Item } from "../shared.js";
|
|
4
|
+
import { getItemKey } from "./itemUtils.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export function useRenderNormalizedItem(tooltipOptions) {
|
|
7
|
+
return useCallback(normalizedItem => {
|
|
8
|
+
var _normalizedItem$item$, _normalizedItem$item, _normalizedItem$item$2, _normalizedItem$item2;
|
|
9
|
+
var key = getItemKey(normalizedItem);
|
|
10
|
+
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$ : '';
|
|
11
|
+
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 : '';
|
|
12
|
+
return /*#__PURE__*/_jsx(Item
|
|
13
|
+
// Note that setting the `key` prop explicitly on `Item` elements
|
|
14
|
+
// causes the picker to expect `selectedKey` and `defaultSelectedKey`
|
|
15
|
+
// to be strings. It also passes the stringified value of the key to
|
|
16
|
+
// `onSelectionChange` handlers` regardless of the actual type of the
|
|
17
|
+
// key. We can't really get around setting in order to support Windowed
|
|
18
|
+
// data, so we'll need to do some manual conversion of keys to strings
|
|
19
|
+
// in other places of this component.
|
|
20
|
+
, {
|
|
21
|
+
// The `textValue` prop gets used to provide the content of `<option>`
|
|
22
|
+
// elements that back the Spectrum Picker. These are not visible in the UI,
|
|
23
|
+
// but are used for accessibility purposes, so we set to an arbitrary
|
|
24
|
+
// 'Empty' value so that they are not empty strings.
|
|
25
|
+
textValue: textValue === '' ? 'Empty' : textValue,
|
|
26
|
+
children: /*#__PURE__*/_jsx(ItemContent, {
|
|
27
|
+
tooltipOptions: tooltipOptions,
|
|
28
|
+
children: content
|
|
29
|
+
})
|
|
30
|
+
}, key);
|
|
31
|
+
}, [tooltipOptions]);
|
|
32
|
+
}
|
|
33
|
+
export default useRenderNormalizedItem;
|
|
34
|
+
//# sourceMappingURL=useRenderNormalizedItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRenderNormalizedItem.js","names":["useCallback","ItemContent","Item","getItemKey","jsx","_jsx","useRenderNormalizedItem","tooltipOptions","normalizedItem","_normalizedItem$item$","_normalizedItem$item","_normalizedItem$item$2","_normalizedItem$item2","key","content","item","textValue","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { Key, useCallback } from 'react';\nimport { ItemContent } from '../ItemContent';\nimport { Item } from '../shared';\nimport { getItemKey, NormalizedItem, TooltipOptions } from './itemUtils';\n\nexport function useRenderNormalizedItem(\n tooltipOptions: TooltipOptions | null\n): (normalizedItem: NormalizedItem) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const key = getItemKey(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 <ItemContent tooltipOptions={tooltipOptions}>{content}</ItemContent>\n </Item>\n );\n },\n [tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":"AAAA,SAAcA,WAAW,QAAQ,OAAO;AAAC,SAChCC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEnB,OAAO,SAASC,uBAAuBA,CACrCC,cAAqC,EACY;EACjD,OAAOP,WAAW,CACfQ,cAA8B,IAAK;IAAA,IAAAC,qBAAA,EAAAC,oBAAA,EAAAC,sBAAA,EAAAC,qBAAA;IAClC,IAAMC,GAAG,GAAGV,UAAU,CAACK,cAAc,CAAC;IACtC,IAAMM,OAAO,IAAAL,qBAAA,IAAAC,oBAAA,GAAGF,cAAc,CAACO,IAAI,cAAAL,oBAAA,uBAAnBA,oBAAA,CAAqBI,OAAO,cAAAL,qBAAA,cAAAA,qBAAA,GAAI,EAAE;IAClD,IAAMO,SAAS,IAAAL,sBAAA,IAAAC,qBAAA,GAAGJ,cAAc,CAACO,IAAI,cAAAH,qBAAA,uBAAnBA,qBAAA,CAAqBI,SAAS,cAAAL,sBAAA,cAAAA,sBAAA,GAAI,EAAE;IAEtD,oBACEN,IAAA,CAACH;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAc,SAAS,EAAEA,SAAS,KAAK,EAAE,GAAG,OAAO,GAAGA,SAAU;MAAAC,QAAA,eAElDZ,IAAA,CAACJ,WAAW;QAACM,cAAc,EAAEA,cAAe;QAAAU,QAAA,EAAEH;MAAO,CAAc;IAAC,GAP/DD,GAQD,CAAC;EAEX,CAAC,EACD,CAACN,cAAc,CACjB,CAAC;AACH;AAEA,eAAeD,uBAAuB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Key } from 'react';
|
|
2
|
+
import { ItemKey, NormalizedItem } from './itemUtils';
|
|
3
|
+
export interface UseStringifiedMultiSelectionOptions {
|
|
4
|
+
normalizedItems: NormalizedItem[];
|
|
5
|
+
selectedKeys?: 'all' | Iterable<ItemKey>;
|
|
6
|
+
defaultSelectedKeys?: 'all' | Iterable<ItemKey>;
|
|
7
|
+
disabledKeys?: Iterable<ItemKey>;
|
|
8
|
+
/**
|
|
9
|
+
* Handler that is called when the selection change.
|
|
10
|
+
* Note that under the hood, this is just an alias for Spectrum's
|
|
11
|
+
* `onSelectionChange`. We are renaming for better consistency with other
|
|
12
|
+
* components.
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (keys: 'all' | Set<ItemKey>) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface UseStringifiedMultiSelectionResult {
|
|
17
|
+
/** Stringified selection keys */
|
|
18
|
+
selectedStringKeys?: 'all' | Set<Key>;
|
|
19
|
+
/** Stringified default selection keys */
|
|
20
|
+
defaultSelectedStringKeys?: 'all' | Set<Key>;
|
|
21
|
+
/** Stringified disabled keys */
|
|
22
|
+
disabledStringKeys?: 'all' | Set<Key>;
|
|
23
|
+
/** Handler that is called when the string key selections change */
|
|
24
|
+
onStringSelectionChange: (keys: 'all' | Set<Key>) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Spectrum collection components treat keys as strings if the `key` prop is
|
|
28
|
+
* explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,
|
|
29
|
+
* we need to ensure that keys are strings in order for selection to work. We
|
|
30
|
+
* then need to convert back to the original key types in the onChange handler.
|
|
31
|
+
* This hook encapsulates converting to and from strings so that keys can match
|
|
32
|
+
* the original key type.
|
|
33
|
+
* @param normalizedItems The normalized items to select from.
|
|
34
|
+
* @param selectedKeys The currently selected keys in the collection.
|
|
35
|
+
* @param defaultSelectedKeys The initial selected keys in the collection.
|
|
36
|
+
* @param disabledKeys The currently disabled keys in the collection.
|
|
37
|
+
* @param onChange Handler that is called when the selection changes.
|
|
38
|
+
* @returns UseStringifiedMultiSelectionResult with stringified key sets and
|
|
39
|
+
* string key selection change handler.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useStringifiedMultiSelection({ normalizedItems, defaultSelectedKeys, disabledKeys, selectedKeys, onChange, }: UseStringifiedMultiSelectionOptions): UseStringifiedMultiSelectionResult;
|
|
42
|
+
export default useStringifiedMultiSelection;
|
|
43
|
+
//# sourceMappingURL=useStringifiedMultiSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStringifiedMultiSelection.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAwB,MAAM,OAAO,CAAC;AAClD,OAAO,EAAc,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAYlE,MAAM,WAAW,mCAAmC;IAClD,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,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;CACjD;AAED,MAAM,WAAW,kCAAkC;IACjD,iCAAiC;IACjC,kBAAkB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,yCAAyC;IACzC,yBAAyB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7C,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,mEAAmE;IACnE,uBAAuB,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,QAAQ,GACT,EAAE,mCAAmC,GAAG,kCAAkC,CA0C1E;AAED,eAAe,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { getItemKey } from "./itemUtils.js";
|
|
3
|
+
function toStringKeySet(keys) {
|
|
4
|
+
if (keys == null || keys === 'all') {
|
|
5
|
+
return keys;
|
|
6
|
+
}
|
|
7
|
+
return new Set([...keys].map(String));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Spectrum collection components treat keys as strings if the `key` prop is
|
|
11
|
+
* explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,
|
|
12
|
+
* we need to ensure that keys are strings in order for selection to work. We
|
|
13
|
+
* then need to convert back to the original key types in the onChange handler.
|
|
14
|
+
* This hook encapsulates converting to and from strings so that keys can match
|
|
15
|
+
* the original key type.
|
|
16
|
+
* @param normalizedItems The normalized items to select from.
|
|
17
|
+
* @param selectedKeys The currently selected keys in the collection.
|
|
18
|
+
* @param defaultSelectedKeys The initial selected keys in the collection.
|
|
19
|
+
* @param disabledKeys The currently disabled keys in the collection.
|
|
20
|
+
* @param onChange Handler that is called when the selection changes.
|
|
21
|
+
* @returns UseStringifiedMultiSelectionResult with stringified key sets and
|
|
22
|
+
* string key selection change handler.
|
|
23
|
+
*/
|
|
24
|
+
export function useStringifiedMultiSelection(_ref) {
|
|
25
|
+
var {
|
|
26
|
+
normalizedItems,
|
|
27
|
+
defaultSelectedKeys,
|
|
28
|
+
disabledKeys,
|
|
29
|
+
selectedKeys,
|
|
30
|
+
onChange
|
|
31
|
+
} = _ref;
|
|
32
|
+
var selectedStringKeys = useMemo(() => toStringKeySet(selectedKeys), [selectedKeys]);
|
|
33
|
+
var defaultSelectedStringKeys = useMemo(() => toStringKeySet(defaultSelectedKeys), [defaultSelectedKeys]);
|
|
34
|
+
var disabledStringKeys = useMemo(() => toStringKeySet(disabledKeys), [disabledKeys]);
|
|
35
|
+
var onStringSelectionChange = useCallback(keys => {
|
|
36
|
+
if (keys === 'all') {
|
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('all');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
var actualKeys = new Set();
|
|
41
|
+
normalizedItems.forEach(item => {
|
|
42
|
+
if (keys.has(String(getItemKey(item)))) {
|
|
43
|
+
actualKeys.add(getItemKey(item));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(actualKeys);
|
|
47
|
+
}, [normalizedItems, onChange]);
|
|
48
|
+
return {
|
|
49
|
+
selectedStringKeys,
|
|
50
|
+
defaultSelectedStringKeys,
|
|
51
|
+
disabledStringKeys,
|
|
52
|
+
onStringSelectionChange
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export default useStringifiedMultiSelection;
|
|
56
|
+
//# sourceMappingURL=useStringifiedMultiSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStringifiedMultiSelection.js","names":["useCallback","useMemo","getItemKey","toStringKeySet","keys","Set","map","String","useStringifiedMultiSelection","_ref","normalizedItems","defaultSelectedKeys","disabledKeys","selectedKeys","onChange","selectedStringKeys","defaultSelectedStringKeys","disabledStringKeys","onStringSelectionChange","actualKeys","forEach","item","has","add"],"sources":["../../../src/spectrum/utils/useStringifiedMultiSelection.ts"],"sourcesContent":["import { Key, useCallback, useMemo } from 'react';\nimport { getItemKey, ItemKey, NormalizedItem } from './itemUtils';\n\nfunction toStringKeySet(\n keys?: 'all' | Iterable<ItemKey>\n): undefined | 'all' | Set<Key> {\n if (keys == null || keys === 'all') {\n return keys as undefined | 'all';\n }\n\n return new Set([...keys].map(String));\n}\n\nexport interface UseStringifiedMultiSelectionOptions {\n normalizedItems: NormalizedItem[];\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\nexport interface UseStringifiedMultiSelectionResult {\n /** Stringified selection keys */\n selectedStringKeys?: 'all' | Set<Key>;\n /** Stringified default selection keys */\n defaultSelectedStringKeys?: 'all' | Set<Key>;\n /** Stringified disabled keys */\n disabledStringKeys?: 'all' | Set<Key>;\n /** Handler that is called when the string key selections change */\n onStringSelectionChange: (keys: 'all' | Set<Key>) => void;\n}\n\n/**\n * Spectrum collection components treat keys as strings if the `key` prop is\n * explicitly set on `Item` elements. Since we do this in `useRenderNormalizedItem`,\n * we need to ensure that keys are strings in order for selection to work. We\n * then need to convert back to the original key types in the onChange handler.\n * This hook encapsulates converting to and from strings so that keys can match\n * the original key type.\n * @param normalizedItems The normalized items to select from.\n * @param selectedKeys The currently selected keys in the collection.\n * @param defaultSelectedKeys The initial selected keys in the collection.\n * @param disabledKeys The currently disabled keys in the collection.\n * @param onChange Handler that is called when the selection changes.\n * @returns UseStringifiedMultiSelectionResult with stringified key sets and\n * string key selection change handler.\n */\nexport function useStringifiedMultiSelection({\n normalizedItems,\n defaultSelectedKeys,\n disabledKeys,\n selectedKeys,\n onChange,\n}: UseStringifiedMultiSelectionOptions): UseStringifiedMultiSelectionResult {\n const selectedStringKeys = useMemo(\n () => toStringKeySet(selectedKeys),\n [selectedKeys]\n );\n\n const defaultSelectedStringKeys = useMemo(\n () => toStringKeySet(defaultSelectedKeys),\n [defaultSelectedKeys]\n );\n\n const disabledStringKeys = useMemo(\n () => toStringKeySet(disabledKeys),\n [disabledKeys]\n );\n\n const onStringSelectionChange = useCallback(\n (keys: 'all' | Set<Key>) => {\n if (keys === 'all') {\n onChange?.('all');\n return;\n }\n\n const actualKeys = new Set<ItemKey>();\n\n normalizedItems.forEach(item => {\n if (keys.has(String(getItemKey(item)))) {\n actualKeys.add(getItemKey(item));\n }\n });\n\n onChange?.(actualKeys);\n },\n [normalizedItems, onChange]\n );\n\n return {\n selectedStringKeys,\n defaultSelectedStringKeys,\n disabledStringKeys,\n onStringSelectionChange,\n };\n}\n\nexport default useStringifiedMultiSelection;\n"],"mappings":"AAAA,SAAcA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAAC,SACzCC,UAAU;AAEnB,SAASC,cAAcA,CACrBC,IAAgC,EACF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CAACT,eAAe,EAAEI,QAAQ,CAC5B,CAAC;EAED,OAAO;IACLC,kBAAkB;IAClBC,yBAAyB;IACzBC,kBAAkB;IAClBC;EACF,CAAC;AACH;AAEA,eAAeV,4BAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/components",
|
|
3
|
-
"version": "0.72.
|
|
3
|
+
"version": "0.72.1-alpha-list-view.16+6e052e96",
|
|
4
4
|
"description": "Deephaven React component library",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@adobe/react-spectrum": "^3.34.1",
|
|
28
|
-
"@deephaven/icons": "^0.72.
|
|
29
|
-
"@deephaven/log": "^0.72.
|
|
30
|
-
"@deephaven/react-hooks": "^0.72.
|
|
31
|
-
"@deephaven/utils": "^0.72.
|
|
28
|
+
"@deephaven/icons": "^0.72.1-alpha-list-view.16+6e052e96",
|
|
29
|
+
"@deephaven/log": "^0.72.1-alpha-list-view.16+6e052e96",
|
|
30
|
+
"@deephaven/react-hooks": "^0.72.1-alpha-list-view.16+6e052e96",
|
|
31
|
+
"@deephaven/utils": "^0.72.1-alpha-list-view.16+6e052e96",
|
|
32
32
|
"@fortawesome/fontawesome-svg-core": "^6.2.1",
|
|
33
33
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
34
34
|
"@react-spectrum/theme-default": "^3.5.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react-dom": ">=16.8.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@deephaven/mocks": "^0.72.
|
|
58
|
+
"@deephaven/mocks": "^0.72.1-alpha-list-view.16+6e052e96"
|
|
59
59
|
},
|
|
60
60
|
"files": [
|
|
61
61
|
"dist",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6e052e963e04985f1af56d97f1460363df8ff076"
|
|
73
73
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface PickerItemContentProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Picker item content. Text content will be wrapped in a Spectrum Text
|
|
7
|
-
* component with ellipsis overflow handling.
|
|
8
|
-
*/
|
|
9
|
-
export declare function PickerItemContent({ children: content, }: PickerItemContentProps): JSX.Element | null;
|
|
10
|
-
export default PickerItemContent;
|
|
11
|
-
//# sourceMappingURL=PickerItemContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PickerItemContent.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerItemContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,SAAS,EAAE,MAAM,OAAO,CAAC;AAM1E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EAAE,OAAO,GAClB,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAyC7C;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PickerItemContent.js","names":["Children","cloneElement","isValidElement","Text","cl","isElementOfType","stylesCommon","jsx","_jsx","Fragment","_Fragment","PickerItemContent","_ref","children","content","String","Array","isArray","map","el","i","_objectSpread","props","UNSAFE_className","spectrumEllipsis"],"sources":["../../../src/spectrum/picker/PickerItemContent.tsx"],"sourcesContent":["import { Children, cloneElement, isValidElement, ReactNode } from 'react';\nimport { Text } from '@adobe/react-spectrum';\nimport cl from 'classnames';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport stylesCommon from '../../SpectrumComponent.module.scss';\n\nexport interface PickerItemContentProps {\n children: ReactNode;\n}\n\n/**\n * Picker item content. Text content will be wrapped in a Spectrum Text\n * component with ellipsis overflow handling.\n */\nexport function PickerItemContent({\n children: content,\n}: PickerItemContentProps): JSX.Element | null {\n if (isValidElement(content)) {\n return content;\n }\n\n /* eslint-disable no-param-reassign */\n if (content === '') {\n // Prevent the item height from collapsing when the content is empty\n content = '\\xa0'; // Non-breaking space\n } else if (typeof content === 'boolean') {\n // Boolean values need to be stringified to render\n content = String(content);\n } else if (Array.isArray(content)) {\n // For cases where there are multiple `Text` children, add a css class to\n // handle overflow. The primary use case for multiple text nodes is when a\n // description is provided for an item. e.g.\n // <Item textValue=\"Some Text\">\n // <SomeIcon />\n // <Text>Some Label</Text>\n // <Text slot=\"description\">Some Description</Text>\n // </Item>\n content = Children.map(content, (el, i) =>\n isElementOfType(el, Text)\n ? cloneElement(el, {\n ...el.props,\n UNSAFE_className: cl(\n el.props.UNSAFE_className,\n stylesCommon.spectrumEllipsis\n ),\n })\n : el\n );\n }\n /* eslint-enable no-param-reassign */\n\n return typeof content === 'string' || typeof content === 'number' ? (\n <Text UNSAFE_className={stylesCommon.spectrumEllipsis}>{content}</Text>\n ) : (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>{content}</>\n );\n}\n\nexport default PickerItemContent;\n"],"mappings":";;;;;AAAA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,cAAc,QAAmB,OAAO;AACzE,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,OAAOC,EAAE,MAAM,YAAY;AAC3B,SAASC,eAAe,QAAQ,wBAAwB;AAAC,OAClDC,YAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAMnB;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAAC,IAAA,EAEc;EAAA,IAFb;IAChCC,QAAQ,EAAEC;EACY,CAA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