react-magma-dom 4.7.0-next.50 → 4.7.0-next.51

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.
@@ -25,7 +25,6 @@ export declare function getTreeItemLabelColor(isInverse: boolean, disabled: bool
25
25
  export declare function getTreeItemWrapperCursor(disabled: boolean, selectable: TreeViewSelectable, nodeType: TreeNodeType): "not-allowed" | "pointer" | "default";
26
26
  export declare function getChildrenItemIds(children: any, status?: string): any[];
27
27
  export declare function getChildrenItemIdsFlat(children: any): any[];
28
- export declare function getChildrenItemIdsInTree(children: any): any[];
29
28
  export declare function filterNullEntries(obj: any): {
30
29
  current: any;
31
30
  } | {
package/dist/esm/index.js CHANGED
@@ -28449,21 +28449,6 @@ function getChildrenItemIdsFlat(children) {
28449
28449
  });
28450
28450
  return itemIds;
28451
28451
  }
28452
- // Return an array of objects where all children are items are nested in the parents
28453
- function getChildrenItemIdsInTree(children) {
28454
- var itemIds = [];
28455
- React__default.Children.forEach(children, function (child) {
28456
- var _child$props7, _child$props8;
28457
- if ((_child$props7 = child.props) != null && _child$props7.itemId && !((_child$props8 = child.props) != null && _child$props8.isDisabled)) {
28458
- var _child$props9, _child$props10;
28459
- itemIds.push({
28460
- itemId: (_child$props9 = child.props) == null ? void 0 : _child$props9.itemId,
28461
- children: getChildrenItemIdsInTree((_child$props10 = child.props) == null ? void 0 : _child$props10.children)
28462
- });
28463
- }
28464
- });
28465
- return itemIds;
28466
- }
28467
28452
  // Return a treeItemRefArray object with no null children
28468
28453
  function filterNullEntries(obj) {
28469
28454
  if (Array.isArray(obj.current)) {
@@ -28497,6 +28482,36 @@ var getIsDisabled = function getIsDisabled(_ref) {
28497
28482
  }
28498
28483
  return isParentDisabled || isDisabled;
28499
28484
  };
28485
+ /* Returns a boolean indicating whether at least one child is valid.
28486
+ A child is considered valid if it can be counted as an item that would make the parent expandable.
28487
+ This is used to set `hasOwnTreeItems` which manages visibility of the expandable arrow.
28488
+ */
28489
+ var areChildrenValid = function areChildrenValid(children) {
28490
+ if (!children) {
28491
+ return false;
28492
+ } else if (!children.length && children.type !== TreeItem) {
28493
+ return false;
28494
+ }
28495
+ var hasValidChild = true;
28496
+ for (var i = 0; i < children.length; i++) {
28497
+ var child = children[i];
28498
+ if (typeof child === 'string') {
28499
+ return false; // Return false if a child is a string
28500
+ }
28501
+ if (child.type !== TreeItem) {
28502
+ return hasValidChild;
28503
+ }
28504
+ // Recursively check the validity of nested children
28505
+ if (child.props.children) {
28506
+ var nestedChildren = Array.isArray(child.props.children) ? child.props.children : [child.props.children];
28507
+ if (areChildrenValid(nestedChildren)) {
28508
+ hasValidChild = true;
28509
+ return hasValidChild;
28510
+ }
28511
+ }
28512
+ }
28513
+ return hasValidChild;
28514
+ };
28500
28515
  var getTreeViewData = function getTreeViewData(_ref2) {
28501
28516
  var children = _ref2.children,
28502
28517
  selectable = _ref2.selectable,
@@ -28523,7 +28538,7 @@ var getTreeViewData = function getTreeViewData(_ref2) {
28523
28538
  itemId: props.itemId,
28524
28539
  parentId: parentId,
28525
28540
  icon: props.icon,
28526
- hasOwnTreeItems: Boolean(props.children),
28541
+ hasOwnTreeItems: areChildrenValid(props.children),
28527
28542
  isDisabled: isDisabled
28528
28543
  }].concat(props.children ? getTreeViewData({
28529
28544
  children: props.children,
@@ -29410,5 +29425,5 @@ var ToggleButton = /*#__PURE__*/forwardRef(function (props, ref) {
29410
29425
  }, children));
29411
29426
  });
29412
29427
 
29413
- export { Accordion, AccordionButton, AccordionContext, AccordionIconPosition, AccordionItem, AccordionItemContext, AccordionPanel, Alert, AlertVariant, Announce, AppBar, AppBarPosition, Badge, BadgeColor, BadgeVariant, Banner, BlockQuote, BlockQuoteItem, Breadcrumb, BreadcrumbItem, Breakpoint, BreakpointScreenSize, BreakpointsContainer, Button, ButtonColor, ButtonGroup, ButtonGroupAlignment, ButtonGroupContext, ButtonGroupOrientation, ButtonIconPosition, ButtonShape, ButtonSize, ButtonTextTransform, ButtonType, ButtonVariant, Card, CardAlignment, CardBody, CardCalloutType, CardHeading, CharacterCounter, Checkbox, CheckboxTextPosition, Combobox, ComboboxStateChangeTypes, Container$1 as Container, Datagrid, DatePicker, Drawer, DrawerPosition, Dropdown, DropdownAlignment, DropdownButton, DropdownContent, DropdownDivider, DropdownDropDirection, DropdownExpandableMenuButton, DropdownExpandableMenuGroup, DropdownExpandableMenuItem, DropdownExpandableMenuListItem, DropdownExpandableMenuPanel, DropdownHeader, DropdownMenuGroup, DropdownMenuItem, DropdownMenuNavItem, DropdownSplitButton, EnumTooltipPosition, Flex, FlexAlignContent, FlexAlignItems, FlexBehavior, FlexDirection, FlexJustify, FlexWrap, Form, FormFieldContainer, FormGroup, GlobalStyles, Grid, GridAlignContent, GridAlignItems, GridAutoFlow, GridDisplay, GridItem, GridItemAlignSelf, GridItemJustifySelf, GridJustifyContent, GridJustifyItems, Heading, HideAtBreakpoint, HideAtBreakpointDisplayType, Hyperlink, HyperlinkIconPosition, I18nContext, IconAlignment, IconButton, IconSizes, IndeterminateCheckbox, IndeterminateCheckboxStatus, Input, InputBase, InputIconPosition, InputMessage, InputSize, InputType, InverseContext, Label, LabelPosition, List$1 as List, ListItem, LoadingIndicator, Modal, ModalSize, MultipleSelectionStateChangeTypes, NativeSelect, NavTab, NavTabs, PageButtonSize, Pagination, PaginationType, Paragraph, PasswordInput, ProgressBar, ProgressBarColor, ProgressRing, Radio, RadioGroup, RadioTextPosition, ResponsiveStepperContainer, Search, Select$1 as Select, SelectStateChangeTypes, SkipLink, SkipLinkContent, Spacer, SpacerAxis, Spinner, Step, Stepper, StepperLayout, StepperOrientation, StyledTooltip, Tab, TabPanel, TabPanelsContainer, TabScrollSpyPanel, Table, TableBody, TableCell, TableCellAlign, TableContext, TableDensity, TableHead, TableHeaderCell, TableHeaderCellScope, TablePagination, TableRow, TableRowColor, TableSortDirection, Tabs, TabsAlignment, TabsBorderPosition, TabsContainer, TabsIconPosition, TabsOrientation, TabsScrollSpyContainer, TabsTextTransform, Tag, TagColor, TagSize, Textarea, ThemeContext, TimePicker, Toast, ToastsContainer, Toggle, ToggleButton, ToggleButtonGroup, ToggleButtonGroupContext, ToggleButtonStyles, ToggleTextPosition, Tooltip, TooltipArrow, TooltipPosition, Transition, TreeItem, TreeNodeType, TreeView, TreeViewSelectable, TypographyColor, TypographyContextVariant, TypographyVisualStyle, VisuallyHidden, blockQuoteStyles, calculateOffset, checkedStatusToBoolean, defaultI18n, filterNullEntries, getChildrenIds, getChildrenItemIds, getChildrenItemIdsFlat, getChildrenItemIdsInTree, getDateFromString, getIconSizes, getInitialExpandedIds, getInitialItems, getListAlignment, getTreeItemLabelColor, getTreeItemWrapperCursor, inDateRange, isEqualArrays, isSelectedItemsChanged, magma, olListType, selectSingle, setBackgroundColor, setIconWidth, toggleAllMulti, toggleMulti, ulListType, useAccordion, useAccordionButton, useAccordionItem, useDataPagination, useDescendants, useFocusLock, useForceUpdate, useGenerateId, useIsInverse, useMediaQuery, usePagination, useTreeItem, useTreeView };
29428
+ export { Accordion, AccordionButton, AccordionContext, AccordionIconPosition, AccordionItem, AccordionItemContext, AccordionPanel, Alert, AlertVariant, Announce, AppBar, AppBarPosition, Badge, BadgeColor, BadgeVariant, Banner, BlockQuote, BlockQuoteItem, Breadcrumb, BreadcrumbItem, Breakpoint, BreakpointScreenSize, BreakpointsContainer, Button, ButtonColor, ButtonGroup, ButtonGroupAlignment, ButtonGroupContext, ButtonGroupOrientation, ButtonIconPosition, ButtonShape, ButtonSize, ButtonTextTransform, ButtonType, ButtonVariant, Card, CardAlignment, CardBody, CardCalloutType, CardHeading, CharacterCounter, Checkbox, CheckboxTextPosition, Combobox, ComboboxStateChangeTypes, Container$1 as Container, Datagrid, DatePicker, Drawer, DrawerPosition, Dropdown, DropdownAlignment, DropdownButton, DropdownContent, DropdownDivider, DropdownDropDirection, DropdownExpandableMenuButton, DropdownExpandableMenuGroup, DropdownExpandableMenuItem, DropdownExpandableMenuListItem, DropdownExpandableMenuPanel, DropdownHeader, DropdownMenuGroup, DropdownMenuItem, DropdownMenuNavItem, DropdownSplitButton, EnumTooltipPosition, Flex, FlexAlignContent, FlexAlignItems, FlexBehavior, FlexDirection, FlexJustify, FlexWrap, Form, FormFieldContainer, FormGroup, GlobalStyles, Grid, GridAlignContent, GridAlignItems, GridAutoFlow, GridDisplay, GridItem, GridItemAlignSelf, GridItemJustifySelf, GridJustifyContent, GridJustifyItems, Heading, HideAtBreakpoint, HideAtBreakpointDisplayType, Hyperlink, HyperlinkIconPosition, I18nContext, IconAlignment, IconButton, IconSizes, IndeterminateCheckbox, IndeterminateCheckboxStatus, Input, InputBase, InputIconPosition, InputMessage, InputSize, InputType, InverseContext, Label, LabelPosition, List$1 as List, ListItem, LoadingIndicator, Modal, ModalSize, MultipleSelectionStateChangeTypes, NativeSelect, NavTab, NavTabs, PageButtonSize, Pagination, PaginationType, Paragraph, PasswordInput, ProgressBar, ProgressBarColor, ProgressRing, Radio, RadioGroup, RadioTextPosition, ResponsiveStepperContainer, Search, Select$1 as Select, SelectStateChangeTypes, SkipLink, SkipLinkContent, Spacer, SpacerAxis, Spinner, Step, Stepper, StepperLayout, StepperOrientation, StyledTooltip, Tab, TabPanel, TabPanelsContainer, TabScrollSpyPanel, Table, TableBody, TableCell, TableCellAlign, TableContext, TableDensity, TableHead, TableHeaderCell, TableHeaderCellScope, TablePagination, TableRow, TableRowColor, TableSortDirection, Tabs, TabsAlignment, TabsBorderPosition, TabsContainer, TabsIconPosition, TabsOrientation, TabsScrollSpyContainer, TabsTextTransform, Tag, TagColor, TagSize, Textarea, ThemeContext, TimePicker, Toast, ToastsContainer, Toggle, ToggleButton, ToggleButtonGroup, ToggleButtonGroupContext, ToggleButtonStyles, ToggleTextPosition, Tooltip, TooltipArrow, TooltipPosition, Transition, TreeItem, TreeNodeType, TreeView, TreeViewSelectable, TypographyColor, TypographyContextVariant, TypographyVisualStyle, VisuallyHidden, blockQuoteStyles, calculateOffset, checkedStatusToBoolean, defaultI18n, filterNullEntries, getChildrenIds, getChildrenItemIds, getChildrenItemIdsFlat, getDateFromString, getIconSizes, getInitialExpandedIds, getInitialItems, getListAlignment, getTreeItemLabelColor, getTreeItemWrapperCursor, inDateRange, isEqualArrays, isSelectedItemsChanged, magma, olListType, selectSingle, setBackgroundColor, setIconWidth, toggleAllMulti, toggleMulti, ulListType, useAccordion, useAccordionButton, useAccordionItem, useDataPagination, useDescendants, useFocusLock, useForceUpdate, useGenerateId, useIsInverse, useMediaQuery, usePagination, useTreeItem, useTreeView };
29414
29429
  //# sourceMappingURL=index.js.map