@cloudscape-design/components-themeable 3.0.65 → 3.0.67

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 (137) hide show
  1. package/lib/internal/scss/internal/styles/typography/mixins.scss +9 -0
  2. package/lib/internal/scss/link/styles.scss +11 -1
  3. package/lib/internal/scss/popover/body.scss +0 -36
  4. package/lib/internal/scss/popover/container.scss +41 -0
  5. package/lib/internal/scss/split-panel/styles.scss +3 -0
  6. package/lib/internal/template/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
  7. package/lib/internal/template/annotation-context/annotation/annotation-popover.js +2 -2
  8. package/lib/internal/template/annotation-context/annotation/annotation-popover.js.map +1 -1
  9. package/lib/internal/template/autosuggest/interfaces.d.ts +2 -2
  10. package/lib/internal/template/autosuggest/interfaces.d.ts.map +1 -1
  11. package/lib/internal/template/autosuggest/interfaces.js.map +1 -1
  12. package/lib/internal/template/button-dropdown/tooltip.js +2 -2
  13. package/lib/internal/template/button-dropdown/tooltip.js.map +1 -1
  14. package/lib/internal/template/calendar/interfaces.d.ts +2 -1
  15. package/lib/internal/template/calendar/interfaces.d.ts.map +1 -1
  16. package/lib/internal/template/calendar/interfaces.js.map +1 -1
  17. package/lib/internal/template/calendar/internal.d.ts +2 -1
  18. package/lib/internal/template/calendar/internal.d.ts.map +1 -1
  19. package/lib/internal/template/calendar/internal.js +8 -3
  20. package/lib/internal/template/calendar/internal.js.map +1 -1
  21. package/lib/internal/template/cards/index.d.ts.map +1 -1
  22. package/lib/internal/template/cards/index.js +15 -5
  23. package/lib/internal/template/cards/index.js.map +1 -1
  24. package/lib/internal/template/checkbox/base-checkbox.d.ts +1 -5
  25. package/lib/internal/template/checkbox/base-checkbox.d.ts.map +1 -1
  26. package/lib/internal/template/checkbox/base-checkbox.js.map +1 -1
  27. package/lib/internal/template/checkbox/internal.d.ts.map +1 -1
  28. package/lib/internal/template/checkbox/internal.js +3 -1
  29. package/lib/internal/template/checkbox/internal.js.map +1 -1
  30. package/lib/internal/template/container/internal.d.ts +2 -1
  31. package/lib/internal/template/container/internal.d.ts.map +1 -1
  32. package/lib/internal/template/container/internal.js +3 -2
  33. package/lib/internal/template/container/internal.js.map +1 -1
  34. package/lib/internal/template/date-input/index.d.ts.map +1 -1
  35. package/lib/internal/template/date-input/index.js +3 -4
  36. package/lib/internal/template/date-input/index.js.map +1 -1
  37. package/lib/internal/template/date-input/internal.d.ts.map +1 -1
  38. package/lib/internal/template/date-input/internal.js +2 -2
  39. package/lib/internal/template/date-input/internal.js.map +1 -1
  40. package/lib/internal/template/date-range-picker/calendar/index.js +2 -2
  41. package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
  42. package/lib/internal/template/form-field/internal.d.ts.map +1 -1
  43. package/lib/internal/template/form-field/internal.js +2 -2
  44. package/lib/internal/template/form-field/internal.js.map +1 -1
  45. package/lib/internal/template/index.d.ts +2 -0
  46. package/lib/internal/template/index.d.ts.map +1 -1
  47. package/lib/internal/template/index.js +2 -0
  48. package/lib/internal/template/index.js.map +1 -1
  49. package/lib/internal/template/input/interfaces.d.ts +11 -9
  50. package/lib/internal/template/input/interfaces.d.ts.map +1 -1
  51. package/lib/internal/template/input/interfaces.js.map +1 -1
  52. package/lib/internal/template/input/internal.d.ts +2 -2
  53. package/lib/internal/template/input/internal.d.ts.map +1 -1
  54. package/lib/internal/template/input/internal.js +7 -0
  55. package/lib/internal/template/input/internal.js.map +1 -1
  56. package/lib/internal/template/internal/base-component/styles.scoped.css +2 -5
  57. package/lib/internal/template/internal/components/autosuggest-input/index.d.ts +2 -2
  58. package/lib/internal/template/internal/components/autosuggest-input/index.d.ts.map +1 -1
  59. package/lib/internal/template/internal/components/autosuggest-input/index.js.map +1 -1
  60. package/lib/internal/template/internal/components/chart-popover/index.js +2 -2
  61. package/lib/internal/template/internal/components/chart-popover/index.js.map +1 -1
  62. package/lib/internal/template/internal/components/checkbox-icon/styles.css.js +7 -7
  63. package/lib/internal/template/internal/components/checkbox-icon/styles.scoped.css +9 -9
  64. package/lib/internal/template/internal/components/checkbox-icon/styles.selectors.js +7 -7
  65. package/lib/internal/template/internal/components/dropdown-status/index.d.ts.map +1 -1
  66. package/lib/internal/template/internal/components/dropdown-status/index.js +1 -1
  67. package/lib/internal/template/internal/components/dropdown-status/index.js.map +1 -1
  68. package/lib/internal/template/internal/environment.js +1 -1
  69. package/lib/internal/template/link/interfaces.d.ts +1 -1
  70. package/lib/internal/template/link/interfaces.d.ts.map +1 -1
  71. package/lib/internal/template/link/interfaces.js.map +1 -1
  72. package/lib/internal/template/link/styles.css.js +20 -19
  73. package/lib/internal/template/link/styles.scoped.css +75 -70
  74. package/lib/internal/template/link/styles.selectors.js +20 -19
  75. package/lib/internal/template/package.json +2 -0
  76. package/lib/internal/template/pie-chart/styles.css.js +27 -27
  77. package/lib/internal/template/pie-chart/styles.scoped.css +44 -44
  78. package/lib/internal/template/pie-chart/styles.selectors.js +27 -27
  79. package/lib/internal/template/popover/body.d.ts +1 -4
  80. package/lib/internal/template/popover/body.d.ts.map +1 -1
  81. package/lib/internal/template/popover/body.js +2 -4
  82. package/lib/internal/template/popover/body.js.map +1 -1
  83. package/lib/internal/template/popover/container.d.ts +4 -1
  84. package/lib/internal/template/popover/container.d.ts.map +1 -1
  85. package/lib/internal/template/popover/container.js +51 -37
  86. package/lib/internal/template/popover/container.js.map +1 -1
  87. package/lib/internal/template/popover/internal.js +2 -2
  88. package/lib/internal/template/popover/internal.js.map +1 -1
  89. package/lib/internal/template/popover/styles.css.js +49 -48
  90. package/lib/internal/template/popover/styles.scoped.css +209 -89
  91. package/lib/internal/template/popover/styles.selectors.js +49 -48
  92. package/lib/internal/template/popover/utils/positions.d.ts +1 -0
  93. package/lib/internal/template/popover/utils/positions.d.ts.map +1 -1
  94. package/lib/internal/template/popover/utils/positions.js +40 -14
  95. package/lib/internal/template/popover/utils/positions.js.map +1 -1
  96. package/lib/internal/template/radio-group/interfaces.d.ts +5 -0
  97. package/lib/internal/template/radio-group/interfaces.d.ts.map +1 -1
  98. package/lib/internal/template/radio-group/interfaces.js.map +1 -1
  99. package/lib/internal/template/radio-group/styles.css.js +9 -9
  100. package/lib/internal/template/radio-group/styles.scoped.css +16 -16
  101. package/lib/internal/template/radio-group/styles.selectors.js +9 -9
  102. package/lib/internal/template/split-panel/index.js +8 -8
  103. package/lib/internal/template/split-panel/index.js.map +1 -1
  104. package/lib/internal/template/split-panel/styles.css.js +58 -58
  105. package/lib/internal/template/split-panel/styles.scoped.css +81 -80
  106. package/lib/internal/template/split-panel/styles.selectors.js +58 -58
  107. package/lib/internal/template/split-panel/utils/use-pointer-events.d.ts +3 -0
  108. package/lib/internal/template/split-panel/utils/use-pointer-events.d.ts.map +1 -0
  109. package/lib/internal/template/split-panel/utils/{use-mouse-events.js → use-pointer-events.js} +12 -12
  110. package/lib/internal/template/split-panel/utils/use-pointer-events.js.map +1 -0
  111. package/lib/internal/template/tag-editor/interfaces.d.ts +1 -1
  112. package/lib/internal/template/tag-editor/interfaces.d.ts.map +1 -1
  113. package/lib/internal/template/tag-editor/interfaces.js.map +1 -1
  114. package/lib/internal/template/test-utils/dom/form-field/index.js +1 -1
  115. package/lib/internal/template/test-utils/dom/form-field/index.js.map +1 -1
  116. package/lib/internal/template/test-utils/dom/index.d.ts +6 -0
  117. package/lib/internal/template/test-utils/dom/index.js +18 -2
  118. package/lib/internal/template/test-utils/dom/index.js.map +1 -1
  119. package/lib/internal/template/test-utils/selectors/form-field/index.js +1 -1
  120. package/lib/internal/template/test-utils/selectors/form-field/index.js.map +1 -1
  121. package/lib/internal/template/test-utils/selectors/index.d.ts +6 -0
  122. package/lib/internal/template/test-utils/selectors/index.js +18 -2
  123. package/lib/internal/template/test-utils/selectors/index.js.map +1 -1
  124. package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
  125. package/lib/internal/template/textarea/interfaces.d.ts +2 -2
  126. package/lib/internal/template/textarea/interfaces.d.ts.map +1 -1
  127. package/lib/internal/template/textarea/interfaces.js.map +1 -1
  128. package/lib/internal/template/time-input/interfaces.d.ts +2 -2
  129. package/lib/internal/template/time-input/interfaces.d.ts.map +1 -1
  130. package/lib/internal/template/time-input/interfaces.js.map +1 -1
  131. package/lib/internal/template/toggle/internal.d.ts.map +1 -1
  132. package/lib/internal/template/toggle/internal.js +3 -1
  133. package/lib/internal/template/toggle/internal.js.map +1 -1
  134. package/package.json +1 -1
  135. package/lib/internal/template/split-panel/utils/use-mouse-events.d.ts +0 -3
  136. package/lib/internal/template/split-panel/utils/use-mouse-events.d.ts.map +0 -1
  137. package/lib/internal/template/split-panel/utils/use-mouse-events.js.map +0 -1
@@ -74,6 +74,12 @@
74
74
  letter-spacing: awsui.$font-display-l-letter-spacing;
75
75
  }
76
76
 
77
+ @mixin font-inherit {
78
+ font-size: inherit;
79
+ line-height: inherit;
80
+ letter-spacing: inherit;
81
+ }
82
+
77
83
  @mixin font-label {
78
84
  @include font-body-m();
79
85
  font-weight: awsui.$font-display-label-weight;
@@ -120,4 +126,7 @@
120
126
  @if $font-size == display-l {
121
127
  @include font-display-l;
122
128
  }
129
+ @if $font-size == inherit {
130
+ @include font-inherit;
131
+ }
123
132
  }
@@ -9,7 +9,17 @@
9
9
  @use '../internal/hooks/focus-visible' as focus-visible;
10
10
  @use './constants' as constants;
11
11
 
12
- $font-sizes: ('body-s', 'body-m', 'heading-xs', 'heading-s', 'heading-m', 'heading-l', 'heading-xl', 'display-l');
12
+ $font-sizes: (
13
+ 'body-s',
14
+ 'body-m',
15
+ 'heading-xs',
16
+ 'heading-s',
17
+ 'heading-m',
18
+ 'heading-l',
19
+ 'heading-xl',
20
+ 'display-l',
21
+ 'inherit'
22
+ );
13
23
 
14
24
  .link {
15
25
  @include styles.styles-reset;
@@ -5,54 +5,18 @@
5
5
 
6
6
  @use '../internal/styles' as styles;
7
7
  @use '../internal/styles/tokens' as awsui;
8
- @use '../internal/hooks/focus-visible' as focus-visible;
9
8
 
10
9
  .body {
11
10
  @include styles.styles-reset;
12
11
  @include styles.text-flex-wrapping;
13
12
 
14
- box-sizing: border-box;
15
- border-radius: awsui.$border-radius-popover;
16
13
  padding: awsui.$space-s awsui.$space-m;
17
14
 
18
- background-color: awsui.$color-background-popover;
19
- box-shadow: awsui.$shadow-popover;
20
- border: awsui.$border-field-width solid awsui.$color-border-popover;
21
15
  &-overflow-visible {
22
16
  overflow: visible;
23
17
  }
24
18
  }
25
19
 
26
- .variant-annotation {
27
- background-color: awsui.$color-background-status-info;
28
- border-color: awsui.$color-border-status-info;
29
- }
30
-
31
- .body-size-small {
32
- max-width: 210px;
33
- &.fixed-width {
34
- width: 210px;
35
- }
36
- }
37
-
38
- .body-size-medium {
39
- max-width: 310px;
40
- &.fixed-width {
41
- width: 310px;
42
- }
43
- }
44
-
45
- .body-size-large {
46
- max-width: 480px;
47
- @media (max-width: 480px) {
48
- // On viewports smaller than 480px, we default to the body-size-medium width
49
- max-width: 310px;
50
- }
51
- &.fixed-width {
52
- width: 480px;
53
- }
54
- }
55
-
56
20
  .has-dismiss {
57
21
  display: flex;
58
22
  align-items: baseline;
@@ -3,6 +3,7 @@
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
 
6
+ @use '../internal/styles' as styles;
6
7
  @use '../internal/styles/tokens' as awsui;
7
8
 
8
9
  .container {
@@ -13,6 +14,46 @@
13
14
  z-index: 2000;
14
15
  }
15
16
 
17
+ .container-body {
18
+ @include styles.styles-reset;
19
+
20
+ border-radius: awsui.$border-radius-popover;
21
+
22
+ background-color: awsui.$color-background-popover;
23
+ box-shadow: awsui.$shadow-popover;
24
+ border: awsui.$border-field-width solid awsui.$color-border-popover;
25
+ }
26
+
27
+ .container-body-variant-annotation {
28
+ background-color: awsui.$color-background-status-info;
29
+ border-color: awsui.$color-border-status-info;
30
+ }
31
+
32
+ .container-body-size-small {
33
+ max-width: 210px;
34
+ &.fixed-width {
35
+ width: 210px;
36
+ }
37
+ }
38
+
39
+ .container-body-size-medium {
40
+ max-width: 310px;
41
+ &.fixed-width {
42
+ width: 310px;
43
+ }
44
+ }
45
+
46
+ .container-body-size-large {
47
+ max-width: 480px;
48
+ @media (max-width: 480px) {
49
+ // On viewports smaller than 480px, we default to the body-size-medium width
50
+ max-width: 310px;
51
+ }
52
+ &.fixed-width {
53
+ width: 480px;
54
+ }
55
+ }
56
+
16
57
  .container-arrow {
17
58
  $arrow-offset: 12px;
18
59
  $arrow-width: 20px;
@@ -133,6 +133,9 @@ $app-layout-drawer-width: calc(#{awsui.$space-layout-toggle-diameter} + 2 * #{aw
133
133
  cursor: ns-resize;
134
134
  margin: 2px 0 0 0;
135
135
  height: $slider-width;
136
+ // Desktop Safari doesn't support touch events, but Safari on iOS does.
137
+ // stylelint-disable-next-line plugin/no-unsupported-browser-features
138
+ touch-action: none;
136
139
 
137
140
  &:focus {
138
141
  outline: none;
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-popover.d.ts","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAS3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAKvD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAErC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAE9B,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAElC,kBAAkB,EAAE,MAAM,CAAC;IAE3B,eAAe,EAAE,MAAM,CAAC;IAExB,gBAAgB,EAAE,OAAO,CAAC;IAE1B,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEvC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACpD;AASD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,KAAK,EAEL,SAAiB,EAEjB,kBAAkB,EAElB,eAAe,EAEf,kBAAkB,EAClB,gBAAgB,EAEhB,SAAS,EAET,iBAAiB,EACjB,iBAAiB,EAEjB,QAAQ,EAER,QAAQ,EAER,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,GACZ,EAAE,sBAAsB,eA6FxB"}
1
+ {"version":3,"file":"annotation-popover.d.ts","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAS3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAKvD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAEvB,SAAS,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAErC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAE9B,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qBAAqB,EAAE,MAAM,IAAI,CAAC;IAElC,kBAAkB,EAAE,MAAM,CAAC;IAE3B,eAAe,EAAE,MAAM,CAAC;IAExB,gBAAgB,EAAE,OAAO,CAAC;IAE1B,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEvC,WAAW,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;CACpD;AASD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,KAAK,EAEL,SAAiB,EAEjB,kBAAkB,EAElB,eAAe,EAEf,kBAAkB,EAClB,gBAAgB,EAEhB,SAAS,EAET,iBAAiB,EACjB,iBAAiB,EAEjB,QAAQ,EAER,QAAQ,EAER,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,GACZ,EAAE,sBAAsB,eA8FxB"}
@@ -23,8 +23,8 @@ export function AnnotationPopover(_a) {
23
23
  scrollElementIntoView((_a = trackRef.current) !== null && _a !== void 0 ? _a : undefined);
24
24
  }
25
25
  }, [trackRef]);
26
- return (React.createElement(PopoverContainer, { position: direction, trackRef: trackRef, trackKey: taskLocalStepIndex, arrow: arrow, zIndex: 1000 },
27
- React.createElement(PopoverBody, { size: "medium", fixedWidth: false, dismissButton: true, dismissAriaLabel: i18nStrings.labelDismissAnnotation, header: React.createElement(InternalBox, { color: "text-body-secondary", fontSize: "body-s", margin: { top: 'xxxs' }, className: styles.header }, title), onDismiss: onDismiss, className: styles.annotation, variant: "annotation", overflowVisible: "content", dismissButtonRef: dismissButtonRefCallback },
26
+ return (React.createElement(PopoverContainer, { size: "medium", fixedWidth: false, position: direction, trackRef: trackRef, trackKey: taskLocalStepIndex, variant: "annotation", arrow: arrow, zIndex: 1000 },
27
+ React.createElement(PopoverBody, { dismissButton: true, dismissAriaLabel: i18nStrings.labelDismissAnnotation, header: React.createElement(InternalBox, { color: "text-body-secondary", fontSize: "body-s", margin: { top: 'xxxs' }, className: styles.header }, title), onDismiss: onDismiss, className: styles.annotation, variant: "annotation", overflowVisible: "content", dismissButtonRef: dismissButtonRefCallback },
28
28
  React.createElement(InternalSpaceBetween, { size: "s" },
29
29
  React.createElement("div", { className: styles.description },
30
30
  React.createElement(InternalBox, { className: styles.content }, content)),
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-popover.js","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAG7C,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AA+BnF,IAAM,KAAK,GAAG,UAAC,QAAiC,IAAK,OAAA,CACnD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,yBAAkB,QAAQ,CAAE,CAAC,CAAC;IACtE,6BAAK,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,GAAI;IACzC,6BAAK,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,GAAI,CACrC,CACP,EALoD,CAKpD,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,EA0BT;QAzBvB,KAAK,WAAA,EACL,OAAO,aAAA,EACP,KAAK,WAAA,EAEL,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EAEjB,kBAAkB,wBAAA,EAElB,eAAe,qBAAA,EAEf,kBAAkB,wBAAA,EAClB,gBAAgB,sBAAA,EAEhB,SAAS,eAAA,EAET,iBAAiB,uBAAA,EACjB,iBAAiB,uBAAA,EAEjB,QAAQ,cAAA,EAER,QAAQ,cAAA,EAER,qBAAqB,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nB,CACe,CACF,CACX,CACG,CACpB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalBox from '../../box/internal';\nimport { ButtonProps } from '../../button/interfaces';\nimport { InternalButton } from '../../button/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport { HotspotProps } from '../../hotspot/interfaces';\nimport { AnnotationContextProps } from '../interfaces';\nimport InternalAlert from '../../alert/internal';\nimport { InternalPosition } from '../../popover/interfaces';\nimport { scrollElementIntoView } from '../../internal/utils/scrollable-containers';\n\nexport interface AnnotationPopoverProps {\n title: string;\n content: React.ReactNode;\n alert: React.ReactNode;\n\n direction: HotspotProps['direction'];\n\n nextButtonEnabled: boolean;\n onNextButtonClick: () => void;\n\n onFinish: () => void;\n\n showPreviousButton: boolean;\n previousButtonEnabled: boolean;\n onPreviousButtonClick: () => void;\n\n taskLocalStepIndex: number;\n\n totalLocalSteps: number;\n\n showFinishButton: boolean;\n\n onDismiss: () => void;\n\n trackRef: React.RefObject<HTMLElement>;\n\n i18nStrings: AnnotationContextProps['i18nStrings'];\n}\n\nconst arrow = (position: InternalPosition | null) => (\n <div className={clsx(styles.arrow, styles[`arrow-position-${position}`])}>\n <div className={styles['arrow-outer']} />\n <div className={styles['arrow-inner']} />\n </div>\n);\n\nexport function AnnotationPopover({\n title,\n content,\n alert,\n\n direction = 'top',\n\n taskLocalStepIndex,\n\n totalLocalSteps,\n\n showPreviousButton,\n showFinishButton,\n\n onDismiss,\n\n nextButtonEnabled,\n onNextButtonClick,\n\n onFinish,\n\n trackRef,\n\n previousButtonEnabled,\n onPreviousButtonClick,\n i18nStrings,\n}: AnnotationPopoverProps) {\n const dismissButtonRefCallback = useCallback(\n (element: ButtonProps.Ref) => {\n if (element) {\n element.focus({ preventScroll: true });\n // Falls back to alignTop on IE11\n scrollElementIntoView(trackRef.current ?? undefined);\n }\n },\n [trackRef]\n );\n\n return (\n <PopoverContainer\n position={direction}\n trackRef={trackRef}\n trackKey={taskLocalStepIndex}\n arrow={arrow}\n zIndex={1000}\n >\n <PopoverBody\n size=\"medium\"\n fixedWidth={false}\n dismissButton={true}\n dismissAriaLabel={i18nStrings.labelDismissAnnotation}\n header={\n <InternalBox color=\"text-body-secondary\" fontSize=\"body-s\" margin={{ top: 'xxxs' }} className={styles.header}>\n {title}\n </InternalBox>\n }\n onDismiss={onDismiss}\n className={styles.annotation}\n variant=\"annotation\"\n overflowVisible=\"content\"\n dismissButtonRef={dismissButtonRefCallback}\n >\n <InternalSpaceBetween size=\"s\">\n <div className={styles.description}>\n <InternalBox className={styles.content}>{content}</InternalBox>\n </div>\n\n {alert && <InternalAlert type=\"warning\">{alert}</InternalAlert>}\n\n <InternalSpaceBetween size=\"s\">\n <div className={styles.divider} />\n\n <div className={styles.actionBar}>\n <div className={styles.stepCounter}>\n <InternalBox className={styles['step-counter-content']} color=\"text-body-secondary\" fontSize=\"body-s\">\n {i18nStrings.stepCounterText(taskLocalStepIndex ?? 0, totalLocalSteps ?? 0)}\n </InternalBox>\n </div>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n {showPreviousButton && (\n <InternalButton\n variant=\"link\"\n onClick={onPreviousButtonClick}\n disabled={!previousButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.previousButtonText}\n className={styles['previous-button']}\n >\n {i18nStrings.previousButtonText}\n </InternalButton>\n )}\n\n {showFinishButton ? (\n <InternalButton\n onClick={onFinish}\n formAction=\"none\"\n ariaLabel={i18nStrings.finishButtonText}\n className={styles['finish-button']}\n >\n {i18nStrings.finishButtonText}\n </InternalButton>\n ) : (\n <InternalButton\n onClick={onNextButtonClick}\n disabled={!nextButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.nextButtonText}\n className={styles['next-button']}\n >\n {i18nStrings.nextButtonText}\n </InternalButton>\n )}\n </InternalSpaceBetween>\n </div>\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </PopoverBody>\n </PopoverContainer>\n );\n}\n"]}
1
+ {"version":3,"file":"annotation-popover.js","sourceRoot":"","sources":["../../../../src/annotation-context/annotation/annotation-popover.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAG7C,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AA+BnF,IAAM,KAAK,GAAG,UAAC,QAAiC,IAAK,OAAA,CACnD,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,yBAAkB,QAAQ,CAAE,CAAC,CAAC;IACtE,6BAAK,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,GAAI;IACzC,6BAAK,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,GAAI,CACrC,CACP,EALoD,CAKpD,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,EA0BT;QAzBvB,KAAK,WAAA,EACL,OAAO,aAAA,EACP,KAAK,WAAA,EAEL,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EAEjB,kBAAkB,wBAAA,EAElB,eAAe,qBAAA,EAEf,kBAAkB,wBAAA,EAClB,gBAAgB,sBAAA,EAEhB,SAA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M,EACjB,SAAS,EAAE,WAAW,CAAC,cAAc,EACrC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,IAE/B,WAAW,CAAC,cAAc,CACZ,CAClB,CACoB,CACnB,CACe,CACF,CACX,CACG,CACpB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useCallback } from 'react';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport InternalBox from '../../box/internal';\nimport { ButtonProps } from '../../button/interfaces';\nimport { InternalButton } from '../../button/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport PopoverContainer from '../../popover/container';\nimport PopoverBody from '../../popover/body';\nimport { HotspotProps } from '../../hotspot/interfaces';\nimport { AnnotationContextProps } from '../interfaces';\nimport InternalAlert from '../../alert/internal';\nimport { InternalPosition } from '../../popover/interfaces';\nimport { scrollElementIntoView } from '../../internal/utils/scrollable-containers';\n\nexport interface AnnotationPopoverProps {\n title: string;\n content: React.ReactNode;\n alert: React.ReactNode;\n\n direction: HotspotProps['direction'];\n\n nextButtonEnabled: boolean;\n onNextButtonClick: () => void;\n\n onFinish: () => void;\n\n showPreviousButton: boolean;\n previousButtonEnabled: boolean;\n onPreviousButtonClick: () => void;\n\n taskLocalStepIndex: number;\n\n totalLocalSteps: number;\n\n showFinishButton: boolean;\n\n onDismiss: () => void;\n\n trackRef: React.RefObject<HTMLElement>;\n\n i18nStrings: AnnotationContextProps['i18nStrings'];\n}\n\nconst arrow = (position: InternalPosition | null) => (\n <div className={clsx(styles.arrow, styles[`arrow-position-${position}`])}>\n <div className={styles['arrow-outer']} />\n <div className={styles['arrow-inner']} />\n </div>\n);\n\nexport function AnnotationPopover({\n title,\n content,\n alert,\n\n direction = 'top',\n\n taskLocalStepIndex,\n\n totalLocalSteps,\n\n showPreviousButton,\n showFinishButton,\n\n onDismiss,\n\n nextButtonEnabled,\n onNextButtonClick,\n\n onFinish,\n\n trackRef,\n\n previousButtonEnabled,\n onPreviousButtonClick,\n i18nStrings,\n}: AnnotationPopoverProps) {\n const dismissButtonRefCallback = useCallback(\n (element: ButtonProps.Ref) => {\n if (element) {\n element.focus({ preventScroll: true });\n // Falls back to alignTop on IE11\n scrollElementIntoView(trackRef.current ?? undefined);\n }\n },\n [trackRef]\n );\n\n return (\n <PopoverContainer\n size=\"medium\"\n fixedWidth={false}\n position={direction}\n trackRef={trackRef}\n trackKey={taskLocalStepIndex}\n variant=\"annotation\"\n arrow={arrow}\n zIndex={1000}\n >\n <PopoverBody\n dismissButton={true}\n dismissAriaLabel={i18nStrings.labelDismissAnnotation}\n header={\n <InternalBox color=\"text-body-secondary\" fontSize=\"body-s\" margin={{ top: 'xxxs' }} className={styles.header}>\n {title}\n </InternalBox>\n }\n onDismiss={onDismiss}\n className={styles.annotation}\n variant=\"annotation\"\n overflowVisible=\"content\"\n dismissButtonRef={dismissButtonRefCallback}\n >\n <InternalSpaceBetween size=\"s\">\n <div className={styles.description}>\n <InternalBox className={styles.content}>{content}</InternalBox>\n </div>\n\n {alert && <InternalAlert type=\"warning\">{alert}</InternalAlert>}\n\n <InternalSpaceBetween size=\"s\">\n <div className={styles.divider} />\n\n <div className={styles.actionBar}>\n <div className={styles.stepCounter}>\n <InternalBox className={styles['step-counter-content']} color=\"text-body-secondary\" fontSize=\"body-s\">\n {i18nStrings.stepCounterText(taskLocalStepIndex ?? 0, totalLocalSteps ?? 0)}\n </InternalBox>\n </div>\n <InternalSpaceBetween size=\"xs\" direction=\"horizontal\">\n {showPreviousButton && (\n <InternalButton\n variant=\"link\"\n onClick={onPreviousButtonClick}\n disabled={!previousButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.previousButtonText}\n className={styles['previous-button']}\n >\n {i18nStrings.previousButtonText}\n </InternalButton>\n )}\n\n {showFinishButton ? (\n <InternalButton\n onClick={onFinish}\n formAction=\"none\"\n ariaLabel={i18nStrings.finishButtonText}\n className={styles['finish-button']}\n >\n {i18nStrings.finishButtonText}\n </InternalButton>\n ) : (\n <InternalButton\n onClick={onNextButtonClick}\n disabled={!nextButtonEnabled}\n formAction=\"none\"\n ariaLabel={i18nStrings.nextButtonText}\n className={styles['next-button']}\n >\n {i18nStrings.nextButtonText}\n </InternalButton>\n )}\n </InternalSpaceBetween>\n </div>\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n </PopoverBody>\n </PopoverContainer>\n );\n}\n"]}
@@ -4,9 +4,9 @@ import { FormFieldValidationControlProps } from '../internal/context/form-field-
4
4
  import { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';
5
5
  import { BaseDropdownHostProps, OptionsLoadItemsDetail, OptionsFilteringType } from '../internal/components/dropdown/interfaces';
6
6
  import { DropdownStatusProps } from '../internal/components/dropdown-status';
7
- import { BaseInputProps, InputKeyEvents, InputProps } from '../input/interfaces';
7
+ import { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../input/interfaces';
8
8
  import { NonCancelableEventHandler } from '../internal/events';
9
- export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, BaseDropdownHostProps, InputKeyEvents, FormFieldValidationControlProps, DropdownStatusProps {
9
+ export interface AutosuggestProps extends BaseComponentProps, BaseInputProps, InputAutoCorrect, BaseDropdownHostProps, InputKeyEvents, FormFieldValidationControlProps, DropdownStatusProps {
10
10
  /**
11
11
  * Specifies an array of options that are displayed to the user as a dropdown list.
12
12
  * The options can be grouped using `OptionGroup` objects.
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EACL,qBAA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/C;CACF;AAGD,oBAAY,eAAe,GAAG,CAAC,gBAAgB,CAAC,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,GAAG;IACvF,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,aAAa,CAAC;IAC1C,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAAC;CACxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsLoadItemsDetail,\n OptionsFilteringType,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { BaseInputProps, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n BaseDropdownHostProps,\n InputKeyEvents,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value` or `label` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n */\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/autosuggest/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { OptionDefinition, OptionGroup } from '../internal/components/option/interfaces';\nimport {\n BaseDropdownHostProps,\n OptionsLoadItemsDetail,\n OptionsFilteringType,\n} from '../internal/components/dropdown/interfaces';\nimport { DropdownStatusProps } from '../internal/components/dropdown-status';\nimport { BaseInputProps, InputAutoCorrect, InputKeyEvents, InputProps } from '../input/interfaces';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface AutosuggestProps\n extends BaseComponentProps,\n BaseInputProps,\n InputAutoCorrect,\n BaseDropdownHostProps,\n InputKeyEvents,\n FormFieldValidationControlProps,\n DropdownStatusProps {\n /**\n * Specifies an array of options that are displayed to the user as a dropdown list.\n * The options can be grouped using `OptionGroup` objects.\n *\n * #### Option\n * - `value` (string) - The returned value of the option when selected.\n * - `label` (string) - (Optional) Option text displayed to the user.\n * - `description` (string) - (Optional) Further information about the option that appears below the label.\n * - `disabled` (boolean) - (Optional) Determines whether the option is disabled.\n * - `labelTag` (string) - (Optional) A label tag that provides additional guidance, shown next to the label.\n * - `tags` [string[]] - (Optional) A list of tags giving further guidance about the option.\n * - `filteringTags` [string[]] - (Optional) A list of additional tags used for automatic filtering.\n * - `iconName` (string) - (Optional) Specifies the name of an [icon](/components/icon/) to display in the option.\n * - `iconAlt` (string) - (Optional) Specifies alternate text for a custom icon, for use with `iconUrl`.\n * - `iconUrl` (string) - (Optional) URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n *\n * #### OptionGroup\n * - `label` (string) - Option group text displayed to the user.\n * - `disabled` (boolean) - (Optional) Determines whether the option group is disabled.\n * - `options` (Option[]) - (Optional) The options under this group.\n *\n * Note: Only one level of option nesting is supported.\n *\n * If you want to use the built-in filtering capabilities of this component, provide\n * a list of all valid options here and they will be automatically filtered based on the user's filtering input.\n *\n * Alternatively, you can listen to the `onChange` or `onLoadItems` event and set new options\n * on your own.\n **/\n options?: AutosuggestProps.Options;\n /**\n * Determines how filtering is applied to the list of `options`:\n * * `auto` - The component will automatically filter options based on user input.\n * * `manual` - You will set up `onChange` or `onLoadItems` event listeners and filter options on your side or request\n * them from server.\n *\n * By default the component will filter the provided `options` based on the value of the filtering input field.\n * Only options that have a `value` or `label` that contains the input value as a substring\n * are displayed in the list of options.\n *\n * If you set this property to `manual`, this default filtering mechanism is disabled and all provided `options` are\n * displayed in the dropdown list. In that case make sure that you use the `onChange` or `onLoadItems` events in order\n * to set the `options` property to the options that are relevant for the user, given the filtering input value.\n *\n * Note: Manual filtering doesn't disable match highlighting.\n **/\n filteringType?: OptionsFilteringType;\n\n /**\n * Specifies a function that generates the custom value indicator (for example, `Use \"${value}\"`).\n */\n enteredTextLabel: AutosuggestProps.EnteredTextLabel;\n\n /**\n * Specifies the text that's displayed when there aren't any suggestions to display.\n * This is displayed when `statusType` is set to `finished` or it's not set at all.\n */\n empty?: React.ReactNode;\n\n /**\n * Called whenever a user selects an option in the dropdown. Don't use this event as the only way to handle user input.\n * Instead, use `onSelect` in combination with the `onChange` handler only as an optional convenience for the user.\n */\n onSelect?: NonCancelableEventHandler<AutosuggestProps.SelectDetail>;\n\n /**\n * Specifies the localized string that describes an option as being selected.\n * This is required to provide a good screen reader experience. For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n selectedAriaLabel?: string;\n /**\n * Overrides the element that is announced to screen readers\n * when the highlighted option changes. By default, this announces\n * the option's name and properties, and its selected state if\n * the `selectedLabel` property is defined.\n * The highlighted option is provided, and its group (if groups\n * are used and it differs from the group of the previously highlighted option).\n *\n * For more information, see the\n * [accessibility guidelines](/components/autosuggest/?tabId=usage#accessibility-guidelines).\n */\n renderHighlightedAriaLive?: AutosuggestProps.ContainingOptionAndGroupString;\n}\n\nexport namespace AutosuggestProps {\n export type ChangeDetail = InputProps.ChangeDetail;\n export type KeyDetail = InputProps.KeyDetail;\n export type FilteringType = OptionsFilteringType;\n export type Option = OptionDefinition;\n export type Options = ReadonlyArray<Option | OptionGroup>;\n export type EnteredTextLabel = (value: string) => string;\n export interface OptionGroup extends Option {\n label?: string;\n options: ReadonlyArray<Option>;\n }\n export type LoadItemsDetail = OptionsLoadItemsDetail;\n export type StatusType = DropdownStatusProps.StatusType;\n export interface SelectDetail {\n value: string;\n }\n\n export interface ContainingOptionAndGroupString {\n (option: Option, group?: OptionGroup): string;\n }\n}\n\n// TODO: use DropdownOption type same as in select and multiselect\nexport type AutosuggestItem = (AutosuggestProps.Option | AutosuggestProps.OptionGroup) & {\n type?: 'parent' | 'child' | 'use-entered';\n option: OptionDefinition | OptionGroup;\n};\n"]}
@@ -19,8 +19,8 @@ export default function Tooltip(_a) {
19
19
  children,
20
20
  open && (React.createElement(Portal, null,
21
21
  React.createElement("span", { className: portalClasses },
22
- React.createElement(PopoverContainer, { position: position, trackRef: ref, arrow: function (position) { return React.createElement(Arrow, { position: position }); }, renderWithPortal: true, zIndex: 7000 },
23
- React.createElement(PopoverBody, { size: "small", fixedWidth: false, dismissButton: false, dismissAriaLabel: undefined, header: null, onDismiss: function () { }, overflowVisible: "both" },
22
+ React.createElement(PopoverContainer, { size: "small", fixedWidth: false, position: position, trackRef: ref, arrow: function (position) { return React.createElement(Arrow, { position: position }); }, renderWithPortal: true, zIndex: 7000 },
23
+ React.createElement(PopoverBody, { dismissButton: false, dismissAriaLabel: undefined, header: null, onDismiss: function () { }, overflowVisible: "both" },
24
24
  React.createElement("span", { "data-testid": "button-dropdown-disabled-reason", role: "tooltip" }, content))))))));
25
25
  }
26
26
  function useTooltipOpen(timeout) {
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/button-dropdown/tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAwB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,MAAM,MAAM,+BAA+B,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,m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AM,EAAU,CAAC;IAC1B,IAAA,KAAsB,QAAQ,CAAC,KAAK,CAAC,EAApC,MAAM,QAAA,EAAE,SAAS,QAAmB,CAAC;IAE5C,IAAM,KAAK,GAAG;QACZ,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7B,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IACF,IAAM,IAAI,GAAG,cAAM,OAAA,SAAS,CAAC,IAAI,CAAC,EAAf,CAAe,CAAC;IACnC,IAAM,WAAW,GAAG;QAClB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC;IACF,IAAM,SAAS,GAAyB,UAAA,CAAC;QACvC,IAAI,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YAC7B,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,EAAE,CAAC;SACT;IACH,CAAC,CAAC;IAEF,IAAM,OAAO,GAAG,WAAW,CAAC;IAC5B,IAAM,MAAM,GAAG,KAAK,CAAC;IAErB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,YAAY,EAAE;YACZ,MAAM,QAAA;YACN,OAAO,SAAA;YACP,SAAS,WAAA;SACV;KACF,CAAC;AACJ,CAAC;AAED,IAAM,QAAQ,GAAG,UAAC,GAAW,IAAK,OAAA,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAjC,CAAiC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEventHandler, useRef, useState } from 'react';\n\nimport Arrow from '../popover/arrow';\nimport PopoverContainer from '../popover/container';\nimport PopoverBody from '../popover/body';\nimport Portal from '../internal/components/portal';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useReducedMotion } from '../internal/hooks/use-visual-mode';\n\nexport interface TooltipProps {\n children?: React.ReactNode;\n content?: React.ReactNode;\n position?: 'top' | 'right' | 'bottom' | 'left';\n}\n\nconst DEFAULT_OPEN_TIMEOUT_IN_MS = 120;\n\nexport default function Tooltip({ children, content, position = 'right' }: TooltipProps) {\n const ref = useRef<HTMLSpanElement | null>(null);\n const isReducedMotion = useReducedMotion(ref);\n const { open, triggerProps } = useTooltipOpen(isReducedMotion ? 0 : DEFAULT_OPEN_TIMEOUT_IN_MS);\n const portalClasses = usePortalModeClasses(ref);\n\n return (\n <span ref={ref} {...triggerProps}>\n {children}\n {open && (\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n position={position}\n trackRef={ref}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={7000}\n >\n <PopoverBody\n size=\"small\"\n fixedWidth={false}\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <span data-testid=\"button-dropdown-disabled-reason\" role=\"tooltip\">\n {content}\n </span>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n )}\n </span>\n );\n}\n\nfunction useTooltipOpen(timeout: number) {\n const handle = useRef<number>();\n const [isOpen, setIsOpen] = useState(false);\n\n const close = () => {\n clearTimeout(handle.current);\n setIsOpen(false);\n };\n const open = () => setIsOpen(true);\n const openDelayed = () => {\n handle.current = setTimeout(open, timeout);\n };\n const onKeyDown: KeyboardEventHandler = e => {\n if (isOpen && isEscape(e.key)) {\n e.preventDefault();\n e.stopPropagation();\n close();\n }\n };\n\n const onFocus = openDelayed;\n const onBlur = close;\n\n return {\n open: isOpen,\n triggerProps: {\n onBlur,\n onFocus,\n onKeyDown,\n },\n };\n}\n\nconst isEscape = (key: string) => key === 'Escape' || key === 'Esc';\n"]}
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/button-dropdown/tooltip.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCA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,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK,EAAjC,CAAiC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { KeyboardEventHandler, useRef, useState } from 'react';\n\nimport Arrow from '../popover/arrow';\nimport PopoverContainer from '../popover/container';\nimport PopoverBody from '../popover/body';\nimport Portal from '../internal/components/portal';\nimport { usePortalModeClasses } from '../internal/hooks/use-portal-mode-classes';\nimport { useReducedMotion } from '../internal/hooks/use-visual-mode';\n\nexport interface TooltipProps {\n children?: React.ReactNode;\n content?: React.ReactNode;\n position?: 'top' | 'right' | 'bottom' | 'left';\n}\n\nconst DEFAULT_OPEN_TIMEOUT_IN_MS = 120;\n\nexport default function Tooltip({ children, content, position = 'right' }: TooltipProps) {\n const ref = useRef<HTMLSpanElement | null>(null);\n const isReducedMotion = useReducedMotion(ref);\n const { open, triggerProps } = useTooltipOpen(isReducedMotion ? 0 : DEFAULT_OPEN_TIMEOUT_IN_MS);\n const portalClasses = usePortalModeClasses(ref);\n\n return (\n <span ref={ref} {...triggerProps}>\n {children}\n {open && (\n <Portal>\n <span className={portalClasses}>\n <PopoverContainer\n size=\"small\"\n fixedWidth={false}\n position={position}\n trackRef={ref}\n arrow={position => <Arrow position={position} />}\n renderWithPortal={true}\n zIndex={7000}\n >\n <PopoverBody\n dismissButton={false}\n dismissAriaLabel={undefined}\n header={null}\n onDismiss={() => {}}\n overflowVisible=\"both\"\n >\n <span data-testid=\"button-dropdown-disabled-reason\" role=\"tooltip\">\n {content}\n </span>\n </PopoverBody>\n </PopoverContainer>\n </span>\n </Portal>\n )}\n </span>\n );\n}\n\nfunction useTooltipOpen(timeout: number) {\n const handle = useRef<number>();\n const [isOpen, setIsOpen] = useState(false);\n\n const close = () => {\n clearTimeout(handle.current);\n setIsOpen(false);\n };\n const open = () => setIsOpen(true);\n const openDelayed = () => {\n handle.current = setTimeout(open, timeout);\n };\n const onKeyDown: KeyboardEventHandler = e => {\n if (isOpen && isEscape(e.key)) {\n e.preventDefault();\n e.stopPropagation();\n close();\n }\n };\n\n const onFocus = openDelayed;\n const onBlur = close;\n\n return {\n open: isOpen,\n triggerProps: {\n onBlur,\n onFocus,\n onKeyDown,\n },\n };\n}\n\nconst isEscape = (key: string) => key === 'Escape' || key === 'Esc';\n"]}
@@ -1,5 +1,6 @@
1
+ import { BaseComponentProps } from '../internal/base-component';
1
2
  import { NonCancelableEventHandler } from '../internal/events';
2
- export interface CalendarProps {
3
+ export interface CalendarProps extends BaseComponentProps {
3
4
  /**
4
5
  * The current input value, in YYYY-MM-DD format.
5
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC;IAEpD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;CAClE;AAED,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,YAAY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,qBAAqB;QACpC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC;IAEpD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;CAClE;AAED,yBAAiB,aAAa,CAAC;IAC7B,UAAiB,YAAY;QAC3B;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,qBAAqB;QACpC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;KACvB;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CalendarProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\n\n /**\n * Defines whether a particular date is enabled in the calendar or not.\n * If you disable a date in the calendar, users can still enter this date using a keyboard.\n * We recommend that you also validate these constraints on the client-side and server-side\n * as you would for other form elements.\n * @param date\n */\n isDateEnabled?: CalendarProps.IsDateEnabledFunction;\n\n /**\n * Specifies the locale to use to render month names and determine the starting day of the week.\n * If you don't provide this, the locale is determined by the page and browser locales.\n * Supported values and formats are listed in the\n * [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Determines the starting day of the week. The values 0-6 map to Sunday-Saturday.\n * By default the starting day of the week is defined by the locale, but you can use this property to override it.\n */\n startOfWeek?: number;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Called whenever a user changes the input value (by typing, pasting, or selecting a value).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<CalendarProps.ChangeDetail>;\n}\n\nexport namespace CalendarProps {\n export interface ChangeDetail {\n /**\n * The new value of this component.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/calendar/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface CalendarProps extends BaseComponentProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\n\n /**\n * Defines whether a particular date is enabled in the calendar or not.\n * If you disable a date in the calendar, users can still enter this date using a keyboard.\n * We recommend that you also validate these constraints on the client-side and server-side\n * as you would for other form elements.\n * @param date\n */\n isDateEnabled?: CalendarProps.IsDateEnabledFunction;\n\n /**\n * Specifies the locale to use to render month names and determine the starting day of the week.\n * If you don't provide this, the locale is determined by the page and browser locales.\n * Supported values and formats are listed in the\n * [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).\n */\n locale?: string;\n\n /**\n * Determines the starting day of the week. The values 0-6 map to Sunday-Saturday.\n * By default the starting day of the week is defined by the locale, but you can use this property to override it.\n */\n startOfWeek?: number;\n\n /**\n * Used as part of the `aria-label` for today's date in the calendar.\n */\n todayAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'next month' button.\n */\n nextMonthAriaLabel: string;\n\n /**\n * Specifies an `aria-label` for the 'previous month' button.\n */\n previousMonthAriaLabel: string;\n\n /**\n * Called whenever a user changes the input value (by typing, pasting, or selecting a value).\n * The event `detail` contains the current value of the field.\n */\n onChange?: NonCancelableEventHandler<CalendarProps.ChangeDetail>;\n}\n\nexport namespace CalendarProps {\n export interface ChangeDetail {\n /**\n * The new value of this component.\n */\n value: string;\n }\n\n export interface IsDateEnabledFunction {\n (date: Date): boolean;\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { CalendarProps } from './interfaces.js';
2
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';
2
3
  export declare type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;
3
- export default function Calendar({ value, locale, startOfWeek, isDateEnabled, todayAriaLabel, nextMonthAriaLabel, previousMonthAriaLabel, onChange, }: CalendarProps): JSX.Element;
4
+ export default function Calendar({ value, locale, startOfWeek, isDateEnabled, todayAriaLabel, nextMonthAriaLabel, previousMonthAriaLabel, onChange, __internalRootRef, ...rest }: CalendarProps & InternalBaseComponentProps): JSX.Element;
4
5
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,MAAW,EACX,WAAW,EACX,aAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,GACT,EAAE,aAAa,eAkHf"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAG3F,oBAAY,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,KAAK,EACL,MAAW,EACX,WAAW,EACX,aAA0B,EAC1B,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,iBAAiB,EACjB,GAAG,IAAI,EACR,EAAE,aAAa,GAAG,0BAA0B,eAyH5C"}
@@ -1,5 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ import { __assign, __rest } from "tslib";
3
4
  import React, { useEffect, useRef, useState } from 'react';
4
5
  import { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';
5
6
  import styles from './styles.css.js';
@@ -13,14 +14,18 @@ import { formatDate } from '../internal/utils/date-time';
13
14
  import { fireNonCancelableEvent } from '../internal/events/index.js';
14
15
  import checkControlled from '../internal/hooks/check-controlled/index.js';
15
16
  import clsx from 'clsx';
17
+ import { getBaseProps } from '../internal/base-component';
18
+ import { useMergeRefs } from '../internal/hooks/use-merge-refs/index.js';
16
19
  export default function Calendar(_a) {
17
- var value = _a.value, _b = _a.locale, locale = _b === void 0 ? '' : _b, startOfWeek = _a.startOfWeek, _c = _a.isDateEnabled, isDateEnabled = _c === void 0 ? function () { return true; } : _c, todayAriaLabel = _a.todayAriaLabel, nextMonthAriaLabel = _a.nextMonthAriaLabel, previousMonthAriaLabel = _a.previousMonthAriaLabel, onChange = _a.onChange;
20
+ var value = _a.value, _b = _a.locale, locale = _b === void 0 ? '' : _b, startOfWeek = _a.startOfWeek, _c = _a.isDateEnabled, isDateEnabled = _c === void 0 ? function () { return true; } : _c, todayAriaLabel = _a.todayAriaLabel, nextMonthAriaLabel = _a.nextMonthAriaLabel, previousMonthAriaLabel = _a.previousMonthAriaLabel, onChange = _a.onChange, __internalRootRef = _a.__internalRootRef, rest = __rest(_a, ["value", "locale", "startOfWeek", "isDateEnabled", "todayAriaLabel", "nextMonthAriaLabel", "previousMonthAriaLabel", "onChange", "__internalRootRef"]);
18
21
  checkControlled('Calendar', 'value', value, 'onChange', onChange);
22
+ var baseProps = getBaseProps(rest);
19
23
  var normalizedLocale = normalizeLocale('Calendar', locale);
20
- var normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);
24
+ var normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, normalizedLocale);
21
25
  var elementRef = useRef(null);
22
26
  var gridWrapperRef = useRef(null);
23
27
  var _d = useState(null), focusedDate = _d[0], setFocusedDate = _d[1];
28
+ var ref = useMergeRefs(elementRef, __internalRootRef);
24
29
  // Set displayed date to value if defined or to current date otherwise.
25
30
  var memoizedValue = memoizedDate('value', value);
26
31
  var defaultDisplayedDate = memoizedValue !== null && memoizedValue !== void 0 ? memoizedValue : new Date();
@@ -89,7 +94,7 @@ export default function Calendar(_a) {
89
94
  setFocusedDate(null);
90
95
  }
91
96
  };
92
- return (React.createElement("div", { className: clsx(styles.root, styles.calendar), ref: elementRef },
97
+ return (React.createElement("div", __assign({ ref: ref, role: "application" }, baseProps, { className: clsx(styles.root, styles.calendar, baseProps.className) }),
93
98
  React.createElement("div", { className: styles['calendar-inner'] },
94
99
  React.createElement(CalendarHeader, { baseDate: baseDate, locale: normalizedLocale, onChangeMonth: onHeaderChangeMonthHandler, previousMonthLabel: previousMonthAriaLabel, nextMonthLabel: nextMonthAriaLabel }),
95
100
  React.createElement("div", { onBlur: onGridBlur, ref: gridWrapperRef },
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,eAAe,MAAM,6CAA6C,CAAC;AAC1E,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EASjB;QARd,KAAK,WAAA,EACL,cAAW,EAAX,MAAM,mBAAG,EAAE,KAAA,EACX,WAAW,iBAAA,EACX,qBAA0B,EAA1B,aAAa,mBAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,KAAA,EAC1B,cAA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EAAE,cAAc;gBAC1C,oBAAC,IAAI,IACH,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,qBAAqB,EAClC,YAAY,EAAE,uBAAuB,EACrC,WAAW,EAAE,sBAAsB,EACnC,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,qBAAqB,EAClC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,aAAa,EAC3B,eAAe,EAAE,gBAAgB,GACjC,CACE,CACF,CACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport moveFocusHandler from './utils/move-focus-handler';\nimport { memoizedDate } from './utils/memoized-date.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update.js';\nimport { normalizeLocale, normalizeStartOfWeek } from './utils/locales.js';\nimport { formatDate } from '../internal/utils/date-time';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport checkControlled from '../internal/hooks/check-controlled/index.js';\nimport clsx from 'clsx';\nimport { CalendarProps } from './interfaces.js';\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport default function Calendar({\n value,\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n}: CalendarProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n const elementRef = useRef<HTMLDivElement>(null);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n\n // Set displayed date to value if defined or to current date otherwise.\n const memoizedValue = memoizedDate('value', value);\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n // Update displayed date if value changes.\n useEffect(() => {\n memoizedValue && setDisplayedDate(prev => (prev.getTime() !== memoizedValue.getTime() ? memoizedValue : prev));\n }, [memoizedValue]);\n\n const selectFocusedDate = (selected: Date | null, baseDate: Date): Date | null => {\n if (selected && isDateEnabled(selected) && isSameMonth(selected, baseDate)) {\n return selected;\n }\n const today = new Date();\n if (isDateEnabled(today) && isSameMonth(today, baseDate)) {\n return today;\n }\n if (isDateEnabled(baseDate)) {\n return baseDate;\n }\n return null;\n };\n\n // Get the first enabled date of the month. If no day is enabled in the given month, return the first day of the month.\n // This is needed because `baseDate` is used as the first focusable date, for example when navigating to the calendar area.\n const getBaseDate = (date: Date) => {\n const startDate = startOfMonth(date);\n for (let i = 0; i < getDaysInMonth(date); i++) {\n const currentDate = addDays(startDate, i);\n if (isDateEnabled(currentDate)) {\n return currentDate;\n }\n }\n return startDate;\n };\n\n const baseDate: Date = getBaseDate(displayedDate);\n const focusedOrSelectedDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);\n\n const onHeaderChangeMonthHandler = (isPreviousButtonClick?: boolean) => {\n setDisplayedDate(addMonths(baseDate, isPreviousButtonClick ? -1 : 1));\n setFocusedDate(null);\n };\n\n const onGridChangeMonthHandler = (newMonth: Date) => {\n setDisplayedDate(newMonth);\n setFocusedDate(null);\n };\n\n const onGridFocusDateHandler = (date: null | Date) => {\n if (date) {\n const value = memoizedDate('focused', formatDate(date));\n setFocusedDate(value);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\n\n // The focused date changes as a feedback to keyboard navigation in the grid.\n // Once changed, the corresponding day button needs to receive the actual focus.\n useEffectOnUpdate(() => {\n if (focusedDate) {\n (elementRef.current?.querySelector(`.${styles['calendar-day-focusable']}`) as HTMLDivElement)?.focus();\n }\n }, [focusedDate]);\n\n const onGridBlur = (event: React.FocusEvent) => {\n const newFocusTargetIsInGrid = event.relatedTarget && gridWrapperRef.current?.contains(event.relatedTarget as Node);\n if (!newFocusTargetIsInGrid) {\n setFocusedDate(null);\n }\n };\n\n return (\n <div className={clsx(styles.root, styles.calendar)} ref={elementRef}>\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedOrSelectedDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/calendar/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;A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Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { addDays, addMonths, getDaysInMonth, isSameMonth, startOfMonth } from 'date-fns';\nimport styles from './styles.css.js';\nimport CalendarHeader from './header';\nimport Grid from './grid';\nimport moveFocusHandler from './utils/move-focus-handler';\nimport { memoizedDate } from './utils/memoized-date.js';\nimport { useEffectOnUpdate } from '../internal/hooks/use-effect-on-update.js';\nimport { normalizeLocale, normalizeStartOfWeek } from './utils/locales.js';\nimport { formatDate } from '../internal/utils/date-time';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport checkControlled from '../internal/hooks/check-controlled/index.js';\nimport clsx from 'clsx';\nimport { CalendarProps } from './interfaces.js';\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs/index.js';\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\nexport default function Calendar({\n value,\n locale = '',\n startOfWeek,\n isDateEnabled = () => true,\n todayAriaLabel,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n onChange,\n __internalRootRef,\n ...rest\n}: CalendarProps & InternalBaseComponentProps) {\n checkControlled('Calendar', 'value', value, 'onChange', onChange);\n\n const baseProps = getBaseProps(rest);\n const normalizedLocale = normalizeLocale('Calendar', locale);\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, normalizedLocale);\n const elementRef = useRef<HTMLDivElement>(null);\n const gridWrapperRef = useRef<HTMLDivElement>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n const ref = useMergeRefs(elementRef, __internalRootRef);\n\n // Set displayed date to value if defined or to current date otherwise.\n const memoizedValue = memoizedDate('value', value);\n const defaultDisplayedDate = memoizedValue ?? new Date();\n const [displayedDate, setDisplayedDate] = useState(defaultDisplayedDate);\n\n // Update displayed date if value changes.\n useEffect(() => {\n memoizedValue && setDisplayedDate(prev => (prev.getTime() !== memoizedValue.getTime() ? memoizedValue : prev));\n }, [memoizedValue]);\n\n const selectFocusedDate = (selected: Date | null, baseDate: Date): Date | null => {\n if (selected && isDateEnabled(selected) && isSameMonth(selected, baseDate)) {\n return selected;\n }\n const today = new Date();\n if (isDateEnabled(today) && isSameMonth(today, baseDate)) {\n return today;\n }\n if (isDateEnabled(baseDate)) {\n return baseDate;\n }\n return null;\n };\n\n // Get the first enabled date of the month. If no day is enabled in the given month, return the first day of the month.\n // This is needed because `baseDate` is used as the first focusable date, for example when navigating to the calendar area.\n const getBaseDate = (date: Date) => {\n const startDate = startOfMonth(date);\n for (let i = 0; i < getDaysInMonth(date); i++) {\n const currentDate = addDays(startDate, i);\n if (isDateEnabled(currentDate)) {\n return currentDate;\n }\n }\n return startDate;\n };\n\n const baseDate: Date = getBaseDate(displayedDate);\n const focusedOrSelectedDate = focusedDate || selectFocusedDate(memoizedValue, baseDate);\n\n const onHeaderChangeMonthHandler = (isPreviousButtonClick?: boolean) => {\n setDisplayedDate(addMonths(baseDate, isPreviousButtonClick ? -1 : 1));\n setFocusedDate(null);\n };\n\n const onGridChangeMonthHandler = (newMonth: Date) => {\n setDisplayedDate(newMonth);\n setFocusedDate(null);\n };\n\n const onGridFocusDateHandler = (date: null | Date) => {\n if (date) {\n const value = memoizedDate('focused', formatDate(date));\n setFocusedDate(value);\n }\n };\n\n const onGridSelectDateHandler = (date: Date) => {\n fireNonCancelableEvent(onChange, { value: formatDate(date) });\n setFocusedDate(null);\n };\n\n // The focused date changes as a feedback to keyboard navigation in the grid.\n // Once changed, the corresponding day button needs to receive the actual focus.\n useEffectOnUpdate(() => {\n if (focusedDate) {\n (elementRef.current?.querySelector(`.${styles['calendar-day-focusable']}`) as HTMLDivElement)?.focus();\n }\n }, [focusedDate]);\n\n const onGridBlur = (event: React.FocusEvent) => {\n const newFocusTargetIsInGrid = event.relatedTarget && gridWrapperRef.current?.contains(event.relatedTarget as Node);\n if (!newFocusTargetIsInGrid) {\n setFocusedDate(null);\n }\n };\n\n return (\n <div\n ref={ref}\n role=\"application\"\n {...baseProps}\n className={clsx(styles.root, styles.calendar, baseProps.className)}\n >\n <div className={styles['calendar-inner']}>\n <CalendarHeader\n baseDate={baseDate}\n locale={normalizedLocale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={previousMonthAriaLabel}\n nextMonthLabel={nextMonthAriaLabel}\n />\n <div onBlur={onGridBlur} ref={gridWrapperRef}>\n <Grid\n locale={normalizedLocale}\n baseDate={baseDate}\n isDateEnabled={isDateEnabled}\n focusedDate={focusedOrSelectedDate}\n onSelectDate={onGridSelectDateHandler}\n onFocusDate={onGridFocusDateHandler}\n onChangeMonth={onGridChangeMonthHandler}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={todayAriaLabel}\n selectedDate={memoizedValue}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBAwHc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cards/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmB/D,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,QAAA,MAAM,KAAK,qBA+Hc,CAAC;AAE1B,eAAe,KAAK,CAAC"}
@@ -19,12 +19,16 @@ import { useSupportsStickyHeader } from '../container/use-sticky-header';
19
19
  import useBaseComponent from '../internal/hooks/use-base-component';
20
20
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
21
21
  import { useMergeRefs } from '../internal/hooks/use-merge-refs';
22
+ import { useUniqueId } from '../internal/hooks/use-unique-id';
22
23
  var Cards = React.forwardRef(function (_a, ref) {
23
24
  var _b = _a.items, items = _b === void 0 ? [] : _b, cardDefinition = _a.cardDefinition, _c = _a.cardsPerRow, cardsPerRow = _c === void 0 ? [] : _c, header = _a.header, filter = _a.filter, pagination = _a.pagination, preferences = _a.preferences, empty = _a.empty, loading = _a.loading, loadingText = _a.loadingText, trackBy = _a.trackBy, selectedItems = _a.selectedItems, selectionType = _a.selectionType, isItemDisabled = _a.isItemDisabled, onSelectionChange = _a.onSelectionChange, ariaLabels = _a.ariaLabels, visibleSections = _a.visibleSections, stickyHeader = _a.stickyHeader, stickyHeaderVerticalOffset = _a.stickyHeaderVerticalOffset, _d = _a.variant, variant = _d === void 0 ? 'container' : _d, rest = __rest(_a, ["items", "cardDefinition", "cardsPerRow", "header", "filter", "pagination", "preferences", "empty", "loading", "loadingText", "trackBy", "selectedItems", "selectionType", "isItemDisabled", "onSelectionChange", "ariaLabels", "visibleSections", "stickyHeader", "stickyHeaderVerticalOffset", "variant"]);
24
25
  var __internalRootRef = useBaseComponent('Cards').__internalRootRef;
25
26
  var baseProps = getBaseProps(rest);
26
27
  var isRefresh = useVisualRefresh();
27
28
  var computedVariant = isRefresh ? variant : 'container';
29
+ var instanceUniqueId = useUniqueId('cards');
30
+ var cardsId = (baseProps === null || baseProps === void 0 ? void 0 : baseProps.id) || instanceUniqueId;
31
+ var cardsHeaderId = header ? "".concat(cardsId, "-header") : undefined;
28
32
  var _e = useContainerQuery(function (_a) {
29
33
  var width = _a.width;
30
34
  return getCardsPerRow(width, cardsPerRow);
@@ -66,24 +70,30 @@ var Cards = React.forwardRef(function (_a, ref) {
66
70
  }
67
71
  return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: mergedRef }),
68
72
  React.createElement(InternalContainer, { header: hasToolsHeader && (React.createElement("div", { className: clsx(styles.header, isRefresh && styles['header-refresh'], styles["header-variant-".concat(computedVariant)]) },
69
- React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences }))), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef },
70
- React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header']) }, status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus }))))));
73
+ React.createElement(ToolsHeader, { header: header, filter: filter, pagination: pagination, preferences: preferences }))), disableContentPaddings: true, disableHeaderPaddings: computedVariant === 'full-page', variant: computedVariant === 'container' ? 'cards' : computedVariant, __stickyHeader: stickyHeader, __stickyOffset: stickyHeaderVerticalOffset, __headerRef: headerRef, __headerId: cardsHeaderId },
74
+ React.createElement("div", { className: clsx(hasToolsHeader && styles['has-header']) }, status !== null && status !== void 0 ? status : (React.createElement(CardsList, { items: items, cardDefinition: cardDefinition, trackBy: trackBy, selectionType: selectionType, columns: columns, isItemSelected: isItemSelected, getItemSelectionProps: getItemSelectionProps, visibleSections: visibleSections, updateShiftToggle: updateShiftToggle, onFocus: onCardFocus, ariaDescribedby: cardsHeaderId, ariaLabelledby: cardsHeaderId }))))));
71
75
  });
72
76
  export default Cards;
73
77
  var CardsList = function (_a) {
74
- var items = _a.items, cardDefinition = _a.cardDefinition, trackBy = _a.trackBy, selectionType = _a.selectionType, columns = _a.columns, isItemSelected = _a.isItemSelected, getItemSelectionProps = _a.getItemSelectionProps, visibleSections = _a.visibleSections, updateShiftToggle = _a.updateShiftToggle, onFocus = _a.onFocus;
78
+ var items = _a.items, cardDefinition = _a.cardDefinition, trackBy = _a.trackBy, selectionType = _a.selectionType, columns = _a.columns, isItemSelected = _a.isItemSelected, getItemSelectionProps = _a.getItemSelectionProps, visibleSections = _a.visibleSections, updateShiftToggle = _a.updateShiftToggle, onFocus = _a.onFocus, ariaLabelledby = _a.ariaLabelledby, ariaDescribedby = _a.ariaDescribedby;
75
79
  var selectable = !!selectionType;
76
80
  var _b = useFocusMove(selectionType, items.length), moveFocusDown = _b.moveFocusDown, moveFocusUp = _b.moveFocusUp;
77
81
  var visibleSectionsDefinition = cardDefinition.sections || [];
78
82
  visibleSectionsDefinition = visibleSections
79
83
  ? visibleSectionsDefinition.filter(function (section) { return section.id && visibleSections.indexOf(section.id) !== -1; })
80
84
  : visibleSectionsDefinition;
81
- return (React.createElement("ol", __assign({ className: clsx(styles.list, styles["list-grid-".concat(columns || 1)]) }, (focusMarkers && focusMarkers.root)), items.map(function (item, index) {
85
+ var listRole = undefined;
86
+ var listItemRole = undefined;
87
+ if (selectable) {
88
+ listRole = 'group';
89
+ listItemRole = 'presentation';
90
+ }
91
+ return (React.createElement("ol", __assign({ className: clsx(styles.list, styles["list-grid-".concat(columns || 1)]), role: listRole, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby }, (focusMarkers && focusMarkers.root)), items.map(function (item, index) {
82
92
  var _a;
83
93
  return (React.createElement("li", __assign({ className: clsx(styles.card, (_a = {},
84
94
  _a[styles['card-selectable']] = selectable,
85
95
  _a[styles['card-selected']] = selectable && isItemSelected(item),
86
- _a)), key: getItemKey(trackBy, item, index), onFocus: onFocus }, (focusMarkers && focusMarkers.item)),
96
+ _a)), key: getItemKey(trackBy, item, index), onFocus: onFocus }, (focusMarkers && focusMarkers.item), { role: listItemRole }),
87
97
  React.createElement("div", { className: styles['card-inner'] },
88
98
  React.createElement("div", { className: styles['card-header'] },
89
99
  React.createElement("span", { className: styles['card-header-inner'] }, cardDefinition.header ? cardDefinition.header(item) : ''),