@app-studio/web 0.9.7 → 0.9.8

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 (35) hide show
  1. package/dist/components/ChatInput/ChatInput/ChatInput.props.d.ts +24 -0
  2. package/dist/components/ChatInput/ChatInput/ChatInput.type.d.ts +1 -1
  3. package/dist/components/ChatInput/EditableInput.d.ts +24 -1
  4. package/dist/components/ChatInput/examples/EnhancedEditableInput.d.ts +2 -0
  5. package/dist/components/ChatInput/examples/MentionEditableInput.d.ts +2 -0
  6. package/dist/components/ContextMenu/ContextMenu/ContextMenu.style.d.ts +1 -5
  7. package/dist/components/DropdownMenu/DropdownMenu/DropdownMenu.type.d.ts +1 -0
  8. package/dist/components/Form/TagInput/TagInput/TagInput.props.d.ts +190 -0
  9. package/dist/components/Form/TagInput/TagInput/TagInput.state.d.ts +26 -0
  10. package/dist/components/Form/TagInput/TagInput/TagInput.type.d.ts +79 -0
  11. package/dist/components/Form/TagInput/TagInput/TagInput.view.d.ts +13 -0
  12. package/dist/components/Form/TagInput/TagInput/index.d.ts +4 -0
  13. package/dist/components/Form/TagInput/TagInput.d.ts +3 -0
  14. package/dist/components/Form/TagInput/examples/Default.d.ts +25 -0
  15. package/dist/components/Form/TagInput/examples/index.d.ts +1 -0
  16. package/dist/components/Form/TagInput/index.d.ts +2 -0
  17. package/dist/components/Formik/Formik.TagInput.d.ts +7 -0
  18. package/dist/components/Formik/examples/FormikTagInput.d.ts +9 -0
  19. package/dist/components/Formik/examples/index.d.ts +1 -0
  20. package/dist/components/Input/FieldContainer/FieldContainer.d.ts +1 -1
  21. package/dist/components/Menubar/Menubar/Menubar.type.d.ts +1 -0
  22. package/dist/components/index.d.ts +1 -0
  23. package/dist/pages/positioning-test.page.d.ts +3 -0
  24. package/dist/pages/tags.page.d.ts +3 -0
  25. package/dist/web.cjs.development.js +1655 -600
  26. package/dist/web.cjs.development.js.map +1 -1
  27. package/dist/web.cjs.production.min.js +1 -1
  28. package/dist/web.cjs.production.min.js.map +1 -1
  29. package/dist/web.esm.js +1657 -603
  30. package/dist/web.esm.js.map +1 -1
  31. package/dist/web.umd.development.js +1544 -489
  32. package/dist/web.umd.development.js.map +1 -1
  33. package/dist/web.umd.production.min.js +1 -1
  34. package/dist/web.umd.production.min.js.map +1 -1
  35. package/package.json +2 -2
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.object.assign.js'), require('react'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('core-js/modules/es.regexp.to-string.js'), require('app-studio'), require('core-js/modules/es.symbol.description.js'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.string.trim-end.js'), require('core-js/modules/es.parse-int.js'), require('react-router-dom'), require('core-js/modules/es.string.ends-with.js'), require('contrast'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.number.to-fixed.js'), require('core-js/modules/es.string.starts-with.js'), require('date-fns/format'), require('core-js/modules/es.regexp.constructor.js'), require('core-js/modules/es.regexp.exec.js'), require('formik'), require('core-js/modules/web.url.js'), require('core-js/modules/web.url.to-json.js'), require('core-js/modules/web.url-search-params.js'), require('zustand'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.search.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.unscopables.flat-map.js'), require('core-js/modules/es.string.trim.js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.object.assign.js', 'react', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/web.dom-collections.iterator.js', 'core-js/modules/es.regexp.to-string.js', 'app-studio', 'core-js/modules/es.symbol.description.js', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.string.trim-end.js', 'core-js/modules/es.parse-int.js', 'react-router-dom', 'core-js/modules/es.string.ends-with.js', 'contrast', 'core-js/modules/es.promise.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.number.to-fixed.js', 'core-js/modules/es.string.starts-with.js', 'date-fns/format', 'core-js/modules/es.regexp.constructor.js', 'core-js/modules/es.regexp.exec.js', 'formik', 'core-js/modules/web.url.js', 'core-js/modules/web.url.to-json.js', 'core-js/modules/web.url-search-params.js', 'zustand', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.search.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.unscopables.flat-map.js', 'core-js/modules/es.string.trim.js'], factory) :
4
- (global = global || self, factory(global['@app-studio/web'] = {}, null, global.React, null, null, null, null, null, global.appStudio, null, null, null, null, global.reactRouterDom, null, global.contrast, null, null, null, null, global.format, null, null, global.formik, null, null, null, global.zustand));
5
- }(this, (function (exports, es_object_assign_js, React, es_array_includes_js, es_array_iterator_js, es_string_includes_js, web_domCollections_iterator_js, es_regexp_toString_js, appStudio, es_symbol_description_js, es_parseFloat_js, es_string_trimEnd_js, es_parseInt_js, reactRouterDom, es_string_endsWith_js, contrast, es_promise_js, es_array_reduce_js, es_number_toFixed_js, es_string_startsWith_js, format, es_regexp_constructor_js, es_regexp_exec_js, formik, web_url_js, web_url_toJson_js, web_urlSearchParams_js, zustand) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.object.assign.js'), require('react'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('core-js/modules/es.regexp.to-string.js'), require('app-studio'), require('core-js/modules/es.symbol.description.js'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.string.trim-end.js'), require('core-js/modules/es.parse-int.js'), require('react-router-dom'), require('core-js/modules/es.string.ends-with.js'), require('contrast'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.number.to-fixed.js'), require('core-js/modules/es.string.starts-with.js'), require('date-fns/format'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/es.regexp.constructor.js'), require('core-js/modules/es.regexp.exec.js'), require('formik'), require('core-js/modules/web.url.js'), require('core-js/modules/web.url.to-json.js'), require('core-js/modules/web.url-search-params.js'), require('zustand'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.search.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.unscopables.flat-map.js')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.object.assign.js', 'react', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/web.dom-collections.iterator.js', 'core-js/modules/es.regexp.to-string.js', 'app-studio', 'core-js/modules/es.symbol.description.js', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.string.trim-end.js', 'core-js/modules/es.parse-int.js', 'react-router-dom', 'core-js/modules/es.string.ends-with.js', 'contrast', 'core-js/modules/es.promise.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.number.to-fixed.js', 'core-js/modules/es.string.starts-with.js', 'date-fns/format', 'core-js/modules/es.string.trim.js', 'core-js/modules/es.regexp.constructor.js', 'core-js/modules/es.regexp.exec.js', 'formik', 'core-js/modules/web.url.js', 'core-js/modules/web.url.to-json.js', 'core-js/modules/web.url-search-params.js', 'zustand', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.search.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.unscopables.flat-map.js'], factory) :
4
+ (global = global || self, factory(global['@app-studio/web'] = {}, null, global.React, null, null, null, null, null, global.appStudio, null, null, null, null, global.reactRouterDom, null, global.contrast, null, null, null, null, global.format, null, null, null, global.formik, null, null, null, global.zustand));
5
+ }(this, (function (exports, es_object_assign_js, React, es_array_includes_js, es_array_iterator_js, es_string_includes_js, web_domCollections_iterator_js, es_regexp_toString_js, appStudio, es_symbol_description_js, es_parseFloat_js, es_string_trimEnd_js, es_parseInt_js, reactRouterDom, es_string_endsWith_js, contrast, es_promise_js, es_array_reduce_js, es_number_toFixed_js, es_string_startsWith_js, format, es_string_trim_js, es_regexp_constructor_js, es_regexp_exec_js, formik, web_url_js, web_url_toJson_js, web_urlSearchParams_js, zustand) { 'use strict';
6
6
 
7
7
  var React__default = 'default' in React ? React['default'] : React;
8
8
  contrast = contrast && Object.prototype.hasOwnProperty.call(contrast, 'default') ? contrast['default'] : contrast;
@@ -6386,60 +6386,8 @@
6386
6386
  cursor: 'not-allowed'
6387
6387
  }
6388
6388
  };
6389
- // Helper function to calculate position based on available space
6390
- var calculateMenuPosition = function calculateMenuPosition(x, y, menuWidth, menuHeight, windowWidth, windowHeight, side, align) {
6391
- if (side === void 0) {
6392
- side = 'right';
6393
- }
6394
- if (align === void 0) {
6395
- align = 'start';
6396
- }
6397
- var posX = x;
6398
- var posY = y;
6399
- // Adjust horizontal position based on side
6400
- if (side === 'left') {
6401
- posX = x - menuWidth;
6402
- } else if (side === 'right') {
6403
- posX = x;
6404
- } else if (side === 'top' || side === 'bottom') {
6405
- // Adjust horizontal position based on alignment for top/bottom
6406
- if (align === 'center') {
6407
- posX = x - menuWidth / 2;
6408
- } else if (align === 'end') {
6409
- posX = x - menuWidth;
6410
- }
6411
- }
6412
- // Adjust vertical position based on side
6413
- if (side === 'top') {
6414
- posY = y - menuHeight;
6415
- } else if (side === 'bottom') {
6416
- posY = y;
6417
- } else if (side === 'left' || side === 'right') {
6418
- // Adjust vertical position based on alignment for left/right
6419
- if (align === 'center') {
6420
- posY = y - menuHeight / 2;
6421
- } else if (align === 'end') {
6422
- posY = y - menuHeight;
6423
- }
6424
- }
6425
- // Ensure menu stays within window bounds
6426
- if (posX + menuWidth > windowWidth) {
6427
- posX = windowWidth - menuWidth;
6428
- }
6429
- if (posX < 0) {
6430
- posX = 0;
6431
- }
6432
- if (posY + menuHeight > windowHeight) {
6433
- posY = windowHeight - menuHeight;
6434
- }
6435
- if (posY < 0) {
6436
- posY = 0;
6437
- }
6438
- return {
6439
- x: posX,
6440
- y: posY
6441
- };
6442
- };
6389
+ // Note: Manual positioning logic has been replaced with intelligent positioning
6390
+ // using viewport-aware algorithms in the ContextMenu component
6443
6391
 
6444
6392
  var _excluded$f = ["children", "disableNativeContextMenu", "asChild", "isDisabled", "views"],
6445
6393
  _excluded2$6 = ["items", "children", "position", "side", "align", "views", "style"],
@@ -6560,28 +6508,72 @@
6560
6508
  variant
6561
6509
  } = useContextMenuContext();
6562
6510
  var menuRef = React.useRef(null);
6511
+ // Use contentRef if provided, otherwise use local menuRef
6512
+ var ref = contentRef || menuRef;
6513
+ // Use useElementPosition for intelligent positioning
6514
+ var {
6515
+ ref: positionRef,
6516
+ relation
6517
+ } = appStudio.useElementPosition({
6518
+ // trackChanges: true,
6519
+ // trackOnHover: false,
6520
+ // trackOnScroll: true,
6521
+ // trackOnResize: true,
6522
+ // throttleMs: 50,
6523
+ });
6563
6524
  var [menuPosition, setMenuPosition] = React.useState({
6564
6525
  x: 0,
6565
6526
  y: 0
6566
6527
  });
6567
- // Use contentRef if provided, otherwise use local menuRef
6568
- var ref = contentRef || menuRef;
6569
- // Calculate the position of the menu
6528
+ // Calculate the position of the menu using useElementPosition
6570
6529
  React.useEffect(() => {
6571
6530
  if (isOpen && ref.current) {
6531
+ var pos = position || contextPosition;
6572
6532
  var menuWidth = ref.current.offsetWidth;
6573
6533
  var menuHeight = ref.current.offsetHeight;
6574
- var windowWidth = window.innerWidth;
6575
- var windowHeight = window.innerHeight;
6576
- var pos = position || contextPosition;
6577
- var calculatedPosition = calculateMenuPosition(pos.x, pos.y, menuWidth, menuHeight, windowWidth, windowHeight, side, align);
6578
- setMenuPosition(calculatedPosition);
6534
+ // Get viewport dimensions for boundary checking
6535
+ var viewportWidth = window.innerWidth;
6536
+ var viewportHeight = window.innerHeight;
6537
+ // Calculate optimal position based on available space
6538
+ var finalX = pos.x;
6539
+ var finalY = pos.y;
6540
+ // Use relation data if available for smarter positioning
6541
+ if (relation) {
6542
+ // Position based on where there's more space
6543
+ if (relation.space.horizontal === 'left') {
6544
+ finalX = pos.x - menuWidth;
6545
+ } else {
6546
+ finalX = pos.x;
6547
+ }
6548
+ if (relation.space.vertical === 'top') {
6549
+ finalY = pos.y - menuHeight;
6550
+ } else {
6551
+ finalY = pos.y;
6552
+ }
6553
+ }
6554
+ // Ensure the menu stays within viewport bounds
6555
+ if (finalX + menuWidth > viewportWidth) {
6556
+ finalX = viewportWidth - menuWidth - 8; // 8px margin
6557
+ }
6558
+ if (finalX < 8) {
6559
+ finalX = 8; // 8px margin
6560
+ }
6561
+ if (finalY + menuHeight > viewportHeight) {
6562
+ finalY = viewportHeight - menuHeight - 8; // 8px margin
6563
+ }
6564
+ if (finalY < 8) {
6565
+ finalY = 8; // 8px margin
6566
+ }
6567
+ setMenuPosition({
6568
+ x: finalX,
6569
+ y: finalY
6570
+ });
6579
6571
  }
6580
- }, [isOpen, contextPosition, position, side, align, ref]);
6572
+ }, [isOpen, contextPosition, position, side, align, ref, relation]);
6581
6573
  if (!isOpen) {
6582
6574
  return null;
6583
6575
  }
6584
- // Basic positioning - place top-left corner at calculated position
6576
+ // Intelligent positioning - place at calculated optimal position
6585
6577
  var positionStyles = {
6586
6578
  position: 'fixed',
6587
6579
  top: menuPosition.y + "px",
@@ -6634,7 +6626,6 @@
6634
6626
  var [isHovered, setIsHovered] = React.useState(false);
6635
6627
  var hasSubmenu = item.items && item.items.length > 0;
6636
6628
  var isSubmenuActive = activeSubmenuId === item.id;
6637
- var itemRef = React.useRef(null);
6638
6629
  var [submenuPosition, setSubmenuPosition] = React.useState({
6639
6630
  x: 0,
6640
6631
  y: 0
@@ -6659,16 +6650,40 @@
6659
6650
  if (closeMenu) closeMenu();
6660
6651
  }
6661
6652
  };
6662
- // Calculate the position of the submenu
6653
+ // Use useElementPosition for submenu positioning
6654
+ var {
6655
+ ref: itemRef,
6656
+ relation: submenuRelation
6657
+ } = appStudio.useElementPosition({
6658
+ // trackChanges: true,
6659
+ // trackOnHover: false,
6660
+ // trackOnScroll: true,
6661
+ // trackOnResize: true,
6662
+ // throttleMs: 50,
6663
+ });
6664
+ // Calculate the position of the submenu with intelligent positioning
6663
6665
  React.useEffect(() => {
6664
6666
  if (isSubmenuActive && itemRef.current) {
6665
6667
  var rect = itemRef.current.getBoundingClientRect();
6668
+ var viewportWidth = window.innerWidth;
6669
+ // Estimate submenu dimensions (will be refined when submenu renders)
6670
+ var estimatedSubmenuWidth = 200; // Default submenu width
6671
+ // Use relation data for smarter positioning if available
6672
+ var useLeftSide = false;
6673
+ if (submenuRelation) {
6674
+ useLeftSide = submenuRelation.space.horizontal === 'left';
6675
+ } else {
6676
+ // Fallback to manual calculation
6677
+ var rightSpace = viewportWidth - rect.right;
6678
+ var leftSpace = rect.left;
6679
+ useLeftSide = rightSpace < estimatedSubmenuWidth && leftSpace > rightSpace;
6680
+ }
6666
6681
  setSubmenuPosition({
6667
- x: rect.right,
6682
+ x: useLeftSide ? rect.left - estimatedSubmenuWidth : rect.right,
6668
6683
  y: rect.top
6669
6684
  });
6670
6685
  }
6671
- }, [isSubmenuActive]);
6686
+ }, [isSubmenuActive, item.items, submenuRelation]);
6672
6687
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
6673
6688
  ref: itemRef,
6674
6689
  role: "menuitem",
@@ -6962,7 +6977,7 @@
6962
6977
  };
6963
6978
 
6964
6979
  var _excluded$j = ["children", "helperText", "error", "views"];
6965
- var FieldContainer = _ref => {
6980
+ var FieldContainer = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
6966
6981
  var {
6967
6982
  children,
6968
6983
  helperText,
@@ -6970,9 +6985,8 @@
6970
6985
  views
6971
6986
  } = _ref,
6972
6987
  props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
6973
- return /*#__PURE__*/React__default.createElement(appStudio.Vertical
6974
- // Layout properties
6975
- , Object.assign({
6988
+ return /*#__PURE__*/React__default.createElement(appStudio.Vertical, Object.assign({
6989
+ ref: ref,
6976
6990
  // Layout properties
6977
6991
  gap: 8,
6978
6992
  position: "relative",
@@ -6988,7 +7002,8 @@
6988
7002
  color: "color.red.500",
6989
7003
  transition: "all 0.2s ease"
6990
7004
  }, views == null ? void 0 : views.error), error)));
6991
- };
7005
+ });
7006
+ FieldContainer.displayName = 'FieldContainer';
6992
7007
 
6993
7008
  /**
6994
7009
  * Input Styles
@@ -7579,6 +7594,47 @@
7579
7594
  highlightedIndex
7580
7595
  } = _ref7,
7581
7596
  props = _objectWithoutPropertiesLoose(_ref7, _excluded4$6);
7597
+ var {
7598
+ ref: triggerRef,
7599
+ relation,
7600
+ updateRelation
7601
+ } = appStudio.useElementPosition({
7602
+ trackChanges: true,
7603
+ throttleMs: 100
7604
+ });
7605
+ var dropdownRef = React.useRef(null);
7606
+ // Get optimal positioning style based on available space
7607
+ var getDropdownStyle = () => {
7608
+ if (!relation) {
7609
+ // Default positioning when relation is not available
7610
+ return {
7611
+ position: 'absolute',
7612
+ top: '100%',
7613
+ marginTop: '8px',
7614
+ left: 0,
7615
+ right: 0,
7616
+ zIndex: 10000
7617
+ };
7618
+ }
7619
+ var baseStyle = {
7620
+ position: 'absolute',
7621
+ left: 0,
7622
+ right: 0,
7623
+ zIndex: 10000
7624
+ };
7625
+ // Place dropdown where there's more space vertically
7626
+ if (relation.space.vertical === 'top') {
7627
+ return Object.assign({}, baseStyle, {
7628
+ bottom: '100%',
7629
+ marginBottom: '8px'
7630
+ });
7631
+ } else {
7632
+ return Object.assign({}, baseStyle, {
7633
+ top: '100%',
7634
+ marginTop: '8px'
7635
+ });
7636
+ }
7637
+ };
7582
7638
  // close when *any* other select opens
7583
7639
  React__default.useEffect(() => {
7584
7640
  var handleCloseAll = () => setHide(true);
@@ -7637,11 +7693,10 @@
7637
7693
  }
7638
7694
  };
7639
7695
  return /*#__PURE__*/React__default.createElement(FieldContainer, {
7640
- style: {
7641
- position: 'relative',
7642
- width: '100%',
7643
- display: 'inline-block'
7644
- },
7696
+ ref: triggerRef,
7697
+ position: "relative",
7698
+ width: "100%",
7699
+ display: "inline-block",
7645
7700
  id: id,
7646
7701
  role: "SelectBox",
7647
7702
  helperText: helperText,
@@ -7671,7 +7726,8 @@
7671
7726
  isFocused: isFocused,
7672
7727
  showLabel: showLabel,
7673
7728
  onMouseEnter: handleHover,
7674
- onMouseLeave: handleHover
7729
+ onMouseLeave: handleHover,
7730
+ position: "relative"
7675
7731
  }, /*#__PURE__*/React__default.createElement(FieldWrapper, null, showLabel && (/*#__PURE__*/React__default.createElement(FieldLabel, Object.assign({
7676
7732
  htmlFor: id,
7677
7733
  color: 'theme.primary',
@@ -7704,15 +7760,10 @@
7704
7760
  orientation: "up",
7705
7761
  widthHeight: IconSizes$2[size],
7706
7762
  style: views.icon
7707
- })))))), !hide && options.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.Element, {
7763
+ }))))), !hide && options.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.Element, {
7764
+ ref: dropdownRef,
7708
7765
  onClick: e => e.stopPropagation(),
7709
- style: {
7710
- position: 'absolute',
7711
- top: 'calc(100% + 4px)',
7712
- left: 0,
7713
- right: 0,
7714
- zIndex: 1000
7715
- }
7766
+ style: getDropdownStyle()
7716
7767
  }, /*#__PURE__*/React__default.createElement(DropDown, {
7717
7768
  size: size,
7718
7769
  views: Object.assign({}, views, {
@@ -7729,7 +7780,7 @@
7729
7780
  callback: handleCallback,
7730
7781
  highlightedIndex: highlightedIndex,
7731
7782
  setHighlightedIndex: setHighlightedIndex
7732
- }))));
7783
+ })))));
7733
7784
  };
7734
7785
 
7735
7786
  // Defines a functional component named 'SelectComponent', which is expected to receive 'SelectProps' as properties.
@@ -11154,6 +11205,45 @@
11154
11205
  // Collects all further props not destructured explicitly.
11155
11206
  } = _ref,
11156
11207
  props = _objectWithoutPropertiesLoose(_ref, _excluded$y);
11208
+ var {
11209
+ ref: triggerRef,
11210
+ relation
11211
+ } = appStudio.useElementPosition();
11212
+ var dropdownRef = React.useRef(null);
11213
+ // Get optimal positioning style based on available space
11214
+ var getDropdownStyle = () => {
11215
+ if (!relation) {
11216
+ // Default positioning when relation is not available
11217
+ return {
11218
+ position: 'absolute',
11219
+ top: '100%',
11220
+ marginTop: '8px',
11221
+ left: 0,
11222
+ right: 0,
11223
+ zIndex: 10000,
11224
+ maxHeight: '240px'
11225
+ };
11226
+ }
11227
+ var baseStyle = {
11228
+ position: 'absolute',
11229
+ left: 0,
11230
+ right: 0,
11231
+ zIndex: 10000,
11232
+ maxHeight: '240px'
11233
+ };
11234
+ // Place dropdown where there's more space vertically
11235
+ if (relation.space.vertical === 'top') {
11236
+ return Object.assign({}, baseStyle, {
11237
+ bottom: '100%',
11238
+ marginBottom: '8px'
11239
+ });
11240
+ } else {
11241
+ return Object.assign({}, baseStyle, {
11242
+ top: '100%',
11243
+ marginTop: '8px'
11244
+ });
11245
+ }
11246
+ };
11157
11247
  // Sets up an effect to handle clicking outside the dropdown to close it.
11158
11248
  React.useEffect(() => {
11159
11249
  var handleClickOutside = event => {
@@ -11196,6 +11286,7 @@
11196
11286
  }, label)), /*#__PURE__*/React__default.createElement(appStudio.View, {
11197
11287
  position: "relative"
11198
11288
  }, /*#__PURE__*/React__default.createElement(appStudio.Horizontal, Object.assign({
11289
+ ref: triggerRef,
11199
11290
  cursor: "pointer",
11200
11291
  backgroundColor: "color.white",
11201
11292
  boxShadow: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
@@ -11216,19 +11307,14 @@
11216
11307
  weight: "medium",
11217
11308
  flexGrow: 1,
11218
11309
  color: "color.gray.800"
11219
- }, views == null ? void 0 : views.label), selectedItem.label)), right, isDropdownVisible && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
11310
+ }, views == null ? void 0 : views.label), selectedItem.label)), right), isDropdownVisible && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
11311
+ ref: dropdownRef,
11220
11312
  id: "combobox-dropdown",
11221
- position: "absolute",
11222
11313
  backgroundColor: "color.white",
11223
- boxShadow: "rgba(0, 0 ,0 ,0.16) 0px 1px 4px",
11224
- width: "100%",
11314
+ boxShadow: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
11225
11315
  overflowY: "auto",
11226
- zIndex: 10000,
11227
- bottom: -8,
11228
- left: 0,
11229
- transform: "translateY(100%)",
11230
- marginTop: "4px",
11231
- borderRadius: "4px"
11316
+ borderRadius: "4px",
11317
+ style: getDropdownStyle()
11232
11318
  }, views == null ? void 0 : views.dropdown), searchEnabled && (/*#__PURE__*/React__default.createElement(TextFieldView, {
11233
11319
  id: props.id,
11234
11320
  name: props.name,
@@ -11262,7 +11348,7 @@
11262
11348
  onClick: () => handleSelect(item)
11263
11349
  }, views == null ? void 0 : views.item), /*#__PURE__*/React__default.createElement(Text, null, item.label), /*#__PURE__*/React__default.createElement(React__default.Fragment, null, item.icon && item.icon, item.value === selectedItem.value && showTick && !item.icon && /*#__PURE__*/React__default.createElement(TickIcon, {
11264
11350
  widthHeight: 20
11265
- }))))))))))));
11351
+ })))))))))));
11266
11352
  };
11267
11353
 
11268
11354
  var _excluded$z = ["id", "name", "items", "placeholder", "searchPlaceholder"];
@@ -11297,6 +11383,417 @@
11297
11383
  // Exports the ComboBoxComponent as ComboBox
11298
11384
  var ComboBox = ComboBoxComponent;
11299
11385
 
11386
+ /**
11387
+ * Custom hook for managing TagInput state
11388
+ */
11389
+ var useTagInputState = props => {
11390
+ var {
11391
+ tags: controlledTags,
11392
+ defaultTags = [],
11393
+ onTagsChange,
11394
+ onTagAdd,
11395
+ onTagRemove,
11396
+ maxTags,
11397
+ minTagLength = 1,
11398
+ maxTagLength = 50,
11399
+ allowDuplicates = false,
11400
+ separators = ['enter', 'comma'],
11401
+ isDisabled = false,
11402
+ isReadOnly = false
11403
+ } = props;
11404
+ // State for input value
11405
+ var [inputValue, setInputValue] = React.useState('');
11406
+ // State for tags (controlled vs uncontrolled)
11407
+ var [internalTags, setInternalTags] = React.useState(() => {
11408
+ var initialValue = controlledTags || defaultTags || [];
11409
+ return initialValue.map((tag, index) => ({
11410
+ id: "tag-" + index + "-" + Date.now(),
11411
+ value: tag
11412
+ }));
11413
+ });
11414
+ // State for focus and hover
11415
+ var [isFocused, setIsFocused] = React.useState(false);
11416
+ var [isHovered, setIsHovered] = React.useState(false);
11417
+ // Use controlled value if provided, otherwise use internal state
11418
+ var tags = controlledTags && Array.isArray(controlledTags) ? controlledTags.map((tag, index) => ({
11419
+ id: "tag-" + index + "-" + Date.now(),
11420
+ value: tag
11421
+ })) : internalTags;
11422
+ // Update internal tags when controlled value changes
11423
+ React.useEffect(() => {
11424
+ if (controlledTags && Array.isArray(controlledTags)) {
11425
+ setInternalTags(controlledTags.map((tag, index) => ({
11426
+ id: "tag-" + index + "-" + Date.now(),
11427
+ value: tag
11428
+ })));
11429
+ }
11430
+ }, [controlledTags]);
11431
+ /**
11432
+ * Validates a tag before adding
11433
+ */
11434
+ var validateTag = React.useCallback(tag => {
11435
+ var trimmed = tag.trim();
11436
+ // Check length constraints
11437
+ if (trimmed.length < minTagLength || trimmed.length > maxTagLength) {
11438
+ return false;
11439
+ }
11440
+ // Check for duplicates if not allowed
11441
+ if (!allowDuplicates) {
11442
+ var tagValues = tags.map(t => t.value.toLowerCase());
11443
+ if (tagValues.includes(trimmed.toLowerCase())) {
11444
+ return false;
11445
+ }
11446
+ }
11447
+ // Check maximum tags limit
11448
+ if (maxTags && tags.length >= maxTags) {
11449
+ return false;
11450
+ }
11451
+ return true;
11452
+ }, [tags, minTagLength, maxTagLength, allowDuplicates, maxTags]);
11453
+ /**
11454
+ * Adds a new tag
11455
+ */
11456
+ var addTag = React.useCallback(tag => {
11457
+ if (isDisabled || isReadOnly) return;
11458
+ var trimmed = tag.trim();
11459
+ if (!trimmed || !validateTag(trimmed)) return;
11460
+ var newTag = {
11461
+ id: "tag-" + Date.now() + "-" + Math.random(),
11462
+ value: trimmed
11463
+ };
11464
+ var newTags = [...tags, newTag];
11465
+ var tagValues = newTags.map(t => t.value);
11466
+ if (!controlledTags) {
11467
+ setInternalTags(newTags);
11468
+ }
11469
+ onTagsChange == null || onTagsChange(tagValues);
11470
+ onTagAdd == null || onTagAdd(trimmed);
11471
+ setInputValue('');
11472
+ }, [tags, validateTag, onTagsChange, onTagAdd, isDisabled, isReadOnly, controlledTags]);
11473
+ /**
11474
+ * Removes a tag by index
11475
+ */
11476
+ var removeTag = React.useCallback(index => {
11477
+ if (isDisabled || isReadOnly) return;
11478
+ var tagToRemove = tags[index];
11479
+ if (!tagToRemove) return;
11480
+ var newTags = tags.filter((_, i) => i !== index);
11481
+ var tagValues = newTags.map(t => t.value);
11482
+ if (!controlledTags) {
11483
+ setInternalTags(newTags);
11484
+ }
11485
+ onTagsChange == null || onTagsChange(tagValues);
11486
+ onTagRemove == null || onTagRemove(tagToRemove.value, index);
11487
+ }, [tags, onTagsChange, onTagRemove, isDisabled, isReadOnly, controlledTags]);
11488
+ /**
11489
+ * Handles input change
11490
+ */
11491
+ var handleInputChange = React.useCallback(event => {
11492
+ if (isDisabled || isReadOnly) return;
11493
+ var newValue = event.target.value;
11494
+ // Check for comma separator
11495
+ if (separators.includes('comma') && newValue.includes(',')) {
11496
+ var parts = newValue.split(',');
11497
+ var tagToAdd = parts[0];
11498
+ var remaining = parts.slice(1).join(',');
11499
+ if (tagToAdd.trim()) {
11500
+ addTag(tagToAdd);
11501
+ }
11502
+ setInputValue(remaining);
11503
+ return;
11504
+ }
11505
+ setInputValue(newValue);
11506
+ }, [addTag, separators, isDisabled, isReadOnly]);
11507
+ /**
11508
+ * Handles key down events
11509
+ */
11510
+ var handleKeyDown = React.useCallback(event => {
11511
+ if (isDisabled || isReadOnly) return;
11512
+ var {
11513
+ key
11514
+ } = event;
11515
+ // Handle Enter key
11516
+ if (separators.includes('enter') && key === 'Enter') {
11517
+ event.preventDefault();
11518
+ if (inputValue.trim()) {
11519
+ addTag(inputValue);
11520
+ }
11521
+ return;
11522
+ }
11523
+ // Handle Tab key
11524
+ if (separators.includes('tab') && key === 'Tab' && inputValue.trim()) {
11525
+ event.preventDefault();
11526
+ addTag(inputValue);
11527
+ return;
11528
+ }
11529
+ // Handle Space key
11530
+ if (separators.includes('space') && key === ' ' && inputValue.trim()) {
11531
+ event.preventDefault();
11532
+ addTag(inputValue);
11533
+ return;
11534
+ }
11535
+ // Handle Backspace to remove last tag
11536
+ if (key === 'Backspace' && !inputValue && tags.length > 0) {
11537
+ event.preventDefault();
11538
+ removeTag(tags.length - 1);
11539
+ return;
11540
+ }
11541
+ }, [addTag, removeTag, inputValue, tags, separators, isDisabled, isReadOnly]);
11542
+ /**
11543
+ * Handles input focus
11544
+ */
11545
+ var handleFocus = React.useCallback(() => {
11546
+ setIsFocused(true);
11547
+ props.onFocus == null || props.onFocus();
11548
+ }, [props.onFocus]);
11549
+ /**
11550
+ * Handles input blur
11551
+ */
11552
+ var handleBlur = React.useCallback(() => {
11553
+ setIsFocused(false);
11554
+ // Add current input value as tag on blur if it exists
11555
+ if (inputValue.trim()) {
11556
+ addTag(inputValue);
11557
+ }
11558
+ props.onBlur == null || props.onBlur();
11559
+ }, [addTag, inputValue, props.onBlur]);
11560
+ return {
11561
+ inputValue,
11562
+ setInputValue,
11563
+ tags,
11564
+ setTags: setInternalTags,
11565
+ isFocused,
11566
+ setIsFocused,
11567
+ isHovered,
11568
+ setIsHovered,
11569
+ addTag,
11570
+ removeTag,
11571
+ handleInputChange,
11572
+ handleKeyDown,
11573
+ handleFocus,
11574
+ handleBlur,
11575
+ validateTag
11576
+ };
11577
+ };
11578
+
11579
+ var _excluded$A = ["id", "name", "label", "placeholder", "helperText", "error", "inputValue", "tags", "left", "right", "shadow", "views", "size", "shape", "variant", "isDisabled", "isReadOnly", "isAutoFocus", "isRemovable", "isFocused", "isHovered", "maxTags", "handleInputChange", "handleKeyDown", "handleFocus", "handleBlur", "removeTag", "setIsHovered", "onClick"];
11580
+ /**
11581
+ * Individual tag chip component
11582
+ */
11583
+ var TagChip = _ref => {
11584
+ var {
11585
+ tag,
11586
+ onRemove,
11587
+ isRemovable,
11588
+ size,
11589
+ views,
11590
+ isDisabled,
11591
+ isReadOnly
11592
+ } = _ref;
11593
+ var {
11594
+ getColor
11595
+ } = appStudio.useTheme();
11596
+ var chipSize = {
11597
+ xs: {
11598
+ padding: '2px 6px',
11599
+ fontSize: '10px',
11600
+ iconSize: 10
11601
+ },
11602
+ sm: {
11603
+ padding: '4px 8px',
11604
+ fontSize: '12px',
11605
+ iconSize: 12
11606
+ },
11607
+ md: {
11608
+ padding: '6px 10px',
11609
+ fontSize: '14px',
11610
+ iconSize: 14
11611
+ },
11612
+ lg: {
11613
+ padding: '8px 12px',
11614
+ fontSize: '16px',
11615
+ iconSize: 16
11616
+ },
11617
+ xl: {
11618
+ padding: '10px 14px',
11619
+ fontSize: '18px',
11620
+ iconSize: 18
11621
+ }
11622
+ }[size] || {
11623
+ padding: '6px 10px',
11624
+ fontSize: '14px',
11625
+ iconSize: 14
11626
+ };
11627
+ return /*#__PURE__*/React__default.createElement(appStudio.Horizontal, Object.assign({
11628
+ alignItems: "center",
11629
+ gap: 4,
11630
+ padding: chipSize.padding,
11631
+ backgroundColor: "color.gray.100",
11632
+ borderRadius: "16px",
11633
+ border: "1px solid",
11634
+ borderColor: "color.gray.200",
11635
+ transition: "all 0.2s ease",
11636
+ opacity: isDisabled ? 0.6 : 1,
11637
+ _hover: !isDisabled && !isReadOnly ? {
11638
+ backgroundColor: 'color.gray.200',
11639
+ borderColor: 'color.gray.300'
11640
+ } : {}
11641
+ }, views == null ? void 0 : views.tag), /*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
11642
+ fontSize: chipSize.fontSize,
11643
+ color: isDisabled ? 'color.gray.400' : 'color.gray.700',
11644
+ fontWeight: "500",
11645
+ whiteSpace: "nowrap"
11646
+ }, views == null ? void 0 : views.tagText), tag), isRemovable && !isDisabled && !isReadOnly && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
11647
+ cursor: "pointer",
11648
+ padding: "2px",
11649
+ borderRadius: "50%",
11650
+ transition: "all 0.2s ease",
11651
+ _hover: {
11652
+ backgroundColor: 'color.gray.300'
11653
+ },
11654
+ onClick: onRemove
11655
+ }, views == null ? void 0 : views.tagRemove), /*#__PURE__*/React__default.createElement(CloseIcon, {
11656
+ widthHeight: chipSize.iconSize,
11657
+ color: "color.gray.500"
11658
+ }))));
11659
+ };
11660
+ /**
11661
+ * Main TagInput view component
11662
+ */
11663
+ var TagInputView = _ref2 => {
11664
+ var {
11665
+ id,
11666
+ name,
11667
+ label,
11668
+ placeholder = 'Type and press Enter to add tags...',
11669
+ helperText,
11670
+ error = false,
11671
+ inputValue = '',
11672
+ tags = [],
11673
+ left,
11674
+ right,
11675
+ shadow = {},
11676
+ views = {},
11677
+ size = 'md',
11678
+ shape = 'default',
11679
+ variant = 'default',
11680
+ isDisabled = false,
11681
+ isReadOnly = false,
11682
+ isAutoFocus = false,
11683
+ isRemovable = true,
11684
+ isFocused = false,
11685
+ isHovered = false,
11686
+ maxTags,
11687
+ handleInputChange,
11688
+ handleKeyDown,
11689
+ handleFocus,
11690
+ handleBlur,
11691
+ removeTag,
11692
+ setIsHovered,
11693
+ onClick
11694
+ } = _ref2,
11695
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$A);
11696
+ var {
11697
+ getColor,
11698
+ themeMode
11699
+ } = appStudio.useTheme();
11700
+ // Determine if we should show the label
11701
+ var showLabel = Boolean(label && (isFocused || tags.length > 0 || inputValue));
11702
+ // Calculate if max tags reached
11703
+ var isMaxReached = maxTags && tags.length >= maxTags;
11704
+ // Container styles
11705
+ var containerStyles = Object.assign({}, Shapes[shape], InputVariants[variant], views == null ? void 0 : views.inputContainer);
11706
+ // Input styles
11707
+ var inputStyles = Object.assign({
11708
+ border: 'none',
11709
+ outline: 'none',
11710
+ backgroundColor: 'transparent',
11711
+ fontSize: appStudio.Typography.fontSizes[size],
11712
+ color: isDisabled ? 'color.gray.400' : 'color.gray.900',
11713
+ flex: 1,
11714
+ minWidth: '120px'
11715
+ }, views == null ? void 0 : views.input);
11716
+ return /*#__PURE__*/React__default.createElement(FieldContainer, Object.assign({
11717
+ error: !!error,
11718
+ helperText: typeof error === 'string' ? error : helperText,
11719
+ views: views
11720
+ }, props), /*#__PURE__*/React__default.createElement(FieldContent, Object.assign({
11721
+ label: label,
11722
+ shadow: shadow,
11723
+ value: tags.length > 0 || inputValue ? 'has-content' : '',
11724
+ size: size,
11725
+ shape: shape,
11726
+ variant: variant,
11727
+ error: !!error,
11728
+ showLabel: showLabel,
11729
+ isFocused: isFocused,
11730
+ isHovered: isHovered,
11731
+ isDisabled: isDisabled,
11732
+ isReadOnly: isReadOnly,
11733
+ views: views,
11734
+ onClick: onClick,
11735
+ onMouseEnter: () => setIsHovered == null ? void 0 : setIsHovered(true),
11736
+ onMouseLeave: () => setIsHovered == null ? void 0 : setIsHovered(false)
11737
+ }, containerStyles), left, /*#__PURE__*/React__default.createElement(FieldWrapper, null, label && (/*#__PURE__*/React__default.createElement(FieldLabel, {
11738
+ size: size,
11739
+ error: !!error,
11740
+ views: views
11741
+ }, label)), /*#__PURE__*/React__default.createElement(appStudio.Horizontal, Object.assign({
11742
+ alignItems: "center",
11743
+ gap: 4,
11744
+ flexWrap: "wrap",
11745
+ width: "100%",
11746
+ minHeight: appStudio.Typography.fontSizes[size],
11747
+ padding: "8px 0"
11748
+ }, views == null ? void 0 : views.tagsContainer), tags.map((tag, index) => (/*#__PURE__*/React__default.createElement(TagChip, {
11749
+ key: tag.id,
11750
+ tag: tag.value,
11751
+ onRemove: () => removeTag == null ? void 0 : removeTag(index),
11752
+ isRemovable: isRemovable,
11753
+ size: size,
11754
+ views: views,
11755
+ isDisabled: isDisabled,
11756
+ isReadOnly: isReadOnly
11757
+ }))), !isMaxReached && (/*#__PURE__*/React__default.createElement(appStudio.Input, Object.assign({
11758
+ id: id,
11759
+ name: name,
11760
+ type: "text",
11761
+ value: inputValue,
11762
+ placeholder: tags.length === 0 ? placeholder : '',
11763
+ disabled: isDisabled,
11764
+ readOnly: isReadOnly,
11765
+ autoFocus: isAutoFocus,
11766
+ onChange: handleInputChange,
11767
+ onKeyDown: handleKeyDown,
11768
+ onFocus: handleFocus,
11769
+ onBlur: handleBlur,
11770
+ autoComplete: "off"
11771
+ }, inputStyles))), isMaxReached && (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
11772
+ fontSize: appStudio.Typography.fontSizes[size],
11773
+ color: "color.gray.500",
11774
+ fontStyle: "italic"
11775
+ }, views == null ? void 0 : views.placeholder), "Maximum ", maxTags, " tags reached")))), right));
11776
+ };
11777
+
11778
+ var _excluded$B = ["tags"];
11779
+ /**
11780
+ * TagInput Component
11781
+ *
11782
+ * A form input component for managing a list of tags.
11783
+ * Users can add tags by typing and pressing Enter or comma,
11784
+ * and remove them by clicking the X button or using backspace.
11785
+ */
11786
+ var TagInputComponent = props => {
11787
+ // Initialize state management with the custom hook
11788
+ var tagInputState = useTagInputState(props);
11789
+ // Separate the tags prop to avoid type conflicts
11790
+ var restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
11791
+ // Render the view component with combined props and state
11792
+ return /*#__PURE__*/React__default.createElement(TagInputView, Object.assign({}, tagInputState, restProps));
11793
+ };
11794
+ // Export the component
11795
+ var TagInput = TagInputComponent;
11796
+
11300
11797
  function syncTimeouts(cb) {
11301
11798
  var t1 = setTimeout(cb, 0); // For faster machines
11302
11799
  var t2 = setTimeout(cb, 10);
@@ -11603,7 +12100,7 @@
11603
12100
  };
11604
12101
  };
11605
12102
 
11606
- var _excluded$A = ["id", "name", "label", "value", "length", "onChange", "onChangeText", "onComplete", "helperText", "placeholder", "shadow", "views", "size", "shape", "variant", "gap", "type", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isAutoFocus", "setValue", "setIsFocused", "setIsHovered", "inputRef", "containerRef", "mirrorSelectionStart", "mirrorSelectionEnd", "setMirrorSelectionStart", "setMirrorSelectionEnd", "handlePaste", "handleChange", "handleFocus", "handleBlur", "handleKeyDown", "handleKeyPress", "secureTextEntry", "isFirstColumn", "stepValues", "setInputRef", "onBlur", "onClick", "onFocus"];
12103
+ var _excluded$C = ["id", "name", "label", "value", "length", "onChange", "onChangeText", "onComplete", "helperText", "placeholder", "shadow", "views", "size", "shape", "variant", "gap", "type", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isAutoFocus", "setValue", "setIsFocused", "setIsHovered", "inputRef", "containerRef", "mirrorSelectionStart", "mirrorSelectionEnd", "setMirrorSelectionStart", "setMirrorSelectionEnd", "handlePaste", "handleChange", "handleFocus", "handleBlur", "handleKeyDown", "handleKeyPress", "secureTextEntry", "isFirstColumn", "stepValues", "setInputRef", "onBlur", "onClick", "onFocus"];
11607
12104
  // Create a context for OTP input slots
11608
12105
  var OTPInputContext = /*#__PURE__*/React.createContext({
11609
12106
  slots: [],
@@ -11657,7 +12154,7 @@
11657
12154
  onFocus = () => {}
11658
12155
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11659
12156
  } = _ref,
11660
- props = _objectWithoutPropertiesLoose(_ref, _excluded$A);
12157
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$C);
11661
12158
  appStudio.useTheme(); // Initialize theme context
11662
12159
  var showLabel = !!label;
11663
12160
  // Create context value for slots
@@ -11889,7 +12386,7 @@
11889
12386
  };
11890
12387
  var OTPInput = OTPInputComponent;
11891
12388
 
11892
- var _excluded$B = ["children", "autoFocus", "initFocus", "onChange"];
12389
+ var _excluded$D = ["children", "autoFocus", "initFocus", "onChange"];
11893
12390
  var FocusContext = /*#__PURE__*/React.createContext({
11894
12391
  active: false,
11895
12392
  focusNextInput: () => {},
@@ -11905,7 +12402,7 @@
11905
12402
  initFocus,
11906
12403
  onChange = () => {}
11907
12404
  } = _ref,
11908
- props = _objectWithoutPropertiesLoose(_ref, _excluded$B);
12405
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$D);
11909
12406
  var formik$1 = formik.useFormikContext();
11910
12407
  React.useEffect(() => {
11911
12408
  onChange(formik$1.values);
@@ -11953,7 +12450,7 @@
11953
12450
  }, /*#__PURE__*/React__default.createElement(appStudio.Form, Object.assign({}, props), children));
11954
12451
  };
11955
12452
 
11956
- var _excluded$C = ["name", "type"];
12453
+ var _excluded$E = ["name", "type"];
11957
12454
  var getInputTypeProps = type => {
11958
12455
  switch (type) {
11959
12456
  case 'email':
@@ -11992,7 +12489,7 @@
11992
12489
  name,
11993
12490
  type
11994
12491
  } = _ref,
11995
- props = _objectWithoutPropertiesLoose(_ref, _excluded$C);
12492
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$E);
11996
12493
  var focus = useFormFocus();
11997
12494
  var {
11998
12495
  touched,
@@ -12036,13 +12533,13 @@
12036
12533
  } : {});
12037
12534
  };
12038
12535
 
12039
- var _excluded$D = ["value"];
12536
+ var _excluded$F = ["value"];
12040
12537
  var CheckboxComponent$1 = props => {
12041
12538
  var _useFormikInput = useFormikInput(props),
12042
12539
  {
12043
12540
  value
12044
12541
  } = _useFormikInput,
12045
- formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$D);
12542
+ formProps = _objectWithoutPropertiesLoose(_useFormikInput, _excluded$F);
12046
12543
  formProps.isChecked = value;
12047
12544
  var checkboxStates = useCheckboxState(props);
12048
12545
  return /*#__PURE__*/React__default.createElement(CheckboxView, Object.assign({}, checkboxStates, formProps));
@@ -12110,11 +12607,11 @@
12110
12607
  */
12111
12608
  var FormikTextArea = TextAreaComponent$1;
12112
12609
 
12113
- var _excluded$E = ["value"];
12610
+ var _excluded$G = ["value"];
12114
12611
  var TextFieldComponent$1 = props => {
12115
12612
  var formProps = useFormikInput(props);
12116
12613
  var _useTextFieldState = useTextFieldState(props),
12117
- textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$E);
12614
+ textFieldStates = _objectWithoutPropertiesLoose(_useTextFieldState, _excluded$G);
12118
12615
  return /*#__PURE__*/React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, formProps));
12119
12616
  };
12120
12617
  /**
@@ -12122,7 +12619,7 @@
12122
12619
  */
12123
12620
  var FormikTextField = TextFieldComponent$1;
12124
12621
 
12125
- var _excluded$F = ["visibleIcon", "hiddenIcon"],
12622
+ var _excluded$H = ["visibleIcon", "hiddenIcon"],
12126
12623
  _excluded2$b = ["isVisible", "setIsVisible"];
12127
12624
  var PasswordComponent$1 = _ref => {
12128
12625
  var {
@@ -12133,7 +12630,7 @@
12133
12630
  widthHeight: 14
12134
12631
  })
12135
12632
  } = _ref,
12136
- props = _objectWithoutPropertiesLoose(_ref, _excluded$F);
12633
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$H);
12137
12634
  var formProps = useFormikInput(props);
12138
12635
  var _usePasswordState = usePasswordState(formProps),
12139
12636
  {
@@ -12158,14 +12655,14 @@
12158
12655
  */
12159
12656
  var FormikPassword = PasswordComponent$1;
12160
12657
 
12161
- var _excluded$G = ["items", "placeholder", "searchPlaceholder"];
12658
+ var _excluded$I = ["items", "placeholder", "searchPlaceholder"];
12162
12659
  var ComboBoxComponent$1 = _ref => {
12163
12660
  var {
12164
12661
  items,
12165
12662
  placeholder,
12166
12663
  searchPlaceholder
12167
12664
  } = _ref,
12168
- props = _objectWithoutPropertiesLoose(_ref, _excluded$G);
12665
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$I);
12169
12666
  var formProps = useFormikInput(props);
12170
12667
  var ComboBoxStates = useComboBoxState(items, placeholder, searchPlaceholder);
12171
12668
  // Ensure the onChange function from formProps is being called when an item is selected
@@ -12446,7 +12943,7 @@
12446
12943
  }
12447
12944
  };
12448
12945
 
12449
- var _excluded$H = ["min", "max", "step", "currentValue", "stepValues", "shape", "size", "variant", "orientation", "isDisabled", "showValue", "showTooltip", "backgroundColor", "label", "helperText", "themeMode", "shadow", "isDragging", "isHovered", "setIsHovered", "trackRef", "thumbRef", "handleThumbMouseDown", "handleTrackMouseDown", "handleKeyDown", "thumbPositionPercent", "ariaLabel", "views"];
12946
+ var _excluded$J = ["min", "max", "step", "currentValue", "stepValues", "shape", "size", "variant", "orientation", "isDisabled", "showValue", "showTooltip", "backgroundColor", "label", "helperText", "themeMode", "shadow", "isDragging", "isHovered", "setIsHovered", "trackRef", "thumbRef", "handleThumbMouseDown", "handleTrackMouseDown", "handleKeyDown", "thumbPositionPercent", "ariaLabel", "views"];
12450
12947
  var SliderView = _ref => {
12451
12948
  var _views$tooltip, _views$tooltip2;
12452
12949
  var {
@@ -12489,7 +12986,7 @@
12489
12986
  tooltip: {}
12490
12987
  }
12491
12988
  } = _ref,
12492
- props = _objectWithoutPropertiesLoose(_ref, _excluded$H);
12989
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$J);
12493
12990
  var {
12494
12991
  getColor,
12495
12992
  themeMode
@@ -13402,7 +13899,7 @@
13402
13899
  }, views == null ? void 0 : views.view)));
13403
13900
  };
13404
13901
 
13405
- var _excluded$I = ["accept", "icon", "text", "maxSize", "onFileSelect", "onMultipleFileSelect", "validateFile", "isLoading", "progress", "fileType", "multiple"];
13902
+ var _excluded$K = ["accept", "icon", "text", "maxSize", "onFileSelect", "onMultipleFileSelect", "validateFile", "isLoading", "progress", "fileType", "multiple"];
13406
13903
  var Uploader = _ref => {
13407
13904
  var {
13408
13905
  accept = '*/*',
@@ -13417,7 +13914,7 @@
13417
13914
  fileType,
13418
13915
  multiple = false
13419
13916
  } = _ref,
13420
- props = _objectWithoutPropertiesLoose(_ref, _excluded$I);
13917
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$K);
13421
13918
  var {
13422
13919
  previewUrl,
13423
13920
  thumbnailUrl,
@@ -13613,7 +14110,7 @@
13613
14110
  }
13614
14111
  };
13615
14112
 
13616
- var _excluded$J = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position", "views"],
14113
+ var _excluded$L = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position", "views"],
13617
14114
  _excluded2$c = ["children", "shadow", "isFullScreen", "shape", "views", "isOpen"],
13618
14115
  _excluded3$8 = ["children", "buttonColor", "iconSize", "buttonPosition", "views"],
13619
14116
  _excluded4$7 = ["children", "views"],
@@ -13628,7 +14125,7 @@
13628
14125
  position = 'center',
13629
14126
  views
13630
14127
  } = _ref,
13631
- props = _objectWithoutPropertiesLoose(_ref, _excluded$J);
14128
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$L);
13632
14129
  var handleClick = () => {
13633
14130
  if (!isClosePrevented) onClose();
13634
14131
  };
@@ -13924,7 +14421,7 @@
13924
14421
  }
13925
14422
  };
13926
14423
 
13927
- var _excluded$K = ["href", "children", "views"];
14424
+ var _excluded$M = ["href", "children", "views"];
13928
14425
  // Create context for the NavigationMenu
13929
14426
  var NavigationMenuContext = /*#__PURE__*/React.createContext({
13930
14427
  activeItemId: null,
@@ -14155,7 +14652,7 @@
14155
14652
  children,
14156
14653
  views
14157
14654
  } = _ref6,
14158
- props = _objectWithoutPropertiesLoose(_ref6, _excluded$K);
14655
+ props = _objectWithoutPropertiesLoose(_ref6, _excluded$M);
14159
14656
  var {
14160
14657
  itemValue,
14161
14658
  isDisabled
@@ -14222,7 +14719,7 @@
14222
14719
  })))));
14223
14720
  };
14224
14721
 
14225
- var _excluded$L = ["items", "children", "orientation", "size", "variant", "defaultActiveItemId", "defaultExpandedItemIds", "onItemActivate", "views"];
14722
+ var _excluded$N = ["items", "children", "orientation", "size", "variant", "defaultActiveItemId", "defaultExpandedItemIds", "onItemActivate", "views"];
14226
14723
  /**
14227
14724
  * NavigationMenu component for creating navigation menus with optional nested items.
14228
14725
  * Supports both data-driven approach (with items prop) and compound component pattern.
@@ -14239,7 +14736,7 @@
14239
14736
  onItemActivate,
14240
14737
  views
14241
14738
  } = _ref,
14242
- props = _objectWithoutPropertiesLoose(_ref, _excluded$L);
14739
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$N);
14243
14740
  var {
14244
14741
  activeItemId,
14245
14742
  setActiveItemId,
@@ -14762,20 +15259,20 @@
14762
15259
  * Font sizes for different title sizes
14763
15260
  */
14764
15261
  var TitleSizes = {
14765
- xs: 16,
14766
- sm: 20,
14767
- md: 32,
14768
- lg: 48,
15262
+ xs: 24,
15263
+ sm: 36,
15264
+ md: 48,
15265
+ lg: 64,
14769
15266
  xl: 72
14770
15267
  };
14771
15268
  /**
14772
15269
  * Line heights for different title sizes
14773
15270
  */
14774
15271
  var LineHeights$1 = {
14775
- xs: 24,
14776
- sm: 28,
14777
- md: 40,
14778
- lg: 56,
15272
+ xs: 32,
15273
+ sm: 40,
15274
+ md: 56,
15275
+ lg: 72,
14779
15276
  xl: 80
14780
15277
  };
14781
15278
  /**
@@ -14815,7 +15312,7 @@
14815
15312
  })
14816
15313
  };
14817
15314
 
14818
- var _excluded$M = ["text", "typingSpeed", "pauseTime", "onComplete", "showCursor", "cursorColor", "textStyle", "as"];
15315
+ var _excluded$O = ["text", "typingSpeed", "pauseTime", "onComplete", "showCursor", "cursorColor", "textStyle", "as"];
14819
15316
  /**
14820
15317
  * A component that creates a typewriter effect for text
14821
15318
  */
@@ -14829,7 +15326,7 @@
14829
15326
  cursorColor = 'currentColor',
14830
15327
  textStyle
14831
15328
  } = _ref,
14832
- props = _objectWithoutPropertiesLoose(_ref, _excluded$M);
15329
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$O);
14833
15330
  // Convert text to array if it's a string
14834
15331
  var textArray = Array.isArray(text) ? text : [text];
14835
15332
  // State for the currently displayed text
@@ -14896,7 +15393,7 @@
14896
15393
  }))))));
14897
15394
  };
14898
15395
 
14899
- var _excluded$N = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "centered", "views", "highlightAnimate", "animate", "highlightTypewriter", "highlightTypewriterDuration"];
15396
+ var _excluded$P = ["children", "highlightText", "highlightStyle", "highlightColor", "highlightSecondaryColor", "size", "centered", "views", "highlightAnimate", "animate", "highlightTypewriter", "highlightTypewriterDuration"];
14900
15397
  function escapeRegExp(string) {
14901
15398
  return string.replace(/[.*+?^${}()|[\\]\\/g, '\\$&');
14902
15399
  }
@@ -14915,7 +15412,7 @@
14915
15412
  highlightTypewriter: propHighlightTypewriter = false,
14916
15413
  highlightTypewriterDuration = 3000
14917
15414
  } = _ref,
14918
- props = _objectWithoutPropertiesLoose(_ref, _excluded$N);
15415
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$P);
14919
15416
  var {
14920
15417
  ref,
14921
15418
  inView
@@ -15086,7 +15583,7 @@
15086
15583
  };
15087
15584
  };
15088
15585
 
15089
- var _excluded$O = ["children", "shape", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle", "views"];
15586
+ var _excluded$Q = ["children", "shape", "variant", "isHovered", "setIsHovered", "isDisabled", "isToggle", "setIsToggled", "onToggle", "views"];
15090
15587
  var ToggleView = _ref => {
15091
15588
  var {
15092
15589
  children,
@@ -15100,7 +15597,7 @@
15100
15597
  onToggle,
15101
15598
  views
15102
15599
  } = _ref,
15103
- props = _objectWithoutPropertiesLoose(_ref, _excluded$O);
15600
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$Q);
15104
15601
  var toggleColor = !isDisabled ? 'color.trueGray.400' : 'theme.disabled';
15105
15602
  var isActive = !!(isToggle || isHovered);
15106
15603
  var toggleVariants = {
@@ -15143,7 +15640,7 @@
15143
15640
  }, toggleVariants[variant], props, views == null ? void 0 : views.container), children);
15144
15641
  };
15145
15642
 
15146
- var _excluded$P = ["children", "shape", "variant", "isDisabled", "isToggled", "onToggle"];
15643
+ var _excluded$R = ["children", "shape", "variant", "isDisabled", "isToggled", "onToggle"];
15147
15644
  // Destructuring properties from ToggleProps to be used within the ToggleComponent.
15148
15645
  var ToggleComponent = _ref => {
15149
15646
  var {
@@ -15155,7 +15652,7 @@
15155
15652
  isToggled = false,
15156
15653
  onToggle
15157
15654
  } = _ref,
15158
- props = _objectWithoutPropertiesLoose(_ref, _excluded$P);
15655
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$R);
15159
15656
  // Initializing toggle state and set state functions using the custom hook useToggleState.
15160
15657
  var {
15161
15658
  isHovered,
@@ -15489,64 +15986,8 @@
15489
15986
  cursor: 'not-allowed'
15490
15987
  }
15491
15988
  };
15492
- // Helper function to calculate position based on side and alignment
15493
- var getDropdownPosition = function getDropdownPosition(side, align) {
15494
- if (side === void 0) {
15495
- side = 'bottom';
15496
- }
15497
- if (align === void 0) {
15498
- align = 'start';
15499
- }
15500
- var positions = {
15501
- top: Object.assign({
15502
- bottom: '100%',
15503
- marginBottom: '8px'
15504
- }, align === 'start' && {
15505
- left: 0
15506
- }, align === 'center' && {
15507
- left: '50%',
15508
- transform: 'translateX(-50%)'
15509
- }, align === 'end' && {
15510
- right: 0
15511
- }),
15512
- right: Object.assign({
15513
- left: '100%',
15514
- marginLeft: '8px'
15515
- }, align === 'start' && {
15516
- top: 0
15517
- }, align === 'center' && {
15518
- top: '50%',
15519
- transform: 'translateY(-50%)'
15520
- }, align === 'end' && {
15521
- bottom: 0
15522
- }),
15523
- bottom: Object.assign({
15524
- top: '100%',
15525
- marginTop: '8px'
15526
- }, align === 'start' && {
15527
- left: 0
15528
- }, align === 'center' && {
15529
- left: '50%',
15530
- transform: 'translateX(-50%)'
15531
- }, align === 'end' && {
15532
- right: 0
15533
- }),
15534
- left: Object.assign({
15535
- right: '100%',
15536
- marginRight: '8px'
15537
- }, align === 'start' && {
15538
- top: 0
15539
- }, align === 'center' && {
15540
- top: '50%',
15541
- transform: 'translateY(-50%)'
15542
- }, align === 'end' && {
15543
- bottom: 0
15544
- })
15545
- };
15546
- return positions[side];
15547
- };
15548
15989
 
15549
- var _excluded$Q = ["children", "views"],
15990
+ var _excluded$S = ["children", "views"],
15550
15991
  _excluded2$d = ["items", "side", "align", "views"],
15551
15992
  _excluded3$9 = ["item", "views"],
15552
15993
  _excluded4$8 = ["views"],
@@ -15558,7 +15999,10 @@
15558
15999
  activeSubmenuId: null,
15559
16000
  setActiveSubmenuId: () => {},
15560
16001
  size: 'md',
15561
- variant: 'default'
16002
+ variant: 'default',
16003
+ triggerRef: {
16004
+ current: null
16005
+ }
15562
16006
  });
15563
16007
  // Provider component for the DropdownMenu context
15564
16008
  var DropdownMenuProvider = _ref => {
@@ -15584,16 +16028,18 @@
15584
16028
  children,
15585
16029
  views
15586
16030
  } = _ref2,
15587
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$Q);
16031
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$S);
15588
16032
  var {
15589
16033
  isOpen,
15590
- setIsOpen
16034
+ setIsOpen,
16035
+ triggerRef
15591
16036
  } = useDropdownMenuContext();
15592
16037
  var handleClick = e => {
15593
16038
  e.stopPropagation();
15594
16039
  setIsOpen(!isOpen);
15595
16040
  };
15596
16041
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
16042
+ ref: triggerRef,
15597
16043
  id: "dropdown-trigger",
15598
16044
  onClick: handleClick,
15599
16045
  cursor: "pointer",
@@ -15612,20 +16058,121 @@
15612
16058
  props = _objectWithoutPropertiesLoose(_ref3, _excluded2$d);
15613
16059
  var {
15614
16060
  isOpen,
15615
- //activeSubmenuId, setActiveSubmenuId, size,
15616
- variant
16061
+ variant,
16062
+ triggerRef
15617
16063
  } = useDropdownMenuContext();
16064
+ var contentRef = React.useRef(null);
16065
+ var [optimalPosition, setOptimalPosition] = React.useState({
16066
+ x: 0,
16067
+ y: 0,
16068
+ placement: side
16069
+ });
16070
+ // Calculate optimal position when the dropdown opens
16071
+ React.useEffect(() => {
16072
+ if (isOpen && contentRef.current && triggerRef.current) {
16073
+ var contentRect = contentRef.current.getBoundingClientRect();
16074
+ var triggerRect = triggerRef.current.getBoundingClientRect();
16075
+ // Get content dimensions
16076
+ var contentWidth = Math.max(contentRect.width || 180, 180);
16077
+ var contentHeight = Math.max(contentRect.height || 100, 100);
16078
+ // Get viewport dimensions
16079
+ var viewportWidth = window.innerWidth;
16080
+ var viewportHeight = window.innerHeight;
16081
+ // Calculate available space on all sides from the trigger
16082
+ var availableSpace = {
16083
+ top: triggerRect.top,
16084
+ right: viewportWidth - triggerRect.right,
16085
+ bottom: viewportHeight - triggerRect.bottom,
16086
+ left: triggerRect.left
16087
+ };
16088
+ // Determine optimal placement based on available space and preferred side
16089
+ var placements = [{
16090
+ placement: 'bottom',
16091
+ space: availableSpace.bottom,
16092
+ fits: availableSpace.bottom >= contentHeight + 8,
16093
+ x: align === 'start' ? triggerRect.left : align === 'end' ? triggerRect.right - contentWidth : triggerRect.left + triggerRect.width / 2 - contentWidth / 2,
16094
+ y: triggerRect.bottom + 8
16095
+ }, {
16096
+ placement: 'top',
16097
+ space: availableSpace.top,
16098
+ fits: availableSpace.top >= contentHeight + 8,
16099
+ x: align === 'start' ? triggerRect.left : align === 'end' ? triggerRect.right - contentWidth : triggerRect.left + triggerRect.width / 2 - contentWidth / 2,
16100
+ y: triggerRect.top - contentHeight - 8
16101
+ }, {
16102
+ placement: 'right',
16103
+ space: availableSpace.right,
16104
+ fits: availableSpace.right >= contentWidth + 8,
16105
+ x: triggerRect.right + 8,
16106
+ y: align === 'start' ? triggerRect.top : align === 'end' ? triggerRect.bottom - contentHeight : triggerRect.top + triggerRect.height / 2 - contentHeight / 2
16107
+ }, {
16108
+ placement: 'left',
16109
+ space: availableSpace.left,
16110
+ fits: availableSpace.left >= contentWidth + 8,
16111
+ x: triggerRect.left - contentWidth - 8,
16112
+ y: align === 'start' ? triggerRect.top : align === 'end' ? triggerRect.bottom - contentHeight : triggerRect.top + triggerRect.height / 2 - contentHeight / 2
16113
+ }];
16114
+ // First try the preferred side if it fits
16115
+ var preferredPlacement = placements.find(p => p.placement === side && p.fits);
16116
+ if (preferredPlacement) {
16117
+ setOptimalPosition({
16118
+ x: preferredPlacement.x,
16119
+ y: preferredPlacement.y,
16120
+ placement: preferredPlacement.placement
16121
+ });
16122
+ return;
16123
+ }
16124
+ // Otherwise, find the best fitting placement
16125
+ var fittingPlacement = placements.find(p => p.fits);
16126
+ if (fittingPlacement) {
16127
+ setOptimalPosition({
16128
+ x: fittingPlacement.x,
16129
+ y: fittingPlacement.y,
16130
+ placement: fittingPlacement.placement
16131
+ });
16132
+ return;
16133
+ }
16134
+ // If nothing fits, choose the placement with the most space
16135
+ var bestPlacement = placements.reduce((best, current) => current.space > best.space ? current : best);
16136
+ // Ensure the content stays within viewport bounds
16137
+ var finalX = bestPlacement.x;
16138
+ var finalY = bestPlacement.y;
16139
+ if (finalX + contentWidth > viewportWidth) {
16140
+ finalX = viewportWidth - contentWidth - 8;
16141
+ }
16142
+ if (finalX < 8) {
16143
+ finalX = 8;
16144
+ }
16145
+ if (finalY + contentHeight > viewportHeight) {
16146
+ finalY = viewportHeight - contentHeight - 8;
16147
+ }
16148
+ if (finalY < 8) {
16149
+ finalY = 8;
16150
+ }
16151
+ setOptimalPosition({
16152
+ x: finalX,
16153
+ y: finalY,
16154
+ placement: bestPlacement.placement
16155
+ });
16156
+ }
16157
+ }, [isOpen, side, align, triggerRef]);
15618
16158
  if (!isOpen) {
15619
16159
  return null;
15620
16160
  }
16161
+ // Create intelligent positioning styles
16162
+ var positionStyles = {
16163
+ position: 'fixed',
16164
+ left: optimalPosition.x,
16165
+ top: optimalPosition.y,
16166
+ zIndex: 1000
16167
+ };
15621
16168
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
16169
+ ref: contentRef,
15622
16170
  id: "dropdown-menu",
15623
- position: "absolute",
15624
- zIndex: 1000,
15625
16171
  borderRadius: 4,
15626
16172
  boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)",
15627
- overflow: "hidden"
15628
- }, getDropdownPosition(side, align), DropdownMenuVariants[variant], views == null ? void 0 : views.menu, props), items.map((item, index) => {
16173
+ overflow: "hidden",
16174
+ style: positionStyles
16175
+ }, DropdownMenuVariants[variant], views == null ? void 0 : views.menu, props), items.map((item, index) => {
15629
16176
  if (item.divider) {
15630
16177
  return /*#__PURE__*/React__default.createElement(DropdownMenuDivider, {
15631
16178
  key: "divider-" + index,
@@ -15637,7 +16184,13 @@
15637
16184
  item: item,
15638
16185
  views: views
15639
16186
  });
15640
- }));
16187
+ }), (/*#__PURE__*/React__default.createElement("div", {
16188
+ style: {
16189
+ fontSize: '10px',
16190
+ opacity: 0.7,
16191
+ padding: '4px'
16192
+ }
16193
+ }, "Placement: ", optimalPosition.placement)));
15641
16194
  };
15642
16195
  // DropdownMenu Item component
15643
16196
  var DropdownMenuItem = _ref4 => {
@@ -15740,7 +16293,7 @@
15740
16293
  }));
15741
16294
  };
15742
16295
 
15743
- var _excluded$R = ["trigger", "items", "size", "variant", "side", "align", "defaultOpen", "views"];
16296
+ var _excluded$T = ["trigger", "items", "size", "variant", "side", "align", "defaultOpen", "views"];
15744
16297
  /**
15745
16298
  * DropdownMenu component for displaying a menu when clicking on a trigger element.
15746
16299
  */
@@ -15755,13 +16308,14 @@
15755
16308
  defaultOpen = false,
15756
16309
  views
15757
16310
  } = _ref,
15758
- props = _objectWithoutPropertiesLoose(_ref, _excluded$R);
16311
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$T);
15759
16312
  var {
15760
16313
  isOpen,
15761
16314
  setIsOpen,
15762
16315
  activeSubmenuId,
15763
16316
  setActiveSubmenuId
15764
16317
  } = useDropdownMenuState(defaultOpen);
16318
+ var triggerRef = React.useRef(null);
15765
16319
  return /*#__PURE__*/React__default.createElement(DropdownMenuProvider, {
15766
16320
  value: {
15767
16321
  isOpen,
@@ -15769,7 +16323,8 @@
15769
16323
  activeSubmenuId,
15770
16324
  setActiveSubmenuId,
15771
16325
  size,
15772
- variant
16326
+ variant,
16327
+ triggerRef
15773
16328
  }
15774
16329
  }, /*#__PURE__*/React__default.createElement(DropdownMenuView, Object.assign({
15775
16330
  trigger: trigger,
@@ -16167,7 +16722,7 @@
16167
16722
  category: 'neutral'
16168
16723
  }];
16169
16724
 
16170
- var _excluded$S = ["id", "name", "label", "placeholder", "helperText", "views", "size", "shape", "variant", "error", "isDisabled", "isReadOnly", "predefinedColors", "showCustomInput", "showRecentColors", "isOpen", "selectedColor", "recentColors", "customColor", "handleToggle", "handleColorSelect", "handleCustomColorChange", "handleCustomColorSubmit", "triggerRef", "dropdownRef"];
16725
+ var _excluded$U = ["id", "name", "label", "placeholder", "helperText", "views", "size", "shape", "variant", "error", "isDisabled", "isReadOnly", "predefinedColors", "showCustomInput", "showRecentColors", "isOpen", "selectedColor", "recentColors", "customColor", "handleToggle", "handleColorSelect", "handleCustomColorChange", "handleCustomColorSubmit", "triggerRef", "dropdownRef"];
16171
16726
  var ColorPickerView = _ref => {
16172
16727
  var {
16173
16728
  // Basic props
@@ -16202,7 +16757,7 @@
16202
16757
  dropdownRef
16203
16758
  // Other props
16204
16759
  } = _ref,
16205
- props = _objectWithoutPropertiesLoose(_ref, _excluded$S);
16760
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$U);
16206
16761
  var {
16207
16762
  getColor
16208
16763
  } = appStudio.useTheme();
@@ -18532,7 +19087,7 @@
18532
19087
  };
18533
19088
  };
18534
19089
 
18535
- var _excluded$T = ["id", "name", "label", "placeholder", "helperText", "views", "size", "shape", "variant", "error", "isDisabled", "isReadOnly", "showSearch", "showCategories", "showRecentEmojis", "enabledCategories", "isOpen", "selectedEmoji", "recentEmojis", "searchQuery", "activeCategory", "filteredEmojis", "handleToggle", "handleEmojiSelect", "handleSearchChange", "handleCategoryChange", "triggerRef", "dropdownRef"];
19090
+ var _excluded$V = ["id", "name", "label", "placeholder", "helperText", "views", "size", "shape", "variant", "error", "isDisabled", "isReadOnly", "showSearch", "showCategories", "showRecentEmojis", "enabledCategories", "isOpen", "selectedEmoji", "recentEmojis", "searchQuery", "activeCategory", "filteredEmojis", "handleToggle", "handleEmojiSelect", "handleSearchChange", "handleCategoryChange", "triggerRef", "dropdownRef"];
18536
19091
  var EmojiPickerView = _ref => {
18537
19092
  var {
18538
19093
  // Basic props
@@ -18570,7 +19125,7 @@
18570
19125
  dropdownRef
18571
19126
  // Other props
18572
19127
  } = _ref,
18573
- props = _objectWithoutPropertiesLoose(_ref, _excluded$T);
19128
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$V);
18574
19129
  var {
18575
19130
  getColor
18576
19131
  } = appStudio.useTheme();
@@ -18722,109 +19277,7 @@
18722
19277
  };
18723
19278
  };
18724
19279
 
18725
- // More advanced positioning using element measurements
18726
- var getContentPositionStyles = function getContentPositionStyles(triggerRect, side, align, sideOffset) {
18727
- if (side === void 0) {
18728
- side = 'bottom';
18729
- }
18730
- if (align === void 0) {
18731
- align = 'center';
18732
- }
18733
- if (sideOffset === void 0) {
18734
- sideOffset = 8;
18735
- }
18736
- if (!triggerRect) {
18737
- return {
18738
- position: 'absolute',
18739
- opacity: 0,
18740
- pointerEvents: 'none'
18741
- }; // Hide if trigger isn't measured
18742
- }
18743
- var styles = {
18744
- position: 'absolute',
18745
- zIndex: 1000
18746
- };
18747
- // Calculate position based on side and alignment
18748
- switch (side) {
18749
- case 'top':
18750
- styles.bottom = '100%';
18751
- styles.marginBottom = sideOffset;
18752
- if (align === 'start') {
18753
- styles.left = 0;
18754
- } else if (align === 'center') {
18755
- styles.left = '50%';
18756
- styles.transform = 'translateX(-50%)';
18757
- } else if (align === 'end') {
18758
- styles.right = 0;
18759
- }
18760
- break;
18761
- case 'right':
18762
- styles.left = '100%';
18763
- styles.marginLeft = sideOffset;
18764
- if (align === 'start') {
18765
- styles.top = 0;
18766
- } else if (align === 'center') {
18767
- styles.top = '50%';
18768
- styles.transform = 'translateY(-50%)';
18769
- } else if (align === 'end') {
18770
- styles.bottom = 0;
18771
- }
18772
- break;
18773
- case 'bottom':
18774
- styles.top = '100%';
18775
- styles.marginTop = sideOffset;
18776
- if (align === 'start') {
18777
- styles.left = 0;
18778
- } else if (align === 'center') {
18779
- styles.left = '50%';
18780
- styles.transform = 'translateX(-50%)';
18781
- } else if (align === 'end') {
18782
- styles.right = 0;
18783
- }
18784
- break;
18785
- case 'left':
18786
- styles.right = '100%';
18787
- styles.marginRight = sideOffset;
18788
- if (align === 'start') {
18789
- styles.top = 0;
18790
- } else if (align === 'center') {
18791
- styles.top = '50%';
18792
- styles.transform = 'translateY(-50%)';
18793
- } else if (align === 'end') {
18794
- styles.bottom = 0;
18795
- }
18796
- break;
18797
- }
18798
- return styles;
18799
- };
18800
-
18801
- /**
18802
- * A hook that returns the DOMRect of an element.
18803
- * @param ref React ref object for the element to measure
18804
- * @returns DOMRect of the element or null if the element is not available
18805
- */
18806
- var useRect = ref => {
18807
- var [rect, setRect] = React.useState(null);
18808
- var updateRect = React.useCallback(() => {
18809
- if (ref.current) {
18810
- setRect(ref.current.getBoundingClientRect());
18811
- }
18812
- }, [ref]);
18813
- React.useLayoutEffect(() => {
18814
- if (!ref.current) return;
18815
- updateRect();
18816
- // Update on resize and scroll
18817
- window.addEventListener('resize', updateRect);
18818
- window.addEventListener('scroll', updateRect);
18819
- return () => {
18820
- window.removeEventListener('resize', updateRect);
18821
- window.removeEventListener('scroll', updateRect);
18822
- };
18823
- }, [ref, updateRect]);
18824
- return rect;
18825
- };
18826
-
18827
- var _excluded$U = ["children", "views", "asChild"],
19280
+ var _excluded$W = ["children", "views", "asChild"],
18828
19281
  _excluded2$e = ["children", "views", "side", "align", "sideOffset", "style", "backgroundColor", "borderRadius", "boxShadow", "padding", "minWidth", "maxWidth"];
18829
19282
  // Create context for the HoverCard
18830
19283
  var HoverCardContext = /*#__PURE__*/React.createContext({
@@ -18863,7 +19316,7 @@
18863
19316
  views,
18864
19317
  asChild = false
18865
19318
  } = _ref2,
18866
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$U);
19319
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$W);
18867
19320
  var {
18868
19321
  openCard,
18869
19322
  closeCard,
@@ -18921,15 +19374,111 @@
18921
19374
  contentId,
18922
19375
  triggerId
18923
19376
  } = useHoverCardContext();
18924
- // Use hook to measure trigger for positioning
18925
- var triggerRect = useRect(triggerRef);
18926
- // Calculate position based on trigger dimensions and side prop
18927
- var positionStyles = getContentPositionStyles(triggerRect, side, align, sideOffset);
19377
+ var [optimalPosition, setOptimalPosition] = React.useState({
19378
+ x: 0,
19379
+ y: 0,
19380
+ placement: side
19381
+ });
19382
+ // Calculate optimal position when the card opens or content dimensions change
19383
+ React.useEffect(() => {
19384
+ if (isOpen && contentRef != null && contentRef.current && triggerRef != null && triggerRef.current) {
19385
+ var contentRect = contentRef.current.getBoundingClientRect();
19386
+ var triggerRect = triggerRef.current.getBoundingClientRect();
19387
+ // Get content dimensions
19388
+ var contentWidth = Math.max(contentRect.width || 200, 200);
19389
+ var contentHeight = Math.max(contentRect.height || 100, 100);
19390
+ // Get viewport dimensions
19391
+ var viewportWidth = window.innerWidth;
19392
+ var viewportHeight = window.innerHeight;
19393
+ // Calculate available space on all sides from the trigger
19394
+ var availableSpace = {
19395
+ top: triggerRect.top,
19396
+ right: viewportWidth - triggerRect.right,
19397
+ bottom: viewportHeight - triggerRect.bottom,
19398
+ left: triggerRect.left
19399
+ };
19400
+ // Determine optimal placement based on available space and preferred side
19401
+ var placements = [{
19402
+ placement: 'bottom',
19403
+ space: availableSpace.bottom,
19404
+ fits: availableSpace.bottom >= contentHeight + sideOffset,
19405
+ x: triggerRect.left + triggerRect.width / 2 - contentWidth / 2,
19406
+ y: triggerRect.bottom + sideOffset
19407
+ }, {
19408
+ placement: 'top',
19409
+ space: availableSpace.top,
19410
+ fits: availableSpace.top >= contentHeight + sideOffset,
19411
+ x: triggerRect.left + triggerRect.width / 2 - contentWidth / 2,
19412
+ y: triggerRect.top - contentHeight - sideOffset
19413
+ }, {
19414
+ placement: 'right',
19415
+ space: availableSpace.right,
19416
+ fits: availableSpace.right >= contentWidth + sideOffset,
19417
+ x: triggerRect.right + sideOffset,
19418
+ y: triggerRect.top + triggerRect.height / 2 - contentHeight / 2
19419
+ }, {
19420
+ placement: 'left',
19421
+ space: availableSpace.left,
19422
+ fits: availableSpace.left >= contentWidth + sideOffset,
19423
+ x: triggerRect.left - contentWidth - sideOffset,
19424
+ y: triggerRect.top + triggerRect.height / 2 - contentHeight / 2
19425
+ }];
19426
+ // First try the preferred side if it fits
19427
+ var preferredPlacement = placements.find(p => p.placement === side && p.fits);
19428
+ if (preferredPlacement) {
19429
+ setOptimalPosition({
19430
+ x: preferredPlacement.x,
19431
+ y: preferredPlacement.y,
19432
+ placement: preferredPlacement.placement
19433
+ });
19434
+ return;
19435
+ }
19436
+ // Otherwise, find the best fitting placement
19437
+ var fittingPlacement = placements.find(p => p.fits);
19438
+ if (fittingPlacement) {
19439
+ setOptimalPosition({
19440
+ x: fittingPlacement.x,
19441
+ y: fittingPlacement.y,
19442
+ placement: fittingPlacement.placement
19443
+ });
19444
+ return;
19445
+ }
19446
+ // If nothing fits, choose the placement with the most space
19447
+ var bestPlacement = placements.reduce((best, current) => current.space > best.space ? current : best);
19448
+ // Ensure the content stays within viewport bounds
19449
+ var finalX = bestPlacement.x;
19450
+ var finalY = bestPlacement.y;
19451
+ if (finalX + contentWidth > viewportWidth) {
19452
+ finalX = viewportWidth - contentWidth - 8;
19453
+ }
19454
+ if (finalX < 8) {
19455
+ finalX = 8;
19456
+ }
19457
+ if (finalY + contentHeight > viewportHeight) {
19458
+ finalY = viewportHeight - contentHeight - 8;
19459
+ }
19460
+ if (finalY < 8) {
19461
+ finalY = 8;
19462
+ }
19463
+ setOptimalPosition({
19464
+ x: finalX,
19465
+ y: finalY,
19466
+ placement: bestPlacement.placement
19467
+ });
19468
+ }
19469
+ }, [isOpen, side, sideOffset, contentRef, triggerRef]);
18928
19470
  var handleMouseEnter = () => cancelCloseTimer(); // Keep card open if mouse enters content
18929
19471
  var handleMouseLeave = () => closeCard();
18930
19472
  if (!isOpen) {
18931
19473
  return null; // Don't render content if not open
18932
19474
  }
19475
+ // Create intelligent positioning styles
19476
+ var positionStyles = {
19477
+ position: 'fixed',
19478
+ left: optimalPosition.x,
19479
+ top: optimalPosition.y,
19480
+ zIndex: 1000
19481
+ };
18933
19482
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
18934
19483
  ref: contentRef,
18935
19484
  id: contentId,
@@ -18944,13 +19493,18 @@
18944
19493
  padding: padding,
18945
19494
  minWidth: minWidth,
18946
19495
  maxWidth: maxWidth,
18947
- zIndex: 1000,
18948
- // Combine calculated position styles with user styles
19496
+ // Combine intelligent position styles with user styles
18949
19497
  style: Object.assign({}, positionStyles, userStyle)
18950
- }, views == null ? void 0 : views.container, props), children);
19498
+ }, views == null ? void 0 : views.container, props), children, (/*#__PURE__*/React__default.createElement("div", {
19499
+ style: {
19500
+ fontSize: '10px',
19501
+ opacity: 0.7,
19502
+ marginTop: '4px'
19503
+ }
19504
+ }, "Placement: ", optimalPosition.placement)));
18951
19505
  };
18952
19506
 
18953
- var _excluded$V = ["children", "views", "openDelay", "closeDelay"];
19507
+ var _excluded$X = ["children", "views", "openDelay", "closeDelay"];
18954
19508
  /**
18955
19509
  * HoverCard component displays floating content when hovering over a trigger element.
18956
19510
  * Supports configurable open and close delays for a smoother user experience.
@@ -18962,7 +19516,7 @@
18962
19516
  openDelay,
18963
19517
  closeDelay
18964
19518
  } = _ref,
18965
- props = _objectWithoutPropertiesLoose(_ref, _excluded$V);
19519
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$X);
18966
19520
  var hoverCardState = useHoverCardState({
18967
19521
  openDelay,
18968
19522
  closeDelay
@@ -19079,20 +19633,8 @@
19079
19633
  cursor: 'not-allowed'
19080
19634
  }
19081
19635
  };
19082
- var getMenubarContentPosition = orientation => {
19083
- if (orientation === 'horizontal') {
19084
- return {
19085
- top: '100%',
19086
- left: 0
19087
- };
19088
- }
19089
- return {
19090
- top: 0,
19091
- left: '100%'
19092
- };
19093
- };
19094
19636
 
19095
- var _excluded$W = ["children", "orientation", "size", "variant", "views"];
19637
+ var _excluded$Y = ["children", "orientation", "size", "variant", "views"];
19096
19638
  // Create context for the Menubar
19097
19639
  var MenubarContext = /*#__PURE__*/React.createContext({
19098
19640
  activeMenuId: null,
@@ -19103,7 +19645,10 @@
19103
19645
  toggleMenu: () => {},
19104
19646
  orientation: 'horizontal',
19105
19647
  size: 'md',
19106
- variant: 'default'
19648
+ variant: 'default',
19649
+ triggerRefs: {
19650
+ current: {}
19651
+ }
19107
19652
  });
19108
19653
  // Hook to use the Menubar context
19109
19654
  var useMenubarContext = () => React.useContext(MenubarContext);
@@ -19126,7 +19671,7 @@
19126
19671
  variant = 'default',
19127
19672
  views
19128
19673
  } = _ref2,
19129
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$W);
19674
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$Y);
19130
19675
  var Container = orientation === 'horizontal' ? appStudio.Horizontal : appStudio.Vertical;
19131
19676
  return /*#__PURE__*/React__default.createElement(Container, Object.assign({
19132
19677
  role: "menubar",
@@ -19173,16 +19718,30 @@
19173
19718
  setActiveMenuId,
19174
19719
  toggleMenu,
19175
19720
  isMenuOpen,
19176
- size
19721
+ size,
19722
+ triggerRefs
19177
19723
  } = useMenubarContext();
19724
+ var triggerRef = React.useRef(null);
19178
19725
  var isActive = activeMenuId === menuId;
19179
19726
  var isOpen = isMenuOpen(menuId);
19727
+ // Store the trigger ref in the context
19728
+ React.useEffect(() => {
19729
+ if (triggerRef.current && menuId) {
19730
+ triggerRefs.current[menuId] = triggerRef.current;
19731
+ }
19732
+ return () => {
19733
+ if (menuId) {
19734
+ delete triggerRefs.current[menuId];
19735
+ }
19736
+ };
19737
+ }, [menuId, triggerRefs]);
19180
19738
  var handleClick = () => {
19181
19739
  if (disabled) return;
19182
19740
  setActiveMenuId(menuId);
19183
19741
  toggleMenu(menuId);
19184
19742
  };
19185
19743
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
19744
+ ref: triggerRef,
19186
19745
  id: "menubar-trigger",
19187
19746
  role: "menuitem",
19188
19747
  "aria-haspopup": "true",
@@ -19205,23 +19764,149 @@
19205
19764
  } = _ref5;
19206
19765
  var {
19207
19766
  isMenuOpen,
19208
- orientation
19767
+ orientation,
19768
+ triggerRefs
19209
19769
  } = useMenubarContext();
19770
+ var contentRef = React.useRef(null);
19771
+ var [optimalPosition, setOptimalPosition] = React.useState({
19772
+ x: 0,
19773
+ y: 0,
19774
+ placement: orientation === 'horizontal' ? 'bottom' : 'right'
19775
+ });
19210
19776
  var isOpen = isMenuOpen(menuId);
19777
+ // Calculate optimal position when the menu opens
19778
+ React.useEffect(() => {
19779
+ if (isOpen && contentRef.current && menuId && triggerRefs.current[menuId]) {
19780
+ var contentRect = contentRef.current.getBoundingClientRect();
19781
+ var triggerRect = triggerRefs.current[menuId].getBoundingClientRect();
19782
+ // Get content dimensions
19783
+ var contentWidth = Math.max(contentRect.width || 200, 200);
19784
+ var contentHeight = Math.max(contentRect.height || 150, 150);
19785
+ // Get viewport dimensions
19786
+ var viewportWidth = window.innerWidth;
19787
+ var viewportHeight = window.innerHeight;
19788
+ // Calculate available space on all sides from the trigger
19789
+ var availableSpace = {
19790
+ top: triggerRect.top,
19791
+ right: viewportWidth - triggerRect.right,
19792
+ bottom: viewportHeight - triggerRect.bottom,
19793
+ left: triggerRect.left
19794
+ };
19795
+ // Determine optimal placement based on orientation and available space
19796
+ var placements = orientation === 'horizontal' ? [
19797
+ // For horizontal menubar, prefer bottom placement
19798
+ {
19799
+ placement: 'bottom',
19800
+ space: availableSpace.bottom,
19801
+ fits: availableSpace.bottom >= contentHeight + 8,
19802
+ x: triggerRect.left,
19803
+ y: triggerRect.bottom + 8
19804
+ }, {
19805
+ placement: 'top',
19806
+ space: availableSpace.top,
19807
+ fits: availableSpace.top >= contentHeight + 8,
19808
+ x: triggerRect.left,
19809
+ y: triggerRect.top - contentHeight - 8
19810
+ }, {
19811
+ placement: 'right',
19812
+ space: availableSpace.right,
19813
+ fits: availableSpace.right >= contentWidth + 8,
19814
+ x: triggerRect.right + 8,
19815
+ y: triggerRect.top
19816
+ }, {
19817
+ placement: 'left',
19818
+ space: availableSpace.left,
19819
+ fits: availableSpace.left >= contentWidth + 8,
19820
+ x: triggerRect.left - contentWidth - 8,
19821
+ y: triggerRect.top
19822
+ }] : [
19823
+ // For vertical menubar, prefer right placement
19824
+ {
19825
+ placement: 'right',
19826
+ space: availableSpace.right,
19827
+ fits: availableSpace.right >= contentWidth + 8,
19828
+ x: triggerRect.right + 8,
19829
+ y: triggerRect.top
19830
+ }, {
19831
+ placement: 'left',
19832
+ space: availableSpace.left,
19833
+ fits: availableSpace.left >= contentWidth + 8,
19834
+ x: triggerRect.left - contentWidth - 8,
19835
+ y: triggerRect.top
19836
+ }, {
19837
+ placement: 'bottom',
19838
+ space: availableSpace.bottom,
19839
+ fits: availableSpace.bottom >= contentHeight + 8,
19840
+ x: triggerRect.left,
19841
+ y: triggerRect.bottom + 8
19842
+ }, {
19843
+ placement: 'top',
19844
+ space: availableSpace.top,
19845
+ fits: availableSpace.top >= contentHeight + 8,
19846
+ x: triggerRect.left,
19847
+ y: triggerRect.top - contentHeight - 8
19848
+ }];
19849
+ // Find the best fitting placement
19850
+ var fittingPlacement = placements.find(p => p.fits);
19851
+ if (fittingPlacement) {
19852
+ setOptimalPosition({
19853
+ x: fittingPlacement.x,
19854
+ y: fittingPlacement.y,
19855
+ placement: fittingPlacement.placement
19856
+ });
19857
+ return;
19858
+ }
19859
+ // If nothing fits, choose the placement with the most space
19860
+ var bestPlacement = placements.reduce((best, current) => current.space > best.space ? current : best);
19861
+ // Ensure the content stays within viewport bounds
19862
+ var finalX = bestPlacement.x;
19863
+ var finalY = bestPlacement.y;
19864
+ if (finalX + contentWidth > viewportWidth) {
19865
+ finalX = viewportWidth - contentWidth - 8;
19866
+ }
19867
+ if (finalX < 8) {
19868
+ finalX = 8;
19869
+ }
19870
+ if (finalY + contentHeight > viewportHeight) {
19871
+ finalY = viewportHeight - contentHeight - 8;
19872
+ }
19873
+ if (finalY < 8) {
19874
+ finalY = 8;
19875
+ }
19876
+ setOptimalPosition({
19877
+ x: finalX,
19878
+ y: finalY,
19879
+ placement: bestPlacement.placement
19880
+ });
19881
+ }
19882
+ }, [isOpen, orientation, menuId, triggerRefs]);
19211
19883
  if (!isOpen) {
19212
19884
  return null;
19213
19885
  }
19886
+ // Create intelligent positioning styles
19887
+ var positionStyles = {
19888
+ position: 'fixed',
19889
+ left: optimalPosition.x,
19890
+ top: optimalPosition.y,
19891
+ zIndex: 1000
19892
+ };
19214
19893
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
19894
+ ref: contentRef,
19215
19895
  id: "menubar-content",
19216
19896
  role: "menu",
19217
- position: "absolute",
19218
- zIndex: 1000,
19219
19897
  minWidth: "200px",
19220
19898
  backgroundColor: "color.white",
19221
19899
  borderRadius: 4,
19222
19900
  boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)",
19223
- overflow: "hidden"
19224
- }, getMenubarContentPosition(orientation), views == null ? void 0 : views.content), children);
19901
+ overflow: "hidden",
19902
+ style: positionStyles
19903
+ }, views == null ? void 0 : views.content), children, (/*#__PURE__*/React__default.createElement("div", {
19904
+ style: {
19905
+ fontSize: '8px',
19906
+ opacity: 0.7,
19907
+ padding: '4px'
19908
+ }
19909
+ }, "Placement: ", optimalPosition.placement)));
19225
19910
  };
19226
19911
  // Menubar Item component
19227
19912
  var MenubarItem = _ref6 => {
@@ -19312,7 +19997,7 @@
19312
19997
  })))))));
19313
19998
  };
19314
19999
 
19315
- var _excluded$X = ["items", "orientation", "size", "variant", "defaultActiveMenuId", "defaultOpenMenuId", "views"];
20000
+ var _excluded$Z = ["items", "orientation", "size", "variant", "defaultActiveMenuId", "defaultOpenMenuId", "views"];
19316
20001
  /**
19317
20002
  * Menubar component for creating horizontal or vertical menu bars with dropdown menus.
19318
20003
  */
@@ -19326,7 +20011,7 @@
19326
20011
  defaultOpenMenuId = null,
19327
20012
  views
19328
20013
  } = _ref,
19329
- props = _objectWithoutPropertiesLoose(_ref, _excluded$X);
20014
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$Z);
19330
20015
  var {
19331
20016
  activeMenuId,
19332
20017
  setActiveMenuId,
@@ -19335,6 +20020,7 @@
19335
20020
  isMenuOpen,
19336
20021
  toggleMenu
19337
20022
  } = useMenubarState(defaultActiveMenuId, defaultOpenMenuId);
20023
+ var triggerRefs = React.useRef({});
19338
20024
  return /*#__PURE__*/React__default.createElement(MenubarProvider, {
19339
20025
  value: {
19340
20026
  activeMenuId,
@@ -19345,7 +20031,8 @@
19345
20031
  toggleMenu,
19346
20032
  orientation,
19347
20033
  size,
19348
- variant
20034
+ variant,
20035
+ triggerRefs
19349
20036
  }
19350
20037
  }, /*#__PURE__*/React__default.createElement(MenubarView, Object.assign({
19351
20038
  items: items,
@@ -19482,7 +20169,7 @@
19482
20169
  }
19483
20170
  };
19484
20171
 
19485
- var _excluded$Y = ["currentPage", "totalPages", "onPageChange", "pageSize", "pageSizeOptions", "onPageSizeChange", "showPageSizeSelector", "showPageInfo", "maxPageButtons", "showFirstLastButtons", "size", "variant", "shape", "visiblePageNumbers", "views"];
20172
+ var _excluded$_ = ["currentPage", "totalPages", "onPageChange", "pageSize", "pageSizeOptions", "onPageSizeChange", "showPageSizeSelector", "showPageInfo", "maxPageButtons", "showFirstLastButtons", "size", "variant", "shape", "visiblePageNumbers", "views"];
19486
20173
  var PaginationView = _ref => {
19487
20174
  var {
19488
20175
  currentPage,
@@ -19513,7 +20200,7 @@
19513
20200
  visiblePageNumbers,
19514
20201
  views
19515
20202
  } = _ref,
19516
- props = _objectWithoutPropertiesLoose(_ref, _excluded$Y);
20203
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$_);
19517
20204
  var handlePageChange = page => {
19518
20205
  if (page < 1 || page > totalPages || page === currentPage) {
19519
20206
  return;
@@ -19632,7 +20319,7 @@
19632
20319
  }, option.label))))));
19633
20320
  };
19634
20321
 
19635
- var _excluded$Z = ["currentPage", "totalPages", "onPageChange", "pageSize", "pageSizeOptions", "onPageSizeChange", "showPageSizeSelector", "showPageInfo", "maxPageButtons", "showFirstLastButtons", "size", "variant", "shape", "views"];
20322
+ var _excluded$$ = ["currentPage", "totalPages", "onPageChange", "pageSize", "pageSizeOptions", "onPageSizeChange", "showPageSizeSelector", "showPageInfo", "maxPageButtons", "showFirstLastButtons", "size", "variant", "shape", "views"];
19636
20323
  /**
19637
20324
  * Pagination component for navigating through pages of content.
19638
20325
  */
@@ -19653,7 +20340,7 @@
19653
20340
  shape = 'rounded',
19654
20341
  views
19655
20342
  } = _ref,
19656
- props = _objectWithoutPropertiesLoose(_ref, _excluded$Z);
20343
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$$);
19657
20344
  var {
19658
20345
  visiblePageNumbers
19659
20346
  } = usePaginationState(currentPage, totalPages, maxPageButtons);
@@ -19723,7 +20410,7 @@
19723
20410
  }
19724
20411
  };
19725
20412
 
19726
- var _excluded$_ = ["orientation", "variant", "thickness", "color", "spacing", "label", "decorative", "views", "themeMode"];
20413
+ var _excluded$10 = ["orientation", "variant", "thickness", "color", "spacing", "label", "decorative", "views", "themeMode"];
19727
20414
  var SeparatorView = _ref => {
19728
20415
  var {
19729
20416
  orientation = 'horizontal',
@@ -19735,7 +20422,7 @@
19735
20422
  decorative = false,
19736
20423
  views
19737
20424
  } = _ref,
19738
- props = _objectWithoutPropertiesLoose(_ref, _excluded$_);
20425
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$10);
19739
20426
  // Access theme if needed for future enhancements
19740
20427
  var {
19741
20428
  themeMode
@@ -19973,7 +20660,7 @@
19973
20660
  bounce: 'width 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55), transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55)'
19974
20661
  };
19975
20662
 
19976
- var _excluded$$ = ["children", "showToggleButton", "views"],
20663
+ var _excluded$11 = ["children", "showToggleButton", "views"],
19977
20664
  _excluded2$f = ["children", "views"],
19978
20665
  _excluded3$a = ["children", "views"],
19979
20666
  _excluded4$9 = ["children", "position", "size", "variant", "fixed", "hasBackdrop", "expandedWidth", "collapsedWidth", "breakpointBehavior", "elevation", "transitionPreset", "ariaLabel", "isExpanded", "isMobile", "collapse", "views", "themeMode"];
@@ -20006,7 +20693,7 @@
20006
20693
  showToggleButton = true,
20007
20694
  views
20008
20695
  } = _ref2,
20009
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$$);
20696
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$11);
20010
20697
  var {
20011
20698
  isExpanded,
20012
20699
  toggleExpanded,
@@ -20161,7 +20848,7 @@
20161
20848
  }))));
20162
20849
  };
20163
20850
 
20164
- var _excluded$10 = ["children", "position", "size", "variant", "defaultExpanded", "expanded", "onExpandedChange", "fixed", "hasBackdrop", "showToggleButton", "expandedWidth", "collapsedWidth", "breakpoint", "breakpointBehavior", "views"];
20851
+ var _excluded$12 = ["children", "position", "size", "variant", "defaultExpanded", "expanded", "onExpandedChange", "fixed", "hasBackdrop", "showToggleButton", "expandedWidth", "collapsedWidth", "breakpoint", "breakpointBehavior", "views"];
20165
20852
  /**
20166
20853
  * Sidebar component for creating collapsible, themeable and customizable sidebars.
20167
20854
  */
@@ -20183,7 +20870,7 @@
20183
20870
  breakpointBehavior = 'overlay',
20184
20871
  views
20185
20872
  } = _ref,
20186
- props = _objectWithoutPropertiesLoose(_ref, _excluded$10);
20873
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$12);
20187
20874
  var {
20188
20875
  isExpanded,
20189
20876
  toggleExpanded,
@@ -20648,7 +21335,7 @@
20648
21335
  }
20649
21336
  };
20650
21337
 
20651
- var _excluded$11 = ["children", "id", "defaultSize", "minSize", "maxSize", "collapsible", "defaultCollapsed", "onCollapseChange", "views"],
21338
+ var _excluded$13 = ["children", "id", "defaultSize", "minSize", "maxSize", "collapsible", "defaultCollapsed", "onCollapseChange", "views"],
20652
21339
  _excluded2$g = ["id", "position", "disabled", "withVisualIndicator", "withCollapseButton", "collapseTarget", "views"],
20653
21340
  _excluded3$b = ["children", "orientation", "size", "variant", "defaultSizes", "minSize", "maxSize", "collapsible", "containerRef", "autoSaveId", "views"];
20654
21341
  // Create context for the Resizable component
@@ -20693,7 +21380,7 @@
20693
21380
  onCollapseChange,
20694
21381
  views
20695
21382
  } = _ref2,
20696
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$11);
21383
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$13);
20697
21384
  var {
20698
21385
  orientation,
20699
21386
  registerPanel,
@@ -20908,7 +21595,7 @@
20908
21595
  }, ResizableOrientations[orientation], views == null ? void 0 : views.container, props), children);
20909
21596
  };
20910
21597
 
20911
- var _excluded$12 = ["children", "orientation", "size", "variant", "defaultSizes", "onSizesChange", "minSize", "maxSize", "collapsible", "autoSaveId", "storage", "keyboardResizeBy", "views"];
21598
+ var _excluded$14 = ["children", "orientation", "size", "variant", "defaultSizes", "onSizesChange", "minSize", "maxSize", "collapsible", "autoSaveId", "storage", "keyboardResizeBy", "views"];
20912
21599
  /**
20913
21600
  * Resizable component for creating resizable panel groups and layouts.
20914
21601
  */
@@ -20928,7 +21615,7 @@
20928
21615
  keyboardResizeBy = 10,
20929
21616
  views
20930
21617
  } = _ref,
20931
- props = _objectWithoutPropertiesLoose(_ref, _excluded$12);
21618
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$14);
20932
21619
  var {
20933
21620
  isResizing,
20934
21621
  setIsResizing,
@@ -21696,7 +22383,7 @@
21696
22383
  color: 'color.gray.500'
21697
22384
  };
21698
22385
 
21699
- var _excluded$13 = ["value", "onValueChange", "placeholder", "views"],
22386
+ var _excluded$15 = ["value", "onValueChange", "placeholder", "views"],
21700
22387
  _excluded2$h = ["children", "views"],
21701
22388
  _excluded3$c = ["heading", "children", "views"],
21702
22389
  _excluded4$a = ["item", "selected", "onSelect", "views"],
@@ -21728,7 +22415,7 @@
21728
22415
  placeholder = 'Type a command or search...',
21729
22416
  views
21730
22417
  } = _ref2,
21731
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$13);
22418
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$15);
21732
22419
  var inputRef = React.useRef(null);
21733
22420
  // Focus input when component mounts
21734
22421
  React__default.useEffect(() => {
@@ -21911,7 +22598,7 @@
21911
22598
  })))), footer && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, CommandFooterStyles, views == null ? void 0 : views.footer), footer)))));
21912
22599
  };
21913
22600
 
21914
- var _excluded$14 = ["open", "onOpenChange", "groups", "commands", "placeholder", "size", "variant", "filter", "emptyState", "footer", "views"];
22601
+ var _excluded$16 = ["open", "onOpenChange", "groups", "commands", "placeholder", "size", "variant", "filter", "emptyState", "footer", "views"];
21915
22602
  /**
21916
22603
  * Command component for displaying a command palette with search functionality.
21917
22604
  */
@@ -21929,7 +22616,7 @@
21929
22616
  footer,
21930
22617
  views
21931
22618
  } = _ref,
21932
- props = _objectWithoutPropertiesLoose(_ref, _excluded$14);
22619
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$16);
21933
22620
  var {
21934
22621
  search,
21935
22622
  setSearch,
@@ -22108,65 +22795,6 @@
22108
22795
  };
22109
22796
  // For backward compatibility
22110
22797
  var TooltipVariants = /*#__PURE__*/getTooltip();
22111
- var getTooltipPositionStyles = (position, align) => {
22112
- var baseStyles = {
22113
- position: 'absolute',
22114
- zIndex: 1000
22115
- };
22116
- // Position styles
22117
- switch (position) {
22118
- case 'top':
22119
- return Object.assign({}, baseStyles, {
22120
- bottom: '100%',
22121
- marginBottom: '8px'
22122
- }, align === 'start' ? {
22123
- left: '0'
22124
- } : align === 'end' ? {
22125
- right: '0'
22126
- } : {
22127
- left: '50%',
22128
- transform: 'translateX(-50%)'
22129
- });
22130
- case 'right':
22131
- return Object.assign({}, baseStyles, {
22132
- left: '100%',
22133
- marginLeft: '8px'
22134
- }, align === 'start' ? {
22135
- top: '0'
22136
- } : align === 'end' ? {
22137
- bottom: '0'
22138
- } : {
22139
- top: '50%',
22140
- transform: 'translateY(-50%)'
22141
- });
22142
- case 'bottom':
22143
- return Object.assign({}, baseStyles, {
22144
- top: '100%',
22145
- marginTop: '8px'
22146
- }, align === 'start' ? {
22147
- left: '0'
22148
- } : align === 'end' ? {
22149
- right: '0'
22150
- } : {
22151
- left: '50%',
22152
- transform: 'translateX(-50%)'
22153
- });
22154
- case 'left':
22155
- return Object.assign({}, baseStyles, {
22156
- right: '100%',
22157
- marginRight: '8px'
22158
- }, align === 'start' ? {
22159
- top: '0'
22160
- } : align === 'end' ? {
22161
- bottom: '0'
22162
- } : {
22163
- top: '50%',
22164
- transform: 'translateY(-50%)'
22165
- });
22166
- default:
22167
- return baseStyles;
22168
- }
22169
- };
22170
22798
  var getArrowStyles = position => {
22171
22799
  var baseStyles = {
22172
22800
  position: 'absolute',
@@ -22216,7 +22844,7 @@
22216
22844
  }
22217
22845
  };
22218
22846
 
22219
- var _excluded$15 = ["children", "views", "asChild"],
22847
+ var _excluded$17 = ["children", "views", "asChild"],
22220
22848
  _excluded2$i = ["children", "views"],
22221
22849
  _excluded3$d = ["content", "children", "position", "align", "size", "variant", "showArrow", "views", "themeMode"];
22222
22850
  // Create context for the Tooltip
@@ -22252,7 +22880,7 @@
22252
22880
  views,
22253
22881
  asChild = false
22254
22882
  } = _ref2,
22255
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$15);
22883
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$17);
22256
22884
  var {
22257
22885
  openTooltip,
22258
22886
  closeTooltip,
@@ -22321,17 +22949,113 @@
22321
22949
  props = _objectWithoutPropertiesLoose(_ref4, _excluded3$d);
22322
22950
  var {
22323
22951
  isOpen,
22324
- // openTooltip,
22325
- // closeTooltip,
22326
- // triggerRef,
22952
+ triggerRef,
22327
22953
  contentRef,
22328
22954
  contentId,
22329
22955
  triggerId
22330
22956
  } = useTooltipContext();
22331
- // Get position styles
22332
- var positionStyles = getTooltipPositionStyles(position, align);
22333
- // Get arrow styles
22334
- var arrowStyles = showArrow ? getArrowStyles(position) : {};
22957
+ var [optimalPosition, setOptimalPosition] = React.useState({
22958
+ x: 0,
22959
+ y: 0,
22960
+ placement: position
22961
+ });
22962
+ // Calculate optimal position when the tooltip opens
22963
+ React.useEffect(() => {
22964
+ if (isOpen && contentRef != null && contentRef.current && triggerRef != null && triggerRef.current) {
22965
+ var contentRect = contentRef.current.getBoundingClientRect();
22966
+ var triggerRect = triggerRef.current.getBoundingClientRect();
22967
+ // Get content dimensions
22968
+ var contentWidth = Math.max(contentRect.width || 120, 120);
22969
+ var contentHeight = Math.max(contentRect.height || 32, 32);
22970
+ // Get viewport dimensions
22971
+ var viewportWidth = window.innerWidth;
22972
+ var viewportHeight = window.innerHeight;
22973
+ // Calculate available space on all sides from the trigger
22974
+ var availableSpace = {
22975
+ top: triggerRect.top,
22976
+ right: viewportWidth - triggerRect.right,
22977
+ bottom: viewportHeight - triggerRect.bottom,
22978
+ left: triggerRect.left
22979
+ };
22980
+ // Determine optimal placement based on available space and preferred position
22981
+ var placements = [{
22982
+ placement: 'top',
22983
+ space: availableSpace.top,
22984
+ fits: availableSpace.top >= contentHeight + 16,
22985
+ x: align === 'start' ? triggerRect.left : align === 'end' ? triggerRect.right - contentWidth : triggerRect.left + triggerRect.width / 2 - contentWidth / 2,
22986
+ y: triggerRect.top - contentHeight - 8
22987
+ }, {
22988
+ placement: 'bottom',
22989
+ space: availableSpace.bottom,
22990
+ fits: availableSpace.bottom >= contentHeight + 16,
22991
+ x: align === 'start' ? triggerRect.left : align === 'end' ? triggerRect.right - contentWidth : triggerRect.left + triggerRect.width / 2 - contentWidth / 2,
22992
+ y: triggerRect.bottom + 8
22993
+ }, {
22994
+ placement: 'right',
22995
+ space: availableSpace.right,
22996
+ fits: availableSpace.right >= contentWidth + 16,
22997
+ x: triggerRect.right + 8,
22998
+ y: align === 'start' ? triggerRect.top : align === 'end' ? triggerRect.bottom - contentHeight : triggerRect.top + triggerRect.height / 2 - contentHeight / 2
22999
+ }, {
23000
+ placement: 'left',
23001
+ space: availableSpace.left,
23002
+ fits: availableSpace.left >= contentWidth + 16,
23003
+ x: triggerRect.left - contentWidth - 8,
23004
+ y: align === 'start' ? triggerRect.top : align === 'end' ? triggerRect.bottom - contentHeight : triggerRect.top + triggerRect.height / 2 - contentHeight / 2
23005
+ }];
23006
+ // First try the preferred position if it fits
23007
+ var preferredPlacement = placements.find(p => p.placement === position && p.fits);
23008
+ if (preferredPlacement) {
23009
+ setOptimalPosition({
23010
+ x: preferredPlacement.x,
23011
+ y: preferredPlacement.y,
23012
+ placement: preferredPlacement.placement
23013
+ });
23014
+ return;
23015
+ }
23016
+ // Otherwise, find the best fitting placement
23017
+ var fittingPlacement = placements.find(p => p.fits);
23018
+ if (fittingPlacement) {
23019
+ setOptimalPosition({
23020
+ x: fittingPlacement.x,
23021
+ y: fittingPlacement.y,
23022
+ placement: fittingPlacement.placement
23023
+ });
23024
+ return;
23025
+ }
23026
+ // If nothing fits, choose the placement with the most space
23027
+ var bestPlacement = placements.reduce((best, current) => current.space > best.space ? current : best);
23028
+ // Ensure the content stays within viewport bounds
23029
+ var finalX = bestPlacement.x;
23030
+ var finalY = bestPlacement.y;
23031
+ if (finalX + contentWidth > viewportWidth) {
23032
+ finalX = viewportWidth - contentWidth - 8;
23033
+ }
23034
+ if (finalX < 8) {
23035
+ finalX = 8;
23036
+ }
23037
+ if (finalY + contentHeight > viewportHeight) {
23038
+ finalY = viewportHeight - contentHeight - 8;
23039
+ }
23040
+ if (finalY < 8) {
23041
+ finalY = 8;
23042
+ }
23043
+ setOptimalPosition({
23044
+ x: finalX,
23045
+ y: finalY,
23046
+ placement: bestPlacement.placement
23047
+ });
23048
+ }
23049
+ }, [isOpen, position, align, triggerRef, contentRef]);
23050
+ // Get arrow styles based on optimal placement
23051
+ var arrowStyles = showArrow ? getArrowStyles(optimalPosition.placement) : {};
23052
+ // Create intelligent positioning styles
23053
+ var positionStyles = {
23054
+ position: 'fixed',
23055
+ left: optimalPosition.x,
23056
+ top: optimalPosition.y,
23057
+ zIndex: 1000
23058
+ };
22335
23059
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
22336
23060
  position: "relative",
22337
23061
  display: "inline-block"
@@ -22341,11 +23065,18 @@
22341
23065
  role: "tooltip",
22342
23066
  "aria-labelledby": triggerId,
22343
23067
  borderRadius: 4,
22344
- boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)"
22345
- }, TooltipSizes[size], TooltipVariants[variant], positionStyles, views == null ? void 0 : views.content), typeof content === 'string' ? (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({}, views == null ? void 0 : views.text), content)) : content, showArrow && /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, arrowStyles, views == null ? void 0 : views.arrow)))));
23068
+ boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.15)",
23069
+ style: positionStyles
23070
+ }, TooltipSizes[size], TooltipVariants[variant], views == null ? void 0 : views.content), typeof content === 'string' ? (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({}, views == null ? void 0 : views.text), content)) : content, showArrow && /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, arrowStyles, views == null ? void 0 : views.arrow)), (/*#__PURE__*/React__default.createElement("div", {
23071
+ style: {
23072
+ fontSize: '8px',
23073
+ opacity: 0.7,
23074
+ marginTop: '2px'
23075
+ }
23076
+ }, "Placement: ", optimalPosition.placement)))));
22346
23077
  };
22347
23078
 
22348
- var _excluded$16 = ["content", "children", "position", "align", "size", "variant", "openDelay", "closeDelay", "showArrow", "defaultOpen", "isDisabled", "views"];
23079
+ var _excluded$18 = ["content", "children", "position", "align", "size", "variant", "openDelay", "closeDelay", "showArrow", "defaultOpen", "isDisabled", "views"];
22349
23080
  /**
22350
23081
  * Tooltip component for displaying additional information when hovering over an element.
22351
23082
  * Supports configurable positions, delays, and styling.
@@ -22365,7 +23096,7 @@
22365
23096
  isDisabled = false,
22366
23097
  views
22367
23098
  } = _ref,
22368
- props = _objectWithoutPropertiesLoose(_ref, _excluded$16);
23099
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$18);
22369
23100
  var tooltipState = useTooltipState({
22370
23101
  defaultOpen,
22371
23102
  openDelay,
@@ -22838,7 +23569,7 @@
22838
23569
  }
22839
23570
  };
22840
23571
 
22841
- var _excluded$17 = ["children", "views", "baseId"],
23572
+ var _excluded$19 = ["children", "views", "baseId"],
22842
23573
  _excluded2$j = ["value", "disabled", "icon", "children", "views", "style", "draggable"],
22843
23574
  _excluded3$e = ["children", "onClick", "onToggleExpand", "hasChildren", "expanded", "icon", "disabled", "isSelected", "isDragging", "size", "variant", "views"],
22844
23575
  _excluded4$b = ["children", "views"];
@@ -22874,7 +23605,7 @@
22874
23605
  baseId
22875
23606
  // themeMode, // If 'app-studio' ViewProps supports themeMode
22876
23607
  } = _ref2,
22877
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$17);
23608
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$19);
22878
23609
  var {
22879
23610
  allowDragAndDrop,
22880
23611
  handleDrop,
@@ -23154,7 +23885,7 @@
23154
23885
  }))));
23155
23886
  };
23156
23887
 
23157
- var _excluded$18 = ["children", "items", "size", "variant", "defaultExpandedItems", "expandedItems", "onExpandedItemsChange", "defaultSelectedItem", "selectedItem", "onItemSelect", "multiSelect", "allowDragAndDrop", "dragHandleIcon", "onItemsReorder", "onDragStart", "onDragEnd", "views"];
23888
+ var _excluded$1a = ["children", "items", "size", "variant", "defaultExpandedItems", "expandedItems", "onExpandedItemsChange", "defaultSelectedItem", "selectedItem", "onItemSelect", "multiSelect", "allowDragAndDrop", "dragHandleIcon", "onItemsReorder", "onDragStart", "onDragEnd", "views"];
23158
23889
  /**
23159
23890
  * Tree component for displaying hierarchical data.
23160
23891
  * Supports both compound component pattern (using Tree.Item, Tree.ItemLabel, Tree.ItemContent)
@@ -23223,7 +23954,7 @@
23223
23954
  views // Global views configuration
23224
23955
  // Remaining ViewProps for the root TreeView container
23225
23956
  } = _ref,
23226
- props = _objectWithoutPropertiesLoose(_ref, _excluded$18);
23957
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1a);
23227
23958
  var treeState = useTreeState({
23228
23959
  defaultExpandedItems,
23229
23960
  expandedItems,
@@ -23796,7 +24527,7 @@
23796
24527
  }
23797
24528
  };
23798
24529
 
23799
- var _excluded$19 = ["node", "onSelect", "isSelected", "isDragging", "onDragStart", "onDrag", "onDragEnd", "size", "variant", "views"],
24530
+ var _excluded$1b = ["node", "onSelect", "isSelected", "isDragging", "onDragStart", "onDrag", "onDragEnd", "size", "variant", "views"],
23800
24531
  _excluded2$k = ["onZoomIn", "onZoomOut", "onReset", "views"],
23801
24532
  _excluded3$f = ["onClick", "views"],
23802
24533
  _excluded4$c = ["nodes", "edges", "selectedNodeId", "draggedNodeId", "onNodeSelect", "onAddNode", "onNodeDragStart", "onNodeDrag", "onNodeDragEnd", "size", "variant", "direction", "showControls", "allowAddingNodes", "allowDraggingNodes", "views", "baseId", "viewport", "onZoomIn", "onZoomOut", "onReset", "onViewportChange"];
@@ -23812,7 +24543,7 @@
23812
24543
  variant = 'default',
23813
24544
  views
23814
24545
  } = _ref,
23815
- props = _objectWithoutPropertiesLoose(_ref, _excluded$19);
24546
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1b);
23816
24547
  var handleClick = () => {
23817
24548
  if (onSelect) {
23818
24549
  onSelect(node.id);
@@ -24459,7 +25190,7 @@
24459
25190
  }, "Zoom: ", Math.round(viewport.zoom * 100), "%")));
24460
25191
  };
24461
25192
 
24462
- var _excluded$1a = ["children", "nodes", "edges", "size", "variant", "direction", "showControls", "allowAddingNodes", "allowDraggingNodes", "onNodesChange", "onEdgesChange", "onNodeSelect", "onNodeAdd", "onNodeDragStart", "onNodeDrag", "onNodeDragEnd", "selectedNodeId", "initialViewport", "viewport", "onViewportChange", "views"];
25193
+ var _excluded$1c = ["children", "nodes", "edges", "size", "variant", "direction", "showControls", "allowAddingNodes", "allowDraggingNodes", "onNodesChange", "onEdgesChange", "onNodeSelect", "onNodeAdd", "onNodeDragStart", "onNodeDrag", "onNodeDragEnd", "selectedNodeId", "initialViewport", "viewport", "onViewportChange", "views"];
24463
25194
  /**
24464
25195
  * Flow component for creating workflow diagrams.
24465
25196
  *
@@ -24516,7 +25247,7 @@
24516
25247
  onViewportChange,
24517
25248
  views
24518
25249
  } = _ref,
24519
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1a);
25250
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1c);
24520
25251
  var flowState = useFlowState({
24521
25252
  initialNodes: controlledNodes,
24522
25253
  initialEdges: controlledEdges,
@@ -24958,9 +25689,6 @@
24958
25689
  },
24959
25690
  rounded: {
24960
25691
  borderRadius: '8px'
24961
- },
24962
- pillShaped: {
24963
- borderRadius: '9999px'
24964
25692
  }
24965
25693
  };
24966
25694
  /**
@@ -25106,71 +25834,373 @@
25106
25834
  };
25107
25835
 
25108
25836
  var EditableInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
25837
+ var _containerRef$current, _containerRef$current2;
25109
25838
  var {
25110
25839
  value,
25111
25840
  onChange,
25112
- onSubmit,
25113
25841
  placeholder = 'Type your message...',
25114
25842
  disabled = false,
25115
25843
  autoFocus = true,
25844
+ suggestions = [],
25845
+ onSuggestionSelect,
25846
+ showSuggestions = false,
25847
+ mentionData = [],
25848
+ mentionTrigger = '@',
25849
+ onMentionSelect,
25850
+ maxHeight = '200px',
25851
+ minHeight = '40px',
25116
25852
  views = {}
25117
25853
  } = _ref;
25118
- var {
25119
- getColor
25120
- } = appStudio.useTheme();
25121
25854
  var lastValueRef = React.useRef(value);
25855
+ var [selectedSuggestionIndex, setSelectedSuggestionIndex] = React.useState(-1);
25856
+ var [showPlaceholder, setShowPlaceholder] = React.useState(!value);
25857
+ var containerRef = React.useRef(null);
25858
+ var [isFocused, setIsFocused] = React.useState(false);
25859
+ // Mention-specific state
25860
+ var [showMentions, setShowMentions] = React.useState(false);
25861
+ var [mentionQuery, setMentionQuery] = React.useState('');
25862
+ var [mentionStartPos, setMentionStartPos] = React.useState(-1);
25863
+ var [selectedMentionIndex, setSelectedMentionIndex] = React.useState(-1);
25864
+ var [filteredMentions, setFilteredMentions] = React.useState([]);
25865
+ // Positioning state for dropdowns
25866
+ var [mentionPosition, setMentionPosition] = React.useState({
25867
+ x: 0,
25868
+ y: 0
25869
+ });
25870
+ var [suggestionPosition, setSuggestionPosition] = React.useState({
25871
+ x: 0,
25872
+ y: 0
25873
+ });
25874
+ // Note: Using custom positioning logic for better control over dropdown placement
25122
25875
  // Update the content of the editable div when the value prop changes
25123
25876
  React.useEffect(() => {
25124
25877
  var editableDiv = ref;
25125
25878
  if (editableDiv.current && value !== lastValueRef.current) {
25126
25879
  editableDiv.current.textContent = value;
25127
25880
  lastValueRef.current = value;
25881
+ setShowPlaceholder(!value);
25128
25882
  }
25129
25883
  }, [value, ref]);
25884
+ // Auto-focus effect
25885
+ React.useEffect(() => {
25886
+ if (autoFocus && ref && typeof ref === 'object' && ref.current) {
25887
+ ref.current.focus();
25888
+ }
25889
+ }, [autoFocus, ref]);
25890
+ // Get cursor position
25891
+ var getCursorPosition = () => {
25892
+ var selection = window.getSelection();
25893
+ if (!selection || selection.rangeCount === 0) return -1;
25894
+ var range = selection.getRangeAt(0);
25895
+ var preCaretRange = range.cloneRange();
25896
+ preCaretRange.selectNodeContents(ref && typeof ref === 'object' && ref.current ? ref.current : document.body);
25897
+ preCaretRange.setEnd(range.endContainer, range.endOffset);
25898
+ return preCaretRange.toString().length;
25899
+ };
25900
+ // Check for mention trigger and filter mentions
25901
+ var checkForMentions = React.useCallback((text, cursorPos) => {
25902
+ var beforeCursor = text.substring(0, cursorPos);
25903
+ var triggerIndex = beforeCursor.lastIndexOf(mentionTrigger);
25904
+ if (triggerIndex !== -1) {
25905
+ var afterTrigger = beforeCursor.substring(triggerIndex + 1);
25906
+ var hasSpaceAfterTrigger = afterTrigger.includes(' ');
25907
+ if (!hasSpaceAfterTrigger) {
25908
+ var query = afterTrigger.toLowerCase();
25909
+ var filtered = mentionData.filter(mention => mention.name.toLowerCase().includes(query));
25910
+ setMentionQuery(query);
25911
+ setMentionStartPos(triggerIndex);
25912
+ setFilteredMentions(filtered);
25913
+ setShowMentions(filtered.length > 0);
25914
+ setSelectedMentionIndex(0);
25915
+ // Calculate position for mentions dropdown
25916
+ var position = calculateDropdownPosition();
25917
+ setMentionPosition(position);
25918
+ return;
25919
+ }
25920
+ }
25921
+ setShowMentions(false);
25922
+ setMentionQuery('');
25923
+ setMentionStartPos(-1);
25924
+ setSelectedMentionIndex(-1);
25925
+ }, [mentionData, mentionTrigger]);
25926
+ // Calculate optimal position for dropdowns
25927
+ var calculateDropdownPosition = React.useCallback(function (dropdownHeight) {
25928
+ if (dropdownHeight === void 0) {
25929
+ dropdownHeight = 200;
25930
+ }
25931
+ if (!containerRef.current) return {
25932
+ x: 0,
25933
+ y: 0
25934
+ };
25935
+ var containerRect = containerRef.current.getBoundingClientRect();
25936
+ var viewportHeight = window.innerHeight;
25937
+ var viewportWidth = window.innerWidth;
25938
+ // Calculate available space
25939
+ var availableSpace = {
25940
+ top: containerRect.top,
25941
+ bottom: viewportHeight - containerRect.bottom,
25942
+ left: containerRect.left,
25943
+ right: viewportWidth - containerRect.right
25944
+ };
25945
+ // Prefer bottom placement, but use top if not enough space
25946
+ var useTopPlacement = availableSpace.bottom < dropdownHeight + 8 && availableSpace.top > availableSpace.bottom;
25947
+ return {
25948
+ x: containerRect.left,
25949
+ y: useTopPlacement ? containerRect.top - dropdownHeight - 8 : containerRect.bottom + 8
25950
+ };
25951
+ }, []);
25952
+ // Handle focus events
25953
+ var handleFocus = React.useCallback(() => {
25954
+ setIsFocused(true);
25955
+ // Calculate position for suggestions when focused
25956
+ var position = calculateDropdownPosition();
25957
+ setSuggestionPosition(position);
25958
+ }, [calculateDropdownPosition]);
25959
+ var handleBlur = React.useCallback(() => {
25960
+ // Delay hiding to allow for dropdown interactions
25961
+ setTimeout(() => {
25962
+ setIsFocused(false);
25963
+ setSelectedSuggestionIndex(-1);
25964
+ }, 150);
25965
+ }, []);
25130
25966
  // Handle input events
25131
25967
  var handleInput = e => {
25132
25968
  var newValue = e.currentTarget.textContent || '';
25133
25969
  if (newValue !== lastValueRef.current) {
25134
25970
  onChange(newValue);
25135
25971
  lastValueRef.current = newValue;
25972
+ setShowPlaceholder(!newValue);
25973
+ // Check for mentions
25974
+ var cursorPos = getCursorPosition();
25975
+ checkForMentions(newValue, cursorPos);
25136
25976
  }
25137
25977
  };
25978
+ // Handle mention selection
25979
+ var handleMentionSelect = React.useCallback(mention => {
25980
+ if (ref && typeof ref === 'object' && ref.current) {
25981
+ var currentText = ref.current.textContent || '';
25982
+ var beforeMention = currentText.substring(0, mentionStartPos);
25983
+ var afterMention = currentText.substring(mentionStartPos + mentionTrigger.length + mentionQuery.length);
25984
+ var newText = beforeMention + mentionTrigger + mention.name + ' ' + afterMention;
25985
+ onChange(newText);
25986
+ lastValueRef.current = newText;
25987
+ ref.current.textContent = newText;
25988
+ // Set cursor position after the mention
25989
+ var newCursorPos = beforeMention.length + mentionTrigger.length + mention.name.length + 1;
25990
+ setTimeout(() => {
25991
+ if (ref.current) {
25992
+ var range = document.createRange();
25993
+ var selection = window.getSelection();
25994
+ var textNode = ref.current.firstChild;
25995
+ if (textNode && selection) {
25996
+ var _textNode$textContent;
25997
+ range.setStart(textNode, Math.min(newCursorPos, ((_textNode$textContent = textNode.textContent) == null ? void 0 : _textNode$textContent.length) || 0));
25998
+ range.collapse(true);
25999
+ selection.removeAllRanges();
26000
+ selection.addRange(range);
26001
+ }
26002
+ }
26003
+ }, 0);
26004
+ }
26005
+ setShowMentions(false);
26006
+ setMentionQuery('');
26007
+ setMentionStartPos(-1);
26008
+ setSelectedMentionIndex(-1);
26009
+ if (onMentionSelect) {
26010
+ onMentionSelect(mention);
26011
+ }
26012
+ }, [mentionStartPos, mentionTrigger, mentionQuery, onChange, onMentionSelect, ref]);
26013
+ // Handle suggestion selection
26014
+ var handleSuggestionSelect = React.useCallback(suggestion => {
26015
+ if (onSuggestionSelect) {
26016
+ onSuggestionSelect(suggestion);
26017
+ }
26018
+ setSelectedSuggestionIndex(-1);
26019
+ }, [onSuggestionSelect]);
25138
26020
  // Handle key down events
25139
26021
  var handleKeyDown = e => {
25140
- if (e.key === 'Enter' && !e.shiftKey) {
25141
- e.preventDefault();
25142
- onSubmit(e);
26022
+ // Handle mention navigation
26023
+ if (showMentions && filteredMentions.length > 0) {
26024
+ if (e.key === 'ArrowDown') {
26025
+ e.preventDefault();
26026
+ setSelectedMentionIndex(prev => prev < filteredMentions.length - 1 ? prev + 1 : 0);
26027
+ return;
26028
+ }
26029
+ if (e.key === 'ArrowUp') {
26030
+ e.preventDefault();
26031
+ setSelectedMentionIndex(prev => prev > 0 ? prev - 1 : filteredMentions.length - 1);
26032
+ return;
26033
+ }
26034
+ if ((e.key === 'Tab' || e.key === 'Enter') && selectedMentionIndex >= 0) {
26035
+ e.preventDefault();
26036
+ handleMentionSelect(filteredMentions[selectedMentionIndex]);
26037
+ return;
26038
+ }
26039
+ if (e.key === 'Escape') {
26040
+ setShowMentions(false);
26041
+ setSelectedMentionIndex(-1);
26042
+ return;
26043
+ }
26044
+ }
26045
+ // Handle suggestion navigation
26046
+ if (showSuggestions && suggestions.length > 0) {
26047
+ if (e.key === 'ArrowDown') {
26048
+ e.preventDefault();
26049
+ setSelectedSuggestionIndex(prev => prev < suggestions.length - 1 ? prev + 1 : 0);
26050
+ return;
26051
+ }
26052
+ if (e.key === 'ArrowUp') {
26053
+ e.preventDefault();
26054
+ setSelectedSuggestionIndex(prev => prev > 0 ? prev - 1 : suggestions.length - 1);
26055
+ return;
26056
+ }
26057
+ if (e.key === 'Tab' && selectedSuggestionIndex >= 0) {
26058
+ e.preventDefault();
26059
+ handleSuggestionSelect(suggestions[selectedSuggestionIndex]);
26060
+ return;
26061
+ }
26062
+ if (e.key === 'Escape') {
26063
+ setSelectedSuggestionIndex(-1);
26064
+ return;
26065
+ }
25143
26066
  }
26067
+ // Allow Enter for line breaks (remove submission on Enter)
26068
+ // Submission should only happen via the send button
25144
26069
  };
25145
26070
  return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26071
+ ref: containerRef,
25146
26072
  width: "100%",
25147
- minHeight: "40px",
25148
- maxHeight: "200px",
25149
- overflowY: "auto"
25150
- }, views == null ? void 0 : views.container), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26073
+ position: "relative"
26074
+ }, views == null ? void 0 : views.container), /*#__PURE__*/React__default.createElement(appStudio.View, {
26075
+ width: "100%",
26076
+ minHeight: minHeight,
26077
+ maxHeight: maxHeight,
26078
+ overflowY: "auto",
26079
+ position: "relative"
26080
+ }, showPlaceholder && (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
26081
+ position: "absolute",
26082
+ top: "8px",
26083
+ left: "8px",
26084
+ color: "color.gray.400",
26085
+ pointerEvents: "none",
26086
+ fontSize: "14px",
26087
+ lineHeight: "1.5",
26088
+ zIndex: 1
26089
+ }, views == null ? void 0 : views.placeholder), placeholder)), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
25151
26090
  as: "div",
25152
26091
  ref: ref,
25153
26092
  contentEditable: !disabled,
25154
26093
  suppressContentEditableWarning: true,
25155
26094
  onInput: handleInput,
25156
26095
  onKeyDown: handleKeyDown,
26096
+ onFocus: handleFocus,
26097
+ onBlur: handleBlur,
25157
26098
  role: "textbox",
25158
26099
  "aria-multiline": "true",
25159
26100
  "aria-placeholder": placeholder,
25160
- "data-placeholder": placeholder,
25161
26101
  width: "100%",
25162
26102
  minHeight: "24px",
26103
+ padding: "8px",
25163
26104
  outline: "none",
25164
26105
  whiteSpace: "pre-wrap",
25165
26106
  wordBreak: "break-word",
25166
- _empty: {
25167
- _before: {
25168
- content: 'attr(data-placeholder)',
25169
- color: 'color.gray.400',
25170
- pointerEvents: 'none'
25171
- }
26107
+ fontSize: "14px",
26108
+ lineHeight: "1.5",
26109
+ color: "color.gray.900",
26110
+ backgroundColor: "transparent"
26111
+ }, views == null ? void 0 : views.input))), showMentions && filteredMentions.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26112
+ position: "fixed",
26113
+ left: mentionPosition.x,
26114
+ top: mentionPosition.y,
26115
+ width: ((_containerRef$current = containerRef.current) == null ? void 0 : _containerRef$current.offsetWidth) || 300,
26116
+ backgroundColor: "color.white",
26117
+ border: "2px solid",
26118
+ borderColor: "color.blue.300",
26119
+ borderRadius: "8px",
26120
+ boxShadow: "0 8px 24px rgba(0, 0, 0, 0.15)",
26121
+ zIndex: 9999,
26122
+ maxHeight: "200px",
26123
+ overflowY: "auto"
26124
+ }, views == null ? void 0 : views.mentionContainer), /*#__PURE__*/React__default.createElement(appStudio.Vertical, {
26125
+ gap: 0
26126
+ }, filteredMentions.map((mention, index) => (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26127
+ key: mention.id,
26128
+ as: "button",
26129
+ type: "button",
26130
+ width: "100%",
26131
+ padding: "12px 16px",
26132
+ backgroundColor: index === selectedMentionIndex ? 'color.blue.50' : 'transparent',
26133
+ border: "none",
26134
+ cursor: "pointer",
26135
+ textAlign: "left",
26136
+ transition: "background-color 0.2s ease",
26137
+ onClick: () => handleMentionSelect(mention),
26138
+ onMouseEnter: () => setSelectedMentionIndex(index),
26139
+ _hover: {
26140
+ backgroundColor: 'color.blue.50'
25172
26141
  }
25173
- }, views == null ? void 0 : views.input)));
26142
+ }, views == null ? void 0 : views.mentionItem), /*#__PURE__*/React__default.createElement(appStudio.Vertical, {
26143
+ gap: 4
26144
+ }, /*#__PURE__*/React__default.createElement(appStudio.Text, {
26145
+ fontSize: "14px",
26146
+ color: "color.gray.900",
26147
+ fontWeight: "medium"
26148
+ }, mentionTrigger, mention.name), mention.description && (/*#__PURE__*/React__default.createElement(appStudio.Text, {
26149
+ fontSize: "12px",
26150
+ color: "color.gray.600"
26151
+ }, mention.description)))))), (/*#__PURE__*/React__default.createElement("div", {
26152
+ style: {
26153
+ fontSize: '8px',
26154
+ opacity: 0.7,
26155
+ padding: '4px'
26156
+ }
26157
+ }, "Mentions (Trigger: ", mentionTrigger, ")"))))), showSuggestions && suggestions.length > 0 && !showMentions && isFocused && !value && (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26158
+ position: "fixed",
26159
+ left: suggestionPosition.x,
26160
+ top: suggestionPosition.y,
26161
+ width: ((_containerRef$current2 = containerRef.current) == null ? void 0 : _containerRef$current2.offsetWidth) || 300,
26162
+ backgroundColor: "color.white",
26163
+ border: "2px solid",
26164
+ borderColor: "color.green.300",
26165
+ borderRadius: "8px",
26166
+ boxShadow: "0 8px 24px rgba(0, 0, 0, 0.15)",
26167
+ zIndex: 9998,
26168
+ maxHeight: "200px",
26169
+ overflowY: "auto"
26170
+ }, views == null ? void 0 : views.suggestionsContainer), /*#__PURE__*/React__default.createElement(appStudio.Vertical, {
26171
+ gap: 0
26172
+ }, suggestions.map((suggestion, index) => (/*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26173
+ key: suggestion.id,
26174
+ as: "button",
26175
+ type: "button",
26176
+ width: "100%",
26177
+ padding: "12px 16px",
26178
+ backgroundColor: index === selectedSuggestionIndex ? 'color.blue.50' : 'transparent',
26179
+ border: "none",
26180
+ cursor: "pointer",
26181
+ textAlign: "left",
26182
+ transition: "background-color 0.2s ease",
26183
+ onClick: () => handleSuggestionSelect(suggestion),
26184
+ onMouseEnter: () => setSelectedSuggestionIndex(index),
26185
+ _hover: {
26186
+ backgroundColor: 'color.blue.50'
26187
+ }
26188
+ }, views == null ? void 0 : views.suggestionItem), /*#__PURE__*/React__default.createElement(appStudio.Vertical, {
26189
+ gap: 4
26190
+ }, /*#__PURE__*/React__default.createElement(appStudio.Text, {
26191
+ fontSize: "14px",
26192
+ color: "color.gray.900",
26193
+ fontWeight: "medium"
26194
+ }, suggestion.text), suggestion.description && (/*#__PURE__*/React__default.createElement(appStudio.Text, {
26195
+ fontSize: "12px",
26196
+ color: "color.gray.600"
26197
+ }, suggestion.description)))))), (/*#__PURE__*/React__default.createElement("div", {
26198
+ style: {
26199
+ fontSize: '8px',
26200
+ opacity: 0.7,
26201
+ padding: '4px'
26202
+ }
26203
+ }, "Suggestions (Focus-triggered)"))))));
25174
26204
  });
25175
26205
  EditableInput.displayName = 'EditableInput';
25176
26206
 
@@ -25211,7 +26241,7 @@
25211
26241
  }, views == null ? void 0 : views.text), example.text)))));
25212
26242
  };
25213
26243
 
25214
- var _excluded$1b = ["onSubmit", "placeholder", "loading", "disabled", "isAgentRunning", "onStopAgent", "loadingText", "autoFocus", "sandboxId", "hideAttachments", "attachmentText", "promptExamples", "showReferenceImageButton", "errorMessage", "size", "shape", "variant", "views", "value", "handleChange", "handleSubmit", "editableRef", "fileInputRef", "isUploading", "isDraggingOver", "uploadedFiles", "removeUploadedFile", "setPendingFiles", "setUploadedFiles", "setIsUploading", "selectedModel", "handleModelChange", "modelOptions", "subscriptionStatus", "canAccessModel", "isGuideTipShown", "hideGuideTip", "isReferenceImageModalShown", "toggleReferenceImageModal", "handlePromptExampleSelect", "handleDragOver", "handleDragLeave", "handleReferenceImageUpload", "removeReferenceImage", "setFileAsReference"];
26244
+ var _excluded$1d = ["onSubmit", "placeholder", "loading", "disabled", "isAgentRunning", "leftButtons", "rightButtons", "onStopAgent", "loadingText", "autoFocus", "sandboxId", "hideAttachments", "attachmentText", "promptExamples", "showReferenceImageButton", "errorMessage", "size", "shape", "variant", "views", "mentionData", "mentionTrigger", "onMentionSelect", "value", "handleChange", "handleSubmit", "editableRef", "fileInputRef", "isUploading", "isDraggingOver", "uploadedFiles", "removeUploadedFile", "setPendingFiles", "setUploadedFiles", "setIsUploading", "selectedModel", "handleModelChange", "modelOptions", "subscriptionStatus", "canAccessModel", "isGuideTipShown", "hideGuideTip", "isReferenceImageModalShown", "toggleReferenceImageModal", "handlePromptExampleSelect", "handleDragOver", "handleDragLeave", "handleReferenceImageUpload", "removeReferenceImage", "setFileAsReference"];
25215
26245
  var ChatInputView = _ref => {
25216
26246
  var _value$trim$length;
25217
26247
  var {
@@ -25220,6 +26250,8 @@
25220
26250
  loading = false,
25221
26251
  disabled = false,
25222
26252
  isAgentRunning = false,
26253
+ leftButtons,
26254
+ rightButtons,
25223
26255
  loadingText = 'Agent is working...',
25224
26256
  autoFocus = true,
25225
26257
  sandboxId,
@@ -25232,6 +26264,9 @@
25232
26264
  shape = 'rounded',
25233
26265
  variant = 'default',
25234
26266
  views = {},
26267
+ mentionData = [],
26268
+ mentionTrigger = '@',
26269
+ onMentionSelect,
25235
26270
  // Props from state
25236
26271
  value,
25237
26272
  handleChange,
@@ -25251,7 +26286,7 @@
25251
26286
  setFileAsReference
25252
26287
  // Other props
25253
26288
  } = _ref,
25254
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1b);
26289
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1d);
25255
26290
  var {} = appStudio.useTheme();
25256
26291
  // Combine styles
25257
26292
  var containerStyles = Object.assign({}, DefaultChatInputStyles.container, Shapes$4[shape], views == null ? void 0 : views.container);
@@ -25343,16 +26378,18 @@
25343
26378
  color: "color.gray.500"
25344
26379
  }, loadingText))), /*#__PURE__*/React__default.createElement(appStudio.View, {
25345
26380
  position: "relative",
25346
- width: "100%"
26381
+ width: "100%",
26382
+ overflow: "visible"
25347
26383
  }, /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
25348
26384
  as: "form",
25349
26385
  onSubmit: handleSubmit,
25350
- overflowY: "auto",
26386
+ overflow: "visible",
25351
26387
  display: "flex",
25352
26388
  flexDirection: "column",
25353
26389
  position: "relative"
25354
26390
  }, contentStyles, containerStyles, {
25355
- paddingHorizontal: 20,
26391
+ paddingHorizontal: 16,
26392
+ paddingVertical: 10,
25356
26393
  backgroundColor: isDraggingOver ? 'color.blue.50' : undefined
25357
26394
  }), /*#__PURE__*/React__default.createElement(AttachmentGroup, {
25358
26395
  files: uploadedFiles,
@@ -25371,10 +26408,21 @@
25371
26408
  ref: editableRef,
25372
26409
  value: value || '',
25373
26410
  onChange: handleChange,
25374
- onSubmit: handleSubmit,
25375
26411
  placeholder: placeholder,
25376
26412
  disabled: disabled && !isAgentRunning,
25377
26413
  autoFocus: autoFocus,
26414
+ suggestions: (promptExamples == null ? void 0 : promptExamples.map(example => ({
26415
+ id: example.id,
26416
+ text: example.text,
26417
+ description: undefined
26418
+ }))) || [],
26419
+ showSuggestions: promptExamples && promptExamples.length > 0 && !value,
26420
+ onSuggestionSelect: suggestion => {
26421
+ handleChange(suggestion.text);
26422
+ },
26423
+ mentionData: mentionData,
26424
+ mentionTrigger: mentionTrigger,
26425
+ onMentionSelect: onMentionSelect,
25378
26426
  views: {
25379
26427
  container: {},
25380
26428
  input: views == null ? void 0 : views.editableInput
@@ -25400,7 +26448,7 @@
25400
26448
  views: {
25401
26449
  container: Object.assign({
25402
26450
  height: '36px',
25403
- margin: '0 12px',
26451
+ //margin: '0 12px',
25404
26452
  // borderRadius: '8px',
25405
26453
  // backgroundColor: 'transparent',
25406
26454
  // border: '1px solid',
@@ -25409,13 +26457,15 @@
25409
26457
  _hover: {
25410
26458
  backgroundColor: 'color.gray.100'
25411
26459
  }
25412
- }, views == null ? void 0 : views.fileButton, containerStyles)
26460
+ }, views == null ? void 0 : views.fileButton)
25413
26461
  },
25414
26462
  containerProps: {
25415
26463
  display: 'flex',
25416
26464
  alignItems: 'center',
25417
26465
  justifyContent: 'center',
25418
- gap: 4
26466
+ gap: 4,
26467
+ borderRadius: shape === 'rounded' ? '50%' : 4,
26468
+ padding: 10
25419
26469
  },
25420
26470
  textProps: {
25421
26471
  fontSize: '14px',
@@ -25427,9 +26477,13 @@
25427
26477
  }
25428
26478
  return null;
25429
26479
  }
25430
- }))), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
26480
+ })), leftButtons), /*#__PURE__*/React__default.createElement(appStudio.Horizontal, {
26481
+ gap: 8,
26482
+ alignItems: "center"
26483
+ }, /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
25431
26484
  as: "button",
25432
- type: "submit",
26485
+ type: "button",
26486
+ onClick: handleSubmit,
25433
26487
  height: "40px",
25434
26488
  width: "40px",
25435
26489
  display: "flex",
@@ -25437,7 +26491,7 @@
25437
26491
  justifyContent: "center",
25438
26492
  backgroundColor: isAgentRunning ? 'theme.error' : hasText ? 'theme.primary' : 'color.gray.300',
25439
26493
  color: "color.white",
25440
- borderRadius: "50%",
26494
+ borderRadius: shape === 'rounded' ? '50%' : 4,
25441
26495
  border: "none",
25442
26496
  cursor: hasText ? 'pointer' : 'not-allowed',
25443
26497
  disabled: !hasText || loading || disabled && !isAgentRunning,
@@ -25457,7 +26511,7 @@
25457
26511
  widthHeight: 16,
25458
26512
  color: "currentColor",
25459
26513
  filled: false
25460
- })))))), errorMessage && (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
26514
+ }))), rightButtons)))), errorMessage && (/*#__PURE__*/React__default.createElement(appStudio.Text, Object.assign({
25461
26515
  color: "theme.error",
25462
26516
  marginTop: "4px"
25463
26517
  }, views == null ? void 0 : views.bottomTip), errorMessage)));
@@ -25518,7 +26572,7 @@
25518
26572
  }
25519
26573
  };
25520
26574
 
25521
- var _excluded$1c = ["children", "showRadialGradient", "views", "themeMode"],
26575
+ var _excluded$1e = ["children", "showRadialGradient", "views", "themeMode"],
25522
26576
  _excluded2$l = ["number"],
25523
26577
  _excluded3$g = ["rows", "cols", "squareSize"],
25524
26578
  _excluded4$d = ["count", "colors", "speed", "shapes"],
@@ -25536,7 +26590,7 @@
25536
26590
  showRadialGradient = true,
25537
26591
  views
25538
26592
  } = _ref,
25539
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1c);
26593
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1e);
25540
26594
  var gradientColors = {
25541
26595
  white: 'rgba(255,255,255,1)',
25542
26596
  transparent: 'rgba(255,255,255,0)'
@@ -26092,6 +27146,7 @@
26092
27146
  exports.Switch = Switch;
26093
27147
  exports.Table = Table;
26094
27148
  exports.Tabs = Tabs;
27149
+ exports.TagInput = TagInput;
26095
27150
  exports.Text = Text;
26096
27151
  exports.TextArea = TextArea;
26097
27152
  exports.TextField = TextField;