@deephaven/components 0.82.1-beta.0 → 0.82.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.
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/spectrum/comboBox/ComboBox.d.ts +7 -0
- package/dist/spectrum/comboBox/ComboBox.d.ts.map +1 -0
- package/dist/spectrum/comboBox/ComboBox.js +41 -0
- package/dist/spectrum/comboBox/ComboBox.js.map +1 -0
- package/dist/spectrum/comboBox/index.d.ts +2 -0
- package/dist/spectrum/comboBox/index.d.ts.map +1 -0
- package/dist/spectrum/comboBox/index.js +2 -0
- package/dist/spectrum/comboBox/index.js.map +1 -0
- package/dist/spectrum/index.d.ts +1 -1
- package/dist/spectrum/index.d.ts.map +1 -1
- package/dist/spectrum/index.js +1 -1
- package/dist/spectrum/index.js.map +1 -1
- package/dist/spectrum/picker/Picker.d.ts +2 -25
- package/dist/spectrum/picker/Picker.d.ts.map +1 -1
- package/dist/spectrum/picker/Picker.js +21 -67
- package/dist/spectrum/picker/Picker.js.map +1 -1
- package/dist/spectrum/picker/PickerNormalized.d.ts +1 -8
- package/dist/spectrum/picker/PickerNormalized.d.ts.map +1 -1
- package/dist/spectrum/picker/PickerNormalized.js +2 -2
- package/dist/spectrum/picker/PickerNormalized.js.map +1 -1
- package/dist/spectrum/picker/PickerProps.d.ts +64 -0
- package/dist/spectrum/picker/PickerProps.d.ts.map +1 -0
- package/dist/spectrum/picker/PickerProps.js +2 -0
- package/dist/spectrum/picker/PickerProps.js.map +1 -0
- package/dist/spectrum/picker/index.d.ts +3 -0
- package/dist/spectrum/picker/index.d.ts.map +1 -1
- package/dist/spectrum/picker/index.js +3 -0
- package/dist/spectrum/picker/index.js.map +1 -1
- package/dist/spectrum/picker/usePickerItemScale.d.ts +9 -0
- package/dist/spectrum/picker/usePickerItemScale.d.ts.map +1 -0
- package/dist/spectrum/picker/usePickerItemScale.js +17 -0
- package/dist/spectrum/picker/usePickerItemScale.js.map +1 -0
- package/dist/spectrum/picker/usePickerProps.d.ts +23 -0
- package/dist/spectrum/picker/usePickerProps.d.ts.map +1 -0
- package/dist/spectrum/picker/usePickerProps.js +70 -0
- package/dist/spectrum/picker/usePickerProps.js.map +1 -0
- package/dist/spectrum/utils/index.d.ts +2 -0
- package/dist/spectrum/utils/index.d.ts.map +1 -1
- package/dist/spectrum/utils/index.js +2 -0
- package/dist/spectrum/utils/index.js.map +1 -1
- package/dist/spectrum/utils/itemUtils.d.ts +7 -2
- package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
- package/dist/spectrum/utils/itemUtils.js +13 -0
- package/dist/spectrum/utils/itemUtils.js.map +1 -1
- package/dist/spectrum/utils/itemWrapperUtils.d.ts.map +1 -1
- package/dist/spectrum/utils/itemWrapperUtils.js +2 -2
- package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -1
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.d.ts +19 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.d.ts.map +1 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js +31 -0
- package/dist/spectrum/utils/useOnChangeTrackUncontrolled.js.map +1 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.d.ts +10 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.d.ts.map +1 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js +27 -0
- package/dist/spectrum/utils/useStaticItemInitialScrollPosition.js.map +1 -0
- package/package.json +7 -7
- package/dist/ComboBox.d.ts +0 -120
- package/dist/ComboBox.d.ts.map +0 -1
- package/dist/ComboBox.js +0 -497
- package/dist/ComboBox.js.map +0 -1
- package/dist/spectrum/pickers.d.ts +0 -2
- package/dist/spectrum/pickers.d.ts.map +0 -1
- package/dist/spectrum/pickers.js +0 -2
- package/dist/spectrum/pickers.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export { default as CardFlip } from './CardFlip';
|
|
|
9
9
|
export * from './context-actions';
|
|
10
10
|
export { default as Collapse } from './Collapse';
|
|
11
11
|
export { default as Checkbox } from './Checkbox';
|
|
12
|
-
export { default as ComboBox } from './ComboBox';
|
|
13
12
|
export { default as CopyButton } from './CopyButton';
|
|
14
13
|
export { default as CustomTimeSelect } from './CustomTimeSelect';
|
|
15
14
|
export * from './DateTimeInput';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,s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@@ -8,7 +8,6 @@ export { default as CardFlip } from "./CardFlip.js";
|
|
|
8
8
|
export * from "./context-actions/index.js";
|
|
9
9
|
export { default as Collapse } from "./Collapse.js";
|
|
10
10
|
export { default as Checkbox } from "./Checkbox.js";
|
|
11
|
-
export { default as ComboBox } from "./ComboBox.js";
|
|
12
11
|
export { default as CopyButton } from "./CopyButton.js";
|
|
13
12
|
export { default as CustomTimeSelect } from "./CustomTimeSelect.js";
|
|
14
13
|
export * from "./DateTimeInput.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","AutoCompleteInput","AutoResizeTextarea","BasicModal","CardFlip","Collapse","Checkbox","
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","AutoCompleteInput","AutoResizeTextarea","BasicModal","CardFlip","Collapse","Checkbox","CopyButton","CustomTimeSelect","DateInput","DebouncedSearchInput","DraggableItemList","DragUtils","EditableItemList","ErrorView","HierarchicalCheckboxMenu","ItemListItem","LoadingOverlay","LoadingSpinner","DropdownMenu","MaskedInput","Option","RandomAreaPlotAnimation","Select","SearchInput","SelectValueList","SocketedButton","ThemeExport","TimeInput","TimeSlider","ToastNotification","UISwitch"],"sources":["../src/index.ts"],"sourcesContent":["export type { Range } from '@deephaven/utils';\nexport * from './actions';\nexport { default as AutoCompleteInput } from './AutoCompleteInput';\nexport { default as AutoResizeTextarea } from './AutoResizeTextarea';\nexport { default as BasicModal } from './BasicModal';\nexport * from './Button';\nexport * from './BulkActionBar';\nexport { default as CardFlip } from './CardFlip';\nexport * from './context-actions';\nexport { default as Collapse } from './Collapse';\nexport { default as Checkbox } from './Checkbox';\nexport { default as CopyButton } from './CopyButton';\nexport { default as CustomTimeSelect } from './CustomTimeSelect';\nexport * from './DateTimeInput';\nexport { default as DateInput } from './DateInput';\nexport { default as DebouncedSearchInput } from './DebouncedSearchInput';\nexport * from './dialogs';\nexport { default as DraggableItemList } from './DraggableItemList';\nexport * from './DraggableItemList';\nexport { default as DragUtils } from './DragUtils';\nexport { default as EditableItemList } from './EditableItemList';\nexport * from './ErrorBoundary';\nexport { default as ErrorView } from './ErrorView';\nexport { default as HierarchicalCheckboxMenu } from './HierarchicalCheckboxMenu';\nexport * from './HierarchicalCheckboxMenu';\nexport * from './ItemList';\nexport { default as ItemListItem } from './ItemListItem';\nexport { default as LoadingOverlay } from './LoadingOverlay';\nexport { default as LoadingSpinner } from './LoadingSpinner';\nexport { default as DropdownMenu } from './menu-actions';\nexport * from './menu-actions';\nexport { default as MaskedInput } from './MaskedInput';\nexport * from './MaskedInput';\nexport * from './MaskedInputUtils';\nexport * from './navigation';\nexport { default as Option } from './Option';\nexport * from './popper';\nexport * from './modal';\nexport { default as RandomAreaPlotAnimation } from './RandomAreaPlotAnimation';\nexport * from './SearchableCombobox';\nexport { default as Select } from './Select';\nexport { default as SearchInput } from './SearchInput';\nexport { default as SelectValueList } from './SelectValueList';\nexport * from './SelectValueList';\nexport * from './shortcuts';\nexport { default as SocketedButton } from './SocketedButton';\nexport * from './spectrum';\nexport * from './SplitButtonGroup';\nexport * from './TableViewEmptyState';\nexport * from './TextWithTooltip';\nexport * from './theme';\nexport * from './transitions';\nexport { default as ThemeExport } from './ThemeExport';\nexport { default as TimeInput } from './TimeInput';\nexport { default as TimeSlider } from './TimeSlider';\nexport { default as ToastNotification } from './ToastNotification';\nexport { default as UISwitch } from './UISwitch';\n"],"mappings":";SAESA,OAAO,IAAIC,iBAAiB;AAAA,SAC5BD,OAAO,IAAIE,kBAAkB;AAAA,SAC7BF,OAAO,IAAIG,UAAU;AAAA;AAAA;AAAA,SAGrBH,OAAO,IAAII,QAAQ;AAAA;AAAA,SAEnBJ,OAAO,IAAIK,QAAQ;AAAA,SACnBL,OAAO,IAAIM,QAAQ;AAAA,SACnBN,OAAO,IAAIO,UAAU;AAAA,SACrBP,OAAO,IAAIQ,gBAAgB;AAAA;AAAA,SAE3BR,OAAO,IAAIS,SAAS;AAAA,SACpBT,OAAO,IAAIU,oBAAoB;AAAA;AAAA,SAE/BV,OAAO,IAAIW,iBAAiB;AAAA;AAAA,SAE5BX,OAAO,IAAIY,SAAS;AAAA,SACpBZ,OAAO,IAAIa,gBAAgB;AAAA;AAAA,SAE3Bb,OAAO,IAAIc,SAAS;AAAA,SACpBd,OAAO,IAAIe,wBAAwB;AAAA;AAAA;AAAA,SAGnCf,OAAO,IAAIgB,YAAY;AAAA,SACvBhB,OAAO,IAAIiB,cAAc;AAAA,SACzBjB,OAAO,IAAIkB,cAAc;AAAA,SACzBlB,OAAO,IAAImB,YAAY;AAAA;AAAA,SAEvBnB,OAAO,IAAIoB,WAAW;AAAA;AAAA;AAAA;AAAA,SAItBpB,OAAO,IAAIqB,MAAM;AAAA;AAAA;AAAA,SAGjBrB,OAAO,IAAIsB,uBAAuB;AAAA;AAAA,SAElCtB,OAAO,IAAIuB,MAAM;AAAA,SACjBvB,OAAO,IAAIwB,WAAW;AAAA,SACtBxB,OAAO,IAAIyB,eAAe;AAAA;AAAA;AAAA,SAG1BzB,OAAO,IAAI0B,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAOzB1B,OAAO,IAAI2B,WAAW;AAAA,SACtB3B,OAAO,IAAI4B,SAAS;AAAA,SACpB5B,OAAO,IAAI6B,UAAU;AAAA,SACrB7B,OAAO,IAAI8B,iBAAiB;AAAA,SAC5B9B,OAAO,IAAI+B,QAAQ"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SpectrumComboBoxProps } from '@adobe/react-spectrum';
|
|
3
|
+
import type { NormalizedItem } from '../utils';
|
|
4
|
+
import { PickerPropsT } from '../picker';
|
|
5
|
+
export type ComboBoxProps = PickerPropsT<SpectrumComboBoxProps<NormalizedItem>>;
|
|
6
|
+
export declare function ComboBox({ UNSAFE_className, ...props }: ComboBoxProps): JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ComboBox.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var _excluded = ["UNSAFE_className"],
|
|
2
|
+
_excluded2 = ["defaultSelectedKey", "disabledKeys", "selectedKey", "scrollRef"];
|
|
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
|
+
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
|
+
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; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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
|
+
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
|
+
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 { ComboBox as SpectrumComboBox } from '@adobe/react-spectrum';
|
|
11
|
+
import cl from 'classnames';
|
|
12
|
+
import { usePickerProps } from "../picker/index.js";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export function ComboBox(_ref) {
|
|
15
|
+
var {
|
|
16
|
+
UNSAFE_className
|
|
17
|
+
} = _ref,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
var _usePickerProps = usePickerProps(props),
|
|
20
|
+
{
|
|
21
|
+
defaultSelectedKey,
|
|
22
|
+
disabledKeys,
|
|
23
|
+
selectedKey,
|
|
24
|
+
scrollRef
|
|
25
|
+
} = _usePickerProps,
|
|
26
|
+
comboBoxProps = _objectWithoutProperties(_usePickerProps, _excluded2);
|
|
27
|
+
return /*#__PURE__*/_jsx(SpectrumComboBox
|
|
28
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
29
|
+
, _objectSpread(_objectSpread({}, comboBoxProps), {}, {
|
|
30
|
+
ref: scrollRef,
|
|
31
|
+
UNSAFE_className: cl('dh-combobox', UNSAFE_className)
|
|
32
|
+
// Type assertions are necessary here since Spectrum types don't account
|
|
33
|
+
// for number and boolean key values even though they are valid runtime
|
|
34
|
+
// values.
|
|
35
|
+
,
|
|
36
|
+
defaultSelectedKey: defaultSelectedKey,
|
|
37
|
+
disabledKeys: disabledKeys,
|
|
38
|
+
selectedKey: selectedKey
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=ComboBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboBox.js","names":["ComboBox","SpectrumComboBox","cl","usePickerProps","jsx","_jsx","_ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","scrollRef","comboBoxProps","_excluded2","_objectSpread","ref"],"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 selectedKey,\n scrollRef,\n ...comboBoxProps\n } = usePickerProps(props);\n\n return (\n <SpectrumComboBox\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...comboBoxProps}\n ref={scrollRef as FocusableRef<HTMLElement>}\n UNSAFE_className={cl('dh-combobox', 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 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,WAAW;MACXC;IAEF,CAAC,GAAAJ,eAAA;IADIK,aAAa,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAGlB,oBACEZ,IAAA,CAACJ;EACC;EAAA,EAAAiB,aAAA,CAAAA,aAAA,KACIF,aAAa;IACjBG,GAAG,EAAEJ,SAAuC;IAC5CR,gBAAgB,EAAEL,EAAE,CAAC,aAAa,EAAEK,gBAAgB;IACpD;IACA;IACA;IAAA;IACAK,kBAAkB,EAChBA,kBACD;IACDC,YAAY,EACVA,YACD;IACDC,WAAW,EACTA;EACD,EACF,CAAC;AAEN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/comboBox/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/comboBox/index.ts"],"sourcesContent":["export * from './ComboBox';\n"],"mappings":""}
|
package/dist/spectrum/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export * from './icons';
|
|
|
10
10
|
export * from './layout';
|
|
11
11
|
export * from './navigation';
|
|
12
12
|
export * from './overlays';
|
|
13
|
-
export * from './pickers';
|
|
14
13
|
export * from './shared';
|
|
15
14
|
export * from './status';
|
|
16
15
|
/**
|
|
@@ -18,6 +17,7 @@ export * from './status';
|
|
|
18
17
|
*/
|
|
19
18
|
export * from './ActionMenu';
|
|
20
19
|
export * from './ActionGroup';
|
|
20
|
+
export * from './comboBox';
|
|
21
21
|
export * from './ListActionGroup';
|
|
22
22
|
export * from './ListActionMenu';
|
|
23
23
|
export * from './listView';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB;;GAEG;AACH,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/dist/spectrum/index.js
CHANGED
|
@@ -10,7 +10,6 @@ export * from "./icons.js";
|
|
|
10
10
|
export * from "./layout.js";
|
|
11
11
|
export * from "./navigation.js";
|
|
12
12
|
export * from "./overlays.js";
|
|
13
|
-
export * from "./pickers.js";
|
|
14
13
|
export * from "./shared.js";
|
|
15
14
|
export * from "./status.js";
|
|
16
15
|
/**
|
|
@@ -18,6 +17,7 @@ export * from "./status.js";
|
|
|
18
17
|
*/
|
|
19
18
|
export * from "./ActionMenu.js";
|
|
20
19
|
export * from "./ActionGroup.js";
|
|
20
|
+
export * from "./comboBox/index.js";
|
|
21
21
|
export * from "./ListActionGroup.js";
|
|
22
22
|
export * from "./ListActionMenu.js";
|
|
23
23
|
export * from "./listView/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["/**\n * Re-exporting React Spectrum components + props.\n */\nexport * from './buttons';\nexport * from './collections';\nexport * from './content';\nexport * from './dateAndTime';\nexport * from './forms';\nexport * from './icons';\nexport * from './layout';\nexport * from './navigation';\nexport * from './overlays';\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["/**\n * Re-exporting React Spectrum components + props.\n */\nexport * from './buttons';\nexport * from './collections';\nexport * from './content';\nexport * from './dateAndTime';\nexport * from './forms';\nexport * from './icons';\nexport * from './layout';\nexport * from './navigation';\nexport * from './overlays';\nexport * from './shared';\nexport * from './status';\n\n/**\n * Custom DH components wrapping React Spectrum components.\n */\nexport * from './ActionMenu';\nexport * from './ActionGroup';\nexport * from './comboBox';\nexport * from './ListActionGroup';\nexport * from './ListActionMenu';\nexport * from './listView';\nexport * from './picker';\nexport * from './Heading';\nexport * from './Text';\nexport * from './View';\n\n/**\n * Custom DH spectrum utils\n */\nexport * from './ItemContent';\nexport * from './ItemTooltip';\nexport * from './utils';\n"],"mappings":"AAAA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA;AACA;AACA;AAFA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcA;AACA;AACA;AAFA;AAAA;AAAA"}
|
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export type PickerProps = {
|
|
4
|
-
children: ItemOrSection | ItemOrSection[];
|
|
5
|
-
/** Can be set to true or a TooltipOptions to enable item tooltips */
|
|
6
|
-
tooltip?: boolean | TooltipOptions;
|
|
7
|
-
/** The currently selected key in the collection (controlled). */
|
|
8
|
-
selectedKey?: ItemKey | null;
|
|
9
|
-
/** The initial selected key in the collection (uncontrolled). */
|
|
10
|
-
defaultSelectedKey?: ItemKey;
|
|
11
|
-
/**
|
|
12
|
-
* Handler that is called when the selection change.
|
|
13
|
-
* Note that under the hood, this is just an alias for Spectrum's
|
|
14
|
-
* `onSelectionChange`. We are renaming for better consistency with other
|
|
15
|
-
* components.
|
|
16
|
-
*/
|
|
17
|
-
onChange?: (key: ItemKey) => void;
|
|
18
|
-
/** Handler that is called when the picker is scrolled. */
|
|
19
|
-
onScroll?: (event: Event) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Handler that is called when the selection changes.
|
|
22
|
-
* @deprecated Use `onChange` instead
|
|
23
|
-
*/
|
|
24
|
-
onSelectionChange?: (key: ItemKey) => void;
|
|
25
|
-
} & Omit<NormalizedSpectrumPickerProps, 'children' | 'items' | 'onSelectionChange' | 'selectedKey' | 'defaultSelectedKey'>;
|
|
2
|
+
import type { PickerProps } from './PickerProps';
|
|
26
3
|
/**
|
|
27
4
|
* Picker component for selecting items from a list of items. Items can be
|
|
28
5
|
* provided via the `children` prop. Each item can be a string, number, boolean,
|
|
@@ -30,6 +7,6 @@ export type PickerProps = {
|
|
|
30
7
|
* for the Spectrum Picker component.
|
|
31
8
|
* See https://react-spectrum.adobe.com/react-spectrum/Picker.html
|
|
32
9
|
*/
|
|
33
|
-
export declare function Picker({
|
|
10
|
+
export declare function Picker({ UNSAFE_className, ...props }: PickerProps): JSX.Element;
|
|
34
11
|
export default Picker;
|
|
35
12
|
//# sourceMappingURL=Picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAOA,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,CA6B3B;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["UNSAFE_className"],
|
|
2
|
+
_excluded2 = ["defaultSelectedKey", "disabledKeys", "selectedKey", "scrollRef"];
|
|
2
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; }
|
|
3
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; }
|
|
4
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; }
|
|
5
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
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); }
|
|
7
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
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; }
|
|
10
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; }
|
|
11
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
12
10
|
import { Picker as SpectrumPicker } from '@adobe/react-spectrum';
|
|
13
11
|
import cl from 'classnames';
|
|
14
|
-
import {
|
|
15
|
-
import { getPositionOfSelectedItemElement, normalizeTooltipOptions, isItemElementWithDescription, isSectionElement } from "../utils/itemUtils.js";
|
|
16
|
-
import { wrapItemChildren } from "../utils/itemWrapperUtils.js";
|
|
17
|
-
import usePickerScrollOnOpen from "./usePickerScrollOnOpen.js";
|
|
18
|
-
import { useSpectrumThemeProvider } from "../../theme/index.js";
|
|
19
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { usePickerProps } from "./usePickerProps.js";
|
|
20
13
|
/**
|
|
21
14
|
* Picker component for selecting items from a list of items. Items can be
|
|
22
15
|
* provided via the `children` prop. Each item can be a string, number, boolean,
|
|
@@ -24,71 +17,32 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
17
|
* for the Spectrum Picker component.
|
|
25
18
|
* See https://react-spectrum.adobe.com/react-spectrum/Picker.html
|
|
26
19
|
*/
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
21
|
export function Picker(_ref) {
|
|
28
22
|
var {
|
|
29
|
-
children,
|
|
30
|
-
tooltip = true,
|
|
31
|
-
defaultSelectedKey,
|
|
32
|
-
selectedKey,
|
|
33
|
-
onChange,
|
|
34
|
-
onOpenChange,
|
|
35
|
-
onScroll = EMPTY_FUNCTION,
|
|
36
|
-
onSelectionChange,
|
|
37
|
-
// eslint-disable-next-line camelcase
|
|
38
23
|
UNSAFE_className
|
|
39
24
|
} = _ref,
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var isUncontrolled = selectedKey === undefined;
|
|
50
|
-
var [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState(defaultSelectedKey);
|
|
51
|
-
var wrappedItems = useMemo(() => ensureArray(wrapItemChildren(children, tooltipOptions)), [children, tooltipOptions]);
|
|
52
|
-
|
|
53
|
-
// Item descriptions and Section elements introduce variable item heights.
|
|
54
|
-
// This throws off scroll position calculations, so we disable auto scrolling
|
|
55
|
-
// if either of these are found.
|
|
56
|
-
var disableScrollOnOpen = useMemo(() => wrappedItems.some(item => isSectionElement(item) || isItemElementWithDescription(item)), [wrappedItems]);
|
|
57
|
-
var getInitialScrollPosition = useCallback( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
58
|
-
return disableScrollOnOpen ? null : getPositionOfSelectedItemElement({
|
|
59
|
-
items: wrappedItems,
|
|
60
|
-
itemHeight,
|
|
61
|
-
selectedKey: isUncontrolled ? uncontrolledSelectedKey : selectedKey,
|
|
62
|
-
topOffset: PICKER_TOP_OFFSET
|
|
63
|
-
});
|
|
64
|
-
}), [disableScrollOnOpen, isUncontrolled, itemHeight, selectedKey, uncontrolledSelectedKey, wrappedItems]);
|
|
65
|
-
var onSelectionChangeInternal = useCallback(key => {
|
|
66
|
-
var _ref3;
|
|
67
|
-
// If our component is uncontrolled, track the selected key internally
|
|
68
|
-
// so that we can scroll to the selected item if the user re-opens
|
|
69
|
-
if (isUncontrolled) {
|
|
70
|
-
setUncontrolledSelectedKey(key);
|
|
71
|
-
}
|
|
72
|
-
(_ref3 = onChange !== null && onChange !== void 0 ? onChange : onSelectionChange) === null || _ref3 === void 0 ? void 0 : _ref3(key);
|
|
73
|
-
}, [isUncontrolled, onChange, onSelectionChange]);
|
|
74
|
-
var {
|
|
75
|
-
ref: scrollRef,
|
|
76
|
-
onOpenChange: onOpenChangeInternal
|
|
77
|
-
} = usePickerScrollOnOpen({
|
|
78
|
-
getInitialScrollPosition,
|
|
79
|
-
onScroll,
|
|
80
|
-
onOpenChange
|
|
81
|
-
});
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var _usePickerProps = usePickerProps(props),
|
|
27
|
+
{
|
|
28
|
+
defaultSelectedKey,
|
|
29
|
+
disabledKeys,
|
|
30
|
+
selectedKey,
|
|
31
|
+
scrollRef
|
|
32
|
+
} = _usePickerProps,
|
|
33
|
+
pickerProps = _objectWithoutProperties(_usePickerProps, _excluded2);
|
|
82
34
|
return /*#__PURE__*/_jsx(SpectrumPicker
|
|
83
35
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
84
|
-
, _objectSpread(_objectSpread({},
|
|
36
|
+
, _objectSpread(_objectSpread({}, pickerProps), {}, {
|
|
85
37
|
ref: scrollRef,
|
|
86
|
-
UNSAFE_className: cl('dh-picker', UNSAFE_className)
|
|
87
|
-
|
|
38
|
+
UNSAFE_className: cl('dh-picker', UNSAFE_className)
|
|
39
|
+
// Type assertions are necessary here since Spectrum types don't account
|
|
40
|
+
// for number and boolean key values even though they are valid runtime
|
|
41
|
+
// values.
|
|
42
|
+
,
|
|
88
43
|
defaultSelectedKey: defaultSelectedKey,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
children: wrappedItems
|
|
44
|
+
disabledKeys: disabledKeys,
|
|
45
|
+
selectedKey: selectedKey
|
|
92
46
|
}));
|
|
93
47
|
}
|
|
94
48
|
export default Picker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.js","names":["
|
|
1
|
+
{"version":3,"file":"Picker.js","names":["Picker","SpectrumPicker","cl","usePickerProps","jsx","_jsx","_ref","UNSAFE_className","props","_objectWithoutProperties","_excluded","_usePickerProps","defaultSelectedKey","disabledKeys","selectedKey","scrollRef","pickerProps","_excluded2","_objectSpread","ref"],"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 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 {\n defaultSelectedKey,\n disabledKeys,\n selectedKey,\n scrollRef,\n ...pickerProps\n } = usePickerProps(props);\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n ref={scrollRef as DOMRef<HTMLDivElement>}\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;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,GAMIR,cAAc,CAACK,KAAK,CAAC;IANnB;MACJI,kBAAkB;MAClBC,YAAY;MACZC,WAAW;MACXC;IAEF,CAAC,GAAAJ,eAAA;IADIK,WAAW,GAAAP,wBAAA,CAAAE,eAAA,EAAAM,UAAA;EAGhB,oBACEZ,IAAA,CAACJ;EACC;EAAA,EAAAiB,aAAA,CAAAA,aAAA,KACIF,WAAW;IACfG,GAAG,EAAEJ,SAAoC;IACzCR,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,12 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
import { NormalizedItem, NormalizedSection } from '../utils';
|
|
4
|
-
export interface PickerNormalizedProps extends Omit<PickerBaseProps, 'children'> {
|
|
5
|
-
normalizedItems: (NormalizedItem | NormalizedSection)[];
|
|
6
|
-
showItemIcons: boolean;
|
|
7
|
-
getInitialScrollPosition?: () => Promise<number | null | undefined>;
|
|
8
|
-
onScroll?: (event: Event) => void;
|
|
9
|
-
}
|
|
2
|
+
import type { PickerNormalizedProps } from './PickerProps';
|
|
10
3
|
/**
|
|
11
4
|
* Picker that takes an array of `NormalizedItem` or `NormalizedSection` items
|
|
12
5
|
* as children and uses a render item function to render the items. This is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerNormalized.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"PickerNormalized.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAW3D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,eAAe,EACf,OAAc,EACd,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,QAAyB,EACzB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAgFrC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -13,13 +13,13 @@ import { EMPTY_FUNCTION } from '@deephaven/utils';
|
|
|
13
13
|
import { Section } from "../shared.js";
|
|
14
14
|
import { getItemKey, isNormalizedSection, normalizeTooltipOptions, useRenderNormalizedItem, useStringifiedSelection } from "../utils/index.js";
|
|
15
15
|
import usePickerScrollOnOpen from "./usePickerScrollOnOpen.js";
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
import { createElement as _createElement } from "react";
|
|
18
16
|
/**
|
|
19
17
|
* Picker that takes an array of `NormalizedItem` or `NormalizedSection` items
|
|
20
18
|
* as children and uses a render item function to render the items. This is
|
|
21
19
|
* necessary to support windowed data.
|
|
22
20
|
*/
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { createElement as _createElement } from "react";
|
|
23
23
|
export function PickerNormalized(_ref) {
|
|
24
24
|
var {
|
|
25
25
|
normalizedItems,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickerNormalized.js","names":["useMemo","Picker","SpectrumPicker","cl","EMPTY_FUNCTION","Section","getItemKey","isNormalizedSection","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedSelection","usePickerScrollOnOpen","jsx","_jsx","createElement","_createElement","PickerNormalized","_ref","normalizedItems","tooltip","selectedKey","defaultSelectedKey","disabledKeys","showItemIcons","UNSAFE_className","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","props","_objectWithoutProperties","_excluded","tooltipOptions","renderNormalizedItem","itemIconSlot","showItemDescriptions","forceRerenderKey","concat","placement","ref","scrollRef","onOpenChangeInternal","selectedStringKey","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","_objectSpread","key","items","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title","item","children"],"sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport type { DOMRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport { Section } from '../shared';\nimport type {
|
|
1
|
+
{"version":3,"file":"PickerNormalized.js","names":["useMemo","Picker","SpectrumPicker","cl","EMPTY_FUNCTION","Section","getItemKey","isNormalizedSection","normalizeTooltipOptions","useRenderNormalizedItem","useStringifiedSelection","usePickerScrollOnOpen","jsx","_jsx","createElement","_createElement","PickerNormalized","_ref","normalizedItems","tooltip","selectedKey","defaultSelectedKey","disabledKeys","showItemIcons","UNSAFE_className","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","props","_objectWithoutProperties","_excluded","tooltipOptions","renderNormalizedItem","itemIconSlot","showItemDescriptions","forceRerenderKey","concat","placement","ref","scrollRef","onOpenChangeInternal","selectedStringKey","defaultSelectedStringKey","disabledStringKeys","onStringSelectionChange","_objectSpread","key","items","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title","item","children"],"sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport type { DOMRef } from '@react-types/shared';\nimport cl from 'classnames';\nimport { EMPTY_FUNCTION } from '@deephaven/utils';\nimport { Section } from '../shared';\nimport type { PickerNormalizedProps } from './PickerProps';\n\nimport {\n getItemKey,\n isNormalizedSection,\n normalizeTooltipOptions,\n useRenderNormalizedItem,\n useStringifiedSelection,\n} from '../utils';\nimport usePickerScrollOnOpen from './usePickerScrollOnOpen';\n\n/**\n * Picker that takes an array of `NormalizedItem` or `NormalizedSection` items\n * as children and uses a render item function to render the items. This is\n * necessary to support windowed data.\n */\nexport function PickerNormalized({\n normalizedItems,\n tooltip = true,\n selectedKey,\n defaultSelectedKey,\n disabledKeys,\n showItemIcons,\n UNSAFE_className,\n getInitialScrollPosition,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n ...props\n}: PickerNormalizedProps): JSX.Element {\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem({\n itemIconSlot: 'icon',\n // Descriptions introduce variable item heights which throws off calculation\n // of initial scroll position and setting viewport on windowed data. For now\n // not going to implement description support in Picker.\n // https://github.com/deephaven/web-client-ui/issues/1958\n showItemDescriptions: false,\n showItemIcons,\n tooltipOptions,\n });\n\n // Spectrum doesn't re-render if only the `renderNormalizedItems` function\n // changes, so we create a key from its dependencies that can be used to force\n // re-render.\n const forceRerenderKey = `${showItemIcons}-${tooltipOptions?.placement}`;\n\n const { ref: scrollRef, onOpenChange: onOpenChangeInternal } =\n usePickerScrollOnOpen({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n });\n\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 // map original key types to and from strings so that selection works.\n const {\n selectedStringKey,\n defaultSelectedStringKey,\n disabledStringKeys,\n onStringSelectionChange,\n } = useStringifiedSelection({\n normalizedItems,\n selectedKey,\n defaultSelectedKey,\n disabledKeys,\n onChange: onChange ?? onSelectionChange,\n });\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n key={forceRerenderKey}\n ref={scrollRef as DOMRef<HTMLDivElement>}\n UNSAFE_className={cl(\n 'dh-picker',\n 'dh-picker-normalized',\n UNSAFE_className\n )}\n items={normalizedItems}\n selectedKey={selectedStringKey}\n defaultSelectedKey={defaultSelectedStringKey}\n disabledKeys={disabledStringKeys}\n onSelectionChange={onStringSelectionChange}\n onOpenChange={onOpenChangeInternal}\n >\n {itemOrSection => {\n if (isNormalizedSection(itemOrSection)) {\n return (\n <Section\n key={getItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderNormalizedItem}\n </Section>\n );\n }\n\n return renderNormalizedItem(itemOrSection);\n }}\n </SpectrumPicker>\n );\n}\n\nexport default PickerNormalized;\n"],"mappings":";;;;;;;;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,MAAM,IAAIC,cAAc,QAAQ,uBAAuB;AAEhE,OAAOC,EAAE,MAAM,YAAY;AAC3B,SAASC,cAAc,QAAQ,kBAAkB;AAAC,SACzCC,OAAO;AAAA,SAIdC,UAAU,EACVC,mBAAmB,EACnBC,uBAAuB,EACvBC,uBAAuB,EACvBC,uBAAuB;AAAA,OAElBC,qBAAqB;AAE5B;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,aAAA,IAAAC,cAAA;AAKA,OAAO,SAASC,gBAAgBA,CAAAC,IAAA,EAcO;EAAA,IAdN;MAC/BC,eAAe;MACfC,OAAO,GAAG,IAAI;MACdC,WAAW;MACXC,kBAAkB;MAClBC,YAAY;MACZC,aAAa;MACbC,gBAAgB;MAChBC,wBAAwB;MACxBC,QAAQ;MACRC,YAAY;MACZC,QAAQ,GAAGxB,cAAc;MACzByB;IAEqB,CAAC,GAAAZ,IAAA;IADnBa,KAAK,GAAAC,wBAAA,CAAAd,IAAA,EAAAe,SAAA;EAER,IAAMC,cAAc,GAAGjC,OAAO,CAC5B,MAAMQ,uBAAuB,CAACW,OAAO,CAAC,EACtC,CAACA,OAAO,CACV,CAAC;EAED,IAAMe,oBAAoB,GAAGzB,uBAAuB,CAAC;IACnD0B,YAAY,EAAE,MAAM;IACpB;IACA;IACA;IACA;IACAC,oBAAoB,EAAE,KAAK;IAC3Bb,aAAa;IACbU;EACF,CAAC,CAAC;;EAEF;EACA;EACA;EACA,IAAMI,gBAAgB,MAAAC,MAAA,CAAMf,aAAa,OAAAe,MAAA,CAAIL,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CA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EA,OAAOhB,oBAAoB,CAACgB,aAAa,CAAC;EAC5C,CACc,CAAC;AAErB;AAEA,eAAelC,gBAAgB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SpectrumPickerProps } from '@adobe/react-spectrum';
|
|
2
|
+
import type { ItemKey, ItemOrSection, NormalizedItem, NormalizedSection, TooltipOptions } from '../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Extend Spectrum Picker props (also other components that adhere to the same
|
|
5
|
+
* apis such as ComboBox).
|
|
6
|
+
* - `children` is extended to include primitive types and to exclude render function
|
|
7
|
+
* - `items` and `defaultItems` are excluded since we are not currently supporting
|
|
8
|
+
* render functions as `children`
|
|
9
|
+
* - selection key types are extended to include number + boolean primitive types
|
|
10
|
+
* - remaining props from the original type are passed through
|
|
11
|
+
*/
|
|
12
|
+
export type PickerPropsT<TProps> = Omit<TProps, 'children' | 'onSelectionChange' | 'selectedKey' | 'defaultSelectedKey' | 'disabledKeys' | 'defaultItems' | 'items'> & {
|
|
13
|
+
children: ItemOrSection | ItemOrSection[];
|
|
14
|
+
/** Can be set to true or a TooltipOptions to enable item tooltips */
|
|
15
|
+
tooltip?: boolean | TooltipOptions;
|
|
16
|
+
/** The currently selected key in the collection (controlled). */
|
|
17
|
+
selectedKey?: ItemKey | null;
|
|
18
|
+
/** The initial selected key in the collection (uncontrolled). */
|
|
19
|
+
defaultSelectedKey?: ItemKey;
|
|
20
|
+
/**
|
|
21
|
+
* The item keys that are disabled. These items cannot be selected, focused,
|
|
22
|
+
* or otherwise interacted with.
|
|
23
|
+
*/
|
|
24
|
+
disabledKeys?: Iterable<ItemKey>;
|
|
25
|
+
/**
|
|
26
|
+
* Handler that is called when the selection change.
|
|
27
|
+
* Note that under the hood, this is just an alias for Spectrum's
|
|
28
|
+
* `onSelectionChange`. We are renaming for better consistency with other
|
|
29
|
+
* components.
|
|
30
|
+
*/
|
|
31
|
+
onChange?: (key: ItemKey | null) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Method that is called when the open state of the menu changes.
|
|
34
|
+
*/
|
|
35
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
36
|
+
/** Handler that is called when the picker is scrolled. */
|
|
37
|
+
onScroll?: (event: Event) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Handler that is called when the selection changes.
|
|
40
|
+
* @deprecated Use `onChange` instead
|
|
41
|
+
*/
|
|
42
|
+
onSelectionChange?: (key: ItemKey | null) => void;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Extend Picker props for usage with normalized items list instead of React
|
|
46
|
+
* `children` elements.
|
|
47
|
+
*/
|
|
48
|
+
export type PickerNormalizedPropsT<TProps> = Omit<PickerPropsT<TProps>, 'children'> & {
|
|
49
|
+
/**
|
|
50
|
+
* Normalized format for items and sections instead React elements.
|
|
51
|
+
*/
|
|
52
|
+
normalizedItems: (NormalizedItem | NormalizedSection)[];
|
|
53
|
+
/**
|
|
54
|
+
* Whether to show icons in items.
|
|
55
|
+
*/
|
|
56
|
+
showItemIcons: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get the initial scroll position to use when picker is opened.
|
|
59
|
+
*/
|
|
60
|
+
getInitialScrollPosition?: () => Promise<number | null | undefined>;
|
|
61
|
+
};
|
|
62
|
+
export type PickerProps = PickerPropsT<SpectrumPickerProps<NormalizedItem>>;
|
|
63
|
+
export type PickerNormalizedProps = PickerNormalizedPropsT<PickerProps>;
|
|
64
|
+
//# sourceMappingURL=PickerProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerProps.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB;;;;;;;;GAQG;AACH,MAAM,MA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;AAC5E,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerProps.js","names":[],"sources":["../../../src/spectrum/picker/PickerProps.ts"],"sourcesContent":["import type { SpectrumPickerProps } from '@adobe/react-spectrum';\nimport type {\n ItemKey,\n ItemOrSection,\n NormalizedItem,\n NormalizedSection,\n TooltipOptions,\n} from '../utils';\n\n/**\n * Extend Spectrum Picker props (also other components that adhere to the same\n * apis such as ComboBox).\n * - `children` is extended to include primitive types and to exclude render function\n * - `items` and `defaultItems` are excluded since we are not currently supporting\n * render functions as `children`\n * - selection key types are extended to include number + boolean primitive types\n * - remaining props from the original type are passed through\n */\nexport type PickerPropsT<TProps> = Omit<\n TProps,\n // These props are all re-defined below\n | 'children'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'disabledKeys'\n // Excluding `defaultItems` and `items` since we are not currently supporting\n // a render function as `children`. This simplifies the API for determining\n // initial scroll position and wrapping items with tooltips.\n | 'defaultItems'\n | 'items'\n> & {\n children: ItemOrSection | ItemOrSection[];\n\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n\n /**\n * The item keys that are disabled. These items cannot be selected, focused,\n * or otherwise interacted with.\n */\n disabledKeys?: Iterable<ItemKey>;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: ItemKey | null) => void;\n\n /**\n * Method that is called when the open state of the menu changes.\n */\n onOpenChange?: (isOpen: boolean) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: ItemKey | null) => void;\n};\n\n/**\n * Extend Picker props for usage with normalized items list instead of React\n * `children` elements.\n */\nexport type PickerNormalizedPropsT<TProps> = Omit<\n PickerPropsT<TProps>,\n 'children'\n> & {\n /**\n * Normalized format for items and sections instead React elements.\n */\n normalizedItems: (NormalizedItem | NormalizedSection)[];\n\n /**\n * Whether to show icons in items.\n */\n showItemIcons: boolean;\n\n /**\n * Get the initial scroll position to use when picker is opened.\n */\n getInitialScrollPosition?: () => Promise<number | null | undefined>;\n};\n\nexport type PickerProps = PickerPropsT<SpectrumPickerProps<NormalizedItem>>;\nexport type PickerNormalizedProps = PickerNormalizedPropsT<PickerProps>;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./Picker.js";
|
|
2
2
|
export * from "./PickerNormalized.js";
|
|
3
|
+
export * from "./PickerProps.js";
|
|
4
|
+
export * from "./usePickerItemScale.js";
|
|
5
|
+
export * from "./usePickerProps.js";
|
|
3
6
|
export * from "./usePickerScrollOnOpen.js";
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/picker/index.ts"],"sourcesContent":["export * from './Picker';\nexport * from './PickerNormalized';\nexport * from './usePickerScrollOnOpen';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/picker/index.ts"],"sourcesContent":["export * from './Picker';\nexport * from './PickerNormalized';\nexport * from './PickerProps';\nexport * from './usePickerItemScale';\nexport * from './usePickerProps';\nexport * from './usePickerScrollOnOpen';\n"],"mappings":""}
|