@deephaven/components 0.74.1-beta.5 → 0.75.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 (62) hide show
  1. package/dist/Button.d.ts +1 -1
  2. package/dist/ErrorView.css +77 -0
  3. package/dist/ErrorView.css.map +1 -0
  4. package/dist/ErrorView.d.ts +16 -0
  5. package/dist/ErrorView.d.ts.map +1 -0
  6. package/dist/ErrorView.js +73 -0
  7. package/dist/ErrorView.js.map +1 -0
  8. package/dist/Select.d.ts +1 -1
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/spectrum/listView/ListView.d.ts +3 -2
  14. package/dist/spectrum/listView/ListView.d.ts.map +1 -1
  15. package/dist/spectrum/listView/ListView.js +10 -63
  16. package/dist/spectrum/listView/ListView.js.map +1 -1
  17. package/dist/spectrum/listView/ListViewNormalized.d.ts +22 -0
  18. package/dist/spectrum/listView/ListViewNormalized.d.ts.map +1 -0
  19. package/dist/spectrum/listView/ListViewNormalized.js +80 -0
  20. package/dist/spectrum/listView/ListViewNormalized.js.map +1 -0
  21. package/dist/spectrum/listView/ListViewWrapper.css +39 -0
  22. package/dist/spectrum/listView/ListViewWrapper.css.map +1 -0
  23. package/dist/spectrum/listView/ListViewWrapper.d.ts +21 -0
  24. package/dist/spectrum/listView/ListViewWrapper.d.ts.map +1 -0
  25. package/dist/spectrum/listView/ListViewWrapper.js +71 -0
  26. package/dist/spectrum/listView/ListViewWrapper.js.map +1 -0
  27. package/dist/spectrum/listView/index.d.ts +2 -0
  28. package/dist/spectrum/listView/index.d.ts.map +1 -1
  29. package/dist/spectrum/listView/index.js +2 -0
  30. package/dist/spectrum/listView/index.js.map +1 -1
  31. package/dist/spectrum/picker/Picker.d.ts.map +1 -1
  32. package/dist/spectrum/picker/Picker.js +2 -2
  33. package/dist/spectrum/picker/Picker.js.map +1 -1
  34. package/dist/spectrum/picker/PickerNormalized.d.ts +2 -1
  35. package/dist/spectrum/picker/PickerNormalized.d.ts.map +1 -1
  36. package/dist/spectrum/picker/PickerNormalized.js +31 -15
  37. package/dist/spectrum/picker/PickerNormalized.js.map +1 -1
  38. package/dist/spectrum/shared.d.ts +13 -9
  39. package/dist/spectrum/shared.d.ts.map +1 -1
  40. package/dist/spectrum/shared.js +16 -1
  41. package/dist/spectrum/shared.js.map +1 -1
  42. package/dist/spectrum/utils/index.d.ts +1 -0
  43. package/dist/spectrum/utils/index.d.ts.map +1 -1
  44. package/dist/spectrum/utils/index.js +1 -0
  45. package/dist/spectrum/utils/index.js.map +1 -1
  46. package/dist/spectrum/utils/itemUtils.d.ts +9 -14
  47. package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
  48. package/dist/spectrum/utils/itemUtils.js +8 -108
  49. package/dist/spectrum/utils/itemUtils.js.map +1 -1
  50. package/dist/spectrum/utils/itemWrapperUtils.d.ts +19 -3
  51. package/dist/spectrum/utils/itemWrapperUtils.d.ts.map +1 -1
  52. package/dist/spectrum/utils/itemWrapperUtils.js +65 -19
  53. package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -1
  54. package/dist/spectrum/utils/propsUtils.d.ts +14 -0
  55. package/dist/spectrum/utils/propsUtils.d.ts.map +1 -0
  56. package/dist/spectrum/utils/propsUtils.js +93 -0
  57. package/dist/spectrum/utils/propsUtils.js.map +1 -0
  58. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts +11 -2
  59. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts.map +1 -1
  60. package/dist/spectrum/utils/useRenderNormalizedItem.js +21 -8
  61. package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -1
  62. package/package.json +7 -7
@@ -5,9 +5,38 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
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 { cloneElement } from 'react';
7
7
  import { Item } from '@adobe/react-spectrum';
8
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
9
+ import { dh as dhIcons } from '@deephaven/icons';
8
10
  import { isElementOfType } from '@deephaven/react-hooks';
11
+ import { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';
9
12
  import { isItemElement, isSectionElement, ITEM_EMPTY_STRING_TEXT_VALUE } from "./itemUtils.js";
10
- import ItemContent from "../ItemContent.js";
13
+ import { ItemContent } from "../ItemContent.js";
14
+ import { Icon } from "../icons.js";
15
+ import { Text } from "../Text.js";
16
+ /**
17
+ * If the given content is a string, wrap it in an Icon component. Otherwise,
18
+ * return the original content. If the key is not found in the dhIcons object,
19
+ * the vsBlank icon will be used.
20
+ * @param maybeIconKey The content to wrap
21
+ * @param slot The slot to use for the Icon component
22
+ * @returns The wrapped content or original content if not a string
23
+ */
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ export function wrapIcon(maybeIconKey, slot) {
26
+ var _maybeIconKey, _dhIcons$maybeIconKey;
27
+ // eslint-disable-next-line no-param-reassign
28
+ maybeIconKey = (_maybeIconKey = maybeIconKey) !== null && _maybeIconKey !== void 0 ? _maybeIconKey : '';
29
+ if (typeof maybeIconKey !== 'string') {
30
+ return maybeIconKey;
31
+ }
32
+ return /*#__PURE__*/_jsx(Icon, {
33
+ slot: slot,
34
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
35
+ icon: (_dhIcons$maybeIconKey = dhIcons[maybeIconKey]) !== null && _dhIcons$maybeIconKey !== void 0 ? _dhIcons$maybeIconKey : dhIcons.vsBlank
36
+ })
37
+ });
38
+ }
39
+
11
40
  /**
12
41
  * Ensure all primitive children are wrapped in `Item` elements and that all
13
42
  * `Item` element content is wrapped in `ItemContent` elements to handle text
@@ -16,10 +45,9 @@ import ItemContent from "../ItemContent.js";
16
45
  * @param tooltipOptions The tooltip options to use when wrapping items
17
46
  * @returns The wrapped items or sections
18
47
  */
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
48
  export function wrapItemChildren(itemsOrSections, tooltipOptions) {
21
- var itemsOrSectionsArray = Array.isArray(itemsOrSections) ? itemsOrSections : [itemsOrSections];
22
- return itemsOrSectionsArray.map(item => {
49
+ var itemsOrSectionsArray = ensureArray(itemsOrSections);
50
+ var result = itemsOrSectionsArray.map(item => {
23
51
  if (isItemElement(item)) {
24
52
  var _item$key;
25
53
  // Item content is already wrapped
@@ -27,13 +55,13 @@ export function wrapItemChildren(itemsOrSections, tooltipOptions) {
27
55
  return item;
28
56
  }
29
57
  var key = (_item$key = item.key) !== null && _item$key !== void 0 ? _item$key : item.props.textValue;
30
- var textValue = item.props.textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : item.props.textValue;
58
+ var _textValue = item.props.textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : item.props.textValue;
31
59
 
32
60
  // Wrap in `ItemContent` so we can support tooltips and handle text
33
61
  // overflow
34
62
  return /*#__PURE__*/cloneElement(item, _objectSpread(_objectSpread({}, item.props), {}, {
35
63
  key,
36
- textValue,
64
+ textValue: _textValue,
37
65
  children: /*#__PURE__*/_jsx(ItemContent, {
38
66
  tooltipOptions: tooltipOptions,
39
67
  children: item.props.children
@@ -47,19 +75,37 @@ export function wrapItemChildren(itemsOrSections, tooltipOptions) {
47
75
  children: wrapItemChildren(item.props.children, tooltipOptions)
48
76
  }));
49
77
  }
50
- if (typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean') {
51
- var text = String(item);
52
- var _textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;
53
- return /*#__PURE__*/_jsx(Item, {
54
- textValue: _textValue,
55
- children: /*#__PURE__*/_jsx(ItemContent, {
56
- tooltipOptions: tooltipOptions,
57
- children: text
58
- })
59
- }, text);
60
- }
61
- return item;
78
+ var text = String(item);
79
+ var textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;
80
+ return /*#__PURE__*/_jsx(Item, {
81
+ textValue: textValue,
82
+ children: /*#__PURE__*/_jsx(ItemContent, {
83
+ tooltipOptions: tooltipOptions,
84
+ children: text
85
+ })
86
+ }, text);
62
87
  });
88
+
89
+ // Keep consistent with original data structure as array or single node
90
+ return Array.isArray(itemsOrSections) ? result : result[0];
91
+ }
92
+
93
+ /**
94
+ * If the given content is a primitive type, wrap it in a Text component.
95
+ * @param content The content to wrap
96
+ * @param slot The slot to use for the Text component
97
+ * @returns The wrapped content or original content if not a primitive type
98
+ */
99
+ export function wrapPrimitiveWithText(content, slot) {
100
+ var _content;
101
+ // eslint-disable-next-line no-param-reassign
102
+ content = (_content = content) !== null && _content !== void 0 ? _content : '';
103
+ if (['string', 'boolean', 'number'].includes(typeof content)) {
104
+ return /*#__PURE__*/_jsx(Text, {
105
+ slot: slot,
106
+ children: content === '' ? NON_BREAKING_SPACE : String(content)
107
+ });
108
+ }
109
+ return content;
63
110
  }
64
- export default wrapItemChildren;
65
111
  //# sourceMappingURL=itemWrapperUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","isElementOfType","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","jsx","_jsx","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","Array","isArray","map","item","_item$key","props","children","key","textValue","_objectSpread","_item$key2","title","undefined","text","String"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, ReactElement } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport {\n isItemElement,\n isSectionElement,\n ItemElement,\n ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n SectionElement,\n TooltipOptions,\n} from './itemUtils';\nimport { ItemProps } from '../shared';\nimport ItemContent from '../ItemContent';\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren(\n itemsOrSections: ItemOrSection | ItemOrSection[],\n tooltipOptions: TooltipOptions | null\n): (ItemElement | SectionElement)[] {\n const itemsOrSectionsArray = Array.isArray(itemsOrSections)\n ? itemsOrSections\n : [itemsOrSections];\n\n return itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue =\n item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren(\n item.props.children,\n tooltipOptions\n ) as ReactElement<ItemProps<unknown>>[],\n });\n }\n\n if (\n typeof item === 'string' ||\n typeof item === 'number' ||\n typeof item === 'boolean'\n ) {\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n }\n\n return item;\n });\n}\n\nexport default wrapItemChildren;\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAsB,OAAO;AAClD,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,wBAAwB;AAAC,SAEvDC,aAAa,EACbC,gBAA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A,UAAA,GACP,OAAOP,IAAI,CAACE,KAAK,CAACM,KAAK,KAAK,QAAQ,GAAGR,IAAI,CAACE,KAAK,CAACM,KAAK,GAAGC,SAAU;QACvEN,QAAQ,EAAEV,gBAAgB,CACxBO,IAAI,CAACE,KAAK,CAACC,QAAQ,EACnBR,cACF;MAAuC,EACxC,CAAC;IACJ;IAEA,IACE,OAAOK,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAOA,IAAI,KAAK,SAAS,EACzB;MACA,IAAMU,IAAI,GAAGC,MAAM,CAACX,IAAI,CAAC;MACzB,IAAMK,UAAS,GAAGK,IAAI,KAAK,EAAE,GAAGrB,4BAA4B,GAAGqB,IAAI;MAEnE,oBACElB,IAAA,CAACP,IAAI;QAAYoB,SAAS,EAAEA,UAAU;QAAAF,QAAA,eACpCX,IAAA,CAACF,WAAW;UAACK,cAAc,EAAEA,cAAe;UAAAQ,QAAA,EAAEO;QAAI,CAAc;MAAC,GADxDA,IAEL,CAAC;IAEX;IAEA,OAAOV,IAAI;EACb,CAAC,CAAC;AACJ;AAEA,eAAeP,gBAAgB"}
1
+ {"version":3,"file":"itemWrapperUtils.js","names":["cloneElement","Item","FontAwesomeIcon","dh","dhIcons","isElementOfType","ensureArray","NON_BREAKING_SPACE","isItemElement","isSectionElement","ITEM_EMPTY_STRING_TEXT_VALUE","ItemContent","Icon","Text","jsx","_jsx","wrapIcon","maybeIconKey","slot","_maybeIconKey","_dhIcons$maybeIconKey","children","icon","vsBlank","wrapItemChildren","itemsOrSections","tooltipOptions","itemsOrSectionsArray","result","map","item","_item$key","props","key","textValue","_objectSpread","_item$key2","title","undefined","text","String","Array","isArray","wrapPrimitiveWithText","content","_content","includes"],"sources":["../../../src/spectrum/utils/itemWrapperUtils.tsx"],"sourcesContent":["import { cloneElement, ReactElement, ReactNode } from 'react';\nimport { Item } from '@adobe/react-spectrum';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { dh as dhIcons } from '@deephaven/icons';\nimport { isElementOfType } from '@deephaven/react-hooks';\nimport { ensureArray, NON_BREAKING_SPACE } from '@deephaven/utils';\nimport {\n isItemElement,\n isSectionElement,\n ItemElement,\n ItemIconSlot,\n ItemOrSection,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n SectionElement,\n TooltipOptions,\n} from './itemUtils';\nimport { ItemProps } from '../shared';\nimport { ItemContent } from '../ItemContent';\nimport { Icon } from '../icons';\nimport { Text } from '../Text';\n\n/**\n * If the given content is a string, wrap it in an Icon component. Otherwise,\n * return the original content. If the key is not found in the dhIcons object,\n * the vsBlank icon will be used.\n * @param maybeIconKey The content to wrap\n * @param slot The slot to use for the Icon component\n * @returns The wrapped content or original content if not a string\n */\nexport function wrapIcon(\n maybeIconKey: ReactNode,\n slot: ItemIconSlot\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n maybeIconKey = maybeIconKey ?? '';\n\n if (typeof maybeIconKey !== 'string') {\n return maybeIconKey;\n }\n\n return (\n <Icon slot={slot}>\n <FontAwesomeIcon icon={dhIcons[maybeIconKey] ?? dhIcons.vsBlank} />\n </Icon>\n );\n}\n\n/**\n * Ensure all primitive children are wrapped in `Item` elements and that all\n * `Item` element content is wrapped in `ItemContent` elements to handle text\n * overflow consistently and to support tooltips.\n * @param itemsOrSections The items or sections to wrap\n * @param tooltipOptions The tooltip options to use when wrapping items\n * @returns The wrapped items or sections\n */\nexport function wrapItemChildren(\n itemsOrSections: ItemOrSection | ItemOrSection[],\n tooltipOptions: TooltipOptions | null\n): ItemElement | SectionElement | (ItemElement | SectionElement)[] {\n const itemsOrSectionsArray = ensureArray(itemsOrSections);\n\n const result = itemsOrSectionsArray.map(item => {\n if (isItemElement(item)) {\n // Item content is already wrapped\n if (isElementOfType(item.props.children, ItemContent)) {\n return item;\n }\n\n const key = item.key ?? item.props.textValue;\n const textValue =\n item.props.textValue === ''\n ? ITEM_EMPTY_STRING_TEXT_VALUE\n : item.props.textValue;\n\n // Wrap in `ItemContent` so we can support tooltips and handle text\n // overflow\n return cloneElement(item, {\n ...item.props,\n key,\n textValue,\n children: (\n <ItemContent tooltipOptions={tooltipOptions}>\n {item.props.children}\n </ItemContent>\n ),\n });\n }\n\n if (isSectionElement(item)) {\n return cloneElement(item, {\n ...item.props,\n key:\n item.key ??\n (typeof item.props.title === 'string' ? item.props.title : undefined),\n children: wrapItemChildren(\n item.props.children,\n tooltipOptions\n ) as ReactElement<ItemProps<unknown>>[],\n });\n }\n\n const text = String(item);\n const textValue = text === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : text;\n\n return (\n <Item key={text} textValue={textValue}>\n <ItemContent tooltipOptions={tooltipOptions}>{text}</ItemContent>\n </Item>\n );\n });\n\n // Keep consistent with original data structure as array or single node\n return Array.isArray(itemsOrSections) ? result : result[0];\n}\n\n/**\n * If the given content is a primitive type, wrap it in a Text component.\n * @param content The content to wrap\n * @param slot The slot to use for the Text component\n * @returns The wrapped content or original content if not a primitive type\n */\nexport function wrapPrimitiveWithText(\n content?: ReactNode,\n slot?: string\n): ReactNode {\n // eslint-disable-next-line no-param-reassign\n content = content ?? '';\n\n if (['string', 'boolean', 'number'].includes(typeof content)) {\n return (\n <Text slot={slot}>\n {/* Non-breaking space is needed to avoid the Text element's height \n collapsing when content is empty */}\n {content === '' ? NON_BREAKING_SPACE : String(content)}\n </Text>\n );\n }\n\n return content;\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,QAAiC,OAAO;AAC7D,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,EAAE,IAAIC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,kBAAkB;AAAC,SAEjEC,aAAa,EACbC,gBAAgB,EAIhBC,4BAA4B;AAAA,SAKrBC,WAAW;AAAA,SACXC,IAAI;AAAA,SACJC,IAAI;AAEb;AACA;AACA;A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A;EACX;EACAD,OAAO,IAAAC,QAAA,GAAGD,OAAO,cAAAC,QAAA,cAAAA,QAAA,GAAI,EAAE;EAEvB,IAAI,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAAC,OAAOF,OAAO,CAAC,EAAE;IAC5D,oBACE7B,IAAA,CAACF,IAAI;MAACK,IAAI,EAAEA,IAAK;MAAAG,QAAA,EAGduB,OAAO,KAAK,EAAE,GAAGrC,kBAAkB,GAAGiC,MAAM,CAACI,OAAO;IAAC,CAClD,CAAC;EAEX;EAEA,OAAOA,OAAO;AAChB"}
@@ -0,0 +1,14 @@
1
+ import type { AriaLabelingProps, StyleProps } from '@react-types/shared';
2
+ /**
3
+ * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and
4
+ * any remaining props.
5
+ * @param props The props to separate
6
+ * @returns The separated props
7
+ */
8
+ export declare function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(props: T): {
9
+ ariaLabelProps: AriaLabelingProps;
10
+ styleProps: StyleProps;
11
+ componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;
12
+ };
13
+ export default separateSpectrumProps;
14
+ //# sourceMappingURL=propsUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propsUtils.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/propsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEzE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,iBAAiB,GAAG,UAAU,EAC5E,KAAK,EAAE,CAAC,GACP;IACD,cAAc,EAAE,iBAAiB,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,iBAAiB,GAAG,UAAU,CAAC,CAAC,CAAC;CACjE,CAsFA;AAED,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,93 @@
1
+ var _excluded = ["aria-label", "aria-labelledby", "aria-describedby", "aria-details", "marginX", "marginY", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "flex", "flexGrow", "flexShrink", "flexBasis", "justifySelf", "alignSelf", "order", "gridArea", "gridColumn", "gridRow", "gridColumnStart", "gridColumnEnd", "gridRowStart", "gridRowEnd", "position", "zIndex", "top", "bottom", "start", "end", "left", "right", "isHidden"];
2
+ 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; }
3
+ 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; }
4
+ /**
5
+ * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and
6
+ * any remaining props.
7
+ * @param props The props to separate
8
+ * @returns The separated props
9
+ */
10
+ export function separateSpectrumProps(props) {
11
+ var {
12
+ 'aria-label': ariaLabel,
13
+ 'aria-labelledby': ariaLabelledby,
14
+ 'aria-describedby': ariaDescribedby,
15
+ 'aria-details': ariaHidden,
16
+ marginX,
17
+ marginY,
18
+ width,
19
+ height,
20
+ minWidth,
21
+ minHeight,
22
+ maxWidth,
23
+ maxHeight,
24
+ flex,
25
+ flexGrow,
26
+ flexShrink,
27
+ flexBasis,
28
+ justifySelf,
29
+ alignSelf,
30
+ order,
31
+ gridArea,
32
+ gridColumn,
33
+ gridRow,
34
+ gridColumnStart,
35
+ gridColumnEnd,
36
+ gridRowStart,
37
+ gridRowEnd,
38
+ position,
39
+ zIndex,
40
+ top,
41
+ bottom,
42
+ start,
43
+ end,
44
+ left,
45
+ right,
46
+ isHidden
47
+ } = props,
48
+ componentProps = _objectWithoutProperties(props, _excluded);
49
+ return {
50
+ ariaLabelProps: {
51
+ 'aria-label': ariaLabel,
52
+ 'aria-labelledby': ariaLabelledby,
53
+ 'aria-describedby': ariaDescribedby,
54
+ 'aria-details': ariaHidden
55
+ },
56
+ styleProps: {
57
+ marginX,
58
+ marginY,
59
+ width,
60
+ height,
61
+ minWidth,
62
+ minHeight,
63
+ maxWidth,
64
+ maxHeight,
65
+ flex,
66
+ flexGrow,
67
+ flexShrink,
68
+ flexBasis,
69
+ justifySelf,
70
+ alignSelf,
71
+ order,
72
+ gridArea,
73
+ gridColumn,
74
+ gridRow,
75
+ gridColumnStart,
76
+ gridColumnEnd,
77
+ gridRowStart,
78
+ gridRowEnd,
79
+ position,
80
+ zIndex,
81
+ top,
82
+ bottom,
83
+ start,
84
+ end,
85
+ left,
86
+ right,
87
+ isHidden
88
+ },
89
+ componentProps: componentProps
90
+ };
91
+ }
92
+ export default separateSpectrumProps;
93
+ //# sourceMappingURL=propsUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propsUtils.js","names":["separateSpectrumProps","props","ariaLabel","ariaLabelledby","ariaDescribedby","ariaHidden","marginX","marginY","width","height","minWidth","minHeight","maxWidth","maxHeight","flex","flexGrow","flexShrink","flexBasis","justifySelf","alignSelf","order","gridArea","gridColumn","gridRow","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","position","zIndex","top","bottom","start","end","left","right","isHidden","componentProps","_objectWithoutProperties","_excluded","ariaLabelProps","styleProps"],"sources":["../../../src/spectrum/utils/propsUtils.ts"],"sourcesContent":["import type { AriaLabelingProps, StyleProps } from '@react-types/shared';\n\n/**\n * Separate props for Spectrum components into AriaLabelingProps, StyleProps, and\n * any remaining props.\n * @param props The props to separate\n * @returns The separated props\n */\nexport function separateSpectrumProps<T extends AriaLabelingProps & StyleProps>(\n props: T\n): {\n ariaLabelProps: AriaLabelingProps;\n styleProps: StyleProps;\n componentProps: Omit<T, keyof (AriaLabelingProps & StyleProps)>;\n} {\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n ...componentProps\n } = props;\n\n return {\n ariaLabelProps: {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaHidden,\n },\n styleProps: {\n marginX,\n marginY,\n width,\n height,\n minWidth,\n minHeight,\n maxWidth,\n maxHeight,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n justifySelf,\n alignSelf,\n order,\n gridArea,\n gridColumn,\n gridRow,\n gridColumnStart,\n gridColumnEnd,\n gridRowStart,\n gridRowEnd,\n position,\n zIndex,\n top,\n bottom,\n start,\n end,\n left,\n right,\n isHidden,\n },\n componentProps: componentProps as Omit<\n T,\n keyof (AriaLabelingProps & StyleProps)\n >,\n };\n}\n\nexport default separateSpectrumProps;\n"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qBAAqBA,CACnCC,KAAQ,EAKR;EACA,IAAM;MACJ,YAAY,EAAEC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC,UAAU;MAE1BC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IAEF,CAAC,GAAGnC,KAAK;IADJoC,cAAc,GAAAC,wBAAA,CACfrC,KAAK,EAAAsC,SAAA;EAET,OAAO;IACLC,cAAc,EAAE;MACd,YAAY,EAAEtC,SAAS;MACvB,iBAAiB,EAAEC,cAAc;MACjC,kBAAkB,EAAEC,eAAe;MACnC,cAAc,EAAEC;IAClB,CAAC;IACDoC,UAAU,EAAE;MACVnC,OAAO;MACPC,OAAO;MACPC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC,SAAS;MACTC,QAAQ;MACRC,SAAS;MACTC,IAAI;MACJC,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,QAAQ;MACRC,UAAU;MACVC,OAAO;MACPC,eAAe;MACfC,aAAa;MACbC,YAAY;MACZC,UAAU;MACVC,QAAQ;MACRC,MAAM;MACNC,GAAG;MACHC,MAAM;MACNC,KAAK;MACLC,GAAG;MACHC,IAAI;MACJC,KAAK;MACLC;IACF,CAAC;IACDC,cAAc,EAAEA;EAIlB,CAAC;AACH;AAEA,eAAerC,qBAAqB"}
@@ -1,11 +1,20 @@
1
1
  /// <reference types="react" />
2
- import { NormalizedItem, TooltipOptions } from './itemUtils';
2
+ import { ItemIconSlot, NormalizedItem, TooltipOptions } from './itemUtils';
3
+ export interface UseRenderNormalizedItemOptions {
4
+ itemIconSlot: ItemIconSlot;
5
+ showItemDescriptions: boolean;
6
+ showItemIcons: boolean;
7
+ tooltipOptions: TooltipOptions | null;
8
+ }
3
9
  /**
4
10
  * Returns a render function that can be used to render a normalized item in
5
11
  * collection components.
12
+ * @param itemIconSlot Slot to use for item icons
13
+ * @param showItemDescriptions Whether to show item descriptions
14
+ * @param showItemIcons Whether to show item icons
6
15
  * @param tooltipOptions Tooltip options to use when rendering the item
7
16
  * @returns Render function for normalized items
8
17
  */
9
- export declare function useRenderNormalizedItem(tooltipOptions: TooltipOptions | null): (normalizedItem: NormalizedItem) => JSX.Element;
18
+ export declare function useRenderNormalizedItem({ itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions, }: UseRenderNormalizedItemOptions): (normalizedItem: NormalizedItem) => JSX.Element;
10
19
  export default useRenderNormalizedItem;
11
20
  //# sourceMappingURL=useRenderNormalizedItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderNormalizedItem.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"names":[],"mappings":";AAGA,OAAO,EAGL,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,GAAG,IAAI,GACpC,CAAC,cAAc,EAAE,cAAc,KAAK,GAAG,CAAC,OAAO,CA+BjD;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"useRenderNormalizedItem.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"names":[],"mappings":";AAGA,OAAO,EAEL,YAAY,EAEZ,cAAc,EACd,cAAc,EACf,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,YAAY,CAAC;IAC3B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,cAAc,GACf,EAAE,8BAA8B,GAAG,CAClC,cAAc,EAAE,cAAc,KAC3B,GAAG,CAAC,OAAO,CA2Cf;AAED,eAAe,uBAAuB,CAAC"}
@@ -2,19 +2,32 @@ import { useCallback } from 'react';
2
2
  import { ItemContent } from "../ItemContent.js";
3
3
  import { Item } from "../shared.js";
4
4
  import { getItemKey, ITEM_EMPTY_STRING_TEXT_VALUE } from "./itemUtils.js";
5
+ import { wrapIcon, wrapPrimitiveWithText } from "./itemWrapperUtils.js";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
5
8
  /**
6
9
  * Returns a render function that can be used to render a normalized item in
7
10
  * collection components.
11
+ * @param itemIconSlot Slot to use for item icons
12
+ * @param showItemDescriptions Whether to show item descriptions
13
+ * @param showItemIcons Whether to show item icons
8
14
  * @param tooltipOptions Tooltip options to use when rendering the item
9
15
  * @returns Render function for normalized items
10
16
  */
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- export function useRenderNormalizedItem(tooltipOptions) {
17
+ export function useRenderNormalizedItem(_ref) {
18
+ var {
19
+ itemIconSlot,
20
+ showItemDescriptions,
21
+ showItemIcons,
22
+ tooltipOptions
23
+ } = _ref;
13
24
  return useCallback(normalizedItem => {
14
- var _normalizedItem$item$, _normalizedItem$item, _normalizedItem$item$2, _normalizedItem$item2;
25
+ var _normalizedItem$item, _normalizedItem$item$, _normalizedItem$item2, _normalizedItem$item3, _normalizedItem$item4;
15
26
  var key = getItemKey(normalizedItem);
16
- var content = (_normalizedItem$item$ = (_normalizedItem$item = normalizedItem.item) === null || _normalizedItem$item === void 0 ? void 0 : _normalizedItem$item.content) !== null && _normalizedItem$item$ !== void 0 ? _normalizedItem$item$ : '';
17
- var textValue = (_normalizedItem$item$2 = (_normalizedItem$item2 = normalizedItem.item) === null || _normalizedItem$item2 === void 0 ? void 0 : _normalizedItem$item2.textValue) !== null && _normalizedItem$item$2 !== void 0 ? _normalizedItem$item$2 : '';
27
+ var content = wrapPrimitiveWithText((_normalizedItem$item = normalizedItem.item) === null || _normalizedItem$item === void 0 ? void 0 : _normalizedItem$item.content);
28
+ var textValue = (_normalizedItem$item$ = (_normalizedItem$item2 = normalizedItem.item) === null || _normalizedItem$item2 === void 0 ? void 0 : _normalizedItem$item2.textValue) !== null && _normalizedItem$item$ !== void 0 ? _normalizedItem$item$ : '';
29
+ var description = showItemDescriptions ? wrapPrimitiveWithText((_normalizedItem$item3 = normalizedItem.item) === null || _normalizedItem$item3 === void 0 ? void 0 : _normalizedItem$item3.description, 'description') : null;
30
+ var icon = showItemIcons ? wrapIcon((_normalizedItem$item4 = normalizedItem.item) === null || _normalizedItem$item4 === void 0 ? void 0 : _normalizedItem$item4.icon, itemIconSlot) : null;
18
31
  return /*#__PURE__*/_jsx(Item
19
32
  // Note that setting the `key` prop explicitly on `Item` elements
20
33
  // causes the picker to expect `selectedKey` and `defaultSelectedKey`
@@ -29,12 +42,12 @@ export function useRenderNormalizedItem(tooltipOptions) {
29
42
  // but are used for accessibility purposes, so we set to an arbitrary
30
43
  // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.
31
44
  textValue: textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue,
32
- children: /*#__PURE__*/_jsx(ItemContent, {
45
+ children: /*#__PURE__*/_jsxs(ItemContent, {
33
46
  tooltipOptions: tooltipOptions,
34
- children: content
47
+ children: [icon, content, description]
35
48
  })
36
49
  }, key);
37
- }, [tooltipOptions]);
50
+ }, [itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]);
38
51
  }
39
52
  export default useRenderNormalizedItem;
40
53
  //# sourceMappingURL=useRenderNormalizedItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRenderNormalizedItem.js","names":["useCallback","ItemContent","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","jsx","_jsx","useRenderNormalizedItem","tooltipOptions","normalizedItem","_normalizedItem$item$","_normalizedItem$item","_normalizedItem$item$2","_normalizedItem$item2","key","content","item","textValue","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { Key, useCallback } from 'react';\nimport { ItemContent } from '../ItemContent';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n NormalizedItem,\n TooltipOptions,\n} from './itemUtils';\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem(\n tooltipOptions: TooltipOptions | null\n): (normalizedItem: NormalizedItem) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const key = getItemKey(normalizedItem);\n const content = normalizedItem.item?.content ?? '';\n const textValue = normalizedItem.item?.textValue ?? '';\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={key as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>{content}</ItemContent>\n </Item>\n );\n },\n [tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":"AAAA,SAAcA,WAAW,QAAQ,OAAO;AAAC,SAChCC,WAAW;AAAA,SACXC,IAAI;AAAA,SAEXC,UAAU,EACVC,4BAA4B;AAK9B;AACA;AACA;AACA;AACA;AACA;AALA,SAAAC,GAAA,IAAAC,IAAA;AAMA,OAAO,SAASC,uBAAuBA,CACrCC,cAAqC,EACY;EACjD,OAAOR,WAAW,CACfS,cAA8B,IAAK;IAAA,IAAAC,qBAAA,EAAAC,oBAAA,EAAAC,sBAAA,EAAAC,qBAAA;IAClC,IAAMC,GAAG,GAAGX,UAAU,CAACM,cAAc,CAAC;IACtC,IAAMM,OAAO,IAAAL,qBAAA,IAAAC,oBAAA,GAAGF,cAAc,CAACO,IAAI,cAAAL,oBAAA,uBAAnBA,oBAAA,CAAqBI,OAAO,cAAAL,qBAAA,cAAAA,qBAAA,GAAI,EAAE;IAClD,IAAMO,SAAS,IAAAL,sBAAA,IAAAC,qBAAA,GAAGJ,cAAc,CAACO,IAAI,cAAAH,qBAAA,uBAAnBA,qBAAA,CAAqBI,SAAS,cAAAL,sBAAA,cAAAA,sBAAA,GAAI,EAAE;IAEtD,oBACEN,IAAA,CAACJ;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAe,SAAS,EACPA,SAAS,KAAK,EAAE,GAAGb,4BAA4B,GAAGa,SACnD;MAAAC,QAAA,eAEDZ,IAAA,CAACL,WAAW;QAACO,cAAc,EAAEA,cAAe;QAAAU,QAAA,EAAEH;MAAO,CAAc;IAAC,GAT/DD,GAUD,CAAC;EAEX,CAAC,EACD,CAACN,cAAc,CACjB,CAAC;AACH;AAEA,eAAeD,uBAAuB"}
1
+ {"version":3,"file":"useRenderNormalizedItem.js","names":["useCallback","ItemContent","Item","getItemKey","ITEM_EMPTY_STRING_TEXT_VALUE","wrapIcon","wrapPrimitiveWithText","jsxs","_jsxs","jsx","_jsx","useRenderNormalizedItem","_ref","itemIconSlot","showItemDescriptions","showItemIcons","tooltipOptions","normalizedItem","_normalizedItem$item","_normalizedItem$item$","_normalizedItem$item2","_normalizedItem$item3","_normalizedItem$item4","key","content","item","textValue","description","icon","children"],"sources":["../../../src/spectrum/utils/useRenderNormalizedItem.tsx"],"sourcesContent":["import { Key, useCallback } from 'react';\nimport { ItemContent } from '../ItemContent';\nimport { Item } from '../shared';\nimport {\n getItemKey,\n ItemIconSlot,\n ITEM_EMPTY_STRING_TEXT_VALUE,\n NormalizedItem,\n TooltipOptions,\n} from './itemUtils';\nimport { wrapIcon, wrapPrimitiveWithText } from './itemWrapperUtils';\n\nexport interface UseRenderNormalizedItemOptions {\n itemIconSlot: ItemIconSlot;\n showItemDescriptions: boolean;\n showItemIcons: boolean;\n tooltipOptions: TooltipOptions | null;\n}\n\n/**\n * Returns a render function that can be used to render a normalized item in\n * collection components.\n * @param itemIconSlot Slot to use for item icons\n * @param showItemDescriptions Whether to show item descriptions\n * @param showItemIcons Whether to show item icons\n * @param tooltipOptions Tooltip options to use when rendering the item\n * @returns Render function for normalized items\n */\nexport function useRenderNormalizedItem({\n itemIconSlot,\n showItemDescriptions,\n showItemIcons,\n tooltipOptions,\n}: UseRenderNormalizedItemOptions): (\n normalizedItem: NormalizedItem\n) => JSX.Element {\n return useCallback(\n (normalizedItem: NormalizedItem) => {\n const key = getItemKey(normalizedItem);\n const content = wrapPrimitiveWithText(normalizedItem.item?.content);\n const textValue = normalizedItem.item?.textValue ?? '';\n\n const description = showItemDescriptions\n ? wrapPrimitiveWithText(normalizedItem.item?.description, 'description')\n : null;\n\n const icon = showItemIcons\n ? wrapIcon(normalizedItem.item?.icon, itemIconSlot)\n : null;\n\n return (\n <Item\n // Note that setting the `key` prop explicitly on `Item` elements\n // causes the picker to expect `selectedKey` and `defaultSelectedKey`\n // to be strings. It also passes the stringified value of the key to\n // `onSelectionChange` handlers` regardless of the actual type of the\n // key. We can't really get around setting in order to support Windowed\n // data, so we'll need to do some manual conversion of keys to strings\n // in other components that use this hook.\n key={key as Key}\n // The `textValue` prop gets used to provide the content of `<option>`\n // elements that back the Spectrum Picker. These are not visible in the UI,\n // but are used for accessibility purposes, so we set to an arbitrary\n // `ITEM_EMPTY_STRING_TEXT_VALUE` value so that they are not empty strings.\n textValue={\n textValue === '' ? ITEM_EMPTY_STRING_TEXT_VALUE : textValue\n }\n >\n <ItemContent tooltipOptions={tooltipOptions}>\n {icon}\n {content}\n {description}\n </ItemContent>\n </Item>\n );\n },\n [itemIconSlot, showItemDescriptions, showItemIcons, tooltipOptions]\n );\n}\n\nexport default useRenderNormalizedItem;\n"],"mappings":"AAAA,SAAcA,WAAW,QAAQ,OAAO;AAAC,SAChCC,WAAW;AAAA,SACXC,IAAI;AAAA,SAEXC,UAAU,EAEVC,4BAA4B;AAAA,SAIrBC,QAAQ,EAAEC,qBAAqB;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AASxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAAAC,IAAA,EAOtB;EAAA,IAPuB;IACtCC,YAAY;IACZC,oBAAoB;IACpBC,aAAa;IACbC;EAC8B,CAAC,GAAAJ,IAAA;EAG/B,OAAOZ,WAAW,CACfiB,cAA8B,IAAK;IAAA,IAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAClC,IAAMC,GAAG,GAAGpB,UAAU,CAACc,cAAc,CAAC;IACtC,IAAMO,OAAO,GAAGlB,qBAAqB,EAAAY,oBAAA,GAACD,cAAc,CAACQ,IAAI,cAAAP,oBAAA,uBAAnBA,oBAAA,CAAqBM,OAAO,CAAC;IACnE,IAAME,SAAS,IAAAP,qBAAA,IAAAC,qBAAA,GAAGH,cAAc,CAACQ,IAAI,cAAAL,qBAAA,uBAAnBA,qBAAA,CAAqBM,SAAS,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,EAAE;IAEtD,IAAMQ,WAAW,GAAGb,oBAAoB,GACpCR,qBAAqB,EAAAe,qBAAA,GAACJ,cAAc,CAACQ,IAAI,cAAAJ,qBAAA,uBAAnBA,qBAAA,CAAqBM,WAAW,EAAE,aAAa,CAAC,GACtE,IAAI;IAER,IAAMC,IAAI,GAAGb,aAAa,GACtBV,QAAQ,EAAAiB,qBAAA,GAACL,cAAc,CAACQ,IAAI,cAAAH,qBAAA,uBAAnBA,qBAAA,CAAqBM,IAAI,EAAEf,YAAY,CAAC,GACjD,IAAI;IAER,oBACEH,IAAA,CAACR;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IAAA;MAEA;MACA;MACA;MACA;MACAwB,SAAS,EACPA,SAAS,KAAK,EAAE,GAAGtB,4BAA4B,GAAGsB,SACnD;MAAAG,QAAA,eAEDrB,KAAA,CAACP,WAAW;QAACe,cAAc,EAAEA,cAAe;QAAAa,QAAA,GACzCD,IAAI,EACJJ,OAAO,EACPG,WAAW;MAAA,CACD;IAAC,GAbTJ,GAcD,CAAC;EAEX,CAAC,EACD,CAACV,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,EAAEC,cAAc,CACpE,CAAC;AACH;AAEA,eAAeL,uBAAuB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/components",
3
- "version": "0.74.1-beta.5+c6bcc155",
3
+ "version": "0.75.0",
4
4
  "description": "Deephaven React component library",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@adobe/react-spectrum": "^3.34.1",
28
- "@deephaven/icons": "^0.74.1-beta.5+c6bcc155",
29
- "@deephaven/log": "^0.74.1-beta.5+c6bcc155",
30
- "@deephaven/react-hooks": "^0.74.1-beta.5+c6bcc155",
31
- "@deephaven/utils": "^0.74.1-beta.5+c6bcc155",
28
+ "@deephaven/icons": "^0.75.0",
29
+ "@deephaven/log": "^0.75.0",
30
+ "@deephaven/react-hooks": "^0.75.0",
31
+ "@deephaven/utils": "^0.75.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",
@@ -55,7 +55,7 @@
55
55
  "react-dom": ">=16.8.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@deephaven/mocks": "^0.74.1-beta.5+c6bcc155"
58
+ "@deephaven/mocks": "^0.75.0"
59
59
  },
60
60
  "files": [
61
61
  "dist",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "c6bcc1556311fa90e4e128025b9dff20f0d49648"
72
+ "gitHead": "cabfaf42c5c7e0b83561d10ba41cbeb305d1076e"
73
73
  }