@deephaven/components 0.71.1-beta.3 → 0.72.0

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.
Files changed (36) hide show
  1. package/dist/Button.d.ts +1 -1
  2. package/dist/SearchInput.css +10 -12
  3. package/dist/SearchInput.css.map +1 -1
  4. package/dist/Select.d.ts +1 -1
  5. package/dist/index.d.ts +0 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +0 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/spectrum/index.js +1 -1
  10. package/dist/spectrum/picker/Picker.d.ts +6 -6
  11. package/dist/spectrum/picker/Picker.d.ts.map +1 -1
  12. package/dist/spectrum/picker/Picker.js +10 -9
  13. package/dist/spectrum/picker/Picker.js.map +1 -1
  14. package/dist/spectrum/picker/index.d.ts +1 -1
  15. package/dist/spectrum/picker/index.d.ts.map +1 -1
  16. package/dist/spectrum/picker/index.js +1 -1
  17. package/dist/spectrum/picker/index.js.map +1 -1
  18. package/dist/spectrum/utils/index.d.ts +3 -0
  19. package/dist/spectrum/utils/index.d.ts.map +1 -0
  20. package/dist/spectrum/utils/index.js +3 -0
  21. package/dist/spectrum/utils/index.js.map +1 -0
  22. package/dist/spectrum/utils/itemUtils.d.ts +111 -0
  23. package/dist/spectrum/utils/itemUtils.d.ts.map +1 -0
  24. package/dist/spectrum/{picker/PickerUtils.js → utils/itemUtils.js} +46 -45
  25. package/dist/spectrum/utils/itemUtils.js.map +1 -0
  26. package/dist/spectrum/{utils.d.ts → utils/themeUtils.d.ts} +2 -1
  27. package/dist/spectrum/utils/themeUtils.d.ts.map +1 -0
  28. package/dist/spectrum/{utils.js → utils/themeUtils.js} +3 -2
  29. package/dist/spectrum/utils/themeUtils.js.map +1 -0
  30. package/dist/theme/SpectrumThemeProvider.js +1 -1
  31. package/package.json +8 -7
  32. package/dist/spectrum/picker/PickerUtils.d.ts +0 -111
  33. package/dist/spectrum/picker/PickerUtils.d.ts.map +0 -1
  34. package/dist/spectrum/picker/PickerUtils.js.map +0 -1
  35. package/dist/spectrum/utils.d.ts.map +0 -1
  36. package/dist/spectrum/utils.js.map +0 -1
@@ -0,0 +1,111 @@
1
+ import { Key, ReactElement, ReactNode } from 'react';
2
+ import { SpectrumPickerProps } from '@adobe/react-spectrum';
3
+ import type { ItemRenderer } from '@react-types/shared';
4
+ import { KeyedItem } from '@deephaven/utils';
5
+ import { ItemProps, SectionProps } from '../shared';
6
+ import { PopperOptions } from '../../popper';
7
+ export declare const INVALID_ITEM_ERROR_MESSAGE = "Items must be strings, numbers, booleans, <Item> or <Section> elements:";
8
+ /**
9
+ * React Spectrum <Section> supports an `ItemRenderer` function as a child. The
10
+ * DH picker makes use of this internally, but we don't want to support it as
11
+ * an incoming prop.
12
+ */
13
+ type SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {
14
+ children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;
15
+ };
16
+ type ItemElement = ReactElement<ItemProps<unknown>>;
17
+ export type SectionElement = ReactElement<SectionPropsNoItemRenderer<unknown>>;
18
+ export type ItemElementOrPrimitive = number | string | boolean | ItemElement;
19
+ export type ItemOrSection = ItemElementOrPrimitive | SectionElement;
20
+ /**
21
+ * Augment the Spectrum selection key type to include boolean values.
22
+ * Spectrum collection components already supports this, but the built in types
23
+ * don't reflect it.
24
+ */
25
+ export type ItemKey = Key | boolean;
26
+ /**
27
+ * Augment the Spectrum selection change handler type to include boolean keys.
28
+ * Spectrum components already supports this, but the built in types don't
29
+ * reflect it.
30
+ */
31
+ export type ItemSelectionChangeHandler = (key: ItemKey) => void;
32
+ export interface NormalizedItemData {
33
+ key?: ItemKey;
34
+ content: ReactNode;
35
+ textValue?: string;
36
+ }
37
+ export interface NormalizedSectionData {
38
+ key?: Key;
39
+ title?: ReactNode;
40
+ items: NormalizedItem[];
41
+ }
42
+ /**
43
+ * Spectrum collection components support a variety of item types, including
44
+ * strings, numbers, booleans, and more complex React elements. This type
45
+ * represents a normalized form to make rendering items simpler and keep the
46
+ * logic of transformation in separate util methods. It also adheres to the
47
+ * `KeyedItem` interface to be compatible with Windowed data utils
48
+ * (e.g. `useViewportData`).
49
+ */
50
+ export type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey | undefined>;
51
+ export type NormalizedSection = KeyedItem<NormalizedSectionData, Key | undefined>;
52
+ export type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedItem>;
53
+ export type TooltipOptions = {
54
+ placement: PopperOptions['placement'];
55
+ };
56
+ /**
57
+ * DH wrappers of Spectrum collection components use a normalized item that
58
+ * includes a `key` prop and an optional `item` prop. This is mostly to support
59
+ * Windowed data where items are created before their data has been loaded (data
60
+ * gets set in the `item` prop). If data has loaded, return its `key`. If not,
61
+ * return the top-level `key` on the normalized item.
62
+ * @param item The normalized item or section
63
+ * @returns The `key` of the item or section
64
+ */
65
+ export declare function getItemKey<TItem extends NormalizedItem | NormalizedSection, TKey extends TItem extends NormalizedItem ? ItemKey | undefined : TItem extends NormalizedSection ? Key | undefined : undefined>(item: TItem | null | undefined): TKey;
66
+ /**
67
+ * Determine if a node is a Section element.
68
+ * @param node The node to check
69
+ * @returns True if the node is a Section element
70
+ */
71
+ export declare function isSectionElement<T>(node: ReactNode): node is ReactElement<SectionProps<T>>;
72
+ /**
73
+ * Determine if a node is an Item element.
74
+ * @param node The node to check
75
+ * @returns True if the node is an Item element
76
+ */
77
+ export declare function isItemElement<T>(node: ReactNode): node is ReactElement<ItemProps<T>>;
78
+ /**
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.
81
+ * @param node The node to check
82
+ * @returns True if the node is a normalized item with keys array
83
+ */
84
+ export declare function isNormalizedItemsWithKeysList(node: ItemOrSection | ItemOrSection[] | (NormalizedItem | NormalizedSection)[]): node is (NormalizedItem | NormalizedSection)[];
85
+ /**
86
+ * Determine if an object is a normalized section.
87
+ * @param maybeNormalizedSection The object to check
88
+ * @returns True if the object is a normalized section
89
+ */
90
+ export declare function isNormalizedSection(maybeNormalizedSection: NormalizedItem | NormalizedSection): maybeNormalizedSection is NormalizedSection;
91
+ /**
92
+ * Determine if a node is an 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 an item or section
96
+ */
97
+ export declare function isItemOrSection(node: ReactNode): node is ItemOrSection;
98
+ /**
99
+ * Get normalized items from an item or array of items.
100
+ * @param itemsOrSections An item or array of items
101
+ * @returns An array of normalized items
102
+ */
103
+ export declare function normalizeItemList(itemsOrSections: ItemOrSection | ItemOrSection[] | NormalizedItem[]): (NormalizedItem | NormalizedSection)[];
104
+ /**
105
+ * Returns a TooltipOptions object or null if options is false or null.
106
+ * @param options
107
+ * @returns TooltipOptions or null
108
+ */
109
+ export declare function normalizeTooltipOptions(options?: boolean | TooltipOptions | null): TooltipOptions | null;
110
+ export {};
111
+ //# sourceMappingURL=itemUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/itemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAQ,SAAS,EAAW,YAAY,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,eAAO,MAAM,0BAA0B,4EACoC,CAAC;AAE5E;;;;GAIG;AACH,KAAK,0BAA0B,CAAC,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,QAAQ,EAAE,OAAO,CAAC,YAAY,CA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js";
4
- var log = Log.module('PickerUtils');
5
- export var INVALID_PICKER_ITEM_ERROR_MESSAGE = 'Picker items must be strings, numbers, booleans, <Item> or <Section> elements:';
4
+ var log = Log.module('itemUtils');
5
+ export var INVALID_ITEM_ERROR_MESSAGE = 'Items must be strings, numbers, booleans, <Item> or <Section> elements:';
6
6
 
7
7
  /**
8
8
  * React Spectrum <Section> supports an `ItemRenderer` function as a child. The
@@ -12,34 +12,35 @@ export var INVALID_PICKER_ITEM_ERROR_MESSAGE = 'Picker items must be strings, nu
12
12
 
13
13
  /**
14
14
  * Augment the Spectrum selection key type to include boolean values.
15
- * The Spectrum Picker already supports this, but the built in types don't
16
- * reflect it.
15
+ * Spectrum collection components already supports this, but the built in types
16
+ * don't reflect it.
17
17
  */
18
18
 
19
19
  /**
20
20
  * Augment the Spectrum selection change handler type to include boolean keys.
21
- * The Spectrum Picker already supports this, but the built in types don't
21
+ * Spectrum components already supports this, but the built in types don't
22
22
  * reflect it.
23
23
  */
24
24
 
25
25
  /**
26
- * The Picker supports a variety of item types, including strings, numbers,
27
- * booleans, and more complex React elements. This type represents a normalized
28
- * form to make rendering items simpler and keep the logic of transformation
29
- * in separate util methods. It also adheres to the `KeyedItem` interface to
30
- * be compatible with Windowed data utils (e.g. `useViewportData`).
26
+ * Spectrum collection components support a variety of item types, including
27
+ * strings, numbers, booleans, and more complex React elements. This type
28
+ * represents a normalized form to make rendering items simpler and keep the
29
+ * logic of transformation in separate util methods. It also adheres to the
30
+ * `KeyedItem` interface to be compatible with Windowed data utils
31
+ * (e.g. `useViewportData`).
31
32
  */
32
33
 
33
34
  /**
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
35
+ * DH wrappers of Spectrum collection components use a normalized item that
36
+ * includes a `key` prop and an optional `item` prop. This is mostly to support
37
+ * Windowed data where items are created before their data has been loaded (data
38
+ * gets set in the `item` prop). If data has loaded, return its `key`. If not,
39
+ * return the top-level `key` on the normalized item.
40
+ * @param item The normalized item or section
40
41
  * @returns The `key` of the item or section
41
42
  */
42
- export function getPickerItemKey(item) {
43
+ export function getItemKey(item) {
43
44
  var _item$item$key, _item$item;
44
45
  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
  }
@@ -75,32 +76,32 @@ export function isNormalizedItemsWithKeysList(node) {
75
76
  if (node.length === 0) {
76
77
  return true;
77
78
  }
78
- return !isPickerItemOrSection(node[0]) && 'key' in node[0];
79
+ return !isItemOrSection(node[0]) && 'key' in node[0];
79
80
  }
80
81
 
81
82
  /**
82
- * Determine if an object is a normalized Picker section.
83
- * @param maybeNormalizedPickerSection The object to check
84
- * @returns True if the object is a normalized Picker section
83
+ * Determine if an object is a normalized section.
84
+ * @param maybeNormalizedSection The object to check
85
+ * @returns True if the object is a normalized section
85
86
  */
86
- export function isNormalizedPickerSection(maybeNormalizedPickerSection) {
87
- return maybeNormalizedPickerSection.item != null && 'items' in maybeNormalizedPickerSection.item;
87
+ export function isNormalizedSection(maybeNormalizedSection) {
88
+ return maybeNormalizedSection.item != null && 'items' in maybeNormalizedSection.item;
88
89
  }
89
90
 
90
91
  /**
91
- * Determine if a node is a Picker item or section. Valid types include strings,
92
+ * Determine if a node is an item or section. Valid types include strings,
92
93
  * numbers, booleans, Item elements, and Section elements.
93
94
  * @param node The node to check
94
- * @returns True if the node is a Picker item or section
95
+ * @returns True if the node is an item or section
95
96
  */
96
- export function isPickerItemOrSection(node) {
97
+ export function isItemOrSection(node) {
97
98
  return typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || isItemElement(node) || isSectionElement(node);
98
99
  }
99
100
 
100
101
  /**
101
- * Determine the `key` of a picker item or section.
102
- * @param itemOrSection The picker item or section
103
- * @returns A `PickerItemKey` for the picker item or undefined if a key can't be determined
102
+ * Determine the `key` of an item or section.
103
+ * @param itemOrSection The item or section
104
+ * @returns A `ItemKey` for the item or undefined if a key can't be determined
104
105
  */
105
106
 
106
107
  function normalizeItemKey(itemOrSection) {
@@ -125,9 +126,9 @@ function normalizeItemKey(itemOrSection) {
125
126
  }
126
127
 
127
128
  /**
128
- * Get a normalized `textValue` for a picker item ensuring it is a string.
129
- * @param item The picker item
130
- * @returns A string `textValue` for the picker item
129
+ * Get a normalized `textValue` for an item ensuring it is a string.
130
+ * @param item The item
131
+ * @returns A string `textValue` for the item
131
132
  */
132
133
  function normalizeTextValue(item) {
133
134
  if (typeof item !== 'object') {
@@ -143,21 +144,21 @@ function normalizeTextValue(item) {
143
144
  }
144
145
 
145
146
  /**
146
- * Normalize a picker item to an object form.
147
+ * Normalize an item or section to an object form.
147
148
  * @param itemOrSection item to normalize
148
- * @returns NormalizedPickerItem object
149
+ * @returns NormalizedItem or NormalizedSection object
149
150
  */
150
- function normalizePickerItem(itemOrSection) {
151
- if (!isPickerItemOrSection(itemOrSection)) {
152
- log.debug(INVALID_PICKER_ITEM_ERROR_MESSAGE, itemOrSection);
153
- throw new Error(INVALID_PICKER_ITEM_ERROR_MESSAGE);
151
+ function normalizeItem(itemOrSection) {
152
+ if (!isItemOrSection(itemOrSection)) {
153
+ log.debug(INVALID_ITEM_ERROR_MESSAGE, itemOrSection);
154
+ throw new Error(INVALID_ITEM_ERROR_MESSAGE);
154
155
  }
155
156
  if (isSectionElement(itemOrSection)) {
156
157
  var _key = normalizeItemKey(itemOrSection);
157
158
  var {
158
159
  title
159
160
  } = itemOrSection.props;
160
- var items = normalizePickerItemList(itemOrSection.props.children).filter(
161
+ var items = normalizeItemList(itemOrSection.props.children).filter(
161
162
  // We don't support nested section elements
162
163
  childItem => !isSectionElement(childItem));
163
164
  return {
@@ -181,17 +182,17 @@ function normalizePickerItem(itemOrSection) {
181
182
  }
182
183
 
183
184
  /**
184
- * Get normalized picker items from a picker item or array of picker items.
185
- * @param itemsOrSections A picker item or array of picker items
186
- * @returns An array of normalized picker items
185
+ * Get normalized items from an item or array of items.
186
+ * @param itemsOrSections An item or array of items
187
+ * @returns An array of normalized items
187
188
  */
188
- export function normalizePickerItemList(itemsOrSections) {
189
+ export function normalizeItemList(itemsOrSections) {
189
190
  // If already normalized, just return as-is
190
191
  if (isNormalizedItemsWithKeysList(itemsOrSections)) {
191
192
  return itemsOrSections;
192
193
  }
193
194
  var itemsArray = Array.isArray(itemsOrSections) ? itemsOrSections : [itemsOrSections];
194
- return itemsArray.map(normalizePickerItem);
195
+ return itemsArray.map(normalizeItem);
195
196
  }
196
197
 
197
198
  /**
@@ -210,4 +211,4 @@ export function normalizeTooltipOptions(options) {
210
211
  }
211
212
  return options;
212
213
  }
213
- //# sourceMappingURL=PickerUtils.js.map
214
+ //# sourceMappingURL=itemUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemUtils.js","names":["isValidElement","Log","Item","Section","log","module","INVALID_ITEM_ERROR_MESSAGE","getItemKey","item","_item$item$key","_item$item","key","isSectionElement","node","type","isItemElement","isNormalizedItemsWithKeysList","Array","isArray","length","isItemOrSection","isNormalizedSection","maybeNormalizedSection","normalizeItemKey","itemOrSection","_itemOrSection$props$","props","title","undefined","textValue","children","normalizeTextValue","String","normalizeItem","debug","Error","items","normalizeItemList","filter","childItem","content","itemsOrSections","itemsArray","map","normalizeTooltipOptions","options","placement"],"sources":["../../../src/spectrum/utils/itemUtils.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('itemUtils');\n\nexport const INVALID_ITEM_ERROR_MESSAGE =\n '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>>;\nexport type SectionElement = ReactElement<SectionPropsNoItemRenderer<unknown>>;\n\nexport type ItemElementOrPrimitive = number | string | boolean | ItemElement;\nexport type ItemOrSection = ItemElementOrPrimitive | SectionElement;\n\n/**\n * Augment the Spectrum selection key type to include boolean values.\n * Spectrum collection components already supports this, but the built in types\n * don't reflect it.\n */\nexport type ItemKey = Key | boolean;\n\n/**\n * Augment the Spectrum selection change handler type to include boolean keys.\n * Spectrum components already supports this, but the built in types don't\n * reflect it.\n */\nexport type ItemSelectionChangeHandler = (key: ItemKey) => void;\n\nexport interface NormalizedItemData {\n key?: ItemKey;\n content: ReactNode;\n textValue?: string;\n}\n\nexport interface NormalizedSectionData {\n key?: Key;\n title?: ReactNode;\n items: NormalizedItem[];\n}\n\n/**\n * Spectrum collection components support a variety of item types, including\n * strings, numbers, booleans, and more complex React elements. This type\n * represents a normalized form to make rendering items simpler and keep the\n * logic of transformation in separate util methods. It also adheres to the\n * `KeyedItem` interface to be compatible with Windowed data utils\n * (e.g. `useViewportData`).\n */\nexport type NormalizedItem = KeyedItem<NormalizedItemData, ItemKey | undefined>;\n\nexport type NormalizedSection = KeyedItem<\n NormalizedSectionData,\n Key | undefined\n>;\n\nexport type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedItem>;\n\nexport type TooltipOptions = { placement: PopperOptions['placement'] };\n\n/**\n * DH wrappers of Spectrum collection components use a normalized item that\n * includes a `key` prop and an optional `item` prop. This is mostly to support\n * Windowed data where items are created before their data has been loaded (data\n * gets set in the `item` prop). If data has loaded, return its `key`. If not,\n * return the top-level `key` on the normalized item.\n * @param item The normalized item or section\n * @returns The `key` of the item or section\n */\nexport function getItemKey<\n TItem extends NormalizedItem | NormalizedSection,\n TKey extends TItem extends NormalizedItem\n ? ItemKey | undefined\n : TItem extends NormalizedSection\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: ItemOrSection | ItemOrSection[] | (NormalizedItem | NormalizedSection)[]\n): node is (NormalizedItem | NormalizedSection)[] {\n if (!Array.isArray(node)) {\n return false;\n }\n\n if (node.length === 0) {\n return true;\n }\n\n return !isItemOrSection(node[0]) && 'key' in node[0];\n}\n\n/**\n * Determine if an object is a normalized section.\n * @param maybeNormalizedSection The object to check\n * @returns True if the object is a normalized section\n */\nexport function isNormalizedSection(\n maybeNormalizedSection: NormalizedItem | NormalizedSection\n): maybeNormalizedSection is NormalizedSection {\n return (\n maybeNormalizedSection.item != null &&\n 'items' in maybeNormalizedSection.item\n );\n}\n\n/**\n * Determine if a node is an 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 an item or section\n */\nexport function isItemOrSection(node: ReactNode): node is ItemOrSection {\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 an item or section.\n * @param itemOrSection The item or section\n * @returns A `ItemKey` for the item or undefined if a key can't be determined\n */\nfunction normalizeItemKey(item: ItemElementOrPrimitive): ItemKey | undefined;\nfunction normalizeItemKey(section: SectionElement): Key | undefined;\nfunction normalizeItemKey(\n itemOrSection: ItemElementOrPrimitive | SectionElement\n): Key | ItemKey | 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 an item ensuring it is a string.\n * @param item The item\n * @returns A string `textValue` for the item\n */\nfunction normalizeTextValue(item: ItemElementOrPrimitive): 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 an item or section to an object form.\n * @param itemOrSection item to normalize\n * @returns NormalizedItem or NormalizedSection object\n */\nfunction normalizeItem(\n itemOrSection: ItemOrSection\n): NormalizedItem | NormalizedSection {\n if (!isItemOrSection(itemOrSection)) {\n log.debug(INVALID_ITEM_ERROR_MESSAGE, itemOrSection);\n throw new Error(INVALID_ITEM_ERROR_MESSAGE);\n }\n\n if (isSectionElement(itemOrSection)) {\n const key = normalizeItemKey(itemOrSection);\n const { title } = itemOrSection.props;\n\n const items = normalizeItemList(itemOrSection.props.children).filter(\n // We don't support nested section elements\n childItem => !isSectionElement(childItem)\n ) as NormalizedItem[];\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 items from an item or array of items.\n * @param itemsOrSections An item or array of items\n * @returns An array of normalized items\n */\nexport function normalizeItemList(\n itemsOrSections: ItemOrSection | ItemOrSection[] | NormalizedItem[]\n): (NormalizedItem | NormalizedSection)[] {\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(normalizeItem);\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,WAAW,CAAC;AAEnC,OAAO,IAAMC,0BAA0B,GACrC,yEAAyE;;AAE3E;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAOxBC,IAA8B,EAAQ;EAAA,IAAAC,cAAA,EAAAC,UAAA;EACtC,QAAAD,cAAA,GAAQD,IAAI,aAAJA,IAAI,wBAAAE,UAAA,GAAJF,IAAI,CAAEA,IAAI,cAAAE,UAAA,uBAAVA,UAAA,CAAYC,GAAG,cAAAF,cAAA,cAAAA,cAAA,GAAID,IA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SAAS,EAAE;IAAQ,CAAC;EAC/B;EAEA,OAAOD,OAAO;AAChB"}
@@ -1,3 +1,4 @@
1
+ export { useStyleProps, baseStyleProps, viewStyleProps, } from '@react-spectrum/utils';
1
2
  /**
2
3
  * Extend light + dark theme variables with DH defaults.
3
4
  *
@@ -42,4 +43,4 @@ export declare const themeDHDefault: {
42
43
  medium: import("@react-types/provider").CSSModule | undefined;
43
44
  large: import("@react-types/provider").CSSModule | undefined;
44
45
  };
45
- //# sourceMappingURL=utils.d.ts.map
46
+ //# sourceMappingURL=themeUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/themeUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EACb,cAAc,EACd,cAAc,GACf,MAAM,uBAAuB,CAAC;AAI/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;CAa1B,CAAC"}
@@ -4,7 +4,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
4
4
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
5
  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); }
6
6
  import { theme } from '@react-spectrum/theme-default';
7
- import { themeSpectrumClassesCommon } from "../theme/theme-spectrum/index.js";
7
+ import { themeSpectrumClassesCommon } from "../../theme/theme-spectrum/index.js";
8
+ export { useStyleProps, baseStyleProps, viewStyleProps } from '@react-spectrum/utils';
8
9
  var {
9
10
  global,
10
11
  light,
@@ -55,4 +56,4 @@ export var themeDHDefault = {
55
56
  medium,
56
57
  large
57
58
  };
58
- //# sourceMappingURL=utils.js.map
59
+ //# sourceMappingURL=themeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeUtils.js","names":["theme","themeSpectrumClassesCommon","useStyleProps","baseStyleProps","viewStyleProps","global","light","dark","medium","large","themeDHDefault","_objectSpread"],"sources":["../../../src/spectrum/utils/themeUtils.ts"],"sourcesContent":["import { theme } from '@react-spectrum/theme-default';\nimport { themeSpectrumClassesCommon } from '../../theme/theme-spectrum';\n\nexport {\n useStyleProps,\n baseStyleProps,\n viewStyleProps,\n} from '@react-spectrum/utils';\n\nconst { global, light, dark, medium, large } = theme;\n\n/**\n * Extend light + dark theme variables with DH defaults.\n *\n * A theme is just a mapped collection of css class names that are generated\n * from a collection of css modules.\n *\n * e.g.\n * {\n * global: {\n * spectrum: 'spectrum_9e130c',\n * 'spectrum--medium': 'spectrum--medium_9e130c',\n * 'spectrum--large': 'spectrum--large_9e130c',\n * 'spectrum--darkest': 'spectrum--darkest_9e130c',\n * 'spectrum--dark': 'spectrum--dark_9e130c',\n * 'spectrum--light': 'spectrum--light_9e130c',\n * 'spectrum--lightest': 'spectrum--lightest_9e130c',\n * },\n * light: {\n * 'spectrum--light': 'spectrum--light_a40724',\n * 'dh-spectrum-theme--light': '_dh-spectrum-theme--light_1hblg_22',\n * },\n * dark: {\n * 'spectrum--darkest': 'spectrum--darkest_256eeb',\n * 'dh-spectrum-theme--dark': '_dh-spectrum-theme--dark_f7kge_22',\n * },\n * medium: {\n * 'spectrum--medium': 'spectrum--medium_4b172c',\n * },\n * large: {\n * 'spectrum--large': 'spectrum--large_c40598',\n * },\n * }\n */\n/* eslint-disable import/prefer-default-export */\nexport const themeDHDefault = {\n global,\n light: {\n ...light,\n ...themeSpectrumClassesCommon,\n },\n dark: {\n ...dark,\n ...themeSpectrumClassesCommon,\n },\n // scales\n medium,\n large,\n};\n"],"mappings":";;;;;AAAA,SAASA,KAAK,QAAQ,+BAA+B;AAAC,SAC7CC,0BAA0B;AAEnC,SACEC,aAAa,EACbC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAE9B,IAAM;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAM,CAAC,GAAGT,KAAK;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMU,cAAc,GAAG;EAC5BL,MAAM;EACNC,KAAK,EAAAK,aAAA,CAAAA,aAAA,KACAL,KAAK,GACLL,0BAA0B,CAC9B;EACDM,IAAI,EAAAI,aAAA,CAAAA,aAAA,KACCJ,IAAI,GACJN,0BAA0B,CAC9B;EACD;EACAO,MAAM;EACNC;AACF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
2
  import { Provider } from '@adobe/react-spectrum';
3
3
  import shortid from 'shortid';
4
- import { themeDHDefault } from "../spectrum/utils.js";
4
+ import { themeDHDefault } from "../spectrum/utils/index.js";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  /**
7
7
  * Wrapper around React Spectrum's theme Provider that provides DH mappings of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/components",
3
- "version": "0.71.1-beta.3+f06a141a",
3
+ "version": "0.72.0",
4
4
  "description": "Deephaven React component library",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -25,13 +25,14 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@adobe/react-spectrum": "^3.34.1",
28
- "@deephaven/icons": "^0.71.1-beta.3+f06a141a",
29
- "@deephaven/log": "^0.71.1-beta.3+f06a141a",
30
- "@deephaven/react-hooks": "^0.71.1-beta.3+f06a141a",
31
- "@deephaven/utils": "^0.71.1-beta.3+f06a141a",
28
+ "@deephaven/icons": "^0.72.0",
29
+ "@deephaven/log": "^0.72.0",
30
+ "@deephaven/react-hooks": "^0.72.0",
31
+ "@deephaven/utils": "^0.72.0",
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",
35
+ "@react-spectrum/utils": "^3.11.5",
35
36
  "@react-types/shared": "^3.22.1",
36
37
  "@react-types/textfield": "^3.9.1",
37
38
  "bootstrap": "4.6.2",
@@ -54,7 +55,7 @@
54
55
  "react-dom": ">=16.8.0"
55
56
  },
56
57
  "devDependencies": {
57
- "@deephaven/mocks": "^0.71.1-beta.3+f06a141a"
58
+ "@deephaven/mocks": "^0.72.0"
58
59
  },
59
60
  "files": [
60
61
  "dist",
@@ -68,5 +69,5 @@
68
69
  "publishConfig": {
69
70
  "access": "public"
70
71
  },
71
- "gitHead": "f06a141a611e1a86c9b6dcbff963d61e3bee7010"
72
+ "gitHead": "cbff452ae56921ea2b5440d6c09d53a8844d6f65"
72
73
  }
@@ -1,111 +0,0 @@
1
- import { Key, ReactElement, ReactNode } from 'react';
2
- import { SpectrumPickerProps } from '@adobe/react-spectrum';
3
- import type { ItemRenderer } from '@react-types/shared';
4
- import { KeyedItem } from '@deephaven/utils';
5
- import { ItemProps, SectionProps } from '../shared';
6
- import { PopperOptions } from '../../popper';
7
- export declare const INVALID_PICKER_ITEM_ERROR_MESSAGE = "Picker items must be strings, numbers, booleans, <Item> or <Section> elements:";
8
- /**
9
- * React Spectrum <Section> supports an `ItemRenderer` function as a child. The
10
- * DH picker makes use of this internally, but we don't want to support it as
11
- * an incoming prop.
12
- */
13
- type SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {
14
- children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;
15
- };
16
- type ItemElement = ReactElement<ItemProps<unknown>>;
17
- type SectionElement = ReactElement<SectionPropsNoItemRenderer<unknown>>;
18
- export type PickerItem = number | string | boolean | ItemElement;
19
- export type PickerSection = SectionElement;
20
- export type PickerItemOrSection = PickerItem | PickerSection;
21
- /**
22
- * Augment the Spectrum selection key type to include boolean values.
23
- * The Spectrum Picker already supports this, but the built in types don't
24
- * reflect it.
25
- */
26
- export type PickerItemKey = Key | boolean;
27
- /**
28
- * Augment the Spectrum selection change handler type to include boolean keys.
29
- * The Spectrum Picker already supports this, but the built in types don't
30
- * reflect it.
31
- */
32
- export type PickerSelectionChangeHandler = (key: PickerItemKey) => void;
33
- export interface NormalizedPickerItemData {
34
- key?: PickerItemKey;
35
- content: ReactNode;
36
- textValue?: string;
37
- }
38
- export interface NormalizedPickerSectionData {
39
- key?: Key;
40
- title?: ReactNode;
41
- items: NormalizedPickerItem[];
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>;
52
- export type NormalizedSpectrumPickerProps = SpectrumPickerProps<NormalizedPickerItem>;
53
- export type TooltipOptions = {
54
- placement: PopperOptions['placement'];
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;
66
- /**
67
- * Determine if a node is a Section element.
68
- * @param node The node to check
69
- * @returns True if the node is a Section element
70
- */
71
- export declare function isSectionElement<T>(node: ReactNode): node is ReactElement<SectionProps<T>>;
72
- /**
73
- * Determine if a node is an Item element.
74
- * @param node The node to check
75
- * @returns True if the node is an Item element
76
- */
77
- export declare function isItemElement<T>(node: ReactNode): node is ReactElement<ItemProps<T>>;
78
- /**
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.
81
- * @param node The node to check
82
- * @returns True if the node is a normalized item with keys array
83
- */
84
- export declare function isNormalizedItemsWithKeysList(node: PickerItemOrSection | PickerItemOrSection[] | (NormalizedPickerItem | NormalizedPickerSection)[]): node is (NormalizedPickerItem | NormalizedPickerSection)[];
85
- /**
86
- * Determine if an object is a normalized Picker section.
87
- * @param maybeNormalizedPickerSection The object to check
88
- * @returns True if the object is a normalized Picker section
89
- */
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;
98
- /**
99
- * Get normalized picker items from a picker item or array of picker items.
100
- * @param itemsOrSections A picker item or array of picker items
101
- * @returns An array of normalized picker items
102
- */
103
- export declare function normalizePickerItemList(itemsOrSections: PickerItemOrSection | PickerItemOrSection[] | NormalizedPickerItem[]): (NormalizedPickerItem | NormalizedPickerSection)[];
104
- /**
105
- * Returns a TooltipOptions object or null if options is false or null.
106
- * @param options
107
- * @returns TooltipOptions or null
108
- */
109
- export declare function normalizeTooltipOptions(options?: boolean | TooltipOptions | null): TooltipOptions | null;
110
- export {};
111
- //# sourceMappingURL=PickerUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PickerUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerUtils.ts"],"names":[],"mappings":"AAAA,OA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BAAuB,CAAC,EAAE,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,4BAA4B,EAAE,oBAAoB,GAAG,uBAAuB,GAC3E,4BAA4B,IAAI,uBAAuB,CAKzD;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,GACd,IAAI,IAAI,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"}
@@ -1 +0,0 @@
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,IA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;AACA;AACA,OAAO,SAASW,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 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/spectrum/utils.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;CAa1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["theme","themeSpectrumClassesCommon","global","light","dark","medium","large","themeDHDefault","_objectSpread"],"sources":["../../src/spectrum/utils.ts"],"sourcesContent":["import { theme } from '@react-spectrum/theme-default';\nimport { themeSpectrumClassesCommon } from '../theme/theme-spectrum';\n\nconst { global, light, dark, medium, large } = theme;\n\n/**\n * Extend light + dark theme variables with DH defaults.\n *\n * A theme is just a mapped collection of css class names that are generated\n * from a collection of css modules.\n *\n * e.g.\n * {\n * global: {\n * spectrum: 'spectrum_9e130c',\n * 'spectrum--medium': 'spectrum--medium_9e130c',\n * 'spectrum--large': 'spectrum--large_9e130c',\n * 'spectrum--darkest': 'spectrum--darkest_9e130c',\n * 'spectrum--dark': 'spectrum--dark_9e130c',\n * 'spectrum--light': 'spectrum--light_9e130c',\n * 'spectrum--lightest': 'spectrum--lightest_9e130c',\n * },\n * light: {\n * 'spectrum--light': 'spectrum--light_a40724',\n * 'dh-spectrum-theme--light': '_dh-spectrum-theme--light_1hblg_22',\n * },\n * dark: {\n * 'spectrum--darkest': 'spectrum--darkest_256eeb',\n * 'dh-spectrum-theme--dark': '_dh-spectrum-theme--dark_f7kge_22',\n * },\n * medium: {\n * 'spectrum--medium': 'spectrum--medium_4b172c',\n * },\n * large: {\n * 'spectrum--large': 'spectrum--large_c40598',\n * },\n * }\n */\n/* eslint-disable import/prefer-default-export */\nexport const themeDHDefault = {\n global,\n light: {\n ...light,\n ...themeSpectrumClassesCommon,\n },\n dark: {\n ...dark,\n ...themeSpectrumClassesCommon,\n },\n // scales\n medium,\n large,\n};\n"],"mappings":";;;;;AAAA,SAASA,KAAK,QAAQ,+BAA+B;AAAC,SAC7CC,0BAA0B;AAEnC,IAAM;EAAEC,MAAM;EAAEC,KAAK;EAAEC,IAAI;EAAEC,MAAM;EAAEC;AAAM,CAAC,GAAGN,KAAK;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMO,cAAc,GAAG;EAC5BL,MAAM;EACNC,KAAK,EAAAK,aAAA,CAAAA,aAAA,KACAL,KAAK,GACLF,0BAA0B,CAC9B;EACDG,IAAI,EAAAI,aAAA,CAAAA,aAAA,KACCJ,IAAI,GACJH,0BAA0B,CAC9B;EACD;EACAI,MAAM;EACNC;AACF,CAAC"}