@dreamcommerce/aurora 3.0.0-85 → 3.0.0-87

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 (24) hide show
  1. package/build/cjs/packages/aurora/src/components/accordion/components/accordion_item.js +1 -1
  2. package/build/cjs/packages/aurora/src/components/accordion/components/accordion_trigger.js +2 -2
  3. package/build/cjs/packages/aurora/src/components/select/components/select_trigger.js +1 -1
  4. package/build/cjs/packages/aurora/src/components/tree/components/tree_node.js +81 -0
  5. package/build/cjs/packages/aurora/src/components/tree/components/tree_node.js.map +1 -0
  6. package/build/cjs/packages/aurora/src/components/tree/hooks/tree_hook.js +21 -0
  7. package/build/cjs/packages/aurora/src/components/tree/hooks/tree_hook.js.map +1 -0
  8. package/build/cjs/packages/aurora/src/components/tree/hooks/tree_node_hook.js +28 -0
  9. package/build/cjs/packages/aurora/src/components/tree/hooks/tree_node_hook.js.map +1 -0
  10. package/build/cjs/packages/aurora/src/index.js +8 -4
  11. package/build/cjs/packages/aurora/src/index.js.map +1 -1
  12. package/build/esm/packages/aurora/src/components/accordion/components/accordion_item.js +1 -1
  13. package/build/esm/packages/aurora/src/components/accordion/components/accordion_trigger.js +2 -2
  14. package/build/esm/packages/aurora/src/components/select/components/select_trigger.js +1 -1
  15. package/build/esm/packages/aurora/src/components/tree/components/tree_node.js +70 -36
  16. package/build/esm/packages/aurora/src/components/tree/components/tree_node.js.map +1 -1
  17. package/build/esm/packages/aurora/src/components/tree/hooks/tree_hook.js +11 -8
  18. package/build/esm/packages/aurora/src/components/tree/hooks/tree_hook.js.map +1 -1
  19. package/build/esm/packages/aurora/src/components/tree/hooks/tree_node_hook.js +22 -17
  20. package/build/esm/packages/aurora/src/components/tree/hooks/tree_node_hook.js.map +1 -1
  21. package/build/esm/packages/aurora/src/index.d.ts +3 -1
  22. package/build/esm/packages/aurora/src/index.js +4 -2
  23. package/build/esm/packages/aurora/src/index.js.map +1 -1
  24. package/package.json +1 -1
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
7
- var cn = require('../../../utilities/cn.js');
8
7
  var AccordionPrimitive = require('@radix-ui/react-accordion');
8
+ var cn = require('../../../utilities/cn.js');
9
9
 
10
10
  var _excluded = ["className", "borderStyle"];
11
11
  var AccordionItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
@@ -4,11 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
7
- var css_icon_color_tokens = require('../../../constants/css_tokens/css_icon_color_tokens.js');
8
- var cn = require('../../../utilities/cn.js');
9
7
  var AccordionPrimitive = require('@radix-ui/react-accordion');
10
8
  var accordion_constants = require('../accordion_constants.js');
9
+ var css_icon_color_tokens = require('../../../constants/css_tokens/css_icon_color_tokens.js');
11
10
  var accordion_context = require('../context/accordion_context.js');
11
+ var cn = require('../../../utilities/cn.js');
12
12
  var arrow_right = require('../../../assets/icons/arrow_right.js');
13
13
 
14
14
  var _excluded = ["className", "children", "backgroundColor", "icon", "iconColor"];
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
7
- var arrow_down_s_fill = require('../../../assets/icons/arrow_down_s_fill.js');
8
7
  var cn = require('../../../utilities/cn.js');
9
8
  var SelectPrimitive = require('@radix-ui/react-select');
9
+ var arrow_down_s_fill = require('../../../assets/icons/arrow_down_s_fill.js');
10
10
 
11
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
12
 
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
7
+ var cn = require('../../../utilities/cn.js');
8
+ var arrow_down_s_fill = require('../../../assets/icons/arrow_down_s_fill.js');
9
+ var reactTransitionGroup = require('react-transition-group');
10
+ var tree_hook = require('../hooks/tree_hook.js');
11
+ var tree_node_hook = require('../hooks/tree_node_hook.js');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
+
17
+ var _excluded = ["children", "id", "cssClassNames", "ContentComponent", "LabelComponent", "disabled"];
18
+ var TreeNode = function TreeNode(_ref) {
19
+ var children = _ref.children,
20
+ id = _ref.id,
21
+ cssClassNames = _ref.cssClassNames,
22
+ ContentComponent = _ref.ContentComponent,
23
+ LabelComponent = _ref.LabelComponent,
24
+ disabled = _ref.disabled,
25
+ rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
26
+ var treeApi = tree_hook.useTree();
27
+ var node = tree_node_hook.useTreeNode(id, rest);
28
+ var nodeChildrenRef = React.useRef(null);
29
+ var childrenCount = React.Children.count(children);
30
+ if (!node) return null;
31
+ var toggleNode = function toggleNode() {
32
+ treeApi.toggleNode(node.id);
33
+ };
34
+ var Label = LabelComponent ? (/*#__PURE__*/React__default['default'].createElement("div", {
35
+ className: "aurora-w-full aurora-px-2 aurora-rounded-4 hover:aurora-bg-hover"
36
+ }, LabelComponent === null || LabelComponent === void 0 ? void 0 : LabelComponent({
37
+ node: node,
38
+ isLeaf: !children
39
+ }))) : (/*#__PURE__*/React__default['default'].createElement("div", {
40
+ tabIndex: !children ? 0 : -1,
41
+ className: "aurora-w-full aurora-px-2 aurora-rounded-4 hover:aurora-bg-hover"
42
+ }, node.label ? node.label : node.id));
43
+ var Content = ContentComponent ? ContentComponent === null || ContentComponent === void 0 ? void 0 : ContentComponent({
44
+ node: node,
45
+ toggleNode: toggleNode,
46
+ isLeaf: !childrenCount
47
+ }) : (/*#__PURE__*/React__default['default'].createElement("div", {
48
+ className: "aurora-flex aurora-items-center aurora-rounded-4 hover:aurora-bg-hover"
49
+ }, /*#__PURE__*/React__default['default'].createElement("button", {
50
+ className: "aurora-flex aurora-items-center aurora-p-1 aurora-cursor-pointer",
51
+ onClick: toggleNode
52
+ }, /*#__PURE__*/React__default['default'].createElement("span", {
53
+ className: "aurora-flex"
54
+ }, /*#__PURE__*/React__default['default'].createElement(arrow_down_s_fill.ArrowDownSFillIcon, {
55
+ className: cn.cn('aurora-h-4 aurora-w-4 aurora-text-inverse-subtle-light -aurora-rotate-90 tree-arrow-transition', {
56
+ 'aurora-rotate-0': node.expanded,
57
+ 'aurora-fill-disabled': disabled
58
+ })
59
+ }))), Label));
60
+ return /*#__PURE__*/React__default['default'].createElement("li", {
61
+ role: "treeitem",
62
+ "aria-expanded": node.expanded
63
+ }, childrenCount ? Content : Label, childrenCount ? (/*#__PURE__*/React__default['default'].createElement(reactTransitionGroup.CSSTransition, {
64
+ unmountOnExit: true,
65
+ in: node.expanded,
66
+ timeout: 50,
67
+ classNames: {
68
+ enter: 'tree__children-enter',
69
+ enterActive: 'tree__children-enter-active',
70
+ exit: 'tree__children-exit',
71
+ exitActive: 'tree__children-exit-active'
72
+ }
73
+ }, /*#__PURE__*/React__default['default'].createElement("ul", {
74
+ className: "aurora-flex aurora-flex-col aurora-gap-2 aurora-mt-2 aurora-pl-4 aurora-scale-100 aurora-origin-top aurora-list-none aurora-will-change-auto tree__children-transition",
75
+ ref: nodeChildrenRef
76
+ }, children))) : null);
77
+ };
78
+
79
+ exports.TreeNode = TreeNode;
80
+ exports.default = TreeNode;
81
+ //# sourceMappingURL=tree_node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var tree_context = require('../context/tree_context.js');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
11
+
12
+ var useTree = function useTree() {
13
+ var context = React__default['default'].useContext(tree_context.TreeContext);
14
+ if (!context) {
15
+ throw new Error('useTree must be used within a TreeContextProvider');
16
+ }
17
+ return context;
18
+ };
19
+
20
+ exports.useTree = useTree;
21
+ //# sourceMappingURL=tree_hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
7
+ var tree_hook = require('./tree_hook.js');
8
+
9
+ var useTreeNode = function useTreeNode(nodeId, props) {
10
+ var treeApi = tree_hook.useTree();
11
+ React.useEffect(function () {
12
+ if (!treeApi.hasNode(nodeId)) treeApi.addNode(_rollupPluginBabelHelpers.objectSpread2({
13
+ id: nodeId
14
+ }, props));
15
+ });
16
+ React.useEffect(function () {
17
+ if (treeApi.hasNode(nodeId) && props) treeApi.updateNode(nodeId, props);
18
+ }, [props === null || props === void 0 ? void 0 : props.expanded]);
19
+ React.useEffect(function () {
20
+ return function () {
21
+ return treeApi.removeNode(nodeId);
22
+ };
23
+ }, []);
24
+ return treeApi.getNode(nodeId);
25
+ };
26
+
27
+ exports.useTreeNode = useTreeNode;
28
+ //# sourceMappingURL=tree_node_hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var accordion_constants = require('./components/accordion/accordion_constants.js');
5
6
  var css_background_tokens = require('./constants/css_tokens/css_background_tokens.js');
6
7
  var css_border_color_tokens = require('./constants/css_tokens/css_border_color_tokens.js');
7
8
  var css_border_radius_tokens = require('./constants/css_tokens/css_border_radius_tokens.js');
@@ -17,8 +18,6 @@ var css_border_style_tokens = require('./constants/css_tokens/css_border_style_t
17
18
  var css_position_tokens = require('./constants/css_tokens/css_position_tokens.js');
18
19
  var css_border_width_tokens = require('./constants/css_tokens/css_border_width_tokens.js');
19
20
  var css_icon_color_tokens = require('./constants/css_tokens/css_icon_color_tokens.js');
20
- var index = require('./components/tree/index.js');
21
- var accordion_constants = require('./components/accordion/accordion_constants.js');
22
21
  var accordion = require('./components/accordion/accordion.js');
23
22
  var accordion_content = require('./components/accordion/components/accordion_content.js');
24
23
  var accordion_item = require('./components/accordion/components/accordion_item.js');
@@ -109,9 +108,13 @@ var xhr_image_picker_control = require('./components/controls/xhr_image_picker_c
109
108
  var values_syncer = require('./components/values_syncer/values_syncer.js');
110
109
  var values_syncer_control = require('./components/controls/values_syncer_control/values_syncer_control.js');
111
110
  var use_toggle = require('./hooks/use_toggle.js');
111
+ var index = require('./components/tree/index.js');
112
+ var tree_hook = require('./components/tree/hooks/tree_hook.js');
113
+ var tree_node = require('./components/tree/components/tree_node.js');
112
114
 
113
115
 
114
116
 
117
+ exports.ACCORDION_SIZES = accordion_constants.ACCORDION_SIZES;
115
118
  exports.CSS_BACKGROUND_TOKENS = css_background_tokens.CSS_BACKGROUND_TOKENS;
116
119
  exports.CSS_BORDER_COLOR_TOKENS = css_border_color_tokens.CSS_BORDER_COLOR_TOKENS;
117
120
  exports.CSS_BORDER_RADIUS_SIDE_TOKENS = css_border_radius_tokens.CSS_BORDER_RADIUS_SIDE_TOKENS;
@@ -129,8 +132,6 @@ exports.CSS_POSITION_TOKENS = css_position_tokens.CSS_POSITION_TOKENS;
129
132
  exports.CSS_BORDER_WIDTH_SIDE_TOKENS = css_border_width_tokens.CSS_BORDER_WIDTH_SIDE_TOKENS;
130
133
  exports.CSS_BORDER_WIDTH_TOKENS = css_border_width_tokens.CSS_BORDER_WIDTH_TOKENS;
131
134
  exports.CSS_ICON_COLOR_TOKENS_VALUES = css_icon_color_tokens.CSS_ICON_COLOR_TOKENS_VALUES;
132
- exports.Tree = index.Tree;
133
- exports.ACCORDION_SIZES = accordion_constants.ACCORDION_SIZES;
134
135
  exports.Accordion = accordion.Accordion;
135
136
  exports.AccordionContent = accordion_content.AccordionContent;
136
137
  exports.AccordionItem = accordion_item.AccordionItem;
@@ -237,4 +238,7 @@ exports.XhrImagePickerControl = xhr_image_picker_control.XhrImagePickerControl;
237
238
  exports.ValuesSyncer = values_syncer.ValuesSyncer;
238
239
  exports.ValuesSyncerControl = values_syncer_control.ValuesSyncerControl;
239
240
  exports.useToggle = use_toggle.useToggle;
241
+ exports.Tree = index.Tree;
242
+ exports.useTree = tree_hook.useTree;
243
+ exports.TreeNode = tree_node.TreeNode;
240
244
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;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;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;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;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;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;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;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;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;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;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;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;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;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;AACA;AACA;AACA;AACA;"}
@@ -1,7 +1,7 @@
1
1
  import { forwardRef, createElement } from 'react';
2
2
  import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
- import { cn } from '../../../utilities/cn.js';
4
3
  import { Item } from '@radix-ui/react-accordion';
4
+ import { cn } from '../../../utilities/cn.js';
5
5
 
6
6
  var _excluded = ["className", "borderStyle"];
7
7
  var AccordionItem = /*#__PURE__*/forwardRef(function (_ref, ref) {
@@ -1,10 +1,10 @@
1
1
  import { forwardRef, useContext, createElement } from 'react';
2
2
  import { objectWithoutProperties as _objectWithoutProperties, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
- import { CSS_ICON_COLOR_TOKENS_VALUES } from '../../../constants/css_tokens/css_icon_color_tokens.js';
4
- import { cn } from '../../../utilities/cn.js';
5
3
  import { Header, Trigger } from '@radix-ui/react-accordion';
6
4
  import { ACCORDION_SIZES } from '../accordion_constants.js';
5
+ import { CSS_ICON_COLOR_TOKENS_VALUES } from '../../../constants/css_tokens/css_icon_color_tokens.js';
7
6
  import { AccordionContext } from '../context/accordion_context.js';
7
+ import { cn } from '../../../utilities/cn.js';
8
8
  import { ArrowRightIcon } from '../../../assets/icons/arrow_right.js';
9
9
 
10
10
  var _excluded = ["className", "children", "backgroundColor", "icon", "iconColor"];
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
- import { ArrowDownSFillIcon } from '../../../assets/icons/arrow_down_s_fill.js';
4
3
  import { cn } from '../../../utilities/cn.js';
5
4
  import { Trigger, Icon } from '@radix-ui/react-select';
5
+ import { ArrowDownSFillIcon } from '../../../assets/icons/arrow_down_s_fill.js';
6
6
 
7
7
  var _excluded = ["className", "hasError", "children"];
8
8
  var SelectTrigger = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
@@ -1,39 +1,73 @@
1
- import React, { Children, useRef } from 'react';
2
- import { ArrowDownSFillIcon } from '@auroraAssets/icons/arrow_down_s_fill';
1
+ import React, { useRef, Children } from 'react';
2
+ import { objectWithoutProperties as _objectWithoutProperties } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { cn } from '../../../utilities/cn.js';
4
+ import { ArrowDownSFillIcon } from '../../../assets/icons/arrow_down_s_fill.js';
3
5
  import { CSSTransition } from 'react-transition-group';
4
- import '@auroraComponents/tree/context/tree_context';
5
- import '@auroraTypings/general';
6
- import { cn } from '@auroraUtilities/cn';
7
- import { useTree } from '@auroraComponents/tree/hooks/tree_hook';
8
- import { useTreeNode } from '@auroraComponents/tree/hooks/tree_node_hook';
9
- export const TreeNode = ({ children, id, cssClassNames, ContentComponent, LabelComponent, disabled, ...rest }) => {
10
- const treeApi = useTree();
11
- const node = useTreeNode(id, rest);
12
- const nodeChildrenRef = useRef(null);
13
- const childrenCount = Children.count(children);
14
- if (!node)
15
- return null;
16
- const toggleNode = () => {
17
- treeApi.toggleNode(node.id);
18
- };
19
- const Label = LabelComponent ? (LabelComponent?.({ node, isLeaf: !children })) : (React.createElement("div", { tabIndex: !children ? 0 : -1, className: "aurora-w-full aurora-px-2 aurora-rounded-4 hover:aurora-bg-hover" }, node.label ? node.label : node.id));
20
- const Content = ContentComponent ? (ContentComponent?.({ node, toggleNode, isLeaf: !childrenCount })) : (React.createElement("div", { className: "aurora-flex aurora-items-center aurora-rounded-4 hover:aurora-bg-hover" },
21
- React.createElement("button", { className: "aurora-flex aurora-items-center aurora-p-1 aurora-cursor-pointer", onClick: toggleNode },
22
- React.createElement("span", { className: "aurora-flex" },
23
- React.createElement(ArrowDownSFillIcon, { className: cn('aurora-h-4 aurora-w-4 aurora-text-inverse-subtle-light -aurora-rotate-90 tree-arrow-transition', {
24
- 'aurora-rotate-0': node.expanded,
25
- 'aurora-fill-disabled': disabled
26
- }) }))),
27
- Label));
28
- return (React.createElement("li", { role: "treeitem", "aria-expanded": node.expanded },
29
- childrenCount ? Content : Label,
30
- childrenCount ? (React.createElement(CSSTransition, { unmountOnExit: true, in: node.expanded, timeout: 50, classNames: {
31
- enter: 'tree__children-enter',
32
- enterActive: 'tree__children-enter-active',
33
- exit: 'tree__children-exit',
34
- exitActive: 'tree__children-exit-active'
35
- } },
36
- React.createElement("ul", { className: "aurora-flex aurora-flex-col aurora-gap-2 aurora-mt-2 aurora-pl-4 aurora-scale-100 aurora-origin-top aurora-list-none aurora-will-change-auto tree__children-transition", ref: nodeChildrenRef }, children))) : null));
6
+ import { useTree } from '../hooks/tree_hook.js';
7
+ import { useTreeNode } from '../hooks/tree_node_hook.js';
8
+
9
+ var _excluded = ["children", "id", "cssClassNames", "ContentComponent", "LabelComponent", "disabled"];
10
+ var TreeNode = function TreeNode(_ref) {
11
+ var children = _ref.children,
12
+ id = _ref.id,
13
+ cssClassNames = _ref.cssClassNames,
14
+ ContentComponent = _ref.ContentComponent,
15
+ LabelComponent = _ref.LabelComponent,
16
+ disabled = _ref.disabled,
17
+ rest = _objectWithoutProperties(_ref, _excluded);
18
+ var treeApi = useTree();
19
+ var node = useTreeNode(id, rest);
20
+ var nodeChildrenRef = useRef(null);
21
+ var childrenCount = Children.count(children);
22
+ if (!node) return null;
23
+ var toggleNode = function toggleNode() {
24
+ treeApi.toggleNode(node.id);
25
+ };
26
+ var Label = LabelComponent ? (/*#__PURE__*/React.createElement("div", {
27
+ className: "aurora-w-full aurora-px-2 aurora-rounded-4 hover:aurora-bg-hover"
28
+ }, LabelComponent === null || LabelComponent === void 0 ? void 0 : LabelComponent({
29
+ node: node,
30
+ isLeaf: !children
31
+ }))) : (/*#__PURE__*/React.createElement("div", {
32
+ tabIndex: !children ? 0 : -1,
33
+ className: "aurora-w-full aurora-px-2 aurora-rounded-4 hover:aurora-bg-hover"
34
+ }, node.label ? node.label : node.id));
35
+ var Content = ContentComponent ? ContentComponent === null || ContentComponent === void 0 ? void 0 : ContentComponent({
36
+ node: node,
37
+ toggleNode: toggleNode,
38
+ isLeaf: !childrenCount
39
+ }) : (/*#__PURE__*/React.createElement("div", {
40
+ className: "aurora-flex aurora-items-center aurora-rounded-4 hover:aurora-bg-hover"
41
+ }, /*#__PURE__*/React.createElement("button", {
42
+ className: "aurora-flex aurora-items-center aurora-p-1 aurora-cursor-pointer",
43
+ onClick: toggleNode
44
+ }, /*#__PURE__*/React.createElement("span", {
45
+ className: "aurora-flex"
46
+ }, /*#__PURE__*/React.createElement(ArrowDownSFillIcon, {
47
+ className: cn('aurora-h-4 aurora-w-4 aurora-text-inverse-subtle-light -aurora-rotate-90 tree-arrow-transition', {
48
+ 'aurora-rotate-0': node.expanded,
49
+ 'aurora-fill-disabled': disabled
50
+ })
51
+ }))), Label));
52
+ return /*#__PURE__*/React.createElement("li", {
53
+ role: "treeitem",
54
+ "aria-expanded": node.expanded
55
+ }, childrenCount ? Content : Label, childrenCount ? (/*#__PURE__*/React.createElement(CSSTransition, {
56
+ unmountOnExit: true,
57
+ in: node.expanded,
58
+ timeout: 50,
59
+ classNames: {
60
+ enter: 'tree__children-enter',
61
+ enterActive: 'tree__children-enter-active',
62
+ exit: 'tree__children-exit',
63
+ exitActive: 'tree__children-exit-active'
64
+ }
65
+ }, /*#__PURE__*/React.createElement("ul", {
66
+ className: "aurora-flex aurora-flex-col aurora-gap-2 aurora-mt-2 aurora-pl-4 aurora-scale-100 aurora-origin-top aurora-list-none aurora-will-change-auto tree__children-transition",
67
+ ref: nodeChildrenRef
68
+ }, children))) : null);
37
69
  };
70
+
38
71
  export default TreeNode;
39
- //# sourceMappingURL=tree_node.js.map
72
+ export { TreeNode };
73
+ //# sourceMappingURL=tree_node.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree_node.js","sourceRoot":"","sources":["../../../../../../../../src/components/tree/components/tree_node.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,E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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,10 +1,13 @@
1
1
  import React from 'react';
2
- import { TreeContext } from '@auroraComponents/tree/context/tree_context';
3
- export const useTree = () => {
4
- const context = React.useContext(TreeContext);
5
- if (!context) {
6
- throw new Error('useTree must be used within a TreeContextProvider');
7
- }
8
- return context;
2
+ import { TreeContext } from '../context/tree_context.js';
3
+
4
+ var useTree = function useTree() {
5
+ var context = React.useContext(TreeContext);
6
+ if (!context) {
7
+ throw new Error('useTree must be used within a TreeContextProvider');
8
+ }
9
+ return context;
9
10
  };
10
- //# sourceMappingURL=tree_hook.js.map
11
+
12
+ export { useTree };
13
+ //# sourceMappingURL=tree_hook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree_hook.js","sourceRoot":"","sources":["../../../../../../../../src/components/tree/hooks/tree_hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAE1E,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IACxB,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAE9C,IAAI,CAAC,OAAO,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;KACxE;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,19 +1,24 @@
1
- import { useTree } from '@auroraComponents/tree/hooks/tree_hook';
2
1
  import { useEffect } from 'react';
3
- import '@auroraComponents/tree/context/tree_context';
4
- export const useTreeNode = (nodeId, props) => {
5
- const treeApi = useTree();
6
- useEffect(() => {
7
- if (!treeApi.hasNode(nodeId))
8
- treeApi.addNode({ id: nodeId, ...props });
9
- });
10
- useEffect(() => {
11
- if (treeApi.hasNode(nodeId) && props)
12
- treeApi.updateNode(nodeId, props);
13
- }, [props?.expanded]);
14
- useEffect(() => {
15
- return () => treeApi.removeNode(nodeId);
16
- }, []);
17
- return treeApi.getNode(nodeId);
2
+ import { objectSpread2 as _objectSpread2 } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { useTree } from './tree_hook.js';
4
+
5
+ var useTreeNode = function useTreeNode(nodeId, props) {
6
+ var treeApi = useTree();
7
+ useEffect(function () {
8
+ if (!treeApi.hasNode(nodeId)) treeApi.addNode(_objectSpread2({
9
+ id: nodeId
10
+ }, props));
11
+ });
12
+ useEffect(function () {
13
+ if (treeApi.hasNode(nodeId) && props) treeApi.updateNode(nodeId, props);
14
+ }, [props === null || props === void 0 ? void 0 : props.expanded]);
15
+ useEffect(function () {
16
+ return function () {
17
+ return treeApi.removeNode(nodeId);
18
+ };
19
+ }, []);
20
+ return treeApi.getNode(nodeId);
18
21
  };
19
- //# sourceMappingURL=tree_node_hook.js.map
22
+
23
+ export { useTreeNode };
24
+ //# sourceMappingURL=tree_node_hook.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree_node_hook.js","sourceRoot":"","sources":["../../../../../../../../src/components/tree/hooks/tree_node_hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAA0B,6CAA6C,CAAC;AAExE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAA0B,EAAE,EAAE;IACtE,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;IAE1B,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK;YAAE,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtB,SAAS,CAAC,GAAG,EAAE;QACX,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC,CAAC"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,5 +1,4 @@
1
1
  import './i18n';
2
- export { Tree } from "./components/tree";
3
2
  export * from './i18n';
4
3
  export { Accordion } from "./components/accordion/accordion";
5
4
  export { AccordionContent } from "./components/accordion/components/accordion_content";
@@ -111,3 +110,6 @@ export { ValuesSyncerControl } from "./components/controls/values_syncer_control
111
110
  export { ValuesSyncer } from "./components/values_syncer/values_syncer";
112
111
  export { useToggle } from "./hooks/use_toggle";
113
112
  export { useClickOutside } from "./hooks/use_click_outside";
113
+ export { Tree } from "./components/tree";
114
+ export { TreeNode } from "./components/tree/components/tree_node";
115
+ export { useTree } from "./components/tree/hooks/tree_hook";
@@ -1,3 +1,4 @@
1
+ export { ACCORDION_SIZES } from './components/accordion/accordion_constants.js';
1
2
  export { CSS_BACKGROUND_TOKENS } from './constants/css_tokens/css_background_tokens.js';
2
3
  export { CSS_BORDER_COLOR_TOKENS } from './constants/css_tokens/css_border_color_tokens.js';
3
4
  export { CSS_BORDER_RADIUS_SIDE_TOKENS, CSS_BORDER_RADIUS_TOKENS } from './constants/css_tokens/css_border_radius_tokens.js';
@@ -13,8 +14,6 @@ export { CSS_BORDER_STYLE_TOKENS } from './constants/css_tokens/css_border_style
13
14
  export { CSS_POSITION_TOKENS } from './constants/css_tokens/css_position_tokens.js';
14
15
  export { CSS_BORDER_WIDTH_SIDE_TOKENS, CSS_BORDER_WIDTH_TOKENS } from './constants/css_tokens/css_border_width_tokens.js';
15
16
  export { CSS_ICON_COLOR_TOKENS_VALUES } from './constants/css_tokens/css_icon_color_tokens.js';
16
- export { Tree } from './components/tree/index.js';
17
- export { ACCORDION_SIZES } from './components/accordion/accordion_constants.js';
18
17
  export { Accordion } from './components/accordion/accordion.js';
19
18
  export { AccordionContent } from './components/accordion/components/accordion_content.js';
20
19
  export { AccordionItem } from './components/accordion/components/accordion_item.js';
@@ -105,4 +104,7 @@ export { XhrImagePickerControl } from './components/controls/xhr_image_picker_co
105
104
  export { ValuesSyncer } from './components/values_syncer/values_syncer.js';
106
105
  export { ValuesSyncerControl } from './components/controls/values_syncer_control/values_syncer_control.js';
107
106
  export { useToggle } from './hooks/use_toggle.js';
107
+ export { Tree } from './components/tree/index.js';
108
+ export { useTree } from './components/tree/hooks/tree_hook.js';
109
+ export { TreeNode } from './components/tree/components/tree_node.js';
108
110
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;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;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;AACA;AACA;AACA;AACA;"}
1
+ {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dreamcommerce/aurora",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "3.0.0-85",
5
+ "version": "3.0.0-87",
6
6
  "description": "aurora",
7
7
  "author": "zefirek",
8
8
  "license": "MIT",