@deephaven/components 0.84.1-beta.0 → 0.84.1-beta.3

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,2 +1,2 @@
1
- export { ActionBar, type SpectrumActionBarProps as ActionBarProps, MenuTrigger, type SpectrumMenuTriggerProps as MenuTriggerProps, TagGroup, type SpectrumTagGroupProps as TagGroupProps, } from '@adobe/react-spectrum';
1
+ export { ActionBar, type SpectrumActionBarProps as ActionBarProps, type SpectrumComboBoxProps, MenuTrigger, type SpectrumMenuTriggerProps as MenuTriggerProps, type SpectrumPickerProps, 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,EAE7C,WAAW,EACX,KAAK,wBAAwB,IAAI,gBAAgB,EAEjD,QAAQ,EACR,KAAK,qBAAqB,IAAI,aAAa,GAC5C,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../src/spectrum/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,IAAI,cAAc,EAG7C,KAAK,qBAAqB,EAE1B,WAAW,EACX,KAAK,wBAAwB,IAAI,gBAAgB,EAIjD,KAAK,mBAAmB,EACxB,QAAQ,EACR,KAAK,qBAAqB,IAAI,aAAa,GAC5C,MAAM,uBAAuB,CAAC"}
@@ -1,6 +1,13 @@
1
- export { ActionBar,
1
+ export { ActionBar
2
+
3
+ // ComboBox is exported from ComboBox.tsx as a custom DH component. Re-exporting
4
+ // the Spectrum props type for upstream consumers that need to compose prop types.
5
+ ,
2
6
  // ListBox - we aren't planning to support this component
3
- MenuTrigger,
7
+ MenuTrigger
8
+
4
9
  // TableView - we aren't planning to support this component
5
- TagGroup } from '@adobe/react-spectrum';
10
+ // Picker is exported from Picker.tsx as a custom DH component. Re-exporting
11
+ // the Spectrum props type for upstream consumers that need to compose prop types.
12
+ , TagGroup } from '@adobe/react-spectrum';
6
13
  //# sourceMappingURL=collections.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collections.js","names":["ActionBar","MenuTrigger","TagGroup"],"sources":["../../src/spectrum/collections.ts"],"sourcesContent":["export {\n ActionBar,\n type SpectrumActionBarProps as ActionBarProps,\n // ListBox - we aren't planning to support this component\n MenuTrigger,\n type SpectrumMenuTriggerProps as MenuTriggerProps,\n // TableView - we aren't planning to support this component\n TagGroup,\n type SpectrumTagGroupProps as TagGroupProps,\n} from '@adobe/react-spectrum';\n"],"mappings":"AAAA,SACEA,SAAS;AAET;AACAC,WAAW;AAEX;AACAC,QAAQ,QAEH,uBAAuB"}
1
+ {"version":3,"file":"collections.js","names":["ActionBar","MenuTrigger","TagGroup"],"sources":["../../src/spectrum/collections.ts"],"sourcesContent":["export {\n ActionBar,\n type SpectrumActionBarProps as ActionBarProps,\n // ComboBox is exported from ComboBox.tsx as a custom DH component. Re-exporting\n // the Spectrum props type for upstream consumers that need to compose prop types.\n type SpectrumComboBoxProps,\n // ListBox - we aren't planning to support this component\n MenuTrigger,\n type SpectrumMenuTriggerProps as MenuTriggerProps,\n // TableView - we aren't planning to support this component\n // Picker is exported from Picker.tsx as a custom DH component. Re-exporting\n // the Spectrum props type for upstream consumers that need to compose prop types.\n type SpectrumPickerProps,\n TagGroup,\n type SpectrumTagGroupProps as TagGroupProps,\n} from '@adobe/react-spectrum';\n"],"mappings":"AAAA,SACEA;;AAEA;AACA;AAAA;AAEA;AACAC;;AAEA;AACA;AACA;AAAA,EAEAC,QAAQ,QAEH,uBAAuB"}
@@ -1,7 +1,17 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { SpectrumComboBoxProps } from '@adobe/react-spectrum';
3
3
  import type { NormalizedItem } from '../utils';
4
4
  import { PickerPropsT } from '../picker';
5
5
  export type ComboBoxProps = PickerPropsT<SpectrumComboBoxProps<NormalizedItem>>;
6
- export declare function ComboBox({ UNSAFE_className, ...props }: ComboBoxProps): JSX.Element;
6
+ export declare const ComboBox: React.ForwardRefExoticComponent<Omit<SpectrumComboBoxProps<NormalizedItem>, "children" | "items" | "selectedKey" | "defaultSelectedKey" | "disabledKeys" | "onSelectionChange" | "defaultItems"> & {
7
+ children: import("../utils").ItemOrSection<unknown> | import("../utils").ItemOrSection<unknown>[];
8
+ tooltip?: boolean | import("../utils").TooltipOptions | undefined;
9
+ selectedKey?: import("../utils").ItemKey | null | undefined;
10
+ defaultSelectedKey?: import("../utils").ItemKey | undefined;
11
+ disabledKeys?: Iterable<import("../utils").ItemKey> | undefined;
12
+ onChange?: ((key: import("../utils").ItemKey | null) => void) | undefined;
13
+ onOpenChange?: ((isOpen: boolean) => void) | undefined;
14
+ onScroll?: ((event: Event) => void) | undefined;
15
+ onSelectionChange?: ((key: import("../utils").ItemKey | null) => void) | undefined;
16
+ } & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLDivElement>>>;
7
17
  //# sourceMappingURL=ComboBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../../src/spectrum/comboBox/ComboBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAkB,MAAM,WAAW,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC;AAEhF,wBAAgB,QAAQ,CAAC,EACvB,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CA6B7B"}
1
+ {"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../../src/spectrum/comboBox/ComboBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAkB,MAAM,WAAW,CAAC;AAGzD,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC;AAEhF,eAAO,MAAM,QAAQ;;;;;;;;;;mFAgCnB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["UNSAFE_className"],
2
- _excluded2 = ["defaultSelectedKey", "disabledKeys", "ref", "selectedKey"];
2
+ _excluded2 = ["defaultSelectedKey", "disabledKeys", "selectedKey", "ref"];
3
3
  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; }
4
4
  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; }
5
5
  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; }
@@ -7,11 +7,13 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
7
7
  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); }
8
8
  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; }
9
9
  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; }
10
+ import React from 'react';
10
11
  import { ComboBox as SpectrumComboBox } from '@adobe/react-spectrum';
11
12
  import cl from 'classnames';
12
13
  import { usePickerProps } from "../picker/index.js";
14
+ import useMultiRef from "../picker/useMultiRef.js";
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
- export function ComboBox(_ref) {
16
+ export var ComboBox = /*#__PURE__*/React.forwardRef(function ComboBox(_ref, ref) {
15
17
  var {
16
18
  UNSAFE_className
17
19
  } = _ref,
@@ -20,15 +22,16 @@ export function ComboBox(_ref) {
20
22
  {
21
23
  defaultSelectedKey,
22
24
  disabledKeys,
23
- ref,
24
- selectedKey
25
+ selectedKey,
26
+ ref: scrollRef
25
27
  } = _usePickerProps,
26
28
  comboBoxProps = _objectWithoutProperties(_usePickerProps, _excluded2);
29
+ var pickerRef = useMultiRef(ref, scrollRef);
27
30
  return /*#__PURE__*/_jsx(SpectrumComboBox
28
31
  // eslint-disable-next-line react/jsx-props-no-spreading
29
32
  , _objectSpread(_objectSpread({}, comboBoxProps), {}, {
30
33
  UNSAFE_className: cl('dh-combobox', UNSAFE_className),
31
- ref: ref
34
+ ref: pickerRef
32
35
  // Type assertions are necessary here since Spectrum types don't account
33
36
  // for number and boolean key values even though they are valid runtime
34
37
  // values.
@@ -37,5 +40,5 @@ export function ComboBox(_ref) {
37
40
  disabledKeys: disabledKeys,
38
41
  selectedKey: selectedKey
39
42
  }));
40
- }
43
+ });
41
44
  //# sourceMappingURL=ComboBox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.js","names":["ComboBox","SpectrumComboBox","cl","usePickerProps","jsx","_jsx","_ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","ref","selectedKey","comboBoxProps","_excluded2","_objectSpread"],"sources":["../../../src/spectrum/comboBox/ComboBox.tsx"],"sourcesContent":["import {\n ComboBox as SpectrumComboBox,\n SpectrumComboBoxProps,\n} from '@adobe/react-spectrum';\nimport type { FocusableRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport type { NormalizedItem } from '../utils';\nimport { PickerPropsT, usePickerProps } from '../picker';\n\nexport type ComboBoxProps = PickerPropsT<SpectrumComboBoxProps<NormalizedItem>>;\n\nexport function ComboBox({\n UNSAFE_className,\n ...props\n}: ComboBoxProps): JSX.Element {\n const {\n defaultSelectedKey,\n disabledKeys,\n ref,\n selectedKey,\n ...comboBoxProps\n } = usePickerProps(props);\n\n return (\n <SpectrumComboBox\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...comboBoxProps}\n UNSAFE_className={cl('dh-combobox', UNSAFE_className)}\n ref={ref as FocusableRef<HTMLElement>}\n // Type assertions are necessary here since Spectrum types don't account\n // for number and boolean key values even though they are valid runtime\n // values.\n defaultSelectedKey={\n defaultSelectedKey as SpectrumComboBoxProps<NormalizedItem>['defaultSelectedKey']\n }\n disabledKeys={\n disabledKeys as SpectrumComboBoxProps<NormalizedItem>['disabledKeys']\n }\n selectedKey={\n selectedKey as SpectrumComboBoxProps<NormalizedItem>['selectedKey']\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;AAAA,SACEA,QAAQ,IAAIC,gBAAgB,QAEvB,uBAAuB;AAE9B,OAAOC,EAAE,MAAM,YAAY;AAAC,SAELC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAIrC,OAAO,SAASL,QAAQA,CAAAM,IAAA,EAGO;EAAA,IAHN;MACvBC;IAEa,CAAC,GAAAD,IAAA;IADXE,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAER,IAAAC,eAAA,GAMIR,cAAc,CAACK,KAAK,CAAC;IANnB;MACJI,kBAAkB;MAClBC,YAAY;MACZC,GAAG;MACHC;IAEF,CAAC,GAAAJ,eAAA;IADIK,aAAa,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAGlB,oBACEZ,IAAA,CAACJ;EACC;EAAA,EAAAiB,aAAA,CAAAA,aAAA,KACIF,aAAa;IACjBT,gBAAgB,EAAEL,EAAE,CAAC,aAAa,EAAEK,gBAAgB,CAAE;IACtDO,GAAG,EAAEA;IACL;IACA;IACA;IAAA;IACAF,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDE,WAAW,EACTA;EACD,EACF,CAAC;AAEN"}
1
+ {"version":3,"file":"ComboBox.js","names":["React","ComboBox","SpectrumComboBox","cl","usePickerProps","useMultiRef","jsx","_jsx","forwardRef","_ref","ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","scrollRef","comboBoxProps","_excluded2","pickerRef","_objectSpread"],"sources":["../../../src/spectrum/comboBox/ComboBox.tsx"],"sourcesContent":["import React from 'react';\nimport {\n ComboBox as SpectrumComboBox,\n SpectrumComboBoxProps,\n} from '@adobe/react-spectrum';\nimport type { DOMRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport type { NormalizedItem } from '../utils';\nimport { PickerPropsT, usePickerProps } from '../picker';\nimport useMultiRef from '../picker/useMultiRef';\n\nexport type ComboBoxProps = PickerPropsT<SpectrumComboBoxProps<NormalizedItem>>;\n\nexport const ComboBox = React.forwardRef(function ComboBox(\n { UNSAFE_className, ...props }: ComboBoxProps,\n ref: DOMRef<HTMLDivElement>\n): JSX.Element {\n const {\n defaultSelectedKey,\n disabledKeys,\n selectedKey,\n ref: scrollRef,\n ...comboBoxProps\n } = usePickerProps(props);\n const pickerRef = useMultiRef(ref, scrollRef);\n return (\n <SpectrumComboBox\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...comboBoxProps}\n UNSAFE_className={cl('dh-combobox', UNSAFE_className)}\n ref={pickerRef}\n // Type assertions are necessary here since Spectrum types don't account\n // for number and boolean key values even though they are valid runtime\n // values.\n defaultSelectedKey={\n defaultSelectedKey as SpectrumComboBoxProps<NormalizedItem>['defaultSelectedKey']\n }\n disabledKeys={\n disabledKeys as SpectrumComboBoxProps<NormalizedItem>['disabledKeys']\n }\n selectedKey={\n selectedKey as SpectrumComboBoxProps<NormalizedItem>['selectedKey']\n }\n />\n );\n});\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,QAAQ,IAAIC,gBAAgB,QAEvB,uBAAuB;AAE9B,OAAOC,EAAE,MAAM,YAAY;AAAC,SAELC,cAAc;AAAA,OAC9BC,WAAW;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAIlB,OAAO,IAAMN,QAAQ,gBAAGD,KAAK,CAACQ,UAAU,CAAC,SAASP,QAAQA,CAAAQ,IAAA,EAExDC,GAA2B,EACd;EAAA,IAFb;MAAEC;IAA0C,CAAC,GAAAF,IAAA;IAAtBG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAG5B,IAAAC,eAAA,GAMIX,cAAc,CAACQ,KAAK,CAAC;IANnB;MACJI,kBAAkB;MAClBC,YAAY;MACZC,WAAW;MACXR,GAAG,EAAES;IAEP,CAAC,GAAAJ,eAAA;IADIK,aAAa,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAElB,IAAMC,SAAS,GAAGjB,WAAW,CAACK,GAAG,EAAES,SAAS,CAAC;EAC7C,oBACEZ,IAAA,CAACL;EACC;EAAA,EAAAqB,aAAA,CAAAA,aAAA,KACIH,aAAa;IACjBT,gBAAgB,EAAER,EAAE,CAAC,aAAa,EAAEQ,gBAAgB,CAAE;IACtDD,GAAG,EAAEY;IACL;IACA;IACA;IAAA;IACAN,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDC,WAAW,EACTA;EACD,EACF,CAAC;AAEN,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
- /// <reference types="react" />
2
- import type { PickerProps } from './PickerProps';
1
+ import { SpectrumPickerProps } from '@adobe/react-spectrum';
2
+ import React from 'react';
3
+ import type { NormalizedItem } from '../utils';
3
4
  /**
4
5
  * Picker component for selecting items from a list of items. Items can be
5
6
  * provided via the `children` prop. Each item can be a string, number, boolean,
@@ -7,6 +8,16 @@ import type { PickerProps } from './PickerProps';
7
8
  * for the Spectrum Picker component.
8
9
  * See https://react-spectrum.adobe.com/react-spectrum/Picker.html
9
10
  */
10
- export declare function Picker({ UNSAFE_className, ...props }: PickerProps): JSX.Element;
11
+ export declare const Picker: React.ForwardRefExoticComponent<Omit<SpectrumPickerProps<NormalizedItem>, "children" | "items" | "selectedKey" | "defaultSelectedKey" | "disabledKeys" | "onSelectionChange" | "defaultItems"> & {
12
+ children: import("../utils").ItemOrSection<unknown> | import("../utils").ItemOrSection<unknown>[];
13
+ tooltip?: boolean | import("../utils").TooltipOptions | undefined;
14
+ selectedKey?: import("../utils").ItemKey | null | undefined;
15
+ defaultSelectedKey?: import("../utils").ItemKey | undefined;
16
+ disabledKeys?: Iterable<import("../utils").ItemKey> | undefined;
17
+ onChange?: ((key: import("../utils").ItemKey | null) => void) | undefined;
18
+ onOpenChange?: ((isOpen: boolean) => void) | undefined;
19
+ onScroll?: ((event: Event) => void) | undefined;
20
+ onSelectionChange?: ((key: import("../utils").ItemKey | null) => void) | undefined;
21
+ } & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLDivElement>>>;
11
22
  export default Picker;
12
23
  //# sourceMappingURL=Picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAuB3B;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;mFAgCjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["UNSAFE_className"],
2
- _excluded2 = ["defaultSelectedKey", "disabledKeys", "selectedKey"];
2
+ _excluded2 = ["defaultSelectedKey", "disabledKeys", "selectedKey", "ref"];
3
3
  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; }
4
4
  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; }
5
5
  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; }
@@ -9,6 +9,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
9
9
  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; }
10
10
  import { Picker as SpectrumPicker } from '@adobe/react-spectrum';
11
11
  import cl from 'classnames';
12
+ import React from 'react';
13
+ import useMultiRef from "./useMultiRef.js";
12
14
  import { usePickerProps } from "./usePickerProps.js";
13
15
  /**
14
16
  * Picker component for selecting items from a list of items. Items can be
@@ -18,7 +20,7 @@ import { usePickerProps } from "./usePickerProps.js";
18
20
  * See https://react-spectrum.adobe.com/react-spectrum/Picker.html
19
21
  */
20
22
  import { jsx as _jsx } from "react/jsx-runtime";
21
- export function Picker(_ref) {
23
+ export var Picker = /*#__PURE__*/React.forwardRef(function Picker(_ref, ref) {
22
24
  var {
23
25
  UNSAFE_className
24
26
  } = _ref,
@@ -27,12 +29,15 @@ export function Picker(_ref) {
27
29
  {
28
30
  defaultSelectedKey,
29
31
  disabledKeys,
30
- selectedKey
32
+ selectedKey,
33
+ ref: scrollRef
31
34
  } = _usePickerProps,
32
35
  pickerProps = _objectWithoutProperties(_usePickerProps, _excluded2);
36
+ var pickerRef = useMultiRef(ref, scrollRef);
33
37
  return /*#__PURE__*/_jsx(SpectrumPicker
34
38
  // eslint-disable-next-line react/jsx-props-no-spreading
35
39
  , _objectSpread(_objectSpread({}, pickerProps), {}, {
40
+ ref: pickerRef,
36
41
  UNSAFE_className: cl('dh-picker', UNSAFE_className)
37
42
  // Type assertions are necessary here since Spectrum types don't account
38
43
  // for number and boolean key values even though they are valid runtime
@@ -42,6 +47,6 @@ export function Picker(_ref) {
42
47
  disabledKeys: disabledKeys,
43
48
  selectedKey: selectedKey
44
49
  }));
45
- }
50
+ });
46
51
  export default Picker;
47
52
  //# sourceMappingURL=Picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.js","names":["Picker","SpectrumPicker","cl","usePickerProps","jsx","_jsx","_ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","pickerProps","_excluded2","_objectSpread"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import {\n Picker as SpectrumPicker,\n SpectrumPickerProps,\n} from '@adobe/react-spectrum';\nimport cl from 'classnames';\nimport type { NormalizedItem } from '../utils';\nimport type { PickerProps } from './PickerProps';\nimport { usePickerProps } from './usePickerProps';\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `children` prop. Each item can be a string,\tnumber, boolean,\n * or a Spectrum <Item> element. The remaining props are just\tpass through props\n * for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n UNSAFE_className,\n ...props\n}: PickerProps): JSX.Element {\n const { defaultSelectedKey, disabledKeys, selectedKey, ...pickerProps } =\n usePickerProps<PickerProps, HTMLDivElement>(props);\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n // Type assertions are necessary here since Spectrum types don't account\n // for number and boolean key values even though they are valid runtime\n // values.\n defaultSelectedKey={\n defaultSelectedKey as SpectrumPickerProps<NormalizedItem>['defaultSelectedKey']\n }\n disabledKeys={\n disabledKeys as SpectrumPickerProps<NormalizedItem>['disabledKeys']\n }\n selectedKey={\n selectedKey as SpectrumPickerProps<NormalizedItem>['selectedKey']\n }\n />\n );\n}\n\nexport default Picker;\n"],"mappings":";;;;;;;;;AAAA,SACEA,MAAM,IAAIC,cAAc,QAEnB,uBAAuB;AAC9B,OAAOC,EAAE,MAAM,YAAY;AAAC,SAGnBC,cAAc;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,OAAO,SAASL,MAAMA,CAAAM,IAAA,EAGO;EAAA,IAHN;MACrBC;IAEW,CAAC,GAAAD,IAAA;IADTE,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EAER,IAAAC,eAAA,GACER,cAAc,CAA8BK,KAAK,CAAC;IAD9C;MAAEI,kBAAkB;MAAEC,YAAY;MAAEC;IAA4B,CAAC,GAAAH,eAAA;IAAbI,WAAW,GAAAN,wBAAA,CAAAE,eAAA,EAAAK,UAAA;EAGrE,oBACEX,IAAA,CAACJ;EACC;EAAA,EAAAgB,aAAA,CAAAA,aAAA,KACIF,WAAW;IACfR,gBAAgB,EAAEL,EAAE,CAAC,WAAW,EAAEK,gBAAgB;IAClD;IACA;IACA;IAAA;IACAK,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDC,WAAW,EACTA;EACD,EACF,CAAC;AAEN;AAEA,eAAed,MAAM"}
1
+ {"version":3,"file":"Picker.js","names":["Picker","SpectrumPicker","cl","React","useMultiRef","usePickerProps","jsx","_jsx","forwardRef","_ref","ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","scrollRef","pickerProps","_excluded2","pickerRef","_objectSpread"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import {\n Picker as SpectrumPicker,\n SpectrumPickerProps,\n} from '@adobe/react-spectrum';\nimport type { DOMRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport React from 'react';\nimport type { NormalizedItem } from '../utils';\nimport type { PickerProps } from './PickerProps';\nimport useMultiRef from './useMultiRef';\nimport { usePickerProps } from './usePickerProps';\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `children` prop. Each item can be a string,\tnumber, boolean,\n * or a Spectrum <Item> element. The remaining props are just\tpass through props\n * for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport const Picker = React.forwardRef(function Picker(\n { UNSAFE_className, ...props }: PickerProps,\n ref: DOMRef<HTMLDivElement>\n): JSX.Element {\n const {\n defaultSelectedKey,\n disabledKeys,\n selectedKey,\n ref: scrollRef,\n ...pickerProps\n } = usePickerProps(props);\n const pickerRef = useMultiRef(ref, scrollRef);\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n ref={pickerRef}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n // Type assertions are necessary here since Spectrum types don't account\n // for number and boolean key values even though they are valid runtime\n // values.\n defaultSelectedKey={\n defaultSelectedKey as SpectrumPickerProps<NormalizedItem>['defaultSelectedKey']\n }\n disabledKeys={\n disabledKeys as SpectrumPickerProps<NormalizedItem>['disabledKeys']\n }\n selectedKey={\n selectedKey as SpectrumPickerProps<NormalizedItem>['selectedKey']\n }\n />\n );\n});\n\nexport default Picker;\n"],"mappings":";;;;;;;;;AAAA,SACEA,MAAM,IAAIC,cAAc,QAEnB,uBAAuB;AAE9B,OAAOC,EAAE,MAAM,YAAY;AAC3B,OAAOC,KAAK,MAAM,OAAO;AAAC,OAGnBC,WAAW;AAAA,SACTC,cAAc;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,OAAO,IAAMP,MAAM,gBAAGG,KAAK,CAACK,UAAU,CAAC,SAASR,MAAMA,CAAAS,IAAA,EAEpDC,GAA2B,EACd;EAAA,IAFb;MAAEC;IAAwC,CAAC,GAAAF,IAAA;IAApBG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAG5B,IAAAC,eAAA,GAMIV,cAAc,CAACO,KAAK,CAAC;IANnB;MACJI,kBAAkB;MAClBC,YAAY;MACZC,WAAW;MACXR,GAAG,EAAES;IAEP,CAAC,GAAAJ,eAAA;IADIK,WAAW,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAEhB,IAAMC,SAAS,GAAGlB,WAAW,CAACM,GAAG,EAAES,SAAS,CAAC;EAC7C,oBACEZ,IAAA,CAACN;EACC;EAAA,EAAAsB,aAAA,CAAAA,aAAA,KACIH,WAAW;IACfV,GAAG,EAAEY,SAAU;IACfX,gBAAgB,EAAET,EAAE,CAAC,WAAW,EAAES,gBAAgB;IAClD;IACA;IACA;IAAA;IACAK,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDC,WAAW,EACTA;EACD,EACF,CAAC;AAEN,CAAC,CAAC;AAEF,eAAelB,MAAM"}
@@ -0,0 +1,9 @@
1
+ import { Ref, RefCallback } from 'react';
2
+ /**
3
+ * Takes in multiple refs and then returns one ref that can be assigned to the component.
4
+ * In turn all the refs passed in will be assigned when the ref returned is assigned.
5
+ * @param refs The refs to assign
6
+ */
7
+ declare function useMultiRef<T>(...refs: readonly Ref<T>[]): RefCallback<T>;
8
+ export default useMultiRef;
9
+ //# sourceMappingURL=useMultiRef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMultiRef.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/useMultiRef.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,GAAG,EAAE,WAAW,EAAe,MAAM,OAAO,CAAC;AAExE;;;;GAIG;AACH,iBAAS,WAAW,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAYlE;AAED,eAAe,WAAW,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { useCallback } from 'react';
2
+
3
+ /**
4
+ * Takes in multiple refs and then returns one ref that can be assigned to the component.
5
+ * In turn all the refs passed in will be assigned when the ref returned is assigned.
6
+ * @param refs The refs to assign
7
+ */
8
+ function useMultiRef() {
9
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
10
+ refs[_key] = arguments[_key];
11
+ }
12
+ return useCallback(newRef => {
13
+ refs.forEach(ref => {
14
+ if (typeof ref === 'function') {
15
+ ref(newRef);
16
+ } else if (ref != null) {
17
+ // eslint-disable-next-line no-param-reassign
18
+ ref.current = newRef;
19
+ }
20
+ });
21
+ // eslint-disable-next-line react-hooks/exhaustive-deps
22
+ }, refs);
23
+ }
24
+ export default useMultiRef;
25
+ //# sourceMappingURL=useMultiRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMultiRef.js","names":["useCallback","useMultiRef","_len","arguments","length","refs","Array","_key","newRef","forEach","ref","current"],"sources":["../../../src/spectrum/picker/useMultiRef.ts"],"sourcesContent":["import { MutableRefObject, Ref, RefCallback, useCallback } from 'react';\n\n/**\n * Takes in multiple refs and then returns one ref that can be assigned to the component.\n * In turn all the refs passed in will be assigned when the ref returned is assigned.\n * @param refs The refs to assign\n */\nfunction useMultiRef<T>(...refs: readonly Ref<T>[]): RefCallback<T> {\n return useCallback(newRef => {\n refs.forEach(ref => {\n if (typeof ref === 'function') {\n ref(newRef);\n } else if (ref != null) {\n // eslint-disable-next-line no-param-reassign\n (ref as MutableRefObject<T | null>).current = newRef;\n }\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, refs);\n}\n\nexport default useMultiRef;\n"],"mappings":"AAAA,SAA6CA,WAAW,QAAQ,OAAO;;AAEvE;AACA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CAAA,EAAgD;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAzCC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EAC7B,OAAOP,WAAW,CAACQ,MAAM,IAAI;IAC3BH,IAAI,CAACI,OAAO,CAACC,GAAG,IAAI;MAClB,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;QAC7BA,GAAG,CAACF,MAAM,CAAC;MACb,CAAC,MAAM,IAAIE,GAAG,IAAI,IAAI,EAAE;QACtB;QACCA,GAAG,CAAgCC,OAAO,GAAGH,MAAM;MACtD;IACF,CAAC,CAAC;IACF;EACF,CAAC,EAAEH,IAAI,CAAC;AACV;AAEA,eAAeJ,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/components",
3
- "version": "0.84.1-beta.0+e3aa3920",
3
+ "version": "0.84.1-beta.3+a11e2cea",
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.35.1",
28
- "@deephaven/icons": "^0.84.1-beta.0+e3aa3920",
29
- "@deephaven/log": "^0.84.1-beta.0+e3aa3920",
30
- "@deephaven/react-hooks": "^0.84.1-beta.0+e3aa3920",
31
- "@deephaven/utils": "^0.84.1-beta.0+e3aa3920",
28
+ "@deephaven/icons": "^0.84.1-beta.3+a11e2cea",
29
+ "@deephaven/log": "^0.84.1-beta.3+a11e2cea",
30
+ "@deephaven/react-hooks": "^0.84.1-beta.3+a11e2cea",
31
+ "@deephaven/utils": "^0.84.1-beta.3+a11e2cea",
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",
@@ -56,7 +56,7 @@
56
56
  "react-dom": ">=16.8.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@deephaven/mocks": "^0.84.1-beta.0+e3aa3920"
59
+ "@deephaven/mocks": "^0.84.1-beta.3+a11e2cea"
60
60
  },
61
61
  "files": [
62
62
  "dist",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "e3aa3920b8c40dcebb2d3e91a570e2df55bfa190"
73
+ "gitHead": "a11e2ceaf216d640068562a05fdb156c69481d47"
74
74
  }