@cloudscape-design/components 3.0.22 → 3.0.25

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 (198) hide show
  1. package/alert/styles.scoped.css +0 -34
  2. package/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
  3. package/annotation-context/annotation/annotation-popover.js +12 -16
  4. package/annotation-context/annotation/annotation-popover.js.map +1 -1
  5. package/annotation-context/annotation/styles.scoped.css +0 -18
  6. package/app-layout/content-wrapper/styles.scoped.css +0 -4
  7. package/app-layout/index.d.ts.map +1 -1
  8. package/app-layout/index.js +6 -4
  9. package/app-layout/index.js.map +1 -1
  10. package/app-layout/mobile-toolbar/styles.scoped.css +0 -9
  11. package/app-layout/styles.scoped.css +0 -20
  12. package/app-layout/toggles/styles.scoped.css +0 -16
  13. package/app-layout/visual-refresh/styles.scoped.css +0 -71
  14. package/area-chart/styles.scoped.css +0 -13
  15. package/attribute-editor/styles.scoped.css +0 -23
  16. package/badge/styles.scoped.css +0 -15
  17. package/bar-chart/interfaces.d.ts +1 -1
  18. package/bar-chart/interfaces.d.ts.map +1 -1
  19. package/bar-chart/interfaces.js.map +1 -1
  20. package/box/styles.scoped.css +0 -171
  21. package/breadcrumb-group/item/styles.scoped.css +0 -11
  22. package/breadcrumb-group/styles.scoped.css +0 -10
  23. package/button/styles.scoped.css +0 -264
  24. package/button-dropdown/category-elements/styles.scoped.css +0 -26
  25. package/button-dropdown/item-element/styles.scoped.css +0 -22
  26. package/button-dropdown/mobile-expandable-group/styles.scoped.css +0 -5
  27. package/button-dropdown/styles.scoped.css +0 -7
  28. package/cards/styles.scoped.css +0 -45
  29. package/checkbox/styles.scoped.css +0 -11
  30. package/code-editor/styles.scoped.css +0 -87
  31. package/collection-preferences/styles.scoped.css +0 -12
  32. package/column-layout/styles.scoped.css +0 -12
  33. package/container/styles.scoped.css +0 -27
  34. package/date-picker/calendar/index.d.ts.map +1 -1
  35. package/date-picker/calendar/index.js +2 -2
  36. package/date-picker/calendar/index.js.map +1 -1
  37. package/date-picker/calendar/utils/locales.d.ts +2 -0
  38. package/date-picker/calendar/utils/locales.d.ts.map +1 -1
  39. package/date-picker/calendar/utils/locales.js +4 -0
  40. package/date-picker/calendar/utils/locales.js.map +1 -1
  41. package/date-picker/styles.scoped.css +0 -45
  42. package/date-range-picker/calendar/grids/day/styles.scoped.css +0 -45
  43. package/date-range-picker/calendar/index.js +2 -2
  44. package/date-range-picker/calendar/index.js.map +1 -1
  45. package/date-range-picker/index.d.ts.map +1 -1
  46. package/date-range-picker/index.js +13 -15
  47. package/date-range-picker/index.js.map +1 -1
  48. package/date-range-picker/relative-range/styles.scoped.css +0 -3
  49. package/date-range-picker/styles.css.js +41 -42
  50. package/date-range-picker/styles.scoped.css +49 -92
  51. package/date-range-picker/styles.selectors.js +41 -42
  52. package/expandable-section/styles.scoped.css +0 -33
  53. package/flashbar/styles.scoped.css +0 -36
  54. package/form/styles.scoped.css +0 -12
  55. package/form-field/styles.scoped.css +0 -26
  56. package/grid/styles.scoped.css +0 -6
  57. package/header/styles.scoped.css +0 -51
  58. package/help-panel/styles.scoped.css +0 -73
  59. package/hotspot/styles.scoped.css +0 -3
  60. package/icon/styles.scoped.css +0 -33
  61. package/input/styles.scoped.css +0 -49
  62. package/internal/base-component/styles.scoped.css +0 -1
  63. package/internal/components/abstract-switch/styles.scoped.css +0 -7
  64. package/internal/components/button-trigger/styles.scoped.css +0 -42
  65. package/internal/components/cartesian-chart/styles.scoped.css +0 -10
  66. package/internal/components/chart-filter/styles.scoped.css +0 -4
  67. package/internal/components/chart-legend/styles.scoped.css +0 -8
  68. package/internal/components/chart-plot/styles.scoped.css +0 -1
  69. package/internal/components/chart-popover/styles.scoped.css +0 -4
  70. package/internal/components/chart-series-details/styles.scoped.css +0 -12
  71. package/internal/components/chart-series-marker/styles.scoped.css +0 -7
  72. package/internal/components/chart-status-container/styles.scoped.css +0 -1
  73. package/internal/components/checkbox-icon/styles.scoped.css +0 -10
  74. package/internal/components/content-layout/styles.scoped.css +0 -5
  75. package/internal/components/dark-ribbon/styles.scoped.css +0 -1
  76. package/internal/components/dropdown/styles.scoped.css +0 -17
  77. package/internal/components/dropdown-footer/styles.scoped.css +0 -6
  78. package/internal/components/dropdown-status/styles.scoped.css +0 -6
  79. package/internal/components/filtering-token/styles.scoped.css +0 -21
  80. package/internal/components/menu-dropdown/styles.scoped.css +0 -17
  81. package/internal/components/option/index.js +3 -3
  82. package/internal/components/option/index.js.map +1 -1
  83. package/internal/components/option/option-parts.js +3 -3
  84. package/internal/components/option/option-parts.js.map +1 -1
  85. package/internal/components/option/styles.scoped.css +0 -16
  86. package/internal/components/options-list/styles.scoped.css +0 -5
  87. package/internal/components/selectable-item/styles.scoped.css +0 -44
  88. package/internal/environment.js +1 -1
  89. package/line-chart/interfaces.d.ts +1 -1
  90. package/line-chart/interfaces.d.ts.map +1 -1
  91. package/line-chart/interfaces.js.map +1 -1
  92. package/link/styles.scoped.css +0 -77
  93. package/mixed-line-bar-chart/bar-series.d.ts +1 -1
  94. package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
  95. package/mixed-line-bar-chart/bar-series.js.map +1 -1
  96. package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
  97. package/mixed-line-bar-chart/chart-container.js +9 -10
  98. package/mixed-line-bar-chart/chart-container.js.map +1 -1
  99. package/mixed-line-bar-chart/chart-filters.d.ts +2 -2
  100. package/mixed-line-bar-chart/chart-filters.d.ts.map +1 -1
  101. package/mixed-line-bar-chart/chart-filters.js +1 -2
  102. package/mixed-line-bar-chart/chart-filters.js.map +1 -1
  103. package/mixed-line-bar-chart/chart-legend.d.ts +2 -2
  104. package/mixed-line-bar-chart/chart-legend.d.ts.map +1 -1
  105. package/mixed-line-bar-chart/chart-legend.js +1 -2
  106. package/mixed-line-bar-chart/chart-legend.js.map +1 -1
  107. package/mixed-line-bar-chart/domain.d.ts +4 -0
  108. package/mixed-line-bar-chart/domain.d.ts.map +1 -0
  109. package/mixed-line-bar-chart/domain.js +138 -0
  110. package/mixed-line-bar-chart/domain.js.map +1 -0
  111. package/mixed-line-bar-chart/format-highlighted.d.ts +2 -4
  112. package/mixed-line-bar-chart/format-highlighted.d.ts.map +1 -1
  113. package/mixed-line-bar-chart/format-highlighted.js +26 -15
  114. package/mixed-line-bar-chart/format-highlighted.js.map +1 -1
  115. package/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts.map +1 -1
  116. package/mixed-line-bar-chart/hooks/use-mouse-hover.js +3 -2
  117. package/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
  118. package/mixed-line-bar-chart/hooks/use-navigation.d.ts.map +1 -1
  119. package/mixed-line-bar-chart/hooks/use-navigation.js +23 -35
  120. package/mixed-line-bar-chart/hooks/use-navigation.js.map +1 -1
  121. package/mixed-line-bar-chart/interfaces.d.ts +12 -2
  122. package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
  123. package/mixed-line-bar-chart/interfaces.js.map +1 -1
  124. package/mixed-line-bar-chart/internal.d.ts.map +1 -1
  125. package/mixed-line-bar-chart/internal.js +14 -6
  126. package/mixed-line-bar-chart/internal.js.map +1 -1
  127. package/mixed-line-bar-chart/line-series.d.ts +2 -2
  128. package/mixed-line-bar-chart/line-series.d.ts.map +1 -1
  129. package/mixed-line-bar-chart/line-series.js +21 -9
  130. package/mixed-line-bar-chart/line-series.js.map +1 -1
  131. package/mixed-line-bar-chart/make-scaled-bar-groups.d.ts.map +1 -1
  132. package/mixed-line-bar-chart/make-scaled-bar-groups.js +11 -4
  133. package/mixed-line-bar-chart/make-scaled-bar-groups.js.map +1 -1
  134. package/mixed-line-bar-chart/make-scaled-series.d.ts +2 -4
  135. package/mixed-line-bar-chart/make-scaled-series.d.ts.map +1 -1
  136. package/mixed-line-bar-chart/make-scaled-series.js +89 -25
  137. package/mixed-line-bar-chart/make-scaled-series.js.map +1 -1
  138. package/mixed-line-bar-chart/styles.scoped.css +0 -13
  139. package/mixed-line-bar-chart/utils.d.ts +5 -6
  140. package/mixed-line-bar-chart/utils.d.ts.map +1 -1
  141. package/mixed-line-bar-chart/utils.js +11 -112
  142. package/mixed-line-bar-chart/utils.js.map +1 -1
  143. package/modal/styles.scoped.css +0 -31
  144. package/multiselect/styles.scoped.css +0 -4
  145. package/package.json +1 -1
  146. package/pagination/styles.scoped.css +0 -22
  147. package/pie-chart/styles.scoped.css +0 -25
  148. package/popover/styles.scoped.css +0 -35
  149. package/progress-bar/internal.d.ts.map +1 -1
  150. package/progress-bar/internal.js +1 -1
  151. package/progress-bar/internal.js.map +1 -1
  152. package/progress-bar/styles.scoped.css +0 -25
  153. package/property-filter/controller.d.ts +3 -3
  154. package/property-filter/controller.d.ts.map +1 -1
  155. package/property-filter/interfaces.d.ts +7 -20
  156. package/property-filter/interfaces.d.ts.map +1 -1
  157. package/property-filter/interfaces.js.map +1 -1
  158. package/property-filter/styles.scoped.css +0 -22
  159. package/property-filter/use-load-items.d.ts +1 -1
  160. package/radio-group/styles.scoped.css +0 -22
  161. package/s3-resource-selector/s3-in-context/styles.scoped.css +0 -6
  162. package/segmented-control/styles.scoped.css +0 -36
  163. package/select/parts/styles.scoped.css +0 -6
  164. package/select/styles.scoped.css +0 -4
  165. package/side-navigation/styles.scoped.css +0 -38
  166. package/space-between/styles.scoped.css +0 -40
  167. package/spinner/styles.scoped.css +0 -17
  168. package/split-panel/styles.scoped.css +0 -65
  169. package/status-indicator/styles.scoped.css +0 -20
  170. package/table/body-cell/styles.scoped.css +0 -29
  171. package/table/header-cell/styles.scoped.css +0 -32
  172. package/table/resizer/styles.scoped.css +0 -6
  173. package/table/selection-control/styles.scoped.css +0 -3
  174. package/table/styles.scoped.css +0 -39
  175. package/tabs/styles.scoped.css +0 -41
  176. package/tabs/tab-header-bar.d.ts.map +1 -1
  177. package/tabs/tab-header-bar.js +3 -1
  178. package/tabs/tab-header-bar.js.map +1 -1
  179. package/tag-editor/styles.scoped.css +0 -12
  180. package/test-utils/dom/split-panel/index.d.ts +1 -0
  181. package/test-utils/dom/split-panel/index.js +3 -0
  182. package/test-utils/dom/split-panel/index.js.map +1 -1
  183. package/test-utils/selectors/split-panel/index.d.ts +1 -0
  184. package/test-utils/selectors/split-panel/index.js +3 -0
  185. package/test-utils/selectors/split-panel/index.js.map +1 -1
  186. package/test-utils/tsconfig.tsbuildinfo +1 -1
  187. package/text-content/styles.scoped.css +0 -54
  188. package/text-filter/styles.scoped.css +0 -7
  189. package/textarea/styles.scoped.css +0 -30
  190. package/tiles/styles.scoped.css +0 -55
  191. package/toggle/styles.scoped.css +0 -14
  192. package/token-group/styles.scoped.css +0 -35
  193. package/top-navigation/1.0-beta/styles.scoped.css +0 -40
  194. package/top-navigation/styles.scoped.css +0 -75
  195. package/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +0 -22
  196. package/tutorial-panel/components/tutorial-list/styles.scoped.css +0 -24
  197. package/tutorial-panel/styles.scoped.css +0 -5
  198. package/wizard/styles.scoped.css +0 -54
@@ -1,3 +1,5 @@
1
+ import { DayIndex } from '..';
1
2
  export declare function mergeLocales(locale: string, fullLocale: string): string;
2
3
  export declare function normalizeLocale(component: string, locale: string | null): string;
4
+ export declare function normalizeStartOfWeek(startOfWeek: number | undefined, locale: string): DayIndex;
3
5
  //# sourceMappingURL=locales.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/locales.ts"],"names":[],"mappings":"AA0BA,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAM9D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWhF"}
1
+ {"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/locales.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAwB9B,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAM9D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAWhF;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,YAEnF"}
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { warnOnce } from '../../../internal/logging';
4
+ import { getWeekStartByLocale } from 'weekstart';
4
5
  var getHtmlElement = function () { return (typeof document !== 'undefined' ? document.querySelector('html') : null); };
5
6
  function getBrowserLocale() {
6
7
  return new Intl.DateTimeFormat().resolvedOptions().locale;
@@ -39,4 +40,7 @@ export function normalizeLocale(component, locale) {
39
40
  }
40
41
  return browserLocale;
41
42
  }
43
+ export function normalizeStartOfWeek(startOfWeek, locale) {
44
+ return (typeof startOfWeek === 'number' ? startOfWeek % 7 : getWeekStartByLocale(locale));
45
+ }
42
46
  //# sourceMappingURL=locales.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/locales.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,IAAM,cAAc,GAAG,cAAM,OAAA,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAzE,CAAyE,CAAC;AAEvG,SAAS,gBAAgB;IACvB,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;AAC5D,CAAC;AAED,SAAS,WAAW,CAAC,SAAiB,EAAE,MAA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} from '../../../internal/logging';\n\nconst getHtmlElement = () => (typeof document !== 'undefined' ? document.querySelector('html') : null);\n\nfunction getBrowserLocale() {\n return new Intl.DateTimeFormat().resolvedOptions().locale;\n}\n\nfunction checkLocale(component: string, locale: string | null | undefined): string {\n if (!locale || locale === '') {\n return '';\n }\n\n // Support underscore-delimited locales\n locale = locale && locale.replace(/^([a-z]{2})_/, '$1-');\n // Check that the value matches aa-BB pattern\n // TODO: support full BCP 47 spec?\n if (locale && !locale.match(/^[a-z]{2}(-[A-Z]{2})?$/)) {\n warnOnce(component, `Invalid locale provided: ${locale}. Falling back to default`);\n locale = '';\n }\n return locale;\n}\n\nexport function mergeLocales(locale: string, fullLocale: string) {\n const isShort = locale.length === 2;\n if (isShort && fullLocale.indexOf(locale) === 0) {\n return fullLocale;\n }\n return locale;\n}\n\nexport function normalizeLocale(component: string, locale: string | null): string {\n locale = checkLocale(component, locale);\n const browserLocale = getBrowserLocale();\n if (locale) {\n return mergeLocales(locale, browserLocale);\n }\n const htmlLocale = checkLocale(component, getHtmlElement()?.getAttribute('lang'));\n if (htmlLocale) {\n return mergeLocales(htmlLocale, browserLocale);\n }\n return browserLocale;\n}\n"]}
1
+ {"version":3,"file":"locales.js","sourceRoot":"","sources":["../../../../../src/date-picker/calendar/utils/locales.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAGjD,IAAM,cAAc,GAAG,cAAM,OAAA,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAzE,CAAyE,CAAC;AAEvG,SAAS,gBAAgB;IACvB,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC;AAC5D,CAA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MAAc;IAClF,OAAO,CAAC,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAa,CAAC;AACxG,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { warnOnce } from '../../../internal/logging';\nimport { getWeekStartByLocale } from 'weekstart';\nimport { DayIndex } from '..';\n\nconst getHtmlElement = () => (typeof document !== 'undefined' ? document.querySelector('html') : null);\n\nfunction getBrowserLocale() {\n return new Intl.DateTimeFormat().resolvedOptions().locale;\n}\n\nfunction checkLocale(component: string, locale: string | null | undefined): string {\n if (!locale || locale === '') {\n return '';\n }\n\n // Support underscore-delimited locales\n locale = locale && locale.replace(/^([a-z]{2})_/, '$1-');\n // Check that the value matches aa-BB pattern\n // TODO: support full BCP 47 spec?\n if (locale && !locale.match(/^[a-z]{2}(-[A-Z]{2})?$/)) {\n warnOnce(component, `Invalid locale provided: ${locale}. Falling back to default`);\n locale = '';\n }\n return locale;\n}\n\nexport function mergeLocales(locale: string, fullLocale: string) {\n const isShort = locale.length === 2;\n if (isShort && fullLocale.indexOf(locale) === 0) {\n return fullLocale;\n }\n return locale;\n}\n\nexport function normalizeLocale(component: string, locale: string | null): string {\n locale = checkLocale(component, locale);\n const browserLocale = getBrowserLocale();\n if (locale) {\n return mergeLocales(locale, browserLocale);\n }\n const htmlLocale = checkLocale(component, getHtmlElement()?.getAttribute('lang'));\n if (htmlLocale) {\n return mergeLocales(htmlLocale, browserLocale);\n }\n return browserLocale;\n}\n\nexport function normalizeStartOfWeek(startOfWeek: number | undefined, locale: string) {\n return (typeof startOfWeek === 'number' ? startOfWeek % 7 : getWeekStartByLocale(locale)) as DayIndex;\n}\n"]}
@@ -91,7 +91,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
93
  .awsui_calendar_145pa_lzpoy_93:not(#\9) {
94
- animation: awsui_awsui-motion-fade-in-0_145pa_lzpoy_1 135ms ease-out;
95
94
  animation: awsui_awsui-motion-fade-in-0_145pa_lzpoy_1 var(--motion-duration-show-quick-tyaalm, 135ms) var(--motion-easing-show-quick-1fcgbv, ease-out);
96
95
  animation-fill-mode: both;
97
96
  }
@@ -148,14 +147,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
148
147
  widows: 2;
149
148
  word-spacing: normal;
150
149
  box-sizing: border-box;
151
- font-size: 14px;
152
150
  font-size: var(--font-body-m-size-sregvd, 14px);
153
- line-height: 22px;
154
151
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
155
- color: #000716;
156
152
  color: var(--color-text-body-default-ajf1h5, #000716);
157
153
  font-weight: 400;
158
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
159
154
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
160
155
  }
161
156
 
@@ -169,7 +164,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
169
164
  }
170
165
 
171
166
  .awsui_date-picker-input_145pa_lzpoy_140:not(#\9) {
172
- padding-right: 8px;
173
167
  padding-right: var(--space-xs-rsr2qu, 8px);
174
168
  width: 100%;
175
169
  }
@@ -211,21 +205,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
211
205
  widows: 2;
212
206
  word-spacing: normal;
213
207
  box-sizing: border-box;
214
- font-size: 14px;
215
208
  font-size: var(--font-body-m-size-sregvd, 14px);
216
- line-height: 22px;
217
209
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
218
- color: #000716;
219
210
  color: var(--color-text-body-default-ajf1h5, #000716);
220
211
  font-weight: 400;
221
- font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
222
212
  font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
223
213
  }
224
214
  .awsui_calendar_145pa_lzpoy_93:not(#\9):focus {
225
215
  outline: none;
226
216
  }
227
217
  .awsui_calendar-inner_145pa_lzpoy_165:not(#\9) {
228
- margin: 8px;
229
218
  margin: var(--space-xs-rsr2qu, 8px);
230
219
  }
231
220
  .awsui_calendar-header_145pa_lzpoy_168:not(#\9) {
@@ -234,12 +223,9 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
234
223
  align-items: center;
235
224
  }
236
225
  .awsui_calendar-header-month_145pa_lzpoy_173:not(#\9) {
237
- font-size: 14px;
238
226
  font-size: var(--font-body-m-size-sregvd, 14px);
239
- line-height: 22px;
240
227
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
241
228
  font-weight: 700;
242
- color: #000716;
243
229
  color: var(--color-text-dropdown-item-default-7tg9p2, #000716);
244
230
  }
245
231
  .awsui_calendar-next-month-btn_145pa_lzpoy_179:not(#\9) {
@@ -257,19 +243,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
257
243
  width: 0;
258
244
  word-break: break-word;
259
245
  text-align: center;
260
- padding: 12px 0 4px;
261
246
  padding: var(--space-s-hv8c1d, 12px) 0 var(--space-xxs-ynfts5, 4px);
262
- color: #5f6b7a;
263
247
  color: var(--color-text-calendar-month-elf7e9, #5f6b7a);
264
- font-size: 12px;
265
248
  font-size: var(--font-body-s-size-ukw2p9, 12px);
266
- line-height: 16px;
267
249
  line-height: var(--font-body-s-line-height-kdsbrl, 16px);
268
- letter-spacing: 0.005em;
269
250
  letter-spacing: var(--font-body-s-letter-spacing-cy0oxj, 0.005em);
270
251
  }
271
252
  .awsui_calendar-dates_145pa_lzpoy_200:not(#\9) {
272
- border: 1px solid transparent;
273
253
  border: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
274
254
  }
275
255
  .awsui_calendar-week_145pa_lzpoy_203:not(#\9) {
@@ -281,15 +261,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
281
261
  width: 0;
282
262
  word-break: break-word;
283
263
  text-align: center;
284
- border-bottom: 1px solid transparent;
285
264
  border-bottom: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
286
- border-right: 1px solid transparent;
287
265
  border-right: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
288
- border-radius: 8px;
289
266
  border-radius: var(--border-radius-item-u2ibpi, 8px);
290
- padding: 4px 0;
291
267
  padding: var(--space-xxs-ynfts5, 4px) 0;
292
- color: #9ba7b6;
293
268
  color: var(--color-text-dropdown-item-disabled-varol7, #9ba7b6);
294
269
  position: relative;
295
270
  }
@@ -304,27 +279,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
304
279
  }
305
280
  .awsui_calendar-day-enabled_145pa_lzpoy_228:not(#\9) {
306
281
  cursor: pointer;
307
- color: #5f6b7a;
308
282
  color: var(--color-text-dropdown-item-secondary-0me7js, #5f6b7a);
309
283
  }
310
284
  .awsui_calendar-day-enabled_145pa_lzpoy_228.awsui_calendar-day-current-month_145pa_lzpoy_232:not(#\9) {
311
- color: #000716;
312
285
  color: var(--color-text-dropdown-item-default-7tg9p2, #000716);
313
286
  }
314
287
  .awsui_calendar-day-enabled_145pa_lzpoy_228.awsui_calendar-day-current-month_145pa_lzpoy_232:not(#\9):hover {
315
- color: #000716;
316
288
  color: var(--color-text-calendar-day-hover-graajh, #000716);
317
- background-color: #f4f4f4;
318
289
  background-color: var(--color-background-dropdown-item-hover-mqsxkv, #f4f4f4);
319
290
  }
320
291
  .awsui_calendar-day-enabled_145pa_lzpoy_228.awsui_calendar-day-current-month_145pa_lzpoy_232:not(#\9):hover:not(.awsui_calendar-day-selected_145pa_lzpoy_239)::after {
321
- border: 2px solid #7d8998;
322
292
  border: var(--border-item-width-qbbbsa, 2px) solid var(--color-border-dropdown-item-hover-tyzq9m, #7d8998);
323
- border-radius: 8px;
324
293
  border-radius: var(--border-radius-item-u2ibpi, 8px);
325
294
  }
326
295
  .awsui_calendar-day-today_145pa_lzpoy_243:not(#\9) {
327
- background-color: #f4f4f4;
328
296
  background-color: var(--color-background-calendar-today-762czq, #f4f4f4);
329
297
  }
330
298
  .awsui_calendar-day_145pa_lzpoy_185:not(#\9)::after {
@@ -346,24 +314,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
346
314
  }
347
315
  .awsui_calendar-day_145pa_lzpoy_185:not(#\9):focus {
348
316
  outline: 2px dotted transparent;
349
- outline-offset: calc(-5px - 1px);
350
317
  outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px) - 1px);
351
318
  }
352
319
  .awsui_calendar-day_145pa_lzpoy_185:not(#\9):focus::before {
353
320
  content: " ";
354
321
  display: block;
355
322
  position: absolute;
356
- left: calc(-1 * -5px);
357
323
  left: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
358
- top: calc(-1 * -5px);
359
324
  top: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
360
- width: calc(100% + 2 * -5px);
361
325
  width: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
362
- height: calc(100% + 2 * -5px);
363
326
  height: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
364
- border-radius: 3px;
365
327
  border-radius: var(--border-radius-calendar-day-focus-ring-a8mlqd, 3px);
366
- box-shadow: 0 0 0 2px #0972d3;
367
328
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
368
329
  }
369
330
  .awsui_calendar-day_145pa_lzpoy_185:not(#\9):focus::before {
@@ -374,23 +335,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
374
335
  position: relative;
375
336
  }
376
337
  .awsui_calendar-day-selected_145pa_lzpoy_239:not(#\9)::after {
377
- background-color: #f2f8fd;
378
338
  background-color: var(--color-background-dropdown-item-selected-8l4mpk, #f2f8fd);
379
- border: 2px solid #0972d3;
380
339
  border: var(--border-item-width-qbbbsa, 2px) solid var(--color-border-dropdown-item-selected-eahq2j, #0972d3);
381
- border-radius: 8px;
382
340
  border-radius: var(--border-radius-item-u2ibpi, 8px);
383
341
  }
384
342
  .awsui_calendar-day-selected_145pa_lzpoy_239 > .awsui_day-inner_145pa_lzpoy_255:not(#\9) {
385
- color: #0972d3;
386
343
  color: var(--color-text-calendar-day-selected-64o9sq, #0972d3);
387
344
  position: relative;
388
345
  }
389
346
  .awsui_calendar_145pa_lzpoy_93[data-awsui-focus-visible=true]:not(#\9):focus {
390
347
  outline: 2px dotted transparent;
391
348
  outline-offset: 2px;
392
- border-radius: 16px;
393
349
  border-radius: var(--border-radius-container-gh9ysk, 16px);
394
- box-shadow: 0 0 0 2px #0972d3;
395
350
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
396
351
  }
@@ -95,13 +95,9 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
95
95
  width: 0;
96
96
  word-break: break-word;
97
97
  text-align: center;
98
- border-bottom: 1px solid transparent;
99
98
  border-bottom: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
100
- border-right: 1px solid transparent;
101
99
  border-right: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
102
- padding: 4px 0;
103
100
  padding: var(--space-xxs-ynfts5, 4px) 0;
104
- color: #9ba7b6;
105
101
  color: var(--color-text-dropdown-item-disabled-varol7, #9ba7b6);
106
102
  position: relative;
107
103
  }
@@ -112,11 +108,9 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
112
108
  content: "";
113
109
  position: absolute;
114
110
  z-index: 1;
115
- top: calc(-1 * 2px);
116
111
  top: calc(-1 * var(--border-item-width-qbbbsa, 2px));
117
112
  left: -1px;
118
113
  bottom: -1px;
119
- right: calc(-1 * 2px);
120
114
  right: calc(-1 * var(--border-item-width-qbbbsa, 2px));
121
115
  background-color: transparent;
122
116
  }
@@ -130,29 +124,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
130
124
  }
131
125
  .awsui_day_vci2l_19xqz_93[data-awsui-focus-visible=true]:not(#\9):focus {
132
126
  outline: 2px dotted transparent;
133
- outline-offset: calc(-5px - 1px);
134
127
  outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px) - 1px);
135
128
  }
136
129
  .awsui_day_vci2l_19xqz_93[data-awsui-focus-visible=true]:not(#\9):focus::before {
137
130
  content: " ";
138
131
  display: block;
139
132
  position: absolute;
140
- left: calc(-1 * -5px);
141
133
  left: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
142
- top: calc(-1 * -5px);
143
134
  top: calc(-1 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
144
- width: calc(100% + 2 * -5px);
145
135
  width: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
146
- height: calc(100% + 2 * -5px);
147
136
  height: calc(100% + 2 * var(--space-calendar-grid-focus-outline-gutter-v3dwvl, -5px));
148
- border-radius: 3px;
149
137
  border-radius: var(--border-radius-calendar-day-focus-ring-a8mlqd, 3px);
150
- box-shadow: 0 0 0 2px #0972d3;
151
138
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
152
139
  }
153
140
 
154
141
  .awsui_in-first-row_vci2l_19xqz_141:not(#\9):not(.awsui_in-previous-month_vci2l_19xqz_141) {
155
- border-top: 1px solid transparent;
156
142
  border-top: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
157
143
  }
158
144
 
@@ -168,7 +154,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
168
154
  border-left: 1px solid transparent;
169
155
  }
170
156
  .awsui_in-first-column_vci2l_19xqz_153.awsui_in-current-month_vci2l_19xqz_156:not(#\9) {
171
- border-left: 1px solid transparent;
172
157
  border-left: 1px solid var(--color-border-calendar-grid-sshunw, transparent);
173
158
  }
174
159
 
@@ -176,28 +161,21 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
176
161
  cursor: pointer;
177
162
  }
178
163
  .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156:not(#\9) {
179
- color: #000716;
180
164
  color: var(--color-text-dropdown-item-default-7tg9p2, #000716);
181
165
  }
182
166
  .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156:not(#\9):not(.awsui_in-range_vci2l_19xqz_166), .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156:not(#\9):not(.awsui_in-range_vci2l_19xqz_166)::after, .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156.awsui_end-date_vci2l_19xqz_166.awsui_start-date_vci2l_19xqz_166:not(#\9), .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156.awsui_end-date_vci2l_19xqz_166.awsui_start-date_vci2l_19xqz_166:not(#\9)::after, .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156.awsui_no-range_vci2l_19xqz_166:not(#\9), .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156.awsui_no-range_vci2l_19xqz_166:not(#\9)::after {
183
- border-radius: 8px;
184
167
  border-radius: var(--border-radius-item-u2ibpi, 8px);
185
168
  }
186
169
  .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156:not(#\9):hover {
187
- color: #000716;
188
170
  color: var(--color-text-calendar-day-hover-graajh, #000716);
189
- background-color: #f4f4f4;
190
171
  background-color: var(--color-background-dropdown-item-hover-mqsxkv, #f4f4f4);
191
172
  }
192
173
  .awsui_enabled_vci2l_19xqz_160.awsui_in-current-month_vci2l_19xqz_156:not(#\9):hover:not(.awsui_selected_vci2l_19xqz_173)::after {
193
- border: 2px solid #7d8998;
194
174
  border: var(--border-item-width-qbbbsa, 2px) solid var(--color-border-dropdown-item-hover-tyzq9m, #7d8998);
195
175
  }
196
176
 
197
177
  .awsui_today_vci2l_19xqz_177:not(#\9):not(.awsui_in-range_vci2l_19xqz_166) {
198
- background-color: #f4f4f4;
199
178
  background-color: var(--color-background-calendar-today-762czq, #f4f4f4);
200
- border-radius: 8px;
201
179
  border-radius: var(--border-radius-item-u2ibpi, 8px);
202
180
  }
203
181
 
@@ -211,92 +189,69 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
211
189
  }
212
190
  .awsui_selected_vci2l_19xqz_173[data-awsui-focus-visible=true]:not(#\9):focus {
213
191
  outline: 2px dotted transparent;
214
- outline-offset: calc(-5px - 1px);
215
192
  outline-offset: calc(var(--space-calendar-grid-selected-focus-outline-gutter-gqgjqz, -5px) - 1px);
216
193
  }
217
194
  .awsui_selected_vci2l_19xqz_173[data-awsui-focus-visible=true]:not(#\9):focus::before {
218
195
  content: " ";
219
196
  display: block;
220
197
  position: absolute;
221
- left: calc(-1 * -5px);
222
198
  left: calc(-1 * var(--space-calendar-grid-selected-focus-outline-gutter-gqgjqz, -5px));
223
- top: calc(-1 * -5px);
224
199
  top: calc(-1 * var(--space-calendar-grid-selected-focus-outline-gutter-gqgjqz, -5px));
225
- width: calc(100% + 2 * -5px);
226
200
  width: calc(100% + 2 * var(--space-calendar-grid-selected-focus-outline-gutter-gqgjqz, -5px));
227
- height: calc(100% + 2 * -5px);
228
201
  height: calc(100% + 2 * var(--space-calendar-grid-selected-focus-outline-gutter-gqgjqz, -5px));
229
- border-radius: 3px;
230
202
  border-radius: var(--border-radius-calendar-day-focus-ring-a8mlqd, 3px);
231
- box-shadow: 0 0 0 2px #fbfbfb;
232
203
  box-shadow: 0 0 0 2px var(--color-border-calendar-grid-selected-focus-ring-cxqa0s, #fbfbfb);
233
204
  }
234
205
  .awsui_selected_vci2l_19xqz_173[data-awsui-focus-visible=true]:not(#\9):focus::before {
235
206
  z-index: 1;
236
207
  }
237
208
  .awsui_selected_vci2l_19xqz_173:not(#\9)::after {
238
- background-color: #0972d3;
239
209
  background-color: var(--color-background-control-checked-9admlu, #0972d3);
240
- border: 2px solid #0972d3;
241
210
  border: var(--border-item-width-qbbbsa, 2px) solid var(--color-background-control-checked-9admlu, #0972d3);
242
211
  z-index: 0;
243
212
  }
244
213
  .awsui_selected_vci2l_19xqz_173.awsui_start-date_vci2l_19xqz_166:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_start-date_vci2l_19xqz_166:not(#\9)::after, .awsui_selected_vci2l_19xqz_173.awsui_range-start-date_vci2l_19xqz_213:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_range-start-date_vci2l_19xqz_213:not(#\9)::after {
245
- border-top-left-radius: 8px;
246
214
  border-top-left-radius: var(--border-radius-item-u2ibpi, 8px);
247
215
  }
248
216
  .awsui_selected_vci2l_19xqz_173.awsui_start-date_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_start-date_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216:not(#\9)::after, .awsui_selected_vci2l_19xqz_173.awsui_range-start-date_vci2l_19xqz_213.awsui_in-range-border-bottom_vci2l_19xqz_216:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_range-start-date_vci2l_19xqz_213.awsui_in-range-border-bottom_vci2l_19xqz_216:not(#\9)::after {
249
- border-bottom-left-radius: 8px;
250
217
  border-bottom-left-radius: var(--border-radius-item-u2ibpi, 8px);
251
218
  }
252
219
  .awsui_selected_vci2l_19xqz_173.awsui_end-date_vci2l_19xqz_166:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_end-date_vci2l_19xqz_166:not(#\9)::after, .awsui_selected_vci2l_19xqz_173.awsui_range-end-date_vci2l_19xqz_219:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_range-end-date_vci2l_19xqz_219:not(#\9)::after {
253
- border-bottom-right-radius: 8px;
254
220
  border-bottom-right-radius: var(--border-radius-item-u2ibpi, 8px);
255
221
  }
256
222
  .awsui_selected_vci2l_19xqz_173.awsui_end-date_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_end-date_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222:not(#\9)::after, .awsui_selected_vci2l_19xqz_173.awsui_range-end-date_vci2l_19xqz_219.awsui_in-range-border-top_vci2l_19xqz_222:not(#\9), .awsui_selected_vci2l_19xqz_173.awsui_range-end-date_vci2l_19xqz_219.awsui_in-range-border-top_vci2l_19xqz_222:not(#\9)::after {
257
- border-top-right-radius: 8px;
258
223
  border-top-right-radius: var(--border-radius-item-u2ibpi, 8px);
259
224
  }
260
225
  .awsui_selected_vci2l_19xqz_173 > .awsui_day-inner_vci2l_19xqz_117:not(#\9) {
261
- color: #ffffff;
262
226
  color: var(--color-background-control-default-4pa05r, #ffffff);
263
227
  position: relative;
264
228
  z-index: 2;
265
229
  }
266
230
 
267
231
  .awsui_in-range_vci2l_19xqz_166:not(#\9) {
268
- background-color: #f2f8fd;
269
232
  background-color: var(--color-background-dropdown-item-selected-8l4mpk, #f2f8fd);
270
233
  }
271
234
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222:not(#\9)::after {
272
- border-top: 2px solid #0972d3;
273
235
  border-top: var(--border-item-width-qbbbsa, 2px) solid var(--color-background-control-checked-9admlu, #0972d3);
274
236
  }
275
237
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-right_vci2l_19xqz_237:not(#\9)::after {
276
- border-right: 2px solid #0972d3;
277
238
  border-right: var(--border-item-width-qbbbsa, 2px) solid var(--color-background-control-checked-9admlu, #0972d3);
278
239
  }
279
240
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216:not(#\9)::after {
280
- border-bottom: 2px solid #0972d3;
281
241
  border-bottom: var(--border-item-width-qbbbsa, 2px) solid var(--color-background-control-checked-9admlu, #0972d3);
282
242
  }
283
243
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-left_vci2l_19xqz_243:not(#\9)::after {
284
- border-left: 2px solid #0972d3;
285
244
  border-left: var(--border-item-width-qbbbsa, 2px) solid var(--color-background-control-checked-9admlu, #0972d3);
286
245
  }
287
246
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222.awsui_in-range-border-right_vci2l_19xqz_237:not(#\9), .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222.awsui_in-range-border-right_vci2l_19xqz_237:not(#\9)::after {
288
- border-top-right-radius: 8px;
289
247
  border-top-right-radius: var(--border-radius-item-u2ibpi, 8px);
290
248
  }
291
249
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216.awsui_in-range-border-right_vci2l_19xqz_237:not(#\9), .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216.awsui_in-range-border-right_vci2l_19xqz_237:not(#\9)::after {
292
- border-bottom-right-radius: 8px;
293
250
  border-bottom-right-radius: var(--border-radius-item-u2ibpi, 8px);
294
251
  }
295
252
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216.awsui_in-range-border-left_vci2l_19xqz_243:not(#\9), .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-bottom_vci2l_19xqz_216.awsui_in-range-border-left_vci2l_19xqz_243:not(#\9)::after {
296
- border-bottom-left-radius: 8px;
297
253
  border-bottom-left-radius: var(--border-radius-item-u2ibpi, 8px);
298
254
  }
299
255
  .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222.awsui_in-range-border-left_vci2l_19xqz_243:not(#\9), .awsui_in-range_vci2l_19xqz_166.awsui_in-range-border-top_vci2l_19xqz_222.awsui_in-range-border-left_vci2l_19xqz_243:not(#\9)::after {
300
- border-top-left-radius: 8px;
301
256
  border-top-left-radius: var(--border-radius-item-u2ibpi, 8px);
302
257
  }
@@ -16,13 +16,13 @@ import { getBaseDate } from './get-base-date.js';
16
16
  import { useUniqueId } from '../../internal/hooks/use-unique-id';
17
17
  import { getDateLabel, renderTimeLabel } from '../../date-picker/calendar/utils/intl';
18
18
  import LiveRegion from '../../internal/components/live-region';
19
- import { getWeekStartByLocale } from 'weekstart';
19
+ import { normalizeStartOfWeek } from '../../date-picker/calendar/utils/locales';
20
20
  export default forwardRef(Calendar);
21
21
  function Calendar(_a, ref) {
22
22
  var _b;
23
23
  var locale = _a.locale, startOfWeek = _a.startOfWeek, isDateEnabled = _a.isDateEnabled, onSelectDateRange = _a.onSelectDateRange, _c = _a.initialEndDate, initialEndDate = _c === void 0 ? '' : _c, _d = _a.initialStartDate, initialStartDate = _d === void 0 ? '' : _d, i18nStrings = _a.i18nStrings, dateOnly = _a.dateOnly, isSingleGrid = _a.isSingleGrid, timeInputFormat = _a.timeInputFormat;
24
24
  var elementRef = useRef(null);
25
- var normalizedStartOfWeek = (typeof startOfWeek === 'number' ? startOfWeek % 7 : getWeekStartByLocale(locale));
25
+ var normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);
26
26
  useImperativeHandle(ref, function () { return ({
27
27
  focus: function () {
28
28
  if (elementRef.current) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,WA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AE,gBAAgB,GACjC,CACgB,CAChB;wBACL,CAAC,QAAQ,IAAI,CACZ,6BAAK,SAAS,EAAE,MAAM,CAAC,6BAA6B,CAAC;4BACnD,oBAAC,iBAAiB,IAAC,KAAK,EAAE,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI;gCAC/D,oBAAC,iBAAiB,IAChB,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,UAAA,CAAC,IAAI,OAAA,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAhC,CAAgC,EAC/C,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,eAAe,EAC5B,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,EACnC,eAAe,EAAE,gBAAgB,GACjC,CACgB,CAChB,CACP,CACG,CACe;gBACtB,WAAW,CAAC,sBAAsB,IAAI,CACrC,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,EAAE,EAAE,EAAE,gBAAgB,IACzE,WAAW,CAAC,sBAAsB,CAC/B,CACP,CACoB,CACF;QACvB,oBAAC,UAAU;YACT,8BAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,YAAY,CAAQ,CACzD,CACZ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSameMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { DateRangePickerProps, Focusable } from '../interfaces';\nimport CalendarHeader from './header';\nimport { Grids, selectFocusedDate } from './grids';\nimport moveFocusHandler from '../../date-picker/calendar/utils/move-focus-handler';\nimport {\n displayToIso,\n formatDate,\n formatTime,\n formatISOStringWithoutTimezone,\n isoToDisplay,\n parseDate,\n} from '../../date-picker/calendar/utils/date';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { InputProps } from '../../input/interfaces';\nimport DateInput from '../../internal/components/date-input';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport clsx from 'clsx';\nimport { getBaseDate } from './get-base-date.js';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { getDateLabel, renderTimeLabel } from '../../date-picker/calendar/utils/intl';\nimport LiveRegion from '../../internal/components/live-region';\nimport { getWeekStartByLocale } from 'weekstart';\n\nexport interface DateChangeHandler {\n (detail: Date): void;\n}\n\nexport interface MonthChangeHandler {\n (newMonth: Date): void;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface HeaderChangeMonthHandler {\n (isPreviousButtonClick?: boolean): void;\n}\n\nexport interface CalendarProps extends BaseComponentProps {\n locale: string;\n startOfWeek: number | undefined;\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n onSelectDateRange: (value: DateRangePickerProps.AbsoluteValue) => void;\n initialStartDate: string | undefined;\n initialEndDate: string | undefined;\n i18nStrings: DateRangePickerProps.I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n isSingleGrid: boolean;\n}\n\nexport default forwardRef(Calendar);\n\nfunction Calendar(\n {\n locale,\n startOfWeek,\n isDateEnabled,\n onSelectDateRange,\n initialEndDate = '',\n initialStartDate = '',\n i18nStrings,\n dateOnly,\n isSingleGrid,\n timeInputFormat,\n }: CalendarProps,\n ref: React.Ref<Focusable>\n) {\n const elementRef = useRef<HTMLDivElement>(null);\n\n const normalizedStartOfWeek = (\n typeof startOfWeek === 'number' ? startOfWeek % 7 : getWeekStartByLocale(locale)\n ) as DayIndex;\n\n useImperativeHandle(ref, () => ({\n focus() {\n if (elementRef.current) {\n const prevButton = elementRef.current.getElementsByClassName(styles['calendar-prev-month-btn'])[0];\n (prevButton as undefined | HTMLButtonElement)?.focus();\n }\n },\n }));\n\n const [initialStartDateString = '', initialStartTimeString = ''] = initialStartDate.split('T');\n const [initialEndDateString = '', initialEndTimeString = ''] = initialEndDate.split('T');\n\n const [startDateString, setStartDateString] = useState(initialStartDateString);\n const [startTimeString, setStartTimeString] = useState(initialStartTimeString);\n\n const [endDateString, setEndDateString] = useState(initialEndDateString);\n const [endTimeString, setEndTimeString] = useState(initialEndTimeString);\n\n const selectedStartDate = parseDate(startDateString, true);\n const selectedEndDate = parseDate(endDateString, true);\n\n const [announcement, setAnnouncement] = useState('');\n\n const [currentMonth, setCurrentMonth] = useState(() => {\n if (startDateString) {\n const startDate = parseDate(startDateString);\n if (isSingleGrid) {\n return startOfMonth(startDate);\n }\n return startOfMonth(addMonths(startDate, 1));\n }\n if (endDateString) {\n return startOfMonth(parseDate(endDateString));\n }\n return startOfMonth(Date.now());\n });\n\n const [focusedDate, setFocusedDate] = useState<Date | null>(() => {\n if (selectedStartDate) {\n if (isSameMonth(selectedStartDate, currentMonth)) {\n return selectedStartDate;\n }\n if (!isSingleGrid && isSameMonth(selectedStartDate, addMonths(currentMonth, -1))) {\n return selectedStartDate;\n }\n }\n return selectFocusedDate(selectedStartDate, currentMonth, isDateEnabled);\n });\n\n useEffect(() => {\n // This effect \"synchronizes\" the local state update back up to the overall DateRangePicker component\n\n const startDate = formatISOStringWithoutTimezone(startDateString, startTimeString);\n const endDate = formatISOStringWithoutTimezone(endDateString, endTimeString);\n\n if (startDate !== initialStartDate || endDate !== initialEndDate) {\n onSelectDateRange({\n startDate,\n endDate,\n type: 'absolute',\n });\n }\n }, [\n startDateString,\n startTimeString,\n endDateString,\n endTimeString,\n onSelectDateRange,\n initialStartDate,\n initialEndDate,\n ]);\n\n const onSelectDateHandler = (selectedDate: Date) => {\n // recommended to include the start/end time announced with the selection\n // because the user is not aware of the fact that a start/end time is also set as soon as they select a date\n const announceStart = (startDate: Date) => {\n return (\n i18nStrings.startDateLabel +\n ', ' +\n getDateLabel(locale, startDate) +\n ', ' +\n i18nStrings.startTimeLabel +\n ', ' +\n renderTimeLabel(locale, startDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceEnd = (endDate: Date) => {\n return (\n i18nStrings.endDateLabel +\n ', ' +\n getDateLabel(locale, endDate) +\n ', ' +\n i18nStrings.endTimeLabel +\n ', ' +\n renderTimeLabel(locale, endDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceRange = (startDate: Date, endDate: Date) => {\n if (!i18nStrings.renderSelectedAbsoluteRangeAriaLive) {\n return `${getDateLabel(locale, startDate)} – ${getDateLabel(locale, endDate)}`;\n }\n return i18nStrings.renderSelectedAbsoluteRangeAriaLive(\n getDateLabel(locale, startDate),\n getDateLabel(locale, endDate)\n );\n };\n\n // If both fields are empty, we set the start date\n if (!startDateString && !endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If both fields are set, we start new\n if (startDateString && endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString('');\n setEndTimeString('');\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If only the END date is empty, we fill it (and swap dates if needed)\n if (startDateString && !endDateString) {\n const parsedStartDate = parseDate(startDateString);\n\n if (isBefore(selectedDate, parsedStartDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(selectedDate);\n const endDate = endOfDay(parsedStartDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, endDate));\n } else {\n const endDate = endOfDay(selectedDate);\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(parsedStartDate, endDate));\n }\n return;\n }\n\n // If only the START date is empty, we fill it (and swap dates if needed)\n if (!startDateString && endDateString) {\n const existingEndDate = parseDate(endDateString);\n\n if (isAfter(selectedDate, existingEndDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(existingEndDate);\n const endDate = endOfDay(selectedDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(startDate, endDate));\n } else {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, existingEndDate));\n }\n return;\n }\n // All possible conditions are covered above\n };\n\n const onHeaderChangeMonthHandler: HeaderChangeMonthHandler = isPrevious => {\n const newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);\n setCurrentMonth(newCurrentMonth);\n\n const newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);\n const newBaseDate = getBaseDate(newBaseDateMonth, 1, isDateEnabled);\n setFocusedDate(newBaseDate);\n };\n\n const onChangeStartDate: InputProps['onChange'] = e => {\n const isoDateString = displayToIso(e.detail.value);\n setStartDateString(isoDateString);\n\n if (isoDateString.length >= 8) {\n const newCurrentMonth = startOfMonth(parseDate(isoDateString));\n setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));\n }\n };\n\n const onChangeEndDate: InputProps['onChange'] = e => {\n const isoDateString = displayToIso(e.detail.value);\n setEndDateString(isoDateString);\n };\n\n let constrainttextId = useUniqueId('awsui-area-date-range-picker');\n constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';\n\n return (\n <>\n <InternalSpaceBetween size=\"m\">\n <div\n className={clsx(styles.calendar, {\n [styles['one-grid']]: isSingleGrid,\n })}\n role=\"application\"\n ref={elementRef}\n >\n <CalendarHeader\n baseDate={currentMonth}\n locale={locale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={i18nStrings.previousMonthAriaLabel}\n nextMonthLabel={i18nStrings.nextMonthAriaLabel}\n isSingleGrid={isSingleGrid}\n />\n\n <Grids\n isSingleGrid={isSingleGrid}\n locale={locale}\n baseDate={currentMonth}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n isDateEnabled={isDateEnabled}\n onSelectDate={onSelectDateHandler}\n onChangeMonth={setCurrentMonth}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={i18nStrings.todayAriaLabel}\n selectedStartDate={selectedStartDate}\n selectedEndDate={selectedEndDate}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxs\">\n <InternalSpaceBetween size=\"xs\" direction={isSingleGrid ? 'vertical' : 'horizontal'}>\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.startDateLabel} stretch={true}>\n <DateInput\n value={isoToDisplay(startDateString)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['start-date-input']}\n onChange={onChangeStartDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.startTimeLabel} stretch={true}>\n <InternalTimeInput\n value={startTimeString}\n onChange={e => setStartTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['start-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.endDateLabel} stretch={true}>\n <DateInput\n value={isoToDisplay(endDateString)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['end-date-input']}\n onChange={onChangeEndDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.endTimeLabel} stretch={true}>\n <InternalTimeInput\n value={endTimeString}\n onChange={e => setEndTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['end-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n </InternalSpaceBetween>\n {i18nStrings.dateTimeConstraintText && (\n <div className={styles['date-and-time-constrainttext']} id={constrainttextId}>\n {i18nStrings.dateTimeConstraintText}\n </div>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n <LiveRegion>\n <span className={styles['calendar-aria-live']}>{announcement}</span>\n </LiveRegion>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/date-range-picker/calendar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACzG,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAGtC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,gBAAgB,MAAM,qDAAqD,CAAC;AACnF,OAAO,EACL,YAAY,EACZ,UAAU,EACV,UAAU,EACV,8BAA8B,EAC9B,YAAY,EACZ,SAAS,GACV,MAAM,uCAAuC,CAAC;AAC/C,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,iB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e,EAAE,gBAAgB,GACjC,CACgB,CAChB,CACP,CACG,CACe;gBACtB,WAAW,CAAC,sBAAsB,IAAI,CACrC,6BAAK,SAAS,EAAE,MAAM,CAAC,8BAA8B,CAAC,EAAE,EAAE,EAAE,gBAAgB,IACzE,WAAW,CAAC,sBAAsB,CAC/B,CACP,CACoB,CACF;QACvB,oBAAC,UAAU;YACT,8BAAM,SAAS,EAAE,MAAM,CAAC,oBAAoB,CAAC,IAAG,YAAY,CAAQ,CACzD,CACZ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { addMonths, endOfDay, isBefore, startOfDay, startOfMonth, isAfter, isSameMonth } from 'date-fns';\nimport styles from '../styles.css.js';\nimport { BaseComponentProps } from '../../internal/base-component';\nimport { DateRangePickerProps, Focusable } from '../interfaces';\nimport CalendarHeader from './header';\nimport { Grids, selectFocusedDate } from './grids';\nimport moveFocusHandler from '../../date-picker/calendar/utils/move-focus-handler';\nimport {\n displayToIso,\n formatDate,\n formatTime,\n formatISOStringWithoutTimezone,\n isoToDisplay,\n parseDate,\n} from '../../date-picker/calendar/utils/date';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport InternalFormField from '../../form-field/internal';\nimport { InputProps } from '../../input/interfaces';\nimport DateInput from '../../internal/components/date-input';\nimport { TimeInputProps } from '../../time-input/interfaces';\nimport InternalTimeInput from '../../time-input/internal';\nimport clsx from 'clsx';\nimport { getBaseDate } from './get-base-date.js';\nimport { useUniqueId } from '../../internal/hooks/use-unique-id';\nimport { getDateLabel, renderTimeLabel } from '../../date-picker/calendar/utils/intl';\nimport LiveRegion from '../../internal/components/live-region';\nimport { normalizeStartOfWeek } from '../../date-picker/calendar/utils/locales';\n\nexport interface DateChangeHandler {\n (detail: Date): void;\n}\n\nexport interface MonthChangeHandler {\n (newMonth: Date): void;\n}\n\nexport type DayIndex = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\ninterface HeaderChangeMonthHandler {\n (isPreviousButtonClick?: boolean): void;\n}\n\nexport interface CalendarProps extends BaseComponentProps {\n locale: string;\n startOfWeek: number | undefined;\n isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;\n onSelectDateRange: (value: DateRangePickerProps.AbsoluteValue) => void;\n initialStartDate: string | undefined;\n initialEndDate: string | undefined;\n i18nStrings: DateRangePickerProps.I18nStrings;\n dateOnly: boolean;\n timeInputFormat: TimeInputProps.Format;\n isSingleGrid: boolean;\n}\n\nexport default forwardRef(Calendar);\n\nfunction Calendar(\n {\n locale,\n startOfWeek,\n isDateEnabled,\n onSelectDateRange,\n initialEndDate = '',\n initialStartDate = '',\n i18nStrings,\n dateOnly,\n isSingleGrid,\n timeInputFormat,\n }: CalendarProps,\n ref: React.Ref<Focusable>\n) {\n const elementRef = useRef<HTMLDivElement>(null);\n\n const normalizedStartOfWeek = normalizeStartOfWeek(startOfWeek, locale);\n\n useImperativeHandle(ref, () => ({\n focus() {\n if (elementRef.current) {\n const prevButton = elementRef.current.getElementsByClassName(styles['calendar-prev-month-btn'])[0];\n (prevButton as undefined | HTMLButtonElement)?.focus();\n }\n },\n }));\n\n const [initialStartDateString = '', initialStartTimeString = ''] = initialStartDate.split('T');\n const [initialEndDateString = '', initialEndTimeString = ''] = initialEndDate.split('T');\n\n const [startDateString, setStartDateString] = useState(initialStartDateString);\n const [startTimeString, setStartTimeString] = useState(initialStartTimeString);\n\n const [endDateString, setEndDateString] = useState(initialEndDateString);\n const [endTimeString, setEndTimeString] = useState(initialEndTimeString);\n\n const selectedStartDate = parseDate(startDateString, true);\n const selectedEndDate = parseDate(endDateString, true);\n\n const [announcement, setAnnouncement] = useState('');\n\n const [currentMonth, setCurrentMonth] = useState(() => {\n if (startDateString) {\n const startDate = parseDate(startDateString);\n if (isSingleGrid) {\n return startOfMonth(startDate);\n }\n return startOfMonth(addMonths(startDate, 1));\n }\n if (endDateString) {\n return startOfMonth(parseDate(endDateString));\n }\n return startOfMonth(Date.now());\n });\n\n const [focusedDate, setFocusedDate] = useState<Date | null>(() => {\n if (selectedStartDate) {\n if (isSameMonth(selectedStartDate, currentMonth)) {\n return selectedStartDate;\n }\n if (!isSingleGrid && isSameMonth(selectedStartDate, addMonths(currentMonth, -1))) {\n return selectedStartDate;\n }\n }\n return selectFocusedDate(selectedStartDate, currentMonth, isDateEnabled);\n });\n\n useEffect(() => {\n // This effect \"synchronizes\" the local state update back up to the overall DateRangePicker component\n\n const startDate = formatISOStringWithoutTimezone(startDateString, startTimeString);\n const endDate = formatISOStringWithoutTimezone(endDateString, endTimeString);\n\n if (startDate !== initialStartDate || endDate !== initialEndDate) {\n onSelectDateRange({\n startDate,\n endDate,\n type: 'absolute',\n });\n }\n }, [\n startDateString,\n startTimeString,\n endDateString,\n endTimeString,\n onSelectDateRange,\n initialStartDate,\n initialEndDate,\n ]);\n\n const onSelectDateHandler = (selectedDate: Date) => {\n // recommended to include the start/end time announced with the selection\n // because the user is not aware of the fact that a start/end time is also set as soon as they select a date\n const announceStart = (startDate: Date) => {\n return (\n i18nStrings.startDateLabel +\n ', ' +\n getDateLabel(locale, startDate) +\n ', ' +\n i18nStrings.startTimeLabel +\n ', ' +\n renderTimeLabel(locale, startDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceEnd = (endDate: Date) => {\n return (\n i18nStrings.endDateLabel +\n ', ' +\n getDateLabel(locale, endDate) +\n ', ' +\n i18nStrings.endTimeLabel +\n ', ' +\n renderTimeLabel(locale, endDate, timeInputFormat) +\n '. '\n );\n };\n\n const announceRange = (startDate: Date, endDate: Date) => {\n if (!i18nStrings.renderSelectedAbsoluteRangeAriaLive) {\n return `${getDateLabel(locale, startDate)} – ${getDateLabel(locale, endDate)}`;\n }\n return i18nStrings.renderSelectedAbsoluteRangeAriaLive(\n getDateLabel(locale, startDate),\n getDateLabel(locale, endDate)\n );\n };\n\n // If both fields are empty, we set the start date\n if (!startDateString && !endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If both fields are set, we start new\n if (startDateString && endDateString) {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString('');\n setEndTimeString('');\n setAnnouncement(announceStart(startDate));\n return;\n }\n\n // If only the END date is empty, we fill it (and swap dates if needed)\n if (startDateString && !endDateString) {\n const parsedStartDate = parseDate(startDateString);\n\n if (isBefore(selectedDate, parsedStartDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(selectedDate);\n const endDate = endOfDay(parsedStartDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, endDate));\n } else {\n const endDate = endOfDay(selectedDate);\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(parsedStartDate, endDate));\n }\n return;\n }\n\n // If only the START date is empty, we fill it (and swap dates if needed)\n if (!startDateString && endDateString) {\n const existingEndDate = parseDate(endDateString);\n\n if (isAfter(selectedDate, existingEndDate)) {\n // The user has selected the range backwards, so we swap start and end\n\n const startDate = startOfDay(existingEndDate);\n const endDate = endOfDay(selectedDate);\n\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n\n setEndDateString(formatDate(endDate));\n setEndTimeString(formatTime(endDate));\n setAnnouncement(announceEnd(endDate) + announceRange(startDate, endDate));\n } else {\n const startDate = startOfDay(selectedDate);\n setStartDateString(formatDate(startDate));\n setStartTimeString(formatTime(startDate));\n setAnnouncement(announceStart(startDate) + announceRange(startDate, existingEndDate));\n }\n return;\n }\n // All possible conditions are covered above\n };\n\n const onHeaderChangeMonthHandler: HeaderChangeMonthHandler = isPrevious => {\n const newCurrentMonth = addMonths(currentMonth, isPrevious ? -1 : 1);\n setCurrentMonth(newCurrentMonth);\n\n const newBaseDateMonth = isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, -1);\n const newBaseDate = getBaseDate(newBaseDateMonth, 1, isDateEnabled);\n setFocusedDate(newBaseDate);\n };\n\n const onChangeStartDate: InputProps['onChange'] = e => {\n const isoDateString = displayToIso(e.detail.value);\n setStartDateString(isoDateString);\n\n if (isoDateString.length >= 8) {\n const newCurrentMonth = startOfMonth(parseDate(isoDateString));\n setCurrentMonth(isSingleGrid ? newCurrentMonth : addMonths(newCurrentMonth, 1));\n }\n };\n\n const onChangeEndDate: InputProps['onChange'] = e => {\n const isoDateString = displayToIso(e.detail.value);\n setEndDateString(isoDateString);\n };\n\n let constrainttextId = useUniqueId('awsui-area-date-range-picker');\n constrainttextId = i18nStrings.dateTimeConstraintText ? constrainttextId : '';\n\n return (\n <>\n <InternalSpaceBetween size=\"m\">\n <div\n className={clsx(styles.calendar, {\n [styles['one-grid']]: isSingleGrid,\n })}\n role=\"application\"\n ref={elementRef}\n >\n <CalendarHeader\n baseDate={currentMonth}\n locale={locale}\n onChangeMonth={onHeaderChangeMonthHandler}\n previousMonthLabel={i18nStrings.previousMonthAriaLabel}\n nextMonthLabel={i18nStrings.nextMonthAriaLabel}\n isSingleGrid={isSingleGrid}\n />\n\n <Grids\n isSingleGrid={isSingleGrid}\n locale={locale}\n baseDate={currentMonth}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n isDateEnabled={isDateEnabled}\n onSelectDate={onSelectDateHandler}\n onChangeMonth={setCurrentMonth}\n startOfWeek={normalizedStartOfWeek}\n todayAriaLabel={i18nStrings.todayAriaLabel}\n selectedStartDate={selectedStartDate}\n selectedEndDate={selectedEndDate}\n handleFocusMove={moveFocusHandler}\n />\n </div>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxs\">\n <InternalSpaceBetween size=\"xs\" direction={isSingleGrid ? 'vertical' : 'horizontal'}>\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.startDateLabel} stretch={true}>\n <DateInput\n value={isoToDisplay(startDateString)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['start-date-input']}\n onChange={onChangeStartDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.startTimeLabel} stretch={true}>\n <InternalTimeInput\n value={startTimeString}\n onChange={e => setStartTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['start-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n\n <div className={styles['date-and-time-wrapper']}>\n <div className={styles['date-and-time-wrapper__date']}>\n <InternalFormField label={i18nStrings.endDateLabel} stretch={true}>\n <DateInput\n value={isoToDisplay(endDateString)}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={false}\n className={styles['end-date-input']}\n onChange={onChangeEndDate}\n placeholder=\"YYYY/MM/DD\"\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n {!dateOnly && (\n <div className={styles['date-and-time-wrapper__time']}>\n <InternalFormField label={i18nStrings.endTimeLabel} stretch={true}>\n <InternalTimeInput\n value={endTimeString}\n onChange={e => setEndTimeString(e.detail.value)}\n format={timeInputFormat}\n placeholder={timeInputFormat}\n className={styles['end-time-input']}\n ariaDescribedby={constrainttextId}\n />\n </InternalFormField>\n </div>\n )}\n </div>\n </InternalSpaceBetween>\n {i18nStrings.dateTimeConstraintText && (\n <div className={styles['date-and-time-constrainttext']} id={constrainttextId}>\n {i18nStrings.dateTimeConstraintText}\n </div>\n )}\n </InternalSpaceBetween>\n </InternalSpaceBetween>\n <LiveRegion>\n <span className={styles['calendar-aria-live']}>{announcement}</span>\n </LiveRegion>\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAyBpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAkEhC,QAAA,MAAM,eAAe,uGAgMpB,CAAC;AAGF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-range-picker/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAyBpD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AA0EhC,QAAA,MAAM,eAAe,uGAgMpB,CAAC;AAGF,eAAe,eAAe,CAAC"}
@@ -30,21 +30,19 @@ function formatDateRange(range, placeholder, formatRelativeRange, timeOffset) {
30
30
  if (!range) {
31
31
  return (React.createElement("span", { className: styles['label-text'], "aria-disabled": true }, placeholder));
32
32
  }
33
- if (range.type === 'relative') {
34
- return (React.createElement(InternalBox, { fontWeight: "normal", display: "inline", color: "inherit" }, formatRelativeRange(range)));
35
- }
36
- if (range.type === 'absolute') {
37
- var formattedOffset = isDateOnly(range) ? '' : formatOffset(timeOffset);
38
- return (React.createElement(InternalBox, { fontWeight: "normal", display: "inline", color: "inherit" },
39
- React.createElement("span", { className: styles['preferred-wordbreak'] },
40
- range.startDate,
41
- formattedOffset,
42
- " \u2014"),
43
- ' ',
44
- React.createElement("span", { className: styles['preferred-wordbreak'] },
45
- range.endDate,
46
- formattedOffset)));
47
- }
33
+ var formatted = range.type === 'relative' ? (formatRelativeRange(range)) : (React.createElement(BreakSpaces, { text: formatAbsoluteRange(range, timeOffset) }));
34
+ return (React.createElement(InternalBox, { fontWeight: "normal", display: "inline", color: "inherit" }, formatted));
35
+ }
36
+ function BreakSpaces(_a) {
37
+ var text = _a.text;
38
+ var tokens = text.split(/( )/);
39
+ return (React.createElement("div", { style: { whiteSpace: 'nowrap' } }, tokens.map(function (token, index) { return (React.createElement(React.Fragment, { key: index },
40
+ token,
41
+ token === ' ' && React.createElement("wbr", null))); })));
42
+ }
43
+ function formatAbsoluteRange(value, timeOffset) {
44
+ var formattedOffset = isDateOnly(value) ? '' : formatOffset(timeOffset);
45
+ return value.startDate + formattedOffset + ' ' + '—' + ' ' + value.endDate + formattedOffset;
48
46
  }
49
47
  function isDateOnly(value) {
50
48
  if (!value || value.type !== 'absolute') {