@aurodesignsystem/auro-formkit 5.2.3 → 5.3.1

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 (55) hide show
  1. package/CHANGELOG.md +2 -10
  2. package/components/bibtemplate/dist/buttonVersion.d.ts +1 -1
  3. package/components/bibtemplate/dist/index.js +44 -88
  4. package/components/bibtemplate/dist/registered.js +44 -88
  5. package/components/checkbox/demo/api.min.js +14 -3
  6. package/components/checkbox/demo/index.min.js +14 -3
  7. package/components/checkbox/dist/index.js +14 -3
  8. package/components/checkbox/dist/registered.js +14 -3
  9. package/components/combobox/demo/api.js +2 -0
  10. package/components/combobox/demo/api.md +115 -1
  11. package/components/combobox/demo/api.min.js +350 -282
  12. package/components/combobox/demo/index.min.js +253 -204
  13. package/components/combobox/dist/auro-combobox.d.ts +9 -0
  14. package/components/combobox/dist/index.js +246 -200
  15. package/components/combobox/dist/registered.js +246 -200
  16. package/components/counter/demo/api.md +29 -1
  17. package/components/counter/demo/api.min.js +219 -185
  18. package/components/counter/demo/index.min.js +219 -185
  19. package/components/counter/dist/auro-counter-group.d.ts +9 -0
  20. package/components/counter/dist/index.js +219 -185
  21. package/components/counter/dist/registered.js +219 -185
  22. package/components/datepicker/demo/api.md +23 -1
  23. package/components/datepicker/demo/api.min.js +304 -294
  24. package/components/datepicker/demo/index.md +6 -6
  25. package/components/datepicker/demo/index.min.js +304 -294
  26. package/components/datepicker/dist/auro-datepicker.d.ts +9 -0
  27. package/components/datepicker/dist/buttonVersion.d.ts +1 -1
  28. package/components/datepicker/dist/index.js +304 -294
  29. package/components/datepicker/dist/registered.js +304 -294
  30. package/components/dropdown/demo/api.md +46 -2
  31. package/components/dropdown/demo/api.min.js +101 -1
  32. package/components/dropdown/demo/index.min.js +101 -1
  33. package/components/dropdown/dist/auro-dropdown.d.ts +10 -0
  34. package/components/dropdown/dist/index.js +101 -1
  35. package/components/dropdown/dist/registered.js +101 -1
  36. package/components/input/demo/api.min.js +62 -95
  37. package/components/input/demo/index.min.js +62 -95
  38. package/components/input/dist/buttonVersion.d.ts +1 -1
  39. package/components/input/dist/index.js +62 -95
  40. package/components/input/dist/registered.js +62 -95
  41. package/components/menu/demo/api.min.js +3 -0
  42. package/components/menu/demo/index.min.js +3 -0
  43. package/components/menu/dist/index.js +3 -0
  44. package/components/menu/dist/registered.js +3 -0
  45. package/components/radio/demo/api.min.js +14 -3
  46. package/components/radio/demo/index.min.js +14 -3
  47. package/components/radio/dist/index.js +14 -3
  48. package/components/radio/dist/registered.js +14 -3
  49. package/components/select/demo/api.md +29 -1
  50. package/components/select/demo/api.min.js +188 -107
  51. package/components/select/demo/index.min.js +188 -107
  52. package/components/select/dist/auro-select.d.ts +9 -0
  53. package/components/select/dist/index.js +181 -103
  54. package/components/select/dist/registered.js +181 -103
  55. package/package.json +5 -5
@@ -30,6 +30,7 @@
30
30
  | [onSlotChange](#onSlotChange) | `onSlotChange` | | | If declared, and a function is set, that function will execute when the slot content is updated. |
31
31
  | [placement](#placement) | `placement` | `string` | "bottom-start" | Position where the bib should appear relative to the trigger. |
32
32
  | [shape](#shape) | | | "undefined" | |
33
+ | [shift](#shift) | `shift` | `boolean` | "false" | If declared, the dropdown will shift its position to avoid being cut off by the viewport. |
33
34
  | [simple](#simple) | `simple` | `boolean` | | If declared, applies a border around the trigger slot. |
34
35
  | [size](#size) | | | "undefined" | |
35
36
 
@@ -658,12 +659,13 @@ On mobile view, adding the `fullscreenBreakpoint="{breakpoint-token}"` will swit
658
659
  </auro-accordion>
659
660
 
660
661
  ### Customized bib position
661
- The bib position can be customized with `placement`, `offset`, `flip`, `autoPlacement` attributes.
662
+ The bib position can be customized with `placement`, `offset`, `flip`, `autoPlacement`, and `shift` attributes.
662
663
 
663
664
  - `placement` specifies the preferred position where the bib should appear relative to the trigger.
664
665
  - `offset` sets the distance between the trigger and the bib.
665
666
  - When `autoPlacement` is enabled, smart positioning logic is applied to determine the best placement for the bib. If all sides have sufficient space, the bib will appear in the position specified by `placement`.
666
- - Unless `noFlip` is enabled, if there isn't enough space for the preferred `placement`, the bib will automatically flip to an alternative position.
667
+ - Unless `noFlip` is enabled, if there isn't enough space for the preferred `placement`, the bib will automatically flip to an alternative position.
668
+ - `shift` when enabled, adjusts the bib position when it would overflow the viewport boundaries, ensuring it remains visible.
667
669
 
668
670
  <div class="exampleWrapper">
669
671
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/floaterConfig.html) -->
@@ -734,6 +736,27 @@ The bib position can be customized with `placement`, `offset`, `flip`, `autoPlac
734
736
  Trigger for right bib with 20px offset, autoPlacement and noFlip
735
737
  </div>
736
738
  </auro-dropdown>
739
+ </div>
740
+ <div aria-label="custom label">
741
+ <auro-dropdown width="350px" class="floaterConfigDropdown" layout="classic" shape="classic" size="lg" chevron noFlip placement="bottom-start" shift offset="20">
742
+ <div width="500px">
743
+ <p>
744
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
745
+ </p>
746
+ <p>
747
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
748
+ </p>
749
+ <p>
750
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
751
+ </p>
752
+ </div>
753
+ <div slot="trigger">
754
+ Trigger
755
+ </div>
756
+ <div slot="helpText">
757
+ Trigger for bottom-start bib with 20px offset, shift and noFlip
758
+ </div>
759
+ </auro-dropdown>
737
760
  </div>
738
761
  <!-- AURO-GENERATED-CONTENT:END -->
739
762
  </div>
@@ -810,6 +833,27 @@ The bib position can be customized with `placement`, `offset`, `flip`, `autoPlac
810
833
  </div>
811
834
  </auro-dropdown>
812
835
  </div>
836
+ <div aria-label="custom label">
837
+ <auro-dropdown width="350px" class="floaterConfigDropdown" layout="classic" shape="classic" size="lg" chevron noFlip placement="bottom-start" shift offset="20">
838
+ <div width="500px">
839
+ <p>
840
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
841
+ </p>
842
+ <p>
843
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
844
+ </p>
845
+ <p>
846
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
847
+ </p>
848
+ </div>
849
+ <div slot="trigger">
850
+ Trigger
851
+ </div>
852
+ <div slot="helpText">
853
+ Trigger for bottom-start bib with 20px offset, shift and noFlip
854
+ </div>
855
+ </auro-dropdown>
856
+ </div>
813
857
  ```
814
858
  <!-- AURO-GENERATED-CONTENT:END -->
815
859
  </auro-accordion>
@@ -183,6 +183,9 @@ const oppositeAlignmentMap = {
183
183
  start: 'end',
184
184
  end: 'start'
185
185
  };
186
+ function clamp(start, value, end) {
187
+ return max(start, min(value, end));
188
+ }
186
189
  function evaluate(value, param) {
187
190
  return typeof value === 'function' ? value(param) : value;
188
191
  }
@@ -825,6 +828,84 @@ const offset$1 = function (options) {
825
828
  };
826
829
  };
827
830
 
831
+ /**
832
+ * Optimizes the visibility of the floating element by shifting it in order to
833
+ * keep it in view when it will overflow the clipping boundary.
834
+ * @see https://floating-ui.com/docs/shift
835
+ */
836
+ const shift$1 = function (options) {
837
+ if (options === void 0) {
838
+ options = {};
839
+ }
840
+ return {
841
+ name: 'shift',
842
+ options,
843
+ async fn(state) {
844
+ const {
845
+ x,
846
+ y,
847
+ placement
848
+ } = state;
849
+ const {
850
+ mainAxis: checkMainAxis = true,
851
+ crossAxis: checkCrossAxis = false,
852
+ limiter = {
853
+ fn: _ref => {
854
+ let {
855
+ x,
856
+ y
857
+ } = _ref;
858
+ return {
859
+ x,
860
+ y
861
+ };
862
+ }
863
+ },
864
+ ...detectOverflowOptions
865
+ } = evaluate(options, state);
866
+ const coords = {
867
+ x,
868
+ y
869
+ };
870
+ const overflow = await detectOverflow(state, detectOverflowOptions);
871
+ const crossAxis = getSideAxis(getSide(placement));
872
+ const mainAxis = getOppositeAxis(crossAxis);
873
+ let mainAxisCoord = coords[mainAxis];
874
+ let crossAxisCoord = coords[crossAxis];
875
+ if (checkMainAxis) {
876
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
877
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
878
+ const min = mainAxisCoord + overflow[minSide];
879
+ const max = mainAxisCoord - overflow[maxSide];
880
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
881
+ }
882
+ if (checkCrossAxis) {
883
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
884
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
885
+ const min = crossAxisCoord + overflow[minSide];
886
+ const max = crossAxisCoord - overflow[maxSide];
887
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
888
+ }
889
+ const limitedCoords = limiter.fn({
890
+ ...state,
891
+ [mainAxis]: mainAxisCoord,
892
+ [crossAxis]: crossAxisCoord
893
+ });
894
+ return {
895
+ ...limitedCoords,
896
+ data: {
897
+ x: limitedCoords.x - x,
898
+ y: limitedCoords.y - y,
899
+ enabled: {
900
+ [mainAxis]: checkMainAxis,
901
+ [crossAxis]: checkCrossAxis
902
+ }
903
+ }
904
+ };
905
+ }
906
+ };
907
+ };
908
+
828
909
  function hasWindow() {
829
910
  return typeof window !== 'undefined';
830
911
  }
@@ -1657,6 +1738,13 @@ const offset = offset$1;
1657
1738
  */
1658
1739
  const autoPlacement = autoPlacement$1;
1659
1740
 
1741
+ /**
1742
+ * Optimizes the visibility of the floating element by shifting it in order to
1743
+ * keep it in view when it will overflow the clipping boundary.
1744
+ * @see https://floating-ui.com/docs/shift
1745
+ */
1746
+ const shift = shift$1;
1747
+
1660
1748
  /**
1661
1749
  * Optimizes the visibility of the floating element by flipping the `placement`
1662
1750
  * in order to keep it in view when the preferred placement(s) will overflow the
@@ -1855,6 +1943,7 @@ class AuroFloatingUI {
1855
1943
  // Define the middlware for the floater configuration
1856
1944
  const middleware = [
1857
1945
  offset(this.element.floaterConfig?.offset || 0),
1946
+ ...this.element.floaterConfig?.shift ? [shift()] : [], // Add shift middleware if shift is enabled.
1858
1947
  ...this.element.floaterConfig?.flip ? [flip()] : [], // Add flip middleware if flip is enabled.
1859
1948
  ...this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : [], // Add autoPlacement middleware if autoPlacement is enabled.
1860
1949
  ];
@@ -3254,7 +3343,7 @@ var classicLayoutCss = i$2`:host([layout*=classic]){position:relative;max-width:
3254
3343
 
3255
3344
  var styleEmphasizedCss = i$2`.layout-emphasized .chevron,.layout-emphasized-left .chevron,.layout-emphasized-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=right])) .leftIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left])) .rightIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left]):not([layout*=right])) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}`;
3256
3345
 
3257
- var styleSnowflakeCss = i$2`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}`;
3346
+ var styleSnowflakeCss = i$2`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-left:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-right:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-200, 1rem)}`;
3258
3347
 
3259
3348
  var colorCss = i$2`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
3260
3349
 
@@ -3645,6 +3734,7 @@ class AuroDropdown extends AuroElement {
3645
3734
  this.placement = 'bottom-start';
3646
3735
  this.offset = 0;
3647
3736
  this.noFlip = false;
3737
+ this.shift = false;
3648
3738
  this.autoPlacement = false;
3649
3739
 
3650
3740
  /**
@@ -3709,6 +3799,7 @@ class AuroDropdown extends AuroElement {
3709
3799
  return {
3710
3800
  placement: this.placement,
3711
3801
  flip: !this.noFlip,
3802
+ shift: this.shift,
3712
3803
  autoPlacement: this.autoPlacement,
3713
3804
  offset: this.offset,
3714
3805
  };
@@ -3909,6 +4000,15 @@ class AuroDropdown extends AuroElement {
3909
4000
  reflect: true
3910
4001
  },
3911
4002
 
4003
+ /**
4004
+ * If declared, the dropdown will shift its position to avoid being cut off by the viewport.
4005
+ * @default false
4006
+ */
4007
+ shift: {
4008
+ type: Boolean,
4009
+ reflect: true
4010
+ },
4011
+
3912
4012
  /**
3913
4013
  * If declared, the dropdown will not hide when moving focus outside the element.
3914
4014
  */
@@ -158,6 +158,9 @@ const oppositeAlignmentMap = {
158
158
  start: 'end',
159
159
  end: 'start'
160
160
  };
161
+ function clamp(start, value, end) {
162
+ return max(start, min(value, end));
163
+ }
161
164
  function evaluate(value, param) {
162
165
  return typeof value === 'function' ? value(param) : value;
163
166
  }
@@ -800,6 +803,84 @@ const offset$1 = function (options) {
800
803
  };
801
804
  };
802
805
 
806
+ /**
807
+ * Optimizes the visibility of the floating element by shifting it in order to
808
+ * keep it in view when it will overflow the clipping boundary.
809
+ * @see https://floating-ui.com/docs/shift
810
+ */
811
+ const shift$1 = function (options) {
812
+ if (options === void 0) {
813
+ options = {};
814
+ }
815
+ return {
816
+ name: 'shift',
817
+ options,
818
+ async fn(state) {
819
+ const {
820
+ x,
821
+ y,
822
+ placement
823
+ } = state;
824
+ const {
825
+ mainAxis: checkMainAxis = true,
826
+ crossAxis: checkCrossAxis = false,
827
+ limiter = {
828
+ fn: _ref => {
829
+ let {
830
+ x,
831
+ y
832
+ } = _ref;
833
+ return {
834
+ x,
835
+ y
836
+ };
837
+ }
838
+ },
839
+ ...detectOverflowOptions
840
+ } = evaluate(options, state);
841
+ const coords = {
842
+ x,
843
+ y
844
+ };
845
+ const overflow = await detectOverflow(state, detectOverflowOptions);
846
+ const crossAxis = getSideAxis(getSide(placement));
847
+ const mainAxis = getOppositeAxis(crossAxis);
848
+ let mainAxisCoord = coords[mainAxis];
849
+ let crossAxisCoord = coords[crossAxis];
850
+ if (checkMainAxis) {
851
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
852
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
853
+ const min = mainAxisCoord + overflow[minSide];
854
+ const max = mainAxisCoord - overflow[maxSide];
855
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
856
+ }
857
+ if (checkCrossAxis) {
858
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
859
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
860
+ const min = crossAxisCoord + overflow[minSide];
861
+ const max = crossAxisCoord - overflow[maxSide];
862
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
863
+ }
864
+ const limitedCoords = limiter.fn({
865
+ ...state,
866
+ [mainAxis]: mainAxisCoord,
867
+ [crossAxis]: crossAxisCoord
868
+ });
869
+ return {
870
+ ...limitedCoords,
871
+ data: {
872
+ x: limitedCoords.x - x,
873
+ y: limitedCoords.y - y,
874
+ enabled: {
875
+ [mainAxis]: checkMainAxis,
876
+ [crossAxis]: checkCrossAxis
877
+ }
878
+ }
879
+ };
880
+ }
881
+ };
882
+ };
883
+
803
884
  function hasWindow() {
804
885
  return typeof window !== 'undefined';
805
886
  }
@@ -1632,6 +1713,13 @@ const offset = offset$1;
1632
1713
  */
1633
1714
  const autoPlacement = autoPlacement$1;
1634
1715
 
1716
+ /**
1717
+ * Optimizes the visibility of the floating element by shifting it in order to
1718
+ * keep it in view when it will overflow the clipping boundary.
1719
+ * @see https://floating-ui.com/docs/shift
1720
+ */
1721
+ const shift = shift$1;
1722
+
1635
1723
  /**
1636
1724
  * Optimizes the visibility of the floating element by flipping the `placement`
1637
1725
  * in order to keep it in view when the preferred placement(s) will overflow the
@@ -1830,6 +1918,7 @@ class AuroFloatingUI {
1830
1918
  // Define the middlware for the floater configuration
1831
1919
  const middleware = [
1832
1920
  offset(this.element.floaterConfig?.offset || 0),
1921
+ ...this.element.floaterConfig?.shift ? [shift()] : [], // Add shift middleware if shift is enabled.
1833
1922
  ...this.element.floaterConfig?.flip ? [flip()] : [], // Add flip middleware if flip is enabled.
1834
1923
  ...this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : [], // Add autoPlacement middleware if autoPlacement is enabled.
1835
1924
  ];
@@ -3229,7 +3318,7 @@ var classicLayoutCss = i$2`:host([layout*=classic]){position:relative;max-width:
3229
3318
 
3230
3319
  var styleEmphasizedCss = i$2`.layout-emphasized .chevron,.layout-emphasized-left .chevron,.layout-emphasized-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=right])) .leftIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left])) .rightIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left]):not([layout*=right])) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}`;
3231
3320
 
3232
- var styleSnowflakeCss = i$2`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}`;
3321
+ var styleSnowflakeCss = i$2`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-left:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-right:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-200, 1rem)}`;
3233
3322
 
3234
3323
  var colorCss = i$2`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
3235
3324
 
@@ -3620,6 +3709,7 @@ class AuroDropdown extends AuroElement {
3620
3709
  this.placement = 'bottom-start';
3621
3710
  this.offset = 0;
3622
3711
  this.noFlip = false;
3712
+ this.shift = false;
3623
3713
  this.autoPlacement = false;
3624
3714
 
3625
3715
  /**
@@ -3684,6 +3774,7 @@ class AuroDropdown extends AuroElement {
3684
3774
  return {
3685
3775
  placement: this.placement,
3686
3776
  flip: !this.noFlip,
3777
+ shift: this.shift,
3687
3778
  autoPlacement: this.autoPlacement,
3688
3779
  offset: this.offset,
3689
3780
  };
@@ -3884,6 +3975,15 @@ class AuroDropdown extends AuroElement {
3884
3975
  reflect: true
3885
3976
  },
3886
3977
 
3978
+ /**
3979
+ * If declared, the dropdown will shift its position to avoid being cut off by the viewport.
3980
+ * @default false
3981
+ */
3982
+ shift: {
3983
+ type: Boolean,
3984
+ reflect: true
3985
+ },
3986
+
3887
3987
  /**
3888
3988
  * If declared, the dropdown will not hide when moving focus outside the element.
3889
3989
  */
@@ -144,6 +144,14 @@ export class AuroDropdown extends AuroElement {
144
144
  type: BooleanConstructor;
145
145
  reflect: boolean;
146
146
  };
147
+ /**
148
+ * If declared, the dropdown will shift its position to avoid being cut off by the viewport.
149
+ * @default false
150
+ */
151
+ shift: {
152
+ type: BooleanConstructor;
153
+ reflect: boolean;
154
+ };
147
155
  /**
148
156
  * If declared, the dropdown will not hide when moving focus outside the element.
149
157
  */
@@ -253,6 +261,7 @@ export class AuroDropdown extends AuroElement {
253
261
  placement: string;
254
262
  offset: number;
255
263
  noFlip: boolean;
264
+ shift: boolean;
256
265
  autoPlacement: boolean;
257
266
  /**
258
267
  * @private
@@ -294,6 +303,7 @@ export class AuroDropdown extends AuroElement {
294
303
  get floaterConfig(): {
295
304
  placement: string;
296
305
  flip: boolean;
306
+ shift: boolean;
297
307
  autoPlacement: boolean;
298
308
  offset: number;
299
309
  };
@@ -100,6 +100,9 @@ const oppositeAlignmentMap = {
100
100
  start: 'end',
101
101
  end: 'start'
102
102
  };
103
+ function clamp(start, value, end) {
104
+ return max(start, min(value, end));
105
+ }
103
106
  function evaluate(value, param) {
104
107
  return typeof value === 'function' ? value(param) : value;
105
108
  }
@@ -742,6 +745,84 @@ const offset$1 = function (options) {
742
745
  };
743
746
  };
744
747
 
748
+ /**
749
+ * Optimizes the visibility of the floating element by shifting it in order to
750
+ * keep it in view when it will overflow the clipping boundary.
751
+ * @see https://floating-ui.com/docs/shift
752
+ */
753
+ const shift$1 = function (options) {
754
+ if (options === void 0) {
755
+ options = {};
756
+ }
757
+ return {
758
+ name: 'shift',
759
+ options,
760
+ async fn(state) {
761
+ const {
762
+ x,
763
+ y,
764
+ placement
765
+ } = state;
766
+ const {
767
+ mainAxis: checkMainAxis = true,
768
+ crossAxis: checkCrossAxis = false,
769
+ limiter = {
770
+ fn: _ref => {
771
+ let {
772
+ x,
773
+ y
774
+ } = _ref;
775
+ return {
776
+ x,
777
+ y
778
+ };
779
+ }
780
+ },
781
+ ...detectOverflowOptions
782
+ } = evaluate(options, state);
783
+ const coords = {
784
+ x,
785
+ y
786
+ };
787
+ const overflow = await detectOverflow(state, detectOverflowOptions);
788
+ const crossAxis = getSideAxis(getSide(placement));
789
+ const mainAxis = getOppositeAxis(crossAxis);
790
+ let mainAxisCoord = coords[mainAxis];
791
+ let crossAxisCoord = coords[crossAxis];
792
+ if (checkMainAxis) {
793
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
794
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
795
+ const min = mainAxisCoord + overflow[minSide];
796
+ const max = mainAxisCoord - overflow[maxSide];
797
+ mainAxisCoord = clamp(min, mainAxisCoord, max);
798
+ }
799
+ if (checkCrossAxis) {
800
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
801
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
802
+ const min = crossAxisCoord + overflow[minSide];
803
+ const max = crossAxisCoord - overflow[maxSide];
804
+ crossAxisCoord = clamp(min, crossAxisCoord, max);
805
+ }
806
+ const limitedCoords = limiter.fn({
807
+ ...state,
808
+ [mainAxis]: mainAxisCoord,
809
+ [crossAxis]: crossAxisCoord
810
+ });
811
+ return {
812
+ ...limitedCoords,
813
+ data: {
814
+ x: limitedCoords.x - x,
815
+ y: limitedCoords.y - y,
816
+ enabled: {
817
+ [mainAxis]: checkMainAxis,
818
+ [crossAxis]: checkCrossAxis
819
+ }
820
+ }
821
+ };
822
+ }
823
+ };
824
+ };
825
+
745
826
  function hasWindow() {
746
827
  return typeof window !== 'undefined';
747
828
  }
@@ -1574,6 +1655,13 @@ const offset = offset$1;
1574
1655
  */
1575
1656
  const autoPlacement = autoPlacement$1;
1576
1657
 
1658
+ /**
1659
+ * Optimizes the visibility of the floating element by shifting it in order to
1660
+ * keep it in view when it will overflow the clipping boundary.
1661
+ * @see https://floating-ui.com/docs/shift
1662
+ */
1663
+ const shift = shift$1;
1664
+
1577
1665
  /**
1578
1666
  * Optimizes the visibility of the floating element by flipping the `placement`
1579
1667
  * in order to keep it in view when the preferred placement(s) will overflow the
@@ -1772,6 +1860,7 @@ class AuroFloatingUI {
1772
1860
  // Define the middlware for the floater configuration
1773
1861
  const middleware = [
1774
1862
  offset(this.element.floaterConfig?.offset || 0),
1863
+ ...this.element.floaterConfig?.shift ? [shift()] : [], // Add shift middleware if shift is enabled.
1775
1864
  ...this.element.floaterConfig?.flip ? [flip()] : [], // Add flip middleware if flip is enabled.
1776
1865
  ...this.element.floaterConfig?.autoPlacement ? [autoPlacement()] : [], // Add autoPlacement middleware if autoPlacement is enabled.
1777
1866
  ];
@@ -3165,7 +3254,7 @@ var classicLayoutCss = css`:host([layout*=classic]){position:relative;max-width:
3165
3254
 
3166
3255
  var styleEmphasizedCss = css`.layout-emphasized .chevron,.layout-emphasized-left .chevron,.layout-emphasized-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=right])) .leftIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left])) .rightIndent{width:calc(100% - var(--ds-size-300, 1.5rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=emphasized][shape*=pill]:not([layout*=left]):not([layout*=right])) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}`;
3167
3256
 
3168
- var styleSnowflakeCss = css`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-left:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-600, 3rem));margin-right:var(--ds-size-300, 1.5rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-300, 1.5rem)}`;
3257
+ var styleSnowflakeCss = css`:host([layout*=snowflake]) .leftIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-left:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .rightIndent{width:calc(100% - var(--ds-size-400, 2rem));margin-right:var(--ds-size-200, 1rem)}:host([layout*=snowflake]) .trigger,:host([layout*=snowflake]) .helpText{text-align:center}.layout-snowflake .chevron,.layout-snowflake-left .chevron,.layout-snowflake-right .chevron{margin-right:var(--ds-size-200, 1rem)}`;
3169
3258
 
3170
3259
  var colorCss = css`:host([error]){--ds-auro-helptext-color: var(--ds-basic-color-status-error, #e31f26)}:host([onDark]){--ds-auro-helptext-color: var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([onDark][error]){--ds-auro-helptext-color: var(--ds-advanced-color-state-error-inverse, #f9a4a8)}.helptext-wrapper{color:var(--ds-auro-helptext-color)}`;
3171
3260
 
@@ -3556,6 +3645,7 @@ class AuroDropdown extends AuroElement {
3556
3645
  this.placement = 'bottom-start';
3557
3646
  this.offset = 0;
3558
3647
  this.noFlip = false;
3648
+ this.shift = false;
3559
3649
  this.autoPlacement = false;
3560
3650
 
3561
3651
  /**
@@ -3620,6 +3710,7 @@ class AuroDropdown extends AuroElement {
3620
3710
  return {
3621
3711
  placement: this.placement,
3622
3712
  flip: !this.noFlip,
3713
+ shift: this.shift,
3623
3714
  autoPlacement: this.autoPlacement,
3624
3715
  offset: this.offset,
3625
3716
  };
@@ -3820,6 +3911,15 @@ class AuroDropdown extends AuroElement {
3820
3911
  reflect: true
3821
3912
  },
3822
3913
 
3914
+ /**
3915
+ * If declared, the dropdown will shift its position to avoid being cut off by the viewport.
3916
+ * @default false
3917
+ */
3918
+ shift: {
3919
+ type: Boolean,
3920
+ reflect: true
3921
+ },
3922
+
3823
3923
  /**
3824
3924
  * If declared, the dropdown will not hide when moving focus outside the element.
3825
3925
  */