@cloudscape-design/components 3.0.394 → 3.0.396

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 (96) hide show
  1. package/app-layout/drawer/index.d.ts.map +1 -1
  2. package/app-layout/drawer/index.js +5 -6
  3. package/app-layout/drawer/index.js.map +1 -1
  4. package/app-layout/drawer/interfaces.d.ts +2 -0
  5. package/app-layout/drawer/interfaces.d.ts.map +1 -1
  6. package/app-layout/drawer/interfaces.js.map +1 -1
  7. package/app-layout/index.d.ts.map +1 -1
  8. package/app-layout/index.js +25 -15
  9. package/app-layout/index.js.map +1 -1
  10. package/app-layout/mobile-toolbar/index.d.ts +3 -2
  11. package/app-layout/mobile-toolbar/index.d.ts.map +1 -1
  12. package/app-layout/mobile-toolbar/index.js +5 -6
  13. package/app-layout/mobile-toolbar/index.js.map +1 -1
  14. package/app-layout/test-classes/styles.css.js +17 -19
  15. package/app-layout/test-classes/styles.scoped.css +17 -25
  16. package/app-layout/test-classes/styles.selectors.js +17 -19
  17. package/app-layout/utils/use-drawers.d.ts +5 -3
  18. package/app-layout/utils/use-drawers.d.ts.map +1 -1
  19. package/app-layout/utils/use-drawers.js +36 -18
  20. package/app-layout/utils/use-drawers.js.map +1 -1
  21. package/app-layout/visual-refresh/context.d.ts +2 -1
  22. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  23. package/app-layout/visual-refresh/context.js +6 -2
  24. package/app-layout/visual-refresh/context.js.map +1 -1
  25. package/app-layout/visual-refresh/drawers.d.ts.map +1 -1
  26. package/app-layout/visual-refresh/drawers.js +19 -39
  27. package/app-layout/visual-refresh/drawers.js.map +1 -1
  28. package/app-layout/visual-refresh/layout.js +1 -1
  29. package/app-layout/visual-refresh/layout.js.map +1 -1
  30. package/app-layout/visual-refresh/mobile-toolbar.d.ts.map +1 -1
  31. package/app-layout/visual-refresh/mobile-toolbar.js +4 -6
  32. package/app-layout/visual-refresh/mobile-toolbar.js.map +1 -1
  33. package/app-layout/visual-refresh/split-panel.d.ts +3 -0
  34. package/app-layout/visual-refresh/split-panel.d.ts.map +1 -1
  35. package/app-layout/visual-refresh/split-panel.js +7 -7
  36. package/app-layout/visual-refresh/split-panel.js.map +1 -1
  37. package/app-layout/visual-refresh/styles.css.js +74 -75
  38. package/app-layout/visual-refresh/styles.scoped.css +171 -204
  39. package/app-layout/visual-refresh/styles.selectors.js +74 -75
  40. package/app-layout/visual-refresh/tools.d.ts +0 -6
  41. package/app-layout/visual-refresh/tools.d.ts.map +1 -1
  42. package/app-layout/visual-refresh/tools.js +2 -17
  43. package/app-layout/visual-refresh/tools.js.map +1 -1
  44. package/button-dropdown/category-elements/expandable-category-element.d.ts.map +1 -1
  45. package/button-dropdown/category-elements/expandable-category-element.js +1 -2
  46. package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
  47. package/button-dropdown/category-elements/mobile-expandable-category-element.d.ts.map +1 -1
  48. package/button-dropdown/category-elements/mobile-expandable-category-element.js +1 -2
  49. package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
  50. package/button-dropdown/item-element/index.d.ts.map +1 -1
  51. package/button-dropdown/item-element/index.js +1 -2
  52. package/button-dropdown/item-element/index.js.map +1 -1
  53. package/date-range-picker/index.d.ts.map +1 -1
  54. package/date-range-picker/index.js +5 -4
  55. package/date-range-picker/index.js.map +1 -1
  56. package/header/internal.d.ts.map +1 -1
  57. package/header/internal.js +3 -1
  58. package/header/internal.js.map +1 -1
  59. package/header/styles.css.js +33 -32
  60. package/header/styles.scoped.css +54 -48
  61. package/header/styles.selectors.js +33 -32
  62. package/internal/components/button-trigger/index.d.ts +1 -0
  63. package/internal/components/button-trigger/index.d.ts.map +1 -1
  64. package/internal/components/button-trigger/index.js +2 -2
  65. package/internal/components/button-trigger/index.js.map +1 -1
  66. package/internal/components/button-trigger/styles.css.js +10 -9
  67. package/internal/components/button-trigger/styles.scoped.css +27 -23
  68. package/internal/components/button-trigger/styles.selectors.js +10 -9
  69. package/internal/environment.js +1 -1
  70. package/internal/environment.json +1 -1
  71. package/internal/manifest.json +1 -1
  72. package/multiselect/index.d.ts.map +1 -1
  73. package/multiselect/index.js +3 -1
  74. package/multiselect/index.js.map +1 -1
  75. package/multiselect/interfaces.d.ts +1 -0
  76. package/multiselect/interfaces.d.ts.map +1 -1
  77. package/multiselect/interfaces.js.map +1 -1
  78. package/multiselect/internal.d.ts +3 -1
  79. package/multiselect/internal.d.ts.map +1 -1
  80. package/multiselect/internal.js +3 -3
  81. package/multiselect/internal.js.map +1 -1
  82. package/package.json +1 -1
  83. package/select/parts/styles.css.js +16 -9
  84. package/select/parts/styles.scoped.css +58 -9
  85. package/select/parts/styles.selectors.js +16 -9
  86. package/select/parts/trigger.d.ts +3 -1
  87. package/select/parts/trigger.d.ts.map +1 -1
  88. package/select/parts/trigger.js +22 -3
  89. package/select/parts/trigger.js.map +1 -1
  90. package/test-utils/dom/app-layout/index.d.ts +1 -3
  91. package/test-utils/dom/app-layout/index.js +1 -7
  92. package/test-utils/dom/app-layout/index.js.map +1 -1
  93. package/test-utils/selectors/app-layout/index.d.ts +1 -3
  94. package/test-utils/selectors/app-layout/index.js +1 -7
  95. package/test-utils/selectors/app-layout/index.js.map +1 -1
  96. package/test-utils/tsconfig.tsbuildinfo +1 -1
@@ -2,80 +2,79 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "background": "awsui_background_hyvsj_1jtpy_93",
6
- "scrolling-background": "awsui_scrolling-background_hyvsj_1jtpy_96",
7
- "sticky-background": "awsui_sticky-background_hyvsj_1jtpy_102",
8
- "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_1jtpy_110",
9
- "breadcrumbs": "awsui_breadcrumbs_hyvsj_1jtpy_123",
10
- "has-sticky-background": "awsui_has-sticky-background_hyvsj_1jtpy_133",
11
- "drawers-container": "awsui_drawers-container_hyvsj_1jtpy_145",
12
- "has-open-drawer": "awsui_has-open-drawer_hyvsj_1jtpy_156",
13
- "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_1jtpy_191",
14
- "drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_1jtpy_196",
15
- "has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_1jtpy_215",
16
- "drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-container_hyvsj_1jtpy_247",
17
- "drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_1jtpy_251",
18
- "drawers-trigger-overflow": "awsui_drawers-trigger-overflow_hyvsj_1jtpy_277",
19
- "drawers-trigger": "awsui_drawers-trigger_hyvsj_1jtpy_251",
20
- "drawer": "awsui_drawer_hyvsj_1jtpy_145",
21
- "drawer-close-button": "awsui_drawer-close-button_hyvsj_1jtpy_308",
22
- "drawer-content": "awsui_drawer-content_hyvsj_1jtpy_313",
23
- "drawer-slider": "awsui_drawer-slider_hyvsj_1jtpy_318",
24
- "is-drawer-open": "awsui_is-drawer-open_hyvsj_1jtpy_325",
25
- "content": "awsui_content_hyvsj_1jtpy_350",
26
- "layout": "awsui_layout_hyvsj_1jtpy_371",
27
- "has-max-content-width": "awsui_has-max-content-width_hyvsj_1jtpy_454",
28
- "content-type-dashboard": "awsui_content-type-dashboard_hyvsj_1jtpy_469",
29
- "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_1jtpy_486",
30
- "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_1jtpy_518",
31
- "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_1jtpy_521",
32
- "content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_1jtpy_531",
33
- "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_1jtpy_534",
34
- "content-first-child-header": "awsui_content-first-child-header_hyvsj_1jtpy_537",
35
- "has-header": "awsui_has-header_hyvsj_1jtpy_537",
36
- "content-first-child-main": "awsui_content-first-child-main_hyvsj_1jtpy_558",
37
- "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_1jtpy_558",
38
- "has-split-panel": "awsui_has-split-panel_hyvsj_1jtpy_601",
39
- "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_1jtpy_601",
40
- "block-body-scroll": "awsui_block-body-scroll_hyvsj_1jtpy_617",
41
- "unfocusable": "awsui_unfocusable_hyvsj_1jtpy_622",
42
- "container": "awsui_container_hyvsj_1jtpy_632",
43
- "is-navigation-open": "awsui_is-navigation-open_hyvsj_1jtpy_657",
44
- "is-tools-open": "awsui_is-tools-open_hyvsj_1jtpy_660",
45
- "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_1jtpy_660",
46
- "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_1jtpy_660",
47
- "mobile-toolbar": "awsui_mobile-toolbar_hyvsj_1jtpy_669",
48
- "mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_1jtpy_685",
49
- "mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_1jtpy_689",
50
- "mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_1jtpy_693",
51
- "navigation-container": "awsui_navigation-container_hyvsj_1jtpy_702",
52
- "show-navigation": "awsui_show-navigation_hyvsj_1jtpy_746",
53
- "animating": "awsui_animating_hyvsj_1jtpy_768",
54
- "showButtons": "awsui_showButtons_hyvsj_1jtpy_1",
55
- "navigation": "awsui_navigation_hyvsj_1jtpy_702",
56
- "openNavigation": "awsui_openNavigation_hyvsj_1jtpy_1",
57
- "animated-content": "awsui_animated-content_hyvsj_1jtpy_830",
58
- "hide-navigation": "awsui_hide-navigation_hyvsj_1jtpy_839",
59
- "notifications": "awsui_notifications_hyvsj_1jtpy_849",
60
- "sticky-notifications": "awsui_sticky-notifications_hyvsj_1jtpy_855",
61
- "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_1jtpy_872",
62
- "position-bottom": "awsui_position-bottom_hyvsj_1jtpy_919",
63
- "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_1jtpy_1",
64
- "split-panel-side": "awsui_split-panel-side_hyvsj_1jtpy_948",
65
- "position-side": "awsui_position-side_hyvsj_1jtpy_976",
66
- "openSplitPanelSide": "awsui_openSplitPanelSide_hyvsj_1jtpy_1",
67
- "tools-container": "awsui_tools-container_hyvsj_1jtpy_1013",
68
- "tools": "awsui_tools_hyvsj_1jtpy_1013",
69
- "openTools": "awsui_openTools_hyvsj_1jtpy_1",
70
- "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_1jtpy_1108",
71
- "hide-tools": "awsui_hide-tools_hyvsj_1jtpy_1118",
72
- "show-tools": "awsui_show-tools_hyvsj_1jtpy_1130",
73
- "has-tools-form": "awsui_has-tools-form_hyvsj_1jtpy_1108",
74
- "trigger-badge-wrapper": "awsui_trigger-badge-wrapper_hyvsj_1jtpy_1190",
75
- "trigger": "awsui_trigger_hyvsj_1jtpy_1190",
76
- "selected": "awsui_selected_hyvsj_1jtpy_1254",
77
- "badge": "awsui_badge_hyvsj_1jtpy_1274",
78
- "trigger-wrapper": "awsui_trigger-wrapper_hyvsj_1jtpy_1278",
79
- "dot": "awsui_dot_hyvsj_1jtpy_1284"
5
+ "background": "awsui_background_hyvsj_ftcro_93",
6
+ "scrolling-background": "awsui_scrolling-background_hyvsj_ftcro_96",
7
+ "sticky-background": "awsui_sticky-background_hyvsj_ftcro_102",
8
+ "has-sticky-notifications": "awsui_has-sticky-notifications_hyvsj_ftcro_110",
9
+ "breadcrumbs": "awsui_breadcrumbs_hyvsj_ftcro_123",
10
+ "has-sticky-background": "awsui_has-sticky-background_hyvsj_ftcro_133",
11
+ "drawers-container": "awsui_drawers-container_hyvsj_ftcro_145",
12
+ "has-open-drawer": "awsui_has-open-drawer_hyvsj_ftcro_156",
13
+ "disable-body-scroll": "awsui_disable-body-scroll_hyvsj_ftcro_191",
14
+ "drawers-desktop-triggers-container": "awsui_drawers-desktop-triggers-container_hyvsj_ftcro_196",
15
+ "has-multiple-triggers": "awsui_has-multiple-triggers_hyvsj_ftcro_215",
16
+ "drawers-mobile-triggers-container": "awsui_drawers-mobile-triggers-container_hyvsj_ftcro_247",
17
+ "drawers-trigger-content": "awsui_drawers-trigger-content_hyvsj_ftcro_251",
18
+ "drawers-trigger-overflow": "awsui_drawers-trigger-overflow_hyvsj_ftcro_277",
19
+ "drawers-trigger": "awsui_drawers-trigger_hyvsj_ftcro_251",
20
+ "drawer": "awsui_drawer_hyvsj_ftcro_145",
21
+ "drawer-close-button": "awsui_drawer-close-button_hyvsj_ftcro_308",
22
+ "drawer-content": "awsui_drawer-content_hyvsj_ftcro_313",
23
+ "drawer-slider": "awsui_drawer-slider_hyvsj_ftcro_318",
24
+ "is-drawer-open": "awsui_is-drawer-open_hyvsj_ftcro_325",
25
+ "content": "awsui_content_hyvsj_ftcro_350",
26
+ "layout": "awsui_layout_hyvsj_ftcro_371",
27
+ "has-max-content-width": "awsui_has-max-content-width_hyvsj_ftcro_454",
28
+ "content-type-dashboard": "awsui_content-type-dashboard_hyvsj_ftcro_469",
29
+ "is-overlap-disabled": "awsui_is-overlap-disabled_hyvsj_ftcro_486",
30
+ "has-content-gap-left": "awsui_has-content-gap-left_hyvsj_ftcro_518",
31
+ "has-content-gap-right": "awsui_has-content-gap-right_hyvsj_ftcro_521",
32
+ "content-first-child-notifications": "awsui_content-first-child-notifications_hyvsj_ftcro_531",
33
+ "has-breadcrumbs": "awsui_has-breadcrumbs_hyvsj_ftcro_534",
34
+ "content-first-child-header": "awsui_content-first-child-header_hyvsj_ftcro_537",
35
+ "has-header": "awsui_has-header_hyvsj_ftcro_537",
36
+ "content-first-child-main": "awsui_content-first-child-main_hyvsj_ftcro_558",
37
+ "disable-content-paddings": "awsui_disable-content-paddings_hyvsj_ftcro_558",
38
+ "has-split-panel": "awsui_has-split-panel_hyvsj_ftcro_601",
39
+ "split-panel-position-bottom": "awsui_split-panel-position-bottom_hyvsj_ftcro_601",
40
+ "block-body-scroll": "awsui_block-body-scroll_hyvsj_ftcro_617",
41
+ "unfocusable": "awsui_unfocusable_hyvsj_ftcro_622",
42
+ "container": "awsui_container_hyvsj_ftcro_632",
43
+ "is-navigation-open": "awsui_is-navigation-open_hyvsj_ftcro_657",
44
+ "is-tools-open": "awsui_is-tools-open_hyvsj_ftcro_660",
45
+ "is-split-panel-open": "awsui_is-split-panel-open_hyvsj_ftcro_660",
46
+ "split-panel-position-side": "awsui_split-panel-position-side_hyvsj_ftcro_660",
47
+ "mobile-toolbar": "awsui_mobile-toolbar_hyvsj_ftcro_669",
48
+ "mobile-toolbar-nav": "awsui_mobile-toolbar-nav_hyvsj_ftcro_685",
49
+ "mobile-toolbar-breadcrumbs": "awsui_mobile-toolbar-breadcrumbs_hyvsj_ftcro_689",
50
+ "mobile-toolbar-tools": "awsui_mobile-toolbar-tools_hyvsj_ftcro_693",
51
+ "navigation-container": "awsui_navigation-container_hyvsj_ftcro_702",
52
+ "show-navigation": "awsui_show-navigation_hyvsj_ftcro_746",
53
+ "animating": "awsui_animating_hyvsj_ftcro_768",
54
+ "showButtons": "awsui_showButtons_hyvsj_ftcro_1",
55
+ "navigation": "awsui_navigation_hyvsj_ftcro_702",
56
+ "openNavigation": "awsui_openNavigation_hyvsj_ftcro_1",
57
+ "animated-content": "awsui_animated-content_hyvsj_ftcro_830",
58
+ "hide-navigation": "awsui_hide-navigation_hyvsj_ftcro_839",
59
+ "notifications": "awsui_notifications_hyvsj_ftcro_849",
60
+ "sticky-notifications": "awsui_sticky-notifications_hyvsj_ftcro_855",
61
+ "split-panel-bottom": "awsui_split-panel-bottom_hyvsj_ftcro_872",
62
+ "position-bottom": "awsui_position-bottom_hyvsj_ftcro_919",
63
+ "openSplitPanelBottom": "awsui_openSplitPanelBottom_hyvsj_ftcro_1",
64
+ "split-panel-side": "awsui_split-panel-side_hyvsj_ftcro_948",
65
+ "position-side": "awsui_position-side_hyvsj_ftcro_961",
66
+ "tools-container": "awsui_tools-container_hyvsj_ftcro_980",
67
+ "tools": "awsui_tools_hyvsj_ftcro_980",
68
+ "openTools": "awsui_openTools_hyvsj_ftcro_1",
69
+ "has-tools-form-persistence": "awsui_has-tools-form-persistence_hyvsj_ftcro_1075",
70
+ "hide-tools": "awsui_hide-tools_hyvsj_ftcro_1085",
71
+ "show-tools": "awsui_show-tools_hyvsj_ftcro_1097",
72
+ "has-tools-form": "awsui_has-tools-form_hyvsj_ftcro_1075",
73
+ "trigger-badge-wrapper": "awsui_trigger-badge-wrapper_hyvsj_ftcro_1157",
74
+ "trigger": "awsui_trigger_hyvsj_ftcro_1157",
75
+ "selected": "awsui_selected_hyvsj_ftcro_1221",
76
+ "badge": "awsui_badge_hyvsj_ftcro_1241",
77
+ "trigger-wrapper": "awsui_trigger-wrapper_hyvsj_ftcro_1245",
78
+ "dot": "awsui_dot_hyvsj_ftcro_1251"
80
79
  };
81
80
 
@@ -11,11 +11,5 @@ interface ToolsProps {
11
11
  * split panel in large viewports;
12
12
  */
13
13
  export default function Tools({ children }: ToolsProps): JSX.Element | null;
14
- /**
15
- * Determine the default state of the Tools component. Mobile viewports should be
16
- * closed by default under all circumstances. If the toolsOpen prop has not been
17
- * set then it should be closed as well. Otherwise, default to the toolsOpen prop.
18
- */
19
- export declare function getToolsDefaultState(isMobile: boolean, stateFromProps?: boolean): boolean;
20
14
  export {};
21
15
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,UAAU,UAAU;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,sBA0IrD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,OAAO,WAU/E"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,UAAU,UAAU;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAE,EAAE,UAAU,sBA0IrD"}
@@ -25,10 +25,10 @@ export default function Tools({ children }) {
25
25
  const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);
26
26
  const isUnfocusable = hasDrawerViewportOverlay && !isToolsOpen;
27
27
  /**
28
- * If the drawers property is defined the Tools and SplitPanel will be mounted and rendered
28
+ * If the drawers property is defined the SplitPanel will be mounted and rendered
29
29
  * by the Drawers component.
30
30
  */
31
- if ((toolsHide && !hasSplitPanel) || drawers.length > 0) {
31
+ if ((toolsHide && !hasSplitPanel) || drawers) {
32
32
  return null;
33
33
  }
34
34
  return (React.createElement(Transition, { in: isToolsOpen !== null && isToolsOpen !== void 0 ? isToolsOpen : false }, (state, transitionEventsRef) => {
@@ -65,21 +65,6 @@ export default function Tools({ children }) {
65
65
  hasSplitPanel && splitPanelToggle.displayed && (React.createElement(TriggerButton, { ariaLabel: splitPanelToggle.ariaLabel, ariaControls: splitPanelControlId, ariaExpanded: !!isSplitPanelOpen, iconName: "view-vertical", onClick: () => handleSplitPanelClick(), selected: hasSplitPanel && isSplitPanelOpen, className: splitPanelStyles['open-button'], ref: splitPanelRefs.toggle }))))));
66
66
  }));
67
67
  }
68
- /**
69
- * Determine the default state of the Tools component. Mobile viewports should be
70
- * closed by default under all circumstances. If the toolsOpen prop has not been
71
- * set then it should be closed as well. Otherwise, default to the toolsOpen prop.
72
- */
73
- export function getToolsDefaultState(isMobile, stateFromProps) {
74
- let isToolsOpen;
75
- if (isMobile || stateFromProps === undefined) {
76
- isToolsOpen = false;
77
- }
78
- else {
79
- isToolsOpen = stateFromProps;
80
- }
81
- return isToolsOpen;
82
- }
83
68
  /**
84
69
  * This simple function returns the presence of the split panel as a child of the
85
70
  * Tools component. It must exist and be in side position.
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAM5E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAc;IACpD,MAAM,EACJ,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,GACX,GAAG,qBAAqB,EAAE,CAAC;IAE5B,MAAM,aAAa,GAAG,CAAC,CAAC,UAAU,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IACnG,MAAM,YAAY,GAAG,kBAAkB,CAAC,aAAa,EAAE,QA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Content":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { InternalButton } from '../../button/internal';\nimport { useAppLayoutInternals } from './context';\nimport TriggerButton from './trigger-button';\nimport styles from './styles.css.js';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface ToolsProps {\n children: React.ReactNode;\n}\n\n/**\n * The Tools component consists of the following elements:\n * the container, or root element, that sits as a direct child to the Layout grid definition;\n * the split panel, which exists only if there is a split panel in side position;\n * the tools, or drawer, that contains the hide tools form and the children passed through the API;\n * the show tools form that contains the triggers for both the drawer and the\n * split panel in large viewports;\n */\nexport default function Tools({ children }: ToolsProps) {\n const {\n ariaLabels,\n disableBodyScroll,\n drawers,\n handleSplitPanelClick,\n handleToolsClick,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n isMobile,\n isSplitPanelOpen,\n isToolsOpen,\n loseToolsFocus,\n splitPanel,\n splitPanelControlId,\n splitPanelDisplayed,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelToggle,\n tools,\n toolsControlId,\n toolsHide,\n toolsRefs,\n toolsWidth,\n } = useAppLayoutInternals();\n\n const hasSplitPanel = !!splitPanel && getSplitPanelStatus(splitPanelDisplayed, splitPanelPosition);\n const hasToolsForm = getToolsFormStatus(hasSplitPanel, isMobile, isSplitPanelOpen, isToolsOpen, toolsHide);\n const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);\n const isUnfocusable = hasDrawerViewportOverlay && !isToolsOpen;\n\n /**\n * If the drawers property is defined the Tools and SplitPanel will be mounted and rendered\n * by the Drawers component.\n */\n if ((toolsHide && !hasSplitPanel) || drawers.length > 0) {\n return null;\n }\n\n return (\n <Transition in={isToolsOpen ?? false}>\n {(state, transitionEventsRef) => (\n <div\n className={clsx(styles['tools-container'], {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles.unfocusable]: isUnfocusable,\n [testutilStyles['drawer-closed']]: !isToolsOpen,\n })}\n style={{\n [customCssProps.toolsAnimationStartingOpacity]: `${hasSplitPanel && isSplitPanelOpen ? 1 : 0}`,\n // Overwrite the default tools width (depends on breakpoints) only when the `toolsWidth` property has been set.\n [customCssProps.toolsWidth]: hasDefaultToolsWidth ? '' : `${toolsWidth}px`,\n }}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n loseToolsFocus();\n }\n }}\n >\n {children}\n\n {!toolsHide && (\n <aside\n id={toolsControlId}\n aria-hidden={!isToolsOpen ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(\n styles.tools,\n {\n [styles.animating]: state === 'entering',\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n [styles['is-tools-open']]: isToolsOpen,\n },\n testutilStyles.tools\n )}\n ref={state !== 'exiting' ? transitionEventsRef : undefined}\n >\n <div className={clsx(styles['animated-content'])}>\n <div className={clsx(styles['hide-tools'])}>\n <InternalButton\n ariaLabel={ariaLabels?.toolsClose ?? undefined}\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => handleToolsClick(false)}\n variant=\"icon\"\n formAction=\"none\"\n className={testutilStyles['tools-close']}\n ref={toolsRefs.close}\n />\n </div>\n\n {tools}\n </div>\n </aside>\n )}\n\n {!isMobile && (\n <aside\n aria-hidden={!hasToolsForm ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(styles['show-tools'], {\n [styles.animating]: state === 'exiting',\n [styles['has-tools-form']]: hasToolsForm,\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n })}\n ref={state === 'exiting' ? transitionEventsRef : undefined}\n data-testid=\"side-split-panel-drawer\"\n >\n {!toolsHide && (\n <TriggerButton\n ariaLabel={ariaLabels?.toolsToggle}\n ariaControls={toolsControlId}\n ariaExpanded={isToolsOpen}\n iconName=\"status-info\"\n onClick={() => handleToolsClick(!isToolsOpen)}\n selected={hasSplitPanel && isToolsOpen}\n className={testutilStyles['tools-toggle']}\n ref={toolsRefs.toggle}\n />\n )}\n\n {hasSplitPanel && splitPanelToggle.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggle.ariaLabel}\n ariaControls={splitPanelControlId}\n ariaExpanded={!!isSplitPanelOpen}\n iconName=\"view-vertical\"\n onClick={() => handleSplitPanelClick()}\n selected={hasSplitPanel && isSplitPanelOpen}\n className={splitPanelStyles['open-button']}\n ref={splitPanelRefs.toggle}\n />\n )}\n </aside>\n )}\n </div>\n )}\n </Transition>\n );\n}\n\n/**\n * Determine the default state of the Tools component. Mobile viewports should be\n * closed by default under all circumstances. If the toolsOpen prop has not been\n * set then it should be closed as well. Otherwise, default to the toolsOpen prop.\n */\nexport function getToolsDefaultState(isMobile: boolean, stateFromProps?: boolean) {\n let isToolsOpen;\n\n if (isMobile || stateFromProps === undefined) {\n isToolsOpen = false;\n } else {\n isToolsOpen = stateFromProps;\n }\n\n return isToolsOpen;\n}\n\n/**\n * This simple function returns the presence of the split panel as a child of the\n * Tools component. It must exist and be in side position.\n */\nfunction getSplitPanelStatus(splitPanelDisplayed: boolean, splitPanelPosition: string) {\n return splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;\n}\n\n/**\n * By default the Tools form is styled as display: none; This behavior should\n * be unchanged in mobile viewports where the Tools form is always suppressed.\n * In large viewports, however the Tools form and its corresponding buttons\n * should be present in the UI under the below circumstances.\n */\nfunction getToolsFormStatus(\n hasSplitPanel: boolean,\n isMobile: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsForm = false;\n\n if (!isMobile) {\n // Both the Split Panel and Tools button are needed\n if (hasSplitPanel && !toolsHide) {\n hasToolsForm = true;\n }\n\n // The Split Panel button is needed\n if (hasSplitPanel && !isSplitPanelOpen && toolsHide) {\n hasToolsForm = true;\n }\n\n // The Tools button is needed\n if (!hasSplitPanel && !toolsHide && !isToolsOpen) {\n hasToolsForm = true;\n }\n }\n\n return hasToolsForm;\n}\n\n/**\n * Under two scenarios the Tools form that contains the triggers\n * for the Tools content and the Split Panel may be persistent\n * in the UI (as opposed to disappearing when one of the drawers\n * is open). This will also add a white background as opposed to the\n * default transparent background. The buttons will present and in a\n * selected / not selected state.\n */\nfunction getToolsFormPersistence(\n hasSplitPanel: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsFormPersistence = false;\n\n // Both Tools and Split Panel exist and one or both is open\n if (hasSplitPanel && !toolsHide && (isSplitPanelOpen || isToolsOpen)) {\n hasToolsFormPersistence = true;\n }\n\n return hasToolsFormPersistence;\n}\n"]}
1
+ {"version":3,"file":"tools.js","sourceRoot":"lib/default/","sources":["app-layout/visual-refresh/tools.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,gBAAgB,MAAM,iCAAiC,CAAC;AAC/D,OAAO,cAAc,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,cAAc,MAAM,gDAAgD,CAAC;AAM5E;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAAE,QAAQ,EAAc;IACpD,MAAM,EACJ,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,wBA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AAC,EAAE;QACpE,uBAAuB,GAAG,IAAI,CAAC;KAChC;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\nimport { InternalButton } from '../../button/internal';\nimport { useAppLayoutInternals } from './context';\nimport TriggerButton from './trigger-button';\nimport styles from './styles.css.js';\nimport splitPanelStyles from '../../split-panel/styles.css.js';\nimport testutilStyles from '../test-classes/styles.css.js';\nimport { Transition } from '../../internal/components/transition';\nimport customCssProps from '../../internal/generated/custom-css-properties';\n\ninterface ToolsProps {\n children: React.ReactNode;\n}\n\n/**\n * The Tools component consists of the following elements:\n * the container, or root element, that sits as a direct child to the Layout grid definition;\n * the split panel, which exists only if there is a split panel in side position;\n * the tools, or drawer, that contains the hide tools form and the children passed through the API;\n * the show tools form that contains the triggers for both the drawer and the\n * split panel in large viewports;\n */\nexport default function Tools({ children }: ToolsProps) {\n const {\n ariaLabels,\n disableBodyScroll,\n drawers,\n handleSplitPanelClick,\n handleToolsClick,\n hasDefaultToolsWidth,\n hasDrawerViewportOverlay,\n isMobile,\n isSplitPanelOpen,\n isToolsOpen,\n loseToolsFocus,\n splitPanel,\n splitPanelControlId,\n splitPanelDisplayed,\n splitPanelPosition,\n splitPanelRefs,\n splitPanelToggle,\n tools,\n toolsControlId,\n toolsHide,\n toolsRefs,\n toolsWidth,\n } = useAppLayoutInternals();\n\n const hasSplitPanel = !!splitPanel && getSplitPanelStatus(splitPanelDisplayed, splitPanelPosition);\n const hasToolsForm = getToolsFormStatus(hasSplitPanel, isMobile, isSplitPanelOpen, isToolsOpen, toolsHide);\n const hasToolsFormPersistence = getToolsFormPersistence(hasSplitPanel, isSplitPanelOpen, isToolsOpen, toolsHide);\n const isUnfocusable = hasDrawerViewportOverlay && !isToolsOpen;\n\n /**\n * If the drawers property is defined the SplitPanel will be mounted and rendered\n * by the Drawers component.\n */\n if ((toolsHide && !hasSplitPanel) || drawers) {\n return null;\n }\n\n return (\n <Transition in={isToolsOpen ?? false}>\n {(state, transitionEventsRef) => (\n <div\n className={clsx(styles['tools-container'], {\n [styles['disable-body-scroll']]: disableBodyScroll,\n [styles.unfocusable]: isUnfocusable,\n [testutilStyles['drawer-closed']]: !isToolsOpen,\n })}\n style={{\n [customCssProps.toolsAnimationStartingOpacity]: `${hasSplitPanel && isSplitPanelOpen ? 1 : 0}`,\n // Overwrite the default tools width (depends on breakpoints) only when the `toolsWidth` property has been set.\n [customCssProps.toolsWidth]: hasDefaultToolsWidth ? '' : `${toolsWidth}px`,\n }}\n onBlur={e => {\n if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {\n loseToolsFocus();\n }\n }}\n >\n {children}\n\n {!toolsHide && (\n <aside\n id={toolsControlId}\n aria-hidden={!isToolsOpen ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(\n styles.tools,\n {\n [styles.animating]: state === 'entering',\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n [styles['is-tools-open']]: isToolsOpen,\n },\n testutilStyles.tools\n )}\n ref={state !== 'exiting' ? transitionEventsRef : undefined}\n >\n <div className={clsx(styles['animated-content'])}>\n <div className={clsx(styles['hide-tools'])}>\n <InternalButton\n ariaLabel={ariaLabels?.toolsClose ?? undefined}\n iconName={isMobile ? 'close' : 'angle-right'}\n onClick={() => handleToolsClick(false)}\n variant=\"icon\"\n formAction=\"none\"\n className={testutilStyles['tools-close']}\n ref={toolsRefs.close}\n />\n </div>\n\n {tools}\n </div>\n </aside>\n )}\n\n {!isMobile && (\n <aside\n aria-hidden={!hasToolsForm ? true : false}\n aria-label={ariaLabels?.tools ?? undefined}\n className={clsx(styles['show-tools'], {\n [styles.animating]: state === 'exiting',\n [styles['has-tools-form']]: hasToolsForm,\n [styles['has-tools-form-persistence']]: hasToolsFormPersistence,\n })}\n ref={state === 'exiting' ? transitionEventsRef : undefined}\n data-testid=\"side-split-panel-drawer\"\n >\n {!toolsHide && (\n <TriggerButton\n ariaLabel={ariaLabels?.toolsToggle}\n ariaControls={toolsControlId}\n ariaExpanded={isToolsOpen}\n iconName=\"status-info\"\n onClick={() => handleToolsClick(!isToolsOpen)}\n selected={hasSplitPanel && isToolsOpen}\n className={testutilStyles['tools-toggle']}\n ref={toolsRefs.toggle}\n />\n )}\n\n {hasSplitPanel && splitPanelToggle.displayed && (\n <TriggerButton\n ariaLabel={splitPanelToggle.ariaLabel}\n ariaControls={splitPanelControlId}\n ariaExpanded={!!isSplitPanelOpen}\n iconName=\"view-vertical\"\n onClick={() => handleSplitPanelClick()}\n selected={hasSplitPanel && isSplitPanelOpen}\n className={splitPanelStyles['open-button']}\n ref={splitPanelRefs.toggle}\n />\n )}\n </aside>\n )}\n </div>\n )}\n </Transition>\n );\n}\n\n/**\n * This simple function returns the presence of the split panel as a child of the\n * Tools component. It must exist and be in side position.\n */\nfunction getSplitPanelStatus(splitPanelDisplayed: boolean, splitPanelPosition: string) {\n return splitPanelDisplayed && splitPanelPosition === 'side' ? true : false;\n}\n\n/**\n * By default the Tools form is styled as display: none; This behavior should\n * be unchanged in mobile viewports where the Tools form is always suppressed.\n * In large viewports, however the Tools form and its corresponding buttons\n * should be present in the UI under the below circumstances.\n */\nfunction getToolsFormStatus(\n hasSplitPanel: boolean,\n isMobile: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsForm = false;\n\n if (!isMobile) {\n // Both the Split Panel and Tools button are needed\n if (hasSplitPanel && !toolsHide) {\n hasToolsForm = true;\n }\n\n // The Split Panel button is needed\n if (hasSplitPanel && !isSplitPanelOpen && toolsHide) {\n hasToolsForm = true;\n }\n\n // The Tools button is needed\n if (!hasSplitPanel && !toolsHide && !isToolsOpen) {\n hasToolsForm = true;\n }\n }\n\n return hasToolsForm;\n}\n\n/**\n * Under two scenarios the Tools form that contains the triggers\n * for the Tools content and the Split Panel may be persistent\n * in the UI (as opposed to disappearing when one of the drawers\n * is open). This will also add a white background as opposed to the\n * default transparent background. The buttons will present and in a\n * selected / not selected state.\n */\nfunction getToolsFormPersistence(\n hasSplitPanel: boolean,\n isSplitPanelOpen?: boolean,\n isToolsOpen?: boolean,\n toolsHide?: boolean\n) {\n let hasToolsFormPersistence = false;\n\n // Both Tools and Split Panel exist and one or both is open\n if (hasSplitPanel && !toolsHide && (isSplitPanelOpen || isToolsOpen)) {\n hasToolsFormPersistence = true;\n }\n\n return hasToolsFormPersistence;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-category-element.d.ts","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/expandable-category-element.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,QAAA,MAAM,yBAAyB,6JAY5B,aAAa,gBA2Gf,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"expandable-category-element.d.ts","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/expandable-category-element.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,QAAA,MAAM,yBAAyB,6JAY5B,aAAa,gBA0Gf,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -28,8 +28,7 @@ const ExpandableCategoryElement = ({ item, onItemActivate, onGroupToggle, target
28
28
  (_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
29
29
  }
30
30
  };
31
- const onHover = (event) => {
32
- event.preventDefault();
31
+ const onHover = () => {
33
32
  highlightItem(item);
34
33
  };
35
34
  const isDisabledWithReason = !!item.disabledReason && item.disabled;
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-category-element.js","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/expandable-category-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MA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E,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,IAEpB,OAAO,CACL,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\n\nimport InternalIcon from '../../icon/internal';\nimport ItemsList from '../items-list';\nimport Dropdown from '../../internal/components/dropdown';\nimport { CategoryProps } from '../interfaces';\nimport useHiddenDescription from '../utils/use-hidden-description';\nimport Tooltip from '../tooltip.js';\nimport { getMenuItemProps } from '../utils/menu-item';\n\nconst ExpandableCategoryElement = ({\n item,\n onItemActivate,\n onGroupToggle,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n disabled,\n expandToViewport,\n variant,\n}: CategoryProps) => {\n const highlighted = isHighlighted(item);\n const expanded = isExpanded(item);\n const isKeyboardHighlighted = isKeyboardHighlight(item);\n const triggerRef = React.useRef<HTMLSpanElement>(null);\n const ref = useRef<HTMLLIElement>(null);\n\n useEffect(() => {\n if (triggerRef.current && highlighted && !expanded) {\n triggerRef.current.focus();\n }\n }, [expanded, highlighted]);\n\n const onClick: React.MouseEventHandler = event => {\n if (!disabled) {\n event.preventDefault();\n onGroupToggle(item, event);\n triggerRef.current?.focus();\n }\n };\n\n const onHover = (event: React.SyntheticEvent) => {\n event.preventDefault();\n highlightItem(item);\n };\n\n const isDisabledWithReason = !!item.disabledReason && item.disabled;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const trigger = item.text && (\n <span\n className={clsx(styles.header, styles['expandable-header'], styles[`variant-${variant}`], {\n [styles.disabled]: disabled,\n [styles.highlighted]: highlighted,\n [styles['is-focused']]: isKeyboardHighlighted,\n })}\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex={highlighted ? 0 : -1}\n ref={triggerRef}\n {...getMenuItemProps({ parent: true, expanded, disabled })}\n {...(isDisabledWithReason ? targetProps : {})}\n >\n {item.text}\n <span className={clsx(styles['expand-icon'], styles['expand-icon-right'])}>\n <InternalIcon name=\"caret-down-filled\" />\n </span>\n </span>\n );\n\n let content: React.ReactNode;\n // If the category element is disabled, we do not render a dropdown.\n // Screenreaders are confused by additional sections\n if (isDisabledWithReason) {\n content = (\n <Tooltip content={item.disabledReason}>\n {trigger}\n {descriptionEl}\n </Tooltip>\n );\n } else if (disabled) {\n content = trigger;\n } else {\n content = (\n <Dropdown\n open={expanded}\n stretchWidth={false}\n interior={true}\n expandToViewport={expandToViewport}\n trigger={trigger}\n >\n {item.items && expanded && (\n <ul role=\"menu\" aria-label={item.text} className={clsx(styles['items-list-container'])}>\n <ItemsList\n items={item.items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n highlightItem={highlightItem}\n variant={variant}\n />\n </ul>\n )}\n </Dropdown>\n );\n }\n\n return (\n <li\n className={clsx(styles.category, styles[`variant-${variant}`], styles.expandable, {\n [styles.expanded]: expanded,\n [styles.disabled]: disabled,\n [styles.highlighted]: highlighted,\n })}\n role=\"presentation\"\n data-testid={item.id}\n ref={ref}\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n >\n {content}\n </li>\n );\n};\n\nexport default ExpandableCategoryElement;\n"]}
1
+ {"version":3,"file":"expandable-category-element.js","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/expandable-category-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO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AO,CACL,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,yBAAyB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\n\nimport InternalIcon from '../../icon/internal';\nimport ItemsList from '../items-list';\nimport Dropdown from '../../internal/components/dropdown';\nimport { CategoryProps } from '../interfaces';\nimport useHiddenDescription from '../utils/use-hidden-description';\nimport Tooltip from '../tooltip.js';\nimport { getMenuItemProps } from '../utils/menu-item';\n\nconst ExpandableCategoryElement = ({\n item,\n onItemActivate,\n onGroupToggle,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n disabled,\n expandToViewport,\n variant,\n}: CategoryProps) => {\n const highlighted = isHighlighted(item);\n const expanded = isExpanded(item);\n const isKeyboardHighlighted = isKeyboardHighlight(item);\n const triggerRef = React.useRef<HTMLSpanElement>(null);\n const ref = useRef<HTMLLIElement>(null);\n\n useEffect(() => {\n if (triggerRef.current && highlighted && !expanded) {\n triggerRef.current.focus();\n }\n }, [expanded, highlighted]);\n\n const onClick: React.MouseEventHandler = event => {\n if (!disabled) {\n event.preventDefault();\n onGroupToggle(item, event);\n triggerRef.current?.focus();\n }\n };\n\n const onHover = () => {\n highlightItem(item);\n };\n\n const isDisabledWithReason = !!item.disabledReason && item.disabled;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const trigger = item.text && (\n <span\n className={clsx(styles.header, styles['expandable-header'], styles[`variant-${variant}`], {\n [styles.disabled]: disabled,\n [styles.highlighted]: highlighted,\n [styles['is-focused']]: isKeyboardHighlighted,\n })}\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex={highlighted ? 0 : -1}\n ref={triggerRef}\n {...getMenuItemProps({ parent: true, expanded, disabled })}\n {...(isDisabledWithReason ? targetProps : {})}\n >\n {item.text}\n <span className={clsx(styles['expand-icon'], styles['expand-icon-right'])}>\n <InternalIcon name=\"caret-down-filled\" />\n </span>\n </span>\n );\n\n let content: React.ReactNode;\n // If the category element is disabled, we do not render a dropdown.\n // Screenreaders are confused by additional sections\n if (isDisabledWithReason) {\n content = (\n <Tooltip content={item.disabledReason}>\n {trigger}\n {descriptionEl}\n </Tooltip>\n );\n } else if (disabled) {\n content = trigger;\n } else {\n content = (\n <Dropdown\n open={expanded}\n stretchWidth={false}\n interior={true}\n expandToViewport={expandToViewport}\n trigger={trigger}\n >\n {item.items && expanded && (\n <ul role=\"menu\" aria-label={item.text} className={clsx(styles['items-list-container'])}>\n <ItemsList\n items={item.items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n highlightItem={highlightItem}\n variant={variant}\n />\n </ul>\n )}\n </Dropdown>\n );\n }\n\n return (\n <li\n className={clsx(styles.category, styles[`variant-${variant}`], styles.expandable, {\n [styles.expanded]: expanded,\n [styles.disabled]: disabled,\n [styles.highlighted]: highlighted,\n })}\n role=\"presentation\"\n data-testid={item.id}\n ref={ref}\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n >\n {content}\n </li>\n );\n};\n\nexport default ExpandableCategoryElement;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-expandable-category-element.d.ts","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/mobile-expandable-category-element.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,QAAA,MAAM,+BAA+B,2IAWlC,aAAa,gBAwGf,CAAC;AAEF,eAAe,+BAA+B,CAAC"}
1
+ {"version":3,"file":"mobile-expandable-category-element.d.ts","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/mobile-expandable-category-element.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAK9C,QAAA,MAAM,+BAA+B,2IAWlC,aAAa,gBAuGf,CAAC;AAEF,eAAe,+BAA+B,CAAC"}
@@ -25,8 +25,7 @@ const MobileExpandableCategoryElement = ({ item, onItemActivate, onGroupToggle,
25
25
  onGroupToggle(item, e);
26
26
  }
27
27
  };
28
- const onHover = (event) => {
29
- event.preventDefault();
28
+ const onHover = () => {
30
29
  highlightItem(item);
31
30
  };
32
31
  const isDisabledWithReason = !!item.disabledReason && item.disabled;
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-expandable-category-element.js","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/mobile-expandable-category-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,qBAAqB,MAAM,oDAAoD,CAAC;AAEvF,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,+BAA+B,GAAG,CAAC,EACvC,IAAI,EACJ,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,EACR,OAAO,GACO,EAAE,EAAE;IAClB,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,IAAI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Aa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,IAAI,EACvB,OAAO,EAAE,OAAO,GAChB,CACC,CACN,CACqB,CACzB,CAAC;KACH;IAED,OAAO,CACL,4BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE;YAChF,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;YAC3B,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;YAC3B,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW,IAAI,QAAQ;YAC7C,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI;SAC1B,CAAC,EACF,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,iBACR,IAAI,CAAC,EAAE,IAEnB,OAAO,CACL,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,+BAA+B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\n\nimport InternalIcon from '../../icon/internal';\nimport ItemsList from '../items-list';\nimport MobileExpandableGroup from '../mobile-expandable-group/mobile-expandable-group';\nimport { CategoryProps } from '../interfaces';\nimport Tooltip from '../tooltip.js';\nimport useHiddenDescription from '../utils/use-hidden-description.js';\nimport { getMenuItemProps } from '../utils/menu-item.js';\n\nconst MobileExpandableCategoryElement = ({\n item,\n onItemActivate,\n onGroupToggle,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n disabled,\n variant,\n}: CategoryProps) => {\n const highlighted = isHighlighted(item);\n const expanded = isExpanded(item);\n const isKeyboardHighlighted = isKeyboardHighlight(item);\n const triggerRef = React.useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n if (triggerRef.current && highlighted && !expanded) {\n triggerRef.current.focus();\n }\n }, [expanded, highlighted]);\n\n const onClick = (e: React.MouseEvent) => {\n if (!disabled) {\n e.preventDefault();\n onGroupToggle(item, e);\n }\n };\n\n const onHover = (event: React.SyntheticEvent) => {\n event.preventDefault();\n highlightItem(item);\n };\n\n const isDisabledWithReason = !!item.disabledReason && item.disabled;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const trigger = item.text && (\n <span\n className={clsx(styles.header, styles['expandable-header'], styles[`variant-${variant}`], {\n [styles.highlighted]: highlighted,\n [styles['rolled-down']]: expanded,\n [styles.disabled]: disabled,\n [styles['is-focused']]: isKeyboardHighlighted,\n })}\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex={highlighted ? 0 : -1}\n ref={triggerRef}\n {...getMenuItemProps({ parent: true, disabled, expanded })}\n {...(isDisabledWithReason ? targetProps : {})}\n >\n {item.text}\n <span\n className={clsx(styles['expand-icon'], {\n [styles['expand-icon-up']]: expanded,\n })}\n >\n <InternalIcon name=\"caret-down-filled\" />\n </span>\n </span>\n );\n\n let content: React.ReactNode;\n\n if (isDisabledWithReason) {\n content = (\n <>\n {descriptionEl}\n <Tooltip content={item.disabledReason}>{trigger}</Tooltip>\n </>\n );\n } else if (disabled) {\n content = trigger;\n } else {\n content = (\n <MobileExpandableGroup open={expanded} trigger={trigger}>\n {item.items && expanded && (\n <ul role=\"menu\" aria-label={item.text} className={clsx(styles['items-list-container'])}>\n <ItemsList\n items={item.items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n highlightItem={highlightItem}\n hasCategoryHeader={true}\n variant={variant}\n />\n </ul>\n )}\n </MobileExpandableGroup>\n );\n }\n\n return (\n <li\n className={clsx(styles.category, styles[`variant-${variant}`], styles.expandable, {\n [styles.expanded]: expanded,\n [styles.disabled]: disabled,\n [styles.highlighted]: highlighted || expanded,\n [styles.expandable]: true,\n })}\n role=\"presentation\"\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n data-testid={item.id}\n >\n {content}\n </li>\n );\n};\n\nexport default MobileExpandableCategoryElement;\n"]}
1
+ {"version":3,"file":"mobile-expandable-category-element.js","sourceRoot":"lib/default/","sources":["button-dropdown/category-elements/mobile-expandable-category-element.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,qBAAqB,MAAM,oDAAoD,CAAC;AAEvF,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,+BAA+B,GAAG,CAAC,EACvC,IAAI,EACJ,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,EACR,OAAO,GACO,EAAE,EAAE;IAClB,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,UAAU,CA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,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE;YAChF,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;YAC3B,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;YAC3B,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW,IAAI,QAAQ;YAC7C,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI;SAC1B,CAAC,EACF,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,iBACR,IAAI,CAAC,EAAE,IAEnB,OAAO,CACL,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,+BAA+B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\n\nimport InternalIcon from '../../icon/internal';\nimport ItemsList from '../items-list';\nimport MobileExpandableGroup from '../mobile-expandable-group/mobile-expandable-group';\nimport { CategoryProps } from '../interfaces';\nimport Tooltip from '../tooltip.js';\nimport useHiddenDescription from '../utils/use-hidden-description.js';\nimport { getMenuItemProps } from '../utils/menu-item.js';\n\nconst MobileExpandableCategoryElement = ({\n item,\n onItemActivate,\n onGroupToggle,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n disabled,\n variant,\n}: CategoryProps) => {\n const highlighted = isHighlighted(item);\n const expanded = isExpanded(item);\n const isKeyboardHighlighted = isKeyboardHighlight(item);\n const triggerRef = React.useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n if (triggerRef.current && highlighted && !expanded) {\n triggerRef.current.focus();\n }\n }, [expanded, highlighted]);\n\n const onClick = (e: React.MouseEvent) => {\n if (!disabled) {\n e.preventDefault();\n onGroupToggle(item, e);\n }\n };\n\n const onHover = () => {\n highlightItem(item);\n };\n\n const isDisabledWithReason = !!item.disabledReason && item.disabled;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const trigger = item.text && (\n <span\n className={clsx(styles.header, styles['expandable-header'], styles[`variant-${variant}`], {\n [styles.highlighted]: highlighted,\n [styles['rolled-down']]: expanded,\n [styles.disabled]: disabled,\n [styles['is-focused']]: isKeyboardHighlighted,\n })}\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex={highlighted ? 0 : -1}\n ref={triggerRef}\n {...getMenuItemProps({ parent: true, disabled, expanded })}\n {...(isDisabledWithReason ? targetProps : {})}\n >\n {item.text}\n <span\n className={clsx(styles['expand-icon'], {\n [styles['expand-icon-up']]: expanded,\n })}\n >\n <InternalIcon name=\"caret-down-filled\" />\n </span>\n </span>\n );\n\n let content: React.ReactNode;\n\n if (isDisabledWithReason) {\n content = (\n <>\n {descriptionEl}\n <Tooltip content={item.disabledReason}>{trigger}</Tooltip>\n </>\n );\n } else if (disabled) {\n content = trigger;\n } else {\n content = (\n <MobileExpandableGroup open={expanded} trigger={trigger}>\n {item.items && expanded && (\n <ul role=\"menu\" aria-label={item.text} className={clsx(styles['items-list-container'])}>\n <ItemsList\n items={item.items}\n onItemActivate={onItemActivate}\n onGroupToggle={onGroupToggle}\n targetItem={targetItem}\n isHighlighted={isHighlighted}\n isKeyboardHighlight={isKeyboardHighlight}\n isExpanded={isExpanded}\n highlightItem={highlightItem}\n hasCategoryHeader={true}\n variant={variant}\n />\n </ul>\n )}\n </MobileExpandableGroup>\n );\n }\n\n return (\n <li\n className={clsx(styles.category, styles[`variant-${variant}`], styles.expandable, {\n [styles.expanded]: expanded,\n [styles.disabled]: disabled,\n [styles.highlighted]: highlighted || expanded,\n [styles.expandable]: true,\n })}\n role=\"presentation\"\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n data-testid={item.id}\n >\n {content}\n </li>\n );\n};\n\nexport default MobileExpandableCategoryElement;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["button-dropdown/item-element/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOpD,QAAA,MAAM,WAAW,oIAWd,SAAS,gBAuCX,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,IAAI,GAAG;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AA4FF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["button-dropdown/item-element/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOpD,QAAA,MAAM,WAAW,oIAWd,SAAS,gBAsCX,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,IAAI,GAAG;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AA4FF,eAAe,WAAW,CAAC"}
@@ -23,8 +23,7 @@ const ItemElement = ({ item, disabled, onItemActivate, highlighted, highlightIte
23
23
  onItemActivate(item, event);
24
24
  }
25
25
  };
26
- const onHover = (event) => {
27
- event.preventDefault();
26
+ const onHover = () => {
28
27
  highlightItem(item);
29
28
  };
30
29
  return (React.createElement("li", { className: clsx(styles['item-element'], styles[`variant-${variant}`], {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OA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\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport { ItemProps } from '../interfaces';\nimport { isLinkItem } from '../utils/utils';\nimport styles from './styles.css.js';\nimport Tooltip from '../tooltip';\n\nimport { ButtonDropdownProps } from '../interfaces';\nimport { getItemTarget } from '../utils/utils';\nimport useHiddenDescription from '../utils/use-hidden-description';\nimport InternalIcon, { InternalIconProps } from '../../icon/internal';\nimport { useDropdownContext } from '../../internal/components/dropdown/context';\nimport { getMenuItemProps } from '../utils/menu-item';\n\nconst ItemElement = ({\n item,\n disabled,\n onItemActivate,\n highlighted,\n highlightItem,\n first = false,\n last,\n hasCategoryHeader,\n isKeyboardHighlighted = false,\n variant = 'normal',\n}: ItemProps) => {\n const isLink = isLinkItem(item);\n const onClick = (event: React.MouseEvent) => {\n // Stop propagation to parent node and handle event exclusively in here. This ensures\n // that no group will interfere with the default behavior of links\n event.stopPropagation();\n if (!isLink) {\n event.preventDefault();\n }\n if (!disabled) {\n onItemActivate(item, event);\n }\n };\n\n const onHover = (event: React.SyntheticEvent) => {\n event.preventDefault();\n highlightItem(item);\n };\n\n return (\n <li\n className={clsx(styles['item-element'], styles[`variant-${variant}`], {\n [styles.highlighted]: highlighted,\n [styles.disabled]: disabled,\n [styles.first]: first,\n [styles.last]: last,\n [styles['has-category-header']]: hasCategoryHeader,\n [styles['is-focused']]: isKeyboardHighlighted,\n })}\n role=\"presentation\"\n data-testid={item.id}\n data-description={item.description}\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n >\n <MenuItem item={item} disabled={disabled} highlighted={highlighted} />\n </li>\n );\n};\n\nexport type InternalItemProps = ButtonDropdownProps.Item & {\n badge?: boolean;\n};\n\ninterface MenuItemProps {\n item: InternalItemProps;\n disabled: boolean;\n highlighted: boolean;\n}\n\nfunction MenuItem({ item, disabled, highlighted }: MenuItemProps) {\n const menuItemRef = useRef<(HTMLSpanElement & HTMLAnchorElement) | null>(null);\n\n useEffect(() => {\n if (highlighted && menuItemRef.current) {\n menuItemRef.current.focus();\n }\n }, [highlighted]);\n\n const isDisabledWithReason = disabled && item.disabledReason;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const menuItemProps: React.HTMLAttributes<HTMLSpanElement & HTMLAnchorElement> = {\n className: styles['menu-item'],\n lang: item.lang,\n ref: menuItemRef,\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex: highlighted ? 0 : -1,\n ...getMenuItemProps({ disabled }),\n ...(isDisabledWithReason ? targetProps : {}),\n };\n\n const menuItem = isLinkItem(item) ? (\n <a\n {...menuItemProps}\n href={!disabled ? item.href : undefined}\n target={getItemTarget(item)}\n rel={item.external ? 'noopener noreferrer' : undefined}\n >\n <MenuItemContent item={item} disabled={disabled} />\n </a>\n ) : (\n <span {...menuItemProps}>\n <MenuItemContent item={item} disabled={disabled} />\n </span>\n );\n\n const { position } = useDropdownContext();\n const tooltipPosition = position === 'bottom-left' || position === 'top-left' ? 'left' : 'right';\n return isDisabledWithReason ? (\n <Tooltip content={item.disabledReason} position={tooltipPosition}>\n {menuItem}\n {descriptionEl}\n </Tooltip>\n ) : (\n menuItem\n );\n}\n\nconst MenuItemContent = ({ item, disabled }: { item: InternalItemProps; disabled: boolean }) => {\n const hasIcon = !!(item.iconName || item.iconUrl || item.iconSvg);\n const hasExternal = isLinkItem(item) && item.external;\n return (\n <>\n {hasIcon && (\n <MenuItemIcon\n name={item.iconName}\n url={item.iconUrl}\n svg={item.iconSvg}\n alt={item.iconAlt}\n badge={item.badge}\n />\n )}{' '}\n {item.text} {hasExternal && <ExternalIcon disabled={disabled} ariaLabel={item.externalIconAriaLabel} />}\n </>\n );\n};\n\nconst MenuItemIcon = (props: InternalIconProps) => (\n <span className={styles.icon}>\n <InternalIcon {...props} />\n </span>\n);\n\nconst ExternalIcon = ({ disabled, ariaLabel }: { disabled: boolean; ariaLabel?: string }) => {\n const icon = <InternalIcon variant={disabled ? 'disabled' : 'normal'} name=\"external\" />;\n return (\n <span className={styles['external-icon']} role={ariaLabel ? 'img' : undefined} aria-label={ariaLabel}>\n {icon}\n </span>\n );\n};\n\nexport default ItemElement;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["button-dropdown/item-element/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,OAAO,MAAM,YAAY,CAAC;AAGjC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,YAAmC,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,WAAW,GAAG,CAAC,EACnB,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,EACb,KAAK,GAAG,KAAK,EACb,IAAI,EACJ,iBAAiB,EACjB,qBAAqB,GAAG,KAAK,EAC7B,OAAO,GAAG,QAAQ,GACR,EAAE,EAAE;IACd,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,CAAC,KAAuB,EAAE,EAAE;QAC1C,qFAAqF;QACrF,kEAAkE;QAClE,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,EAAE;YACX,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;QACD,IAAI,CAAC,QAAQ,EAAE;YACb,cAAc,CAAC,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AAC;IACzF,OAAO,CACL,8BAAM,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,gBAAc,SAAS,IACjG,IAAI,CACA,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\nimport { ItemProps } from '../interfaces';\nimport { isLinkItem } from '../utils/utils';\nimport styles from './styles.css.js';\nimport Tooltip from '../tooltip';\n\nimport { ButtonDropdownProps } from '../interfaces';\nimport { getItemTarget } from '../utils/utils';\nimport useHiddenDescription from '../utils/use-hidden-description';\nimport InternalIcon, { InternalIconProps } from '../../icon/internal';\nimport { useDropdownContext } from '../../internal/components/dropdown/context';\nimport { getMenuItemProps } from '../utils/menu-item';\n\nconst ItemElement = ({\n item,\n disabled,\n onItemActivate,\n highlighted,\n highlightItem,\n first = false,\n last,\n hasCategoryHeader,\n isKeyboardHighlighted = false,\n variant = 'normal',\n}: ItemProps) => {\n const isLink = isLinkItem(item);\n const onClick = (event: React.MouseEvent) => {\n // Stop propagation to parent node and handle event exclusively in here. This ensures\n // that no group will interfere with the default behavior of links\n event.stopPropagation();\n if (!isLink) {\n event.preventDefault();\n }\n if (!disabled) {\n onItemActivate(item, event);\n }\n };\n\n const onHover = () => {\n highlightItem(item);\n };\n\n return (\n <li\n className={clsx(styles['item-element'], styles[`variant-${variant}`], {\n [styles.highlighted]: highlighted,\n [styles.disabled]: disabled,\n [styles.first]: first,\n [styles.last]: last,\n [styles['has-category-header']]: hasCategoryHeader,\n [styles['is-focused']]: isKeyboardHighlighted,\n })}\n role=\"presentation\"\n data-testid={item.id}\n data-description={item.description}\n onClick={onClick}\n onMouseEnter={onHover}\n onTouchStart={onHover}\n >\n <MenuItem item={item} disabled={disabled} highlighted={highlighted} />\n </li>\n );\n};\n\nexport type InternalItemProps = ButtonDropdownProps.Item & {\n badge?: boolean;\n};\n\ninterface MenuItemProps {\n item: InternalItemProps;\n disabled: boolean;\n highlighted: boolean;\n}\n\nfunction MenuItem({ item, disabled, highlighted }: MenuItemProps) {\n const menuItemRef = useRef<(HTMLSpanElement & HTMLAnchorElement) | null>(null);\n\n useEffect(() => {\n if (highlighted && menuItemRef.current) {\n menuItemRef.current.focus();\n }\n }, [highlighted]);\n\n const isDisabledWithReason = disabled && item.disabledReason;\n const { targetProps, descriptionEl } = useHiddenDescription(item.disabledReason);\n const menuItemProps: React.HTMLAttributes<HTMLSpanElement & HTMLAnchorElement> = {\n className: styles['menu-item'],\n lang: item.lang,\n ref: menuItemRef,\n // We are using the roving tabindex technique to manage the focus state of the dropdown.\n // The current element will always have tabindex=0 which means that it can be tabbed to,\n // while all other items have tabindex=-1 so we can focus them when necessary.\n tabIndex: highlighted ? 0 : -1,\n ...getMenuItemProps({ disabled }),\n ...(isDisabledWithReason ? targetProps : {}),\n };\n\n const menuItem = isLinkItem(item) ? (\n <a\n {...menuItemProps}\n href={!disabled ? item.href : undefined}\n target={getItemTarget(item)}\n rel={item.external ? 'noopener noreferrer' : undefined}\n >\n <MenuItemContent item={item} disabled={disabled} />\n </a>\n ) : (\n <span {...menuItemProps}>\n <MenuItemContent item={item} disabled={disabled} />\n </span>\n );\n\n const { position } = useDropdownContext();\n const tooltipPosition = position === 'bottom-left' || position === 'top-left' ? 'left' : 'right';\n return isDisabledWithReason ? (\n <Tooltip content={item.disabledReason} position={tooltipPosition}>\n {menuItem}\n {descriptionEl}\n </Tooltip>\n ) : (\n menuItem\n );\n}\n\nconst MenuItemContent = ({ item, disabled }: { item: InternalItemProps; disabled: boolean }) => {\n const hasIcon = !!(item.iconName || item.iconUrl || item.iconSvg);\n const hasExternal = isLinkItem(item) && item.external;\n return (\n <>\n {hasIcon && (\n <MenuItemIcon\n name={item.iconName}\n url={item.iconUrl}\n svg={item.iconSvg}\n alt={item.iconAlt}\n badge={item.badge}\n />\n )}{' '}\n {item.text} {hasExternal && <ExternalIcon disabled={disabled} ariaLabel={item.externalIconAriaLabel} />}\n </>\n );\n};\n\nconst MenuItemIcon = (props: InternalIconProps) => (\n <span className={styles.icon}>\n <InternalIcon {...props} />\n </span>\n);\n\nconst ExternalIcon = ({ disabled, ariaLabel }: { disabled: boolean; ariaLabel?: string }) => {\n const icon = <InternalIcon variant={disabled ? 'disabled' : 'normal'} name=\"external\" />;\n return (\n <span className={styles['external-icon']} role={ariaLabel ? 'img' : undefined} aria-label={ariaLabel}>\n {icon}\n </span>\n );\n};\n\nexport default ItemElement;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA4BpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAmDhC,QAAA,MAAM,eAAe,uGA2NpB,CAAC;AAGF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AA4BpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAmDhC,QAAA,MAAM,eAAe,uGA8NpB,CAAC;AAGF,eAAe,eAAe,CAAC"}
@@ -16,7 +16,7 @@ import Dropdown from '../internal/components/dropdown';
16
16
  import { useFocusTracker } from '../internal/hooks/use-focus-tracker';
17
17
  import { useMobile } from '../internal/hooks/use-mobile';
18
18
  import ButtonTrigger from '../internal/components/button-trigger';
19
- import { useFormFieldContext } from '../internal/context/form-field-context';
19
+ import { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';
20
20
  import InternalIcon from '../icon/internal';
21
21
  import { normalizeTimeOffset, shiftTimeOffset } from './time-offset';
22
22
  import useBaseComponent from '../internal/hooks/use-base-component';
@@ -121,7 +121,7 @@ const DateRangePicker = React.forwardRef((_a, ref) => {
121
121
  const i18n = useInternalI18n('date-range-picker');
122
122
  const formatRelativeRange = i18n('i18nStrings.formatRelativeRange', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatRelativeRange, format => ({ amount, unit }) => format({ amount, unit }));
123
123
  if (isDevelopment) {
124
- if (!formatRelativeRange) {
124
+ if (!formatRelativeRange && rangeSelectorMode !== 'absolute-only') {
125
125
  warnOnce('DateRangePicker', 'A function for i18nStrings.formatRelativeRange was not provided. Relative ranges will not be correctly rendered.');
126
126
  }
127
127
  }
@@ -132,14 +132,15 @@ const DateRangePicker = React.forwardRef((_a, ref) => {
132
132
  if (!readOnly && !disabled) {
133
133
  setIsDropDownOpen(true);
134
134
  }
135
- }, disabled: disabled, readOnly: readOnly, ariaHasPopup: "true" },
135
+ }, disabled: disabled, readOnly: readOnly, ariaHasPopup: "dialog" },
136
136
  React.createElement("span", { className: styles['trigger-flexbox'] },
137
137
  React.createElement("span", { className: styles['icon-wrapper'] },
138
138
  React.createElement(InternalIcon, { name: "calendar", variant: disabled || readOnly ? 'disabled' : 'normal' })),
139
139
  renderDateRange(value, placeholder !== null && placeholder !== void 0 ? placeholder : '', formatRelativeRange, normalizedTimeOffset)))));
140
140
  const mergedRef = useMergeRefs(rootRef, __internalRootRef);
141
141
  return (React.createElement("div", Object.assign({}, baseProps, { ref: mergedRef, className: clsx(baseProps.className, styles.root), onKeyDown: onWrapperKeyDownHandler }),
142
- React.createElement(Dropdown, { stretchWidth: true, stretchHeight: true, open: isDropDownOpen, onDropdownClose: () => closeDropdown(), trigger: trigger, stretchToTriggerWidth: false, expandToViewport: expandToViewport, dropdownId: dropdownId }, isDropDownOpen && (React.createElement(DateRangePickerDropdown, { startOfWeek: startOfWeek, locale: normalizedLocale, isSingleGrid: isSingleGrid, onDropdownClose: () => closeDropdown(true), value: value, showClearButton: showClearButton, isDateEnabled: isDateEnabled, i18nStrings: i18nStrings, onClear: onClear, onApply: onApply, relativeOptions: relativeOptions, isValidRange: isValidRange, dateOnly: dateOnly, timeInputFormat: timeInputFormat, rangeSelectorMode: rangeSelectorMode, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, customAbsoluteRangeControl: customAbsoluteRangeControl })))));
142
+ React.createElement(Dropdown, { stretchWidth: true, stretchHeight: true, open: isDropDownOpen, onDropdownClose: () => closeDropdown(), trigger: trigger, stretchToTriggerWidth: false, expandToViewport: expandToViewport, dropdownId: dropdownId },
143
+ React.createElement(FormFieldContext.Provider, { value: {} }, isDropDownOpen && (React.createElement(DateRangePickerDropdown, { startOfWeek: startOfWeek, locale: normalizedLocale, isSingleGrid: isSingleGrid, onDropdownClose: () => closeDropdown(true), value: value, showClearButton: showClearButton, isDateEnabled: isDateEnabled, i18nStrings: i18nStrings, onClear: onClear, onApply: onApply, relativeOptions: relativeOptions, isValidRange: isValidRange, dateOnly: dateOnly, timeInputFormat: timeInputFormat, rangeSelectorMode: rangeSelectorMode, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, customAbsoluteRangeControl: customAbsoluteRangeControl }))))));
143
144
  });
144
145
  applyDisplayName(DateRangePicker, 'DateRangePicker');
145
146
  export default DateRangePicker;