@deephaven/components 0.70.1-beta.1 → 0.70.1-beta.6

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.
@@ -1,13 +1,15 @@
1
1
  /// <reference types="react" />
2
- import { NormalizedSpectrumPickerProps, PickerItemOrSection, PickerItemKey, TooltipOptions } from './PickerUtils';
2
+ import { NormalizedSpectrumPickerProps, NormalizedPickerItem, PickerItemOrSection, TooltipOptions, PickerItemKey } from './PickerUtils';
3
3
  export type PickerProps = {
4
- children: PickerItemOrSection | PickerItemOrSection[];
4
+ children: PickerItemOrSection | PickerItemOrSection[] | NormalizedPickerItem[];
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
8
  selectedKey?: PickerItemKey | null;
9
9
  /** The initial selected key in the collection (uncontrolled). */
10
10
  defaultSelectedKey?: PickerItemKey;
11
+ /** Function to retrieve initial scroll position when opening the picker */
12
+ getInitialScrollPosition?: () => Promise<number | null>;
11
13
  /**
12
14
  * Handler that is called when the selection change.
13
15
  * Note that under the hood, this is just an alias for Spectrum's
@@ -15,6 +17,8 @@ export type PickerProps = {
15
17
  * components.
16
18
  */
17
19
  onChange?: (key: PickerItemKey) => void;
20
+ /** Handler that is called when the picker is scrolled. */
21
+ onScroll?: (event: Event) => void;
18
22
  /**
19
23
  * Handler that is called when the selection changes.
20
24
  * @deprecated Use `onChange` instead
@@ -28,6 +32,6 @@ export type PickerProps = {
28
32
  * pass through props for the Spectrum Picker component.
29
33
  * See https://react-spectrum.adobe.com/react-spectrum/Picker.html
30
34
  */
31
- export declare function Picker({ children, tooltip, defaultSelectedKey, selectedKey, onChange, onSelectionChange, UNSAFE_className, ...spectrumPickerProps }: PickerProps): JSX.Element;
35
+ export declare function Picker({ children, tooltip, defaultSelectedKey, selectedKey, getInitialScrollPosition, onChange, onOpenChange, onScroll, onSelectionChange, UNSAFE_className, ...spectrumPickerProps }: PickerProps): JSX.Element;
32
36
  export default Picker;
33
37
  //# sourceMappingURL=Picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAKA,OAAO,EACL,6BAA6B,EAG7B,mBAAmB,EACnB,aAAa,EACb,cAAc,EAGf,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;IACtD,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,iEAAiE;IACjE,WAAW,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;CAClD,GAKK,IAAI,CACR,6BAA6B,EAC3B,UAAU,GACV,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,oBAAoB,CACvB,CAAC;AAsBF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAc,EACd,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,iBAAiB,EAEjB,gBAAgB,EAChB,GAAG,mBAAmB,EACvB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAoE3B;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAEL,6BAA6B,EAG7B,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,aAAa,EAEd,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EACJ,mBAAmB,GACnB,mBAAmB,EAAE,GACrB,oBAAoB,EAAE,CAAC;IAC3B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,iEAAiE;IACjE,WAAW,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,aAAa,CAAC;IACnC,2EAA2E;IAC3E,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;IAExC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;CAClD,GAKK,IAAI,CACR,6BAA6B,EAC3B,UAAU,GACV,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,oBAAoB,CACvB,CAAC;AAsBF;;;;;;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,CAoI3B;AAED,eAAe,MAAM,CAAC"}
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "tooltip", "defaultSelectedKey", "selectedKey", "onChange", "onSelectionChange", "UNSAFE_className"];
1
+ var _excluded = ["children", "tooltip", "defaultSelectedKey", "selectedKey", "getInitialScrollPosition", "onChange", "onOpenChange", "onScroll", "onSelectionChange", "UNSAFE_className"];
2
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
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
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; }
@@ -8,13 +8,15 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
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
10
  import { Flex, Picker as SpectrumPicker, Text } from '@adobe/react-spectrum';
11
- import { isElementOfType } from '@deephaven/react-hooks';
11
+ import { getPositionOfSelectedItem, findSpectrumPickerScrollArea, isElementOfType, usePopoverOnScrollRef } from '@deephaven/react-hooks';
12
+ import { EMPTY_FUNCTION, PICKER_ITEM_HEIGHT, PICKER_TOP_OFFSET } from '@deephaven/utils';
12
13
  import cl from 'classnames';
13
14
  import { Tooltip } from "../../popper/index.js";
14
- import { normalizePickerItemList, normalizeTooltipOptions, isNormalizedPickerSection } from "./PickerUtils.js";
15
+ import { isNormalizedPickerSection, normalizePickerItemList, normalizeTooltipOptions, getPickerItemKey } from "./PickerUtils.js";
15
16
  import { PickerItemContent } from "./PickerItemContent.js";
16
17
  import { Item, Section } from "../shared.js";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ import { Fragment as _Fragment } from "react/jsx-runtime";
18
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
21
  /**
20
22
  * Create tooltip content optionally wrapping with a Flex column for array
@@ -47,7 +49,10 @@ export function Picker(_ref) {
47
49
  tooltip = true,
48
50
  defaultSelectedKey,
49
51
  selectedKey,
52
+ getInitialScrollPosition,
50
53
  onChange,
54
+ onOpenChange,
55
+ onScroll = EMPTY_FUNCTION,
51
56
  onSelectionChange,
52
57
  // eslint-disable-next-line camelcase
53
58
  UNSAFE_className
@@ -55,50 +60,87 @@ export function Picker(_ref) {
55
60
  spectrumPickerProps = _objectWithoutProperties(_ref, _excluded);
56
61
  var normalizedItems = useMemo(() => normalizePickerItemList(children), [children]);
57
62
  var tooltipOptions = useMemo(() => normalizeTooltipOptions(tooltip), [tooltip]);
58
- var renderItem = useCallback(_ref2 => {
59
- var {
60
- key,
61
- content,
62
- textValue
63
- } = _ref2;
64
- return (
65
- /*#__PURE__*/
63
+ var renderItem = useCallback(normalizedItem => {
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
+ , {
66
77
  // The `textValue` prop gets used to provide the content of `<option>`
67
78
  // elements that back the Spectrum Picker. These are not visible in the UI,
68
79
  // but are used for accessibility purposes, so we set to an arbitrary
69
80
  // 'Empty' value so that they are not empty strings.
70
- _jsxs(Item, {
71
- textValue: textValue === '' || textValue == null ? 'Empty' : textValue,
81
+ textValue: textValue === '' ? 'Empty' : textValue,
82
+ children: /*#__PURE__*/_jsxs(_Fragment, {
72
83
  children: [/*#__PURE__*/_jsx(PickerItemContent, {
73
84
  children: content
74
85
  }), tooltipOptions == null || content === '' ? null : /*#__PURE__*/_jsx(Tooltip, {
75
86
  options: tooltipOptions,
76
87
  children: createTooltipContent(content)
77
88
  })]
78
- }, key)
79
- );
89
+ })
90
+ }, key);
80
91
  }, [tooltipOptions]);
92
+ var getInitialScrollPositionInternal = useCallback(() => getInitialScrollPosition == null ? getPositionOfSelectedItem({
93
+ keyedItems: normalizedItems,
94
+ // TODO: #1890 & deephaven-plugins#371 add support for sections and
95
+ // items with descriptions since they impact the height calculations
96
+ itemHeight: PICKER_ITEM_HEIGHT,
97
+ selectedKey,
98
+ topOffset: PICKER_TOP_OFFSET
99
+ }) : getInitialScrollPosition(), [getInitialScrollPosition, normalizedItems, selectedKey]);
100
+ var {
101
+ ref: scrollRef,
102
+ onOpenChange: popoverOnOpenChange
103
+ } = usePopoverOnScrollRef(findSpectrumPickerScrollArea, onScroll, getInitialScrollPositionInternal);
104
+ var onOpenChangeInternal = useCallback(isOpen => {
105
+ // Attach scroll event handling
106
+ popoverOnOpenChange(isOpen);
107
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
108
+ }, [onOpenChange, popoverOnOpenChange]);
109
+ var onSelectionChangeInternal = useCallback(key => {
110
+ var _getPickerItemKey, _ref2;
111
+ // The `key` arg will always be a string due to us setting the `Item` key
112
+ // prop in `renderItem`. We need to find the matching item to determine
113
+ // the actual key.
114
+ var selectedItem = normalizedItems.find(item => String(getPickerItemKey(item)) === key);
115
+ var actualKey = (_getPickerItemKey = getPickerItemKey(selectedItem)) !== null && _getPickerItemKey !== void 0 ? _getPickerItemKey : key;
116
+ (_ref2 = onChange !== null && onChange !== void 0 ? onChange : onSelectionChange) === null || _ref2 === void 0 ? void 0 : _ref2(actualKey);
117
+ }, [normalizedItems, onChange, onSelectionChange]);
81
118
  return /*#__PURE__*/_jsx(SpectrumPicker
82
119
  // eslint-disable-next-line react/jsx-props-no-spreading
83
120
  , _objectSpread(_objectSpread({}, spectrumPickerProps), {}, {
121
+ // The `ref` prop type defined by React Spectrum is incorrect here
122
+ ref: scrollRef,
123
+ onOpenChange: onOpenChangeInternal,
84
124
  UNSAFE_className: cl('dh-picker', UNSAFE_className),
85
125
  items: normalizedItems
86
- // Type assertions are necessary for `selectedKey`, `defaultSelectedKey`,
87
- // and `onSelectionChange` due to Spectrum types not accounting for
88
- // `boolean` keys
126
+ // Spectrum Picker treats keys as strings if the `key` prop is explicitly
127
+ // set on `Item` elements. Since we do this in `renderItem`, we need to
128
+ // ensure that `selectedKey` and `defaultSelectedKey` are strings in order
129
+ // for selection to work.
89
130
  ,
90
- selectedKey: selectedKey,
91
- defaultSelectedKey: defaultSelectedKey
131
+ selectedKey: selectedKey === null || selectedKey === void 0 ? void 0 : selectedKey.toString(),
132
+ defaultSelectedKey: defaultSelectedKey === null || defaultSelectedKey === void 0 ? void 0 : defaultSelectedKey.toString()
92
133
  // `onChange` is just an alias for `onSelectionChange`
93
134
  ,
94
- onSelectionChange: onChange !== null && onChange !== void 0 ? onChange : onSelectionChange,
135
+ onSelectionChange: onSelectionChangeInternal,
95
136
  children: itemOrSection => {
96
137
  if (isNormalizedPickerSection(itemOrSection)) {
138
+ var _itemOrSection$item, _itemOrSection$item2;
97
139
  return /*#__PURE__*/_jsx(Section, {
98
- title: itemOrSection.title,
99
- items: itemOrSection.items,
140
+ title: (_itemOrSection$item = itemOrSection.item) === null || _itemOrSection$item === void 0 ? void 0 : _itemOrSection$item.title,
141
+ items: (_itemOrSection$item2 = itemOrSection.item) === null || _itemOrSection$item2 === void 0 ? void 0 : _itemOrSection$item2.items,
100
142
  children: renderItem
101
- }, itemOrSection.key);
143
+ }, getPickerItemKey(itemOrSection));
102
144
  }
103
145
  return renderItem(itemOrSection);
104
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.js","names":["useCallback","useMemo","Flex","Picker","SpectrumPicker","Text","isElementOfType","cl","Tooltip","normalizePickerItemList","normalizeTooltipOptions","isNormalizedPickerSection","PickerItemContent","Item","Section","jsx","_jsx","jsxs","_jsxs","createTooltipContent","content","String","Array","isArray","direction","alignItems","children","filter","node","_ref","tooltip","defaultSelectedKey","selectedKey","onChange","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderItem","_ref2","key","textValue","options","_objectSpread","items","itemOrSection","title"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { Key, ReactNode, useCallback, useMemo } from 'react';\nimport { Flex, Picker as SpectrumPicker, Text } from '@adobe/react-spectrum';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport cl from 'classnames';\nimport { Tooltip } from '../../popper';\nimport {\n NormalizedSpectrumPickerProps,\n normalizePickerItemList,\n normalizeTooltipOptions,\n PickerItemOrSection,\n PickerItemKey,\n TooltipOptions,\n NormalizedPickerItem,\n isNormalizedPickerSection,\n} from './PickerUtils';\nimport { PickerItemContent } from './PickerItemContent';\nimport { Item, Section } from '../shared';\n\nexport type PickerProps = {\n children: PickerItemOrSection | PickerItemOrSection[];\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 /**\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 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 onChange,\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 ({ key, content, textValue }: NormalizedPickerItem) => (\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 <Item\n key={key as Key}\n textValue={textValue === '' || textValue == null ? 'Empty' : textValue}\n >\n <PickerItemContent>{content}</PickerItemContent>\n {tooltipOptions == null || content === '' ? null : (\n <Tooltip options={tooltipOptions}>\n {createTooltipContent(content)}\n </Tooltip>\n )}\n </Item>\n ),\n [tooltipOptions]\n );\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n items={normalizedItems}\n // Type assertions are necessary for `selectedKey`, `defaultSelectedKey`,\n // and `onSelectionChange` due to Spectrum types not accounting for\n // `boolean` keys\n selectedKey={selectedKey as NormalizedSpectrumPickerProps['selectedKey']}\n defaultSelectedKey={\n defaultSelectedKey as NormalizedSpectrumPickerProps['defaultSelectedKey']\n }\n // `onChange` is just an alias for `onSelectionChange`\n onSelectionChange={\n (onChange ??\n onSelectionChange) as NormalizedSpectrumPickerProps['onSelectionChange']\n }\n >\n {itemOrSection => {\n if (isNormalizedPickerSection(itemOrSection)) {\n return (\n <Section\n key={itemOrSection.key}\n title={itemOrSection.title}\n items={itemOrSection.items}\n >\n {renderItem}\n </Section>\n );\n }\n\n return renderItem(itemOrSection);\n }}\n </SpectrumPicker>\n );\n}\n\nexport default Picker;\n"],"mappings":";;;;;;;;AAAA,SAAyBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5D,SAASC,IAAI,EAAEC,MAAM,IAAIC,cAAc,EAAEC,IAAI,QAAQ,uBAAuB;AAC5E,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,EAAE,MAAM,YAAY;AAAC,SACnBC,OAAO;AAAA,SAGdC,uBAAuB,EACvBC,uBAAuB,EAKvBC,yBAAyB;AAAA,SAElBC,iBAAiB;AAAA,SACjBC,IAAI,EAAEC,OAAO;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAoCtB;AACA;AACA;AACA;AACA,SAASC,oBAAoBA,CAACC,OAAkB,EAAE;E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AAc,IAAI,IAAI,IAAIpB,OAAO,KAAK,EAAE,GAAG,IAAI,gBAC9CJ,IAAA,CAACR,OAAO;UAACqC,OAAO,EAAEL,cAAe;UAAAd,QAAA,EAC9BP,oBAAoB,CAACC,OAAO;QAAC,CACvB,CACV;MAAA,GARIuB,GASD;IAAC;EAAA,CACR,EACD,CAACH,cAAc,CACjB,CAAC;EAED,oBACExB,IAAA,CAACZ;EACC;EAAA,EAAA0C,aAAA,CAAAA,aAAA,KACIV,mBAAmB;IACvBD,gBAAgB,EAAE5B,EAAE,CAAC,WAAW,EAAE4B,gBAAgB,CAAE;IACpDY,KAAK,EAAER;IACP;IACA;IACA;IAAA;IACAP,WAAW,EAAEA,WAA4D;IACzED,kBAAkB,EAChBA;IAEF;IAAA;IACAG,iBAAiB,EACdD,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GACPC,iBACH;IAAAR,QAAA,EAEAsB,aAAa,IAAI;MAChB,IAAIrC,yBAAyB,CAACqC,aAAa,CAAC,EAAE;QAC5C,oBACEhC,IAAA,CAACF,OAAO;UAENmC,KAAK,EAAED,aAAa,CAACC,KAAM;UAC3BF,KAAK,EAAEC,aAAa,CAACD,KAAM;UAAArB,QAAA,EAE1Be;QAAU,GAJNO,aAAa,CAACL,GAKZ,CAAC;MAEd;MAEA,OAAOF,UAAU,CAACO,aAAa,CAAC;IAClC;EAAC,EACa,CAAC;AAErB;AAEA,eAAe7C,MAAM"}
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":";;;;;;;;AAAA,SAAyBA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAE5D,SAASC,IAAI,EAAEC,MAAM,IAAIC,cAAc,EAAEC,IAAI,QAAQ,uBAAuB;AAC5E,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,eAAe,EACfC,qBAAqB,QAChB,wBAAwB;AAC/B,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,QACZ,kBAAkB;AACzB,OAAOC,EAAE,MAAM,YAAY;AAAC,SACnBC,OAAO;AAAA,SAEdC,yBAAyB,EAEzBC,uBAAuB,EACvBC,uBAAuB,EAKvBC,gBAAgB;AAAA,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uBAAXA,WAAW,CAAEuC,QAAQ,CAAC,CAAE;IACrCxC,kBAAkB,EAAEA,kBAAkB,aAAlBA,kBAAkB,uBAAlBA,kBAAkB,CAAEwC,QAAQ,CAAC;IACjD;IAAA;IACAlC,iBAAiB,EACf0B,yBACD;IAAArC,QAAA,EAEA8C,aAAa,IAAI;MAChB,IAAIlE,yBAAyB,CAACkE,aAAa,CAAC,EAAE;QAAA,IAAAC,mBAAA,EAAAC,oBAAA;QAC5C,oBACE5D,IAAA,CAACF,OAAO;UAEN+D,KAAK,GAAAF,mBAAA,GAAED,aAAa,CAACrB,IAAI,cAAAsB,mBAAA,uBAAlBA,mBAAA,CAAoBE,KAAM;UACjCL,KAAK,GAAAI,oBAAA,GAAEF,aAAa,CAACrB,IAAI,cAAAuB,oBAAA,uBAAlBA,oBAAA,CAAoBJ,KAAM;UAAA5C,QAAA,EAEhCkB;QAAU,GAJNnC,gBAAgB,CAAC+D,aAAa,CAK5B,CAAC;MAEd;MAEA,OAAO5B,UAAU,CAAC4B,aAAa,CAAC;IAClC;EAAC,EACa,CAAC;AAErB;AAEA,eAAe9E,MAAM"}
@@ -1,6 +1,7 @@
1
1
  import { Key, ReactElement, ReactNode } from 'react';
2
2
  import { SpectrumPickerProps } from '@adobe/react-spectrum';
3
3
  import type { ItemRenderer } from '@react-types/shared';
4
+ import { KeyedItem } from '@deephaven/utils';
4
5
  import { ItemProps, SectionProps } from '../shared';
5
6
  import { PopperOptions } from '../../popper';
6
7
  export declare const INVALID_PICKER_ITEM_ERROR_MESSAGE = "Picker items must be strings, numbers, booleans, <Item> or <Section> elements:";
@@ -29,26 +30,39 @@ export type PickerItemKey = Key | boolean;
29
30
  * reflect it.
30
31
  */
31
32
  export type PickerSelectionChangeHandler = (key: PickerItemKey) => void;
32
- /**
33
- * The Picker supports a variety of item types, including strings, numbers,
34
- * booleans, and more complex React elements. This type represents a normalized
35
- * form to make rendering items simpler and keep the logic of transformation
36
- * in separate util methods.
37
- */
38
- export interface NormalizedPickerItem {
33
+ export interface NormalizedPickerItemData {
39
34
  key?: PickerItemKey;
40
35
  content: ReactNode;
41
36
  textValue?: string;
42
37
  }
43
- export interface NormalizedPickerSection {
38
+ export interface NormalizedPickerSectionData {
44
39
  key?: Key;
45
40
  title?: ReactNode;
46
41
  items: NormalizedPickerItem[];
47
42
  }
43
+ /**
44
+ * The Picker supports a variety of item types, including strings, numbers,
45
+ * booleans, and more complex React elements. This type represents a normalized
46
+ * form to make rendering items simpler and keep the logic of transformation
47
+ * in separate util methods. It also adheres to the `KeyedItem` interface to
48
+ * be compatible with Windowed data utils (e.g. `useViewportData`).
49
+ */
50
+ export type NormalizedPickerItem = KeyedItem<NormalizedPickerItemData, PickerItemKey | undefined>;
51
+ export type NormalizedPickerSection = KeyedItem<NormalizedPickerSectionData, Key | undefined>;
48
52
  export type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedPickerItem>;
49
53
  export type TooltipOptions = {
50
54
  placement: PopperOptions['placement'];
51
55
  };
56
+ /**
57
+ * Picker uses a normalized item that includes a `key` prop and an optional
58
+ * `item` prop. This is mostly to support Windowed data where items are created
59
+ * before their data has been loaded (data gets set in the `item` prop). If
60
+ * data has loaded, return its `key`. If not, return the top-level `key` on the
61
+ * normalized item.
62
+ * @param item The normalized picker item or section
63
+ * @returns The `key` of the item or section
64
+ */
65
+ export declare function getPickerItemKey<TItem extends NormalizedPickerItem | NormalizedPickerSection, TKey extends TItem extends NormalizedPickerItem ? PickerItemKey | undefined : TItem extends NormalizedPickerSection ? Key | undefined : undefined>(item: TItem | null | undefined): TKey;
52
66
  /**
53
67
  * Determine if a node is a Section element.
54
68
  * @param node The node to check
@@ -62,24 +76,31 @@ export declare function isSectionElement<T>(node: ReactNode): node is ReactEleme
62
76
  */
63
77
  export declare function isItemElement<T>(node: ReactNode): node is ReactElement<ItemProps<T>>;
64
78
  /**
65
- * Determine if a node is a Picker item or section. Valid types include strings,
66
- * numbers, booleans, Item elements, and Section elements.
79
+ * Determine if a node is an array containing normalized items with keys.
80
+ * Note that this only checks the first node in the array.
67
81
  * @param node The node to check
68
- * @returns True if the node is a Picker item or section
82
+ * @returns True if the node is a normalized item with keys array
69
83
  */
70
- export declare function isPickerItemOrSection(node: ReactNode): node is PickerItemOrSection;
84
+ export declare function isNormalizedItemsWithKeysList(node: PickerItemOrSection | PickerItemOrSection[] | (NormalizedPickerItem | NormalizedPickerSection)[]): node is (NormalizedPickerItem | NormalizedPickerSection)[];
71
85
  /**
72
86
  * Determine if an object is a normalized Picker section.
73
87
  * @param maybeNormalizedPickerSection The object to check
74
88
  * @returns True if the object is a normalized Picker section
75
89
  */
76
90
  export declare function isNormalizedPickerSection(maybeNormalizedPickerSection: NormalizedPickerItem | NormalizedPickerSection): maybeNormalizedPickerSection is NormalizedPickerSection;
91
+ /**
92
+ * Determine if a node is a Picker item or section. Valid types include strings,
93
+ * numbers, booleans, Item elements, and Section elements.
94
+ * @param node The node to check
95
+ * @returns True if the node is a Picker item or section
96
+ */
97
+ export declare function isPickerItemOrSection(node: ReactNode): node is PickerItemOrSection;
77
98
  /**
78
99
  * Get normalized picker items from a picker item or array of picker items.
79
100
  * @param itemsOrSections A picker item or array of picker items
80
101
  * @returns An array of normalized picker items
81
102
  */
82
- export declare function normalizePickerItemList(itemsOrSections: PickerItemOrSection | PickerItemOrSection[]): (NormalizedPickerItem | NormalizedPickerSection)[];
103
+ export declare function normalizePickerItemList(itemsOrSections: PickerItemOrSection | PickerItemOrSection[] | NormalizedPickerItem[]): (NormalizedPickerItem | NormalizedPickerSection)[];
83
104
  /**
84
105
  * Returns a TooltipOptions object or null if options is false or null.
85
106
  * @param options
@@ -1 +1 @@
1
- {"version":3,"file":"PickerUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBA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AAI,mBAAmB,CAQ7B;AAiGD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EACX,mBAAmB,GACnB,mBAAmB,EAAE,GACrB,oBAAoB,EAAE,GACzB,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,CAWpD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,GACxC,cAAc,GAAG,IAAI,CAUvB"}
@@ -26,9 +26,24 @@ export var INVALID_PICKER_ITEM_ERROR_MESSAGE = 'Picker items must be strings, nu
26
26
  * The Picker supports a variety of item types, including strings, numbers,
27
27
  * booleans, and more complex React elements. This type represents a normalized
28
28
  * form to make rendering items simpler and keep the logic of transformation
29
- * in separate util methods.
29
+ * in separate util methods. It also adheres to the `KeyedItem` interface to
30
+ * be compatible with Windowed data utils (e.g. `useViewportData`).
30
31
  */
31
32
 
33
+ /**
34
+ * Picker uses a normalized item that includes a `key` prop and an optional
35
+ * `item` prop. This is mostly to support Windowed data where items are created
36
+ * before their data has been loaded (data gets set in the `item` prop). If
37
+ * data has loaded, return its `key`. If not, return the top-level `key` on the
38
+ * normalized item.
39
+ * @param item The normalized picker item or section
40
+ * @returns The `key` of the item or section
41
+ */
42
+ export function getPickerItemKey(item) {
43
+ var _item$item$key, _item$item;
44
+ return (_item$item$key = item === null || item === void 0 ? void 0 : (_item$item = item.item) === null || _item$item === void 0 ? void 0 : _item$item.key) !== null && _item$item$key !== void 0 ? _item$item$key : item === null || item === void 0 ? void 0 : item.key;
45
+ }
46
+
32
47
  /**
33
48
  * Determine if a node is a Section element.
34
49
  * @param node The node to check
@@ -48,13 +63,19 @@ export function isItemElement(node) {
48
63
  }
49
64
 
50
65
  /**
51
- * Determine if a node is a Picker item or section. Valid types include strings,
52
- * numbers, booleans, Item elements, and Section elements.
66
+ * Determine if a node is an array containing normalized items with keys.
67
+ * Note that this only checks the first node in the array.
53
68
  * @param node The node to check
54
- * @returns True if the node is a Picker item or section
69
+ * @returns True if the node is a normalized item with keys array
55
70
  */
56
- export function isPickerItemOrSection(node) {
57
- return typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || isItemElement(node) || isSectionElement(node);
71
+ export function isNormalizedItemsWithKeysList(node) {
72
+ if (!Array.isArray(node)) {
73
+ return false;
74
+ }
75
+ if (node.length === 0) {
76
+ return true;
77
+ }
78
+ return !isPickerItemOrSection(node[0]) && 'key' in node[0];
58
79
  }
59
80
 
60
81
  /**
@@ -63,7 +84,17 @@ export function isPickerItemOrSection(node) {
63
84
  * @returns True if the object is a normalized Picker section
64
85
  */
65
86
  export function isNormalizedPickerSection(maybeNormalizedPickerSection) {
66
- return 'items' in maybeNormalizedPickerSection;
87
+ return maybeNormalizedPickerSection.item != null && 'items' in maybeNormalizedPickerSection.item;
88
+ }
89
+
90
+ /**
91
+ * Determine if a node is a Picker item or section. Valid types include strings,
92
+ * numbers, booleans, Item elements, and Section elements.
93
+ * @param node The node to check
94
+ * @returns True if the node is a Picker item or section
95
+ */
96
+ export function isPickerItemOrSection(node) {
97
+ return typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || isItemElement(node) || isSectionElement(node);
67
98
  }
68
99
 
69
100
  /**
@@ -130,18 +161,22 @@ function normalizePickerItem(itemOrSection) {
130
161
  // We don't support nested section elements
131
162
  childItem => !isSectionElement(childItem));
132
163
  return {
133
- key: _key,
134
- title,
135
- items
164
+ item: {
165
+ key: _key,
166
+ title,
167
+ items
168
+ }
136
169
  };
137
170
  }
138
171
  var key = normalizeItemKey(itemOrSection);
139
172
  var content = isItemElement(itemOrSection) ? itemOrSection.props.children : itemOrSection;
140
173
  var textValue = normalizeTextValue(itemOrSection);
141
174
  return {
142
- key,
143
- content,
144
- textValue
175
+ item: {
176
+ key,
177
+ content,
178
+ textValue
179
+ }
145
180
  };
146
181
  }
147
182
 
@@ -151,6 +186,10 @@ function normalizePickerItem(itemOrSection) {
151
186
  * @returns An array of normalized picker items
152
187
  */
153
188
  export function normalizePickerItemList(itemsOrSections) {
189
+ // If already normalized, just return as-is
190
+ if (isNormalizedItemsWithKeysList(itemsOrSections)) {
191
+ return itemsOrSections;
192
+ }
154
193
  var itemsArray = Array.isArray(itemsOrSections) ? itemsOrSections : [itemsOrSections];
155
194
  return itemsArray.map(normalizePickerItem);
156
195
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PickerUtils.js","names":["isValidElement","Log","Item","Section","log","module","INVALID_PICKER_ITEM_ERROR_MESSAGE","isSectionElement","node","type","isItemElement","isPickerItemOrSection","isNormalizedPickerSection","maybeNormalizedPickerSection","normalizeItemKey","itemOrSection","_itemOrSection$props$","key","props","title","undefined","textValue","children","normalizeTextValue","item","String","normalizePickerItem","debug","Error","items","normalizePickerItemList","filter","childItem","content","itemsOrSections","itemsArray","Array","isArray","map","normalizeTooltipOptions","options","placement"],"sources":["../../../src/spectrum/picker/PickerUtils.ts"],"sourcesContent":["import { isValidElement, Key, ReactElement, ReactNode } from 'react';\nimport { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type { ItemRenderer } from '@react-types/shared';\nimport Log from '@deephaven/log';\nimport { Item, ItemProps, Section, SectionProps } from '../shared';\nimport { PopperOptions } from '../../popper';\n\nconst log = Log.module('PickerUtils');\n\nexport const INVALID_PICKER_ITEM_ERROR_MESSAGE =\n 'Picker items must be strings, numbers, booleans, <Item> or <Section> elements:';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\ntype ItemElement = ReactElement<ItemProps<unknown>>;\ntype SectionElement = ReactElement<SectionPropsNoItemRenderer<unknown>>;\n\nexport type PickerItem = number | string | boolean | ItemElement;\nexport type PickerSection = SectionElement;\nexport type PickerItemOrSection = PickerItem | PickerSection;\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * The Spectrum Picker already supports this, but the built in types don't\n * reflect it.\n */\nexport type PickerItemKey = Key | boolean;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * The Spectrum Picker already supports this, but the built in types don't\n * reflect it.\n */\nexport type PickerSelectionChangeHandler = (key: PickerItemKey) => void;\n\n/**\n * The Picker supports a variety of item types, including strings, numbers,\n * booleans, and more complex React elements. This type represents a normalized\n * form to make rendering items simpler and keep the logic of transformation\n * in separate util methods.\n */\nexport interface NormalizedPickerItem {\n key?: PickerItemKey;\n content: ReactNode;\n textValue?: string;\n}\n\nexport interface NormalizedPickerSection {\n key?: Key;\n title?: ReactNode;\n items: NormalizedPickerItem[];\n}\n\nexport type NormalizedSpectrumPickerProps =\n SpectrumPickerProps<NormalizedPickerItem>;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is ReactElement<SectionProps<T>> {\n return isValidElement<SectionProps<T>>(node) && node.type === Section;\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n return isValidElement<ItemProps<T>>(node) && node.type === Item;\n}\n\n/**\n * Determine if a node is a Picker item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is a Picker item or section\n */\nexport function isPickerItemOrSection(\n node: ReactNode\n): node is PickerItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Determine if an object is a normalized Picker section.\n * @param maybeNormalizedPickerSection The object to check\n * @returns True if the object is a normalized Picker section\n */\nexport function isNormalizedPickerSection(\n maybeNormalizedPickerSection: NormalizedPickerItem | NormalizedPickerSection\n): maybeNormalizedPickerSection is NormalizedPickerSection {\n return 'items' in maybeNormalizedPickerSection;\n}\n\n/**\n * Determine the `key` of a picker item or section.\n * @param itemOrSection The picker item or section\n * @returns A `PickerItemKey` for the picker item or undefined if a key can't be determined\n */\nfunction normalizeItemKey(item: PickerItem): PickerItemKey | undefined;\nfunction normalizeItemKey(section: PickerSection): Key | undefined;\nfunction normalizeItemKey(\n itemOrSection: PickerItem | PickerSection\n): Key | PickerItemKey | undefined {\n // string, number, or boolean\n if (typeof itemOrSection !== 'object') {\n return itemOrSection;\n }\n\n // If `key` prop is explicitly set\n if (itemOrSection.key != null) {\n return itemOrSection.key;\n }\n\n // Section element\n if (isSectionElement(itemOrSection)) {\n return typeof itemOrSection.props.title === 'string'\n ? itemOrSection.props.title\n : undefined;\n }\n\n // Item element\n return (\n itemOrSection.props.textValue ??\n (typeof itemOrSection.props.children === 'string'\n ? itemOrSection.props.children\n : undefined)\n );\n}\n\n/**\n * Get a normalized `textValue` for a picker item ensuring it is a string.\n * @param item The picker item\n * @returns A string `textValue` for the picker item\n */\nfunction normalizeTextValue(item: PickerItem): string | undefined {\n if (typeof item !== 'object') {\n return String(item);\n }\n\n if (item.props.textValue != null) {\n return item.props.textValue;\n }\n\n if (typeof item.props.children === 'string') {\n return item.props.children;\n }\n\n return undefined;\n}\n\n/**\n * Normalize a picker item to an object form.\n * @param itemOrSection item to normalize\n * @returns NormalizedPickerItem object\n */\nfunction normalizePickerItem(\n itemOrSection: PickerItemOrSection\n): NormalizedPickerItem | NormalizedPickerSection {\n if (!isPickerItemOrSection(itemOrSection)) {\n log.debug(INVALID_PICKER_ITEM_ERROR_MESSAGE, itemOrSection);\n throw new Error(INVALID_PICKER_ITEM_ERROR_MESSAGE);\n }\n\n if (isSectionElement(itemOrSection)) {\n const key = normalizeItemKey(itemOrSection);\n const { title } = itemOrSection.props;\n\n const items = normalizePickerItemList(itemOrSection.props.children).filter(\n // We don't support nested section elements\n childItem => !isSectionElement(childItem)\n ) as NormalizedPickerItem[];\n\n return {\n key,\n title,\n items,\n };\n }\n\n const key = normalizeItemKey(itemOrSection);\n const content = isItemElement(itemOrSection)\n ? itemOrSection.props.children\n : itemOrSection;\n const textValue = normalizeTextValue(itemOrSection);\n\n return {\n key,\n content,\n textValue,\n };\n}\n\n/**\n * Get normalized picker items from a picker item or array of picker items.\n * @param itemsOrSections A picker item or array of picker items\n * @returns An array of normalized picker items\n */\nexport function normalizePickerItemList(\n itemsOrSections: PickerItemOrSection | PickerItemOrSection[]\n): (NormalizedPickerItem | NormalizedPickerSection)[] {\n const itemsArray = Array.isArray(itemsOrSections)\n ? itemsOrSections\n : [itemsOrSections];\n return itemsArray.map(normalizePickerItem);\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement: 'right' };\n }\n\n return options;\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAsC,OAAO;AAGpE,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SACxBC,IAAI,EAAaC,OAAO;AAGjC,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,aAAa,CAAC;AAErC,OAAO,IAAMC,iCAAiC,GAC5C,gFAAgF;;AAElF;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9BC,IAAe,EACwB;EACvC,OAAO,aAAAR,cAAc,CAAkBQ,IAAI,CAAC,IAAIA,IAAI,CAACC,IAAI,KAAKN,OAAO;AACvE;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,aAAaA,CAC3BF,IAAe,EACqB;EACpC,OAAO,aAAAR,cAAc,CAAeQ,IAAI,CAA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,KAAK,CAACC,OAAO,CAACH,eAAe,CAAC,GAC7CA,eAAe,GACf,CAACA,eAAe,CAAC;EACrB,OAAOC,UAAU,CAACG,GAAG,CAACZ,mBAAmB,CAAC;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASa,uBAAuBA,CACrCC,OAAyC,EAClB;EACvB,IAAIA,OAAO,IAAI,IAAI,IAAIA,OAAO,KAAK,KAAK,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC,SAAS,EAAE;IAAQ,CAAC;EAC/B;EAEA,OAAOD,OAAO;AAChB"}
1
+ {"version":3,"file":"PickerUtils.js","names":["isValidElement","Log","Item","Section","log","module","INVALID_PICKER_ITEM_ERROR_MESSAGE","getPickerItemKey","item","_item$item$key","_item$item","key","isSectionElement","node","type","isItemElement","isNormalizedItemsWithKeysList","Array","isArray","length","isPickerItemOrSection","isNormalizedPickerSection","maybeNormalizedPickerSection","normalizeItemKey","itemOrSection","_itemOrSection$props$","props","title","undefined","textValue","children","normalizeTextValue","String","normalizePickerItem","debug","Error","items","normalizePickerItemList","filter","childItem","content","itemsOrSections","itemsArray","map","normalizeTooltipOptions","options","placement"],"sources":["../../../src/spectrum/picker/PickerUtils.ts"],"sourcesContent":["import { isValidElement, Key, ReactElement, ReactNode } from 'react';\nimport { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type { ItemRenderer } from '@react-types/shared';\nimport Log from '@deephaven/log';\nimport { KeyedItem } from '@deephaven/utils';\nimport { Item, ItemProps, Section, SectionProps } from '../shared';\nimport { PopperOptions } from '../../popper';\n\nconst log = Log.module('PickerUtils');\n\nexport const INVALID_PICKER_ITEM_ERROR_MESSAGE =\n 'Picker items must be strings, numbers, booleans, <Item> or <Section> elements:';\n\n/**\n * React Spectrum <Section> supports an `ItemRenderer` function as a child. The\n * DH picker makes use of this internally, but we don't want to support it as\n * an incoming prop.\n */\ntype SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {\n children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;\n};\n\ntype ItemElement = ReactElement<ItemProps<unknown>>;\ntype SectionElement = ReactElement<SectionPropsNoItemRenderer<unknown>>;\n\nexport type PickerItem = number | string | boolean | ItemElement;\nexport type PickerSection = SectionElement;\nexport type PickerItemOrSection = PickerItem | PickerSection;\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * The Spectrum Picker already supports this, but the built in types don't\n * reflect it.\n */\nexport type PickerItemKey = Key | boolean;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * The Spectrum Picker already supports this, but the built in types don't\n * reflect it.\n */\nexport type PickerSelectionChangeHandler = (key: PickerItemKey) => void;\n\nexport interface NormalizedPickerItemData {\n key?: PickerItemKey;\n content: ReactNode;\n textValue?: string;\n}\n\nexport interface NormalizedPickerSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedPickerItem[];\n}\n\n/**\n * The Picker supports a variety of item types, including strings, numbers,\n * booleans, and more complex React elements. This type represents a normalized\n * form to make rendering items simpler and keep the logic of transformation\n * in separate util methods. It also adheres to the `KeyedItem` interface to\n * be compatible with Windowed data utils (e.g. `useViewportData`).\n */\nexport type NormalizedPickerItem = KeyedItem<\n NormalizedPickerItemData,\n PickerItemKey | undefined\n>;\n\nexport type NormalizedPickerSection = KeyedItem<\n NormalizedPickerSectionData,\n Key | undefined\n>;\n\nexport type NormalizedSpectrumPickerProps =\n SpectrumPickerProps<NormalizedPickerItem>;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * Picker uses a normalized item that includes a `key` prop and an optional\n * `item` prop. This is mostly to support Windowed data where items are created\n * before their data has been loaded (data gets set in the `item` prop). If\n * data has loaded, return its `key`. If not, return the top-level `key` on the\n * normalized item.\n * @param item The normalized picker item or section\n * @returns The `key` of the item or section\n */\nexport function getPickerItemKey<\n TItem extends NormalizedPickerItem | NormalizedPickerSection,\n TKey extends TItem extends NormalizedPickerItem\n ? PickerItemKey | undefined\n : TItem extends NormalizedPickerSection\n ? Key | undefined\n : undefined,\n>(item: TItem | null | undefined): TKey {\n return (item?.item?.key ?? item?.key) as TKey;\n}\n\n/**\n * Determine if a node is a Section element.\n * @param node The node to check\n * @returns True if the node is a Section element\n */\nexport function isSectionElement<T>(\n node: ReactNode\n): node is ReactElement<SectionProps<T>> {\n return isValidElement<SectionProps<T>>(node) && node.type === Section;\n}\n\n/**\n * Determine if a node is an Item element.\n * @param node The node to check\n * @returns True if the node is an Item element\n */\nexport function isItemElement<T>(\n node: ReactNode\n): node is ReactElement<ItemProps<T>> {\n return isValidElement<ItemProps<T>>(node) && node.type === Item;\n}\n\n/**\n * Determine if a node is an array containing normalized items with keys.\n * Note that this only checks the first node in the array.\n * @param node The node to check\n * @returns True if the node is a normalized item with keys array\n */\nexport function isNormalizedItemsWithKeysList(\n node:\n | PickerItemOrSection\n | PickerItemOrSection[]\n | (NormalizedPickerItem | NormalizedPickerSection)[]\n): node is (NormalizedPickerItem | NormalizedPickerSection)[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return !isPickerItemOrSection(node[0]) && 'key' in node[0];\n}\n\n/**\n * Determine if an object is a normalized Picker section.\n * @param maybeNormalizedPickerSection The object to check\n * @returns True if the object is a normalized Picker section\n */\nexport function isNormalizedPickerSection(\n maybeNormalizedPickerSection: NormalizedPickerItem | NormalizedPickerSection\n): maybeNormalizedPickerSection is NormalizedPickerSection {\n return (\n maybeNormalizedPickerSection.item != null &&\n 'items' in maybeNormalizedPickerSection.item\n );\n}\n\n/**\n * Determine if a node is a Picker item or section. Valid types include strings,\n * numbers, booleans, Item elements, and Section elements.\n * @param node The node to check\n * @returns True if the node is a Picker item or section\n */\nexport function isPickerItemOrSection(\n node: ReactNode\n): node is PickerItemOrSection {\n return (\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean' ||\n isItemElement(node) ||\n isSectionElement(node)\n );\n}\n\n/**\n * Determine the `key` of a picker item or section.\n * @param itemOrSection The picker item or section\n * @returns A `PickerItemKey` for the picker item or undefined if a key can't be determined\n */\nfunction normalizeItemKey(item: PickerItem): PickerItemKey | undefined;\nfunction normalizeItemKey(section: PickerSection): Key | undefined;\nfunction normalizeItemKey(\n itemOrSection: PickerItem | PickerSection\n): Key | PickerItemKey | undefined {\n // string, number, or boolean\n if (typeof itemOrSection !== 'object') {\n return itemOrSection;\n }\n\n // If `key` prop is explicitly set\n if (itemOrSection.key != null) {\n return itemOrSection.key;\n }\n\n // Section element\n if (isSectionElement(itemOrSection)) {\n return typeof itemOrSection.props.title === 'string'\n ? itemOrSection.props.title\n : undefined;\n }\n\n // Item element\n return (\n itemOrSection.props.textValue ??\n (typeof itemOrSection.props.children === 'string'\n ? itemOrSection.props.children\n : undefined)\n );\n}\n\n/**\n * Get a normalized `textValue` for a picker item ensuring it is a string.\n * @param item The picker item\n * @returns A string `textValue` for the picker item\n */\nfunction normalizeTextValue(item: PickerItem): string | undefined {\n if (typeof item !== 'object') {\n return String(item);\n }\n\n if (item.props.textValue != null) {\n return item.props.textValue;\n }\n\n if (typeof item.props.children === 'string') {\n return item.props.children;\n }\n\n return undefined;\n}\n\n/**\n * Normalize a picker item to an object form.\n * @param itemOrSection item to normalize\n * @returns NormalizedPickerItem object\n */\nfunction normalizePickerItem(\n itemOrSection: PickerItemOrSection\n): NormalizedPickerItem | NormalizedPickerSection {\n if (!isPickerItemOrSection(itemOrSection)) {\n log.debug(INVALID_PICKER_ITEM_ERROR_MESSAGE, itemOrSection);\n throw new Error(INVALID_PICKER_ITEM_ERROR_MESSAGE);\n }\n\n if (isSectionElement(itemOrSection)) {\n const key = normalizeItemKey(itemOrSection);\n const { title } = itemOrSection.props;\n\n const items = normalizePickerItemList(itemOrSection.props.children).filter(\n // We don't support nested section elements\n childItem => !isSectionElement(childItem)\n ) as NormalizedPickerItem[];\n\n return {\n item: { key, title, items },\n };\n }\n\n const key = normalizeItemKey(itemOrSection);\n const content = isItemElement(itemOrSection)\n ? itemOrSection.props.children\n : itemOrSection;\n const textValue = normalizeTextValue(itemOrSection);\n\n return {\n item: { key, content, textValue },\n };\n}\n\n/**\n * Get normalized picker items from a picker item or array of picker items.\n * @param itemsOrSections A picker item or array of picker items\n * @returns An array of normalized picker items\n */\nexport function normalizePickerItemList(\n itemsOrSections:\n | PickerItemOrSection\n | PickerItemOrSection[]\n | NormalizedPickerItem[]\n): (NormalizedPickerItem | NormalizedPickerSection)[] {\n // If already normalized, just return as-is\n if (isNormalizedItemsWithKeysList(itemsOrSections)) {\n return itemsOrSections;\n }\n\n const itemsArray = Array.isArray(itemsOrSections)\n ? itemsOrSections\n : [itemsOrSections];\n\n return itemsArray.map(normalizePickerItem);\n}\n\n/**\n * Returns a TooltipOptions object or null if options is false or null.\n * @param options\n * @returns TooltipOptions or null\n */\nexport function normalizeTooltipOptions(\n options?: boolean | TooltipOptions | null\n): TooltipOptions | null {\n if (options == null || options === false) {\n return null;\n }\n\n if (options === true) {\n return { placement: 'right' };\n }\n\n return options;\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAsC,OAAO;AAGpE,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SAExBC,IAAI,EAAaC,OAAO;AAGjC,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,aAAa,CAAC;AAErC,OAAO,IAAMC,iCAAiC,GAC5C,gFAAgF;;AAElF;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAO9BC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,wBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uB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,IAAI;EACb;EAEA,IAAIA,OAAO,KAAK,IAAI,EAAE;IACpB,OAAO;MAAEC,SAAS,EAAE;IAAQ,CAAC;EAC/B;EAEA,OAAOD,OAAO;AAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/components",
3
- "version": "0.70.1-beta.1+b49b5069",
3
+ "version": "0.70.1-beta.6+bfbf7b12",
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.70.1-beta.1+b49b5069",
29
- "@deephaven/log": "^0.70.1-beta.1+b49b5069",
30
- "@deephaven/react-hooks": "^0.70.1-beta.1+b49b5069",
31
- "@deephaven/utils": "^0.70.1-beta.1+b49b5069",
28
+ "@deephaven/icons": "^0.70.1-beta.6+bfbf7b12",
29
+ "@deephaven/log": "^0.70.1-beta.6+bfbf7b12",
30
+ "@deephaven/react-hooks": "^0.70.1-beta.6+bfbf7b12",
31
+ "@deephaven/utils": "^0.70.1-beta.6+bfbf7b12",
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",
@@ -54,7 +54,7 @@
54
54
  "react-dom": ">=16.8.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@deephaven/mocks": "^0.70.1-beta.1+b49b5069"
57
+ "@deephaven/mocks": "^0.70.1-beta.6+bfbf7b12"
58
58
  },
59
59
  "files": [
60
60
  "dist",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "b49b5069d637ac136578ce839d9fc0416f468adf"
71
+ "gitHead": "bfbf7b128f0be0a82c7dd33e9023ff7df3f480fc"
72
72
  }