@cloudscape-design/components-themeable 3.0.1056 → 3.0.1058

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 (93) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.scss +9 -0
  3. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  4. package/lib/internal/scss/internal/styles/forms/mixins.scss +11 -7
  5. package/lib/internal/scss/internal/styles/links.scss +4 -3
  6. package/lib/internal/scss/link/styles.scss +12 -1
  7. package/lib/internal/scss/table/body-cell/styles.scss +0 -1
  8. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.d.ts.map +1 -1
  9. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.js +4 -2
  10. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/index.js.map +1 -1
  11. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.css.js +7 -0
  12. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.scoped.css +7 -0
  13. package/lib/internal/template/app-layout/visual-refresh-toolbar/skeleton/breadcrumbs/styles.selectors.js +8 -0
  14. package/lib/internal/template/attribute-editor/styles.css.js +15 -15
  15. package/lib/internal/template/attribute-editor/styles.scoped.css +28 -28
  16. package/lib/internal/template/attribute-editor/styles.selectors.js +15 -15
  17. package/lib/internal/template/breadcrumb-group/item/styles.css.js +7 -7
  18. package/lib/internal/template/breadcrumb-group/item/styles.scoped.css +28 -28
  19. package/lib/internal/template/breadcrumb-group/item/styles.selectors.js +7 -7
  20. package/lib/internal/template/button-dropdown/item-element/styles.css.js +16 -16
  21. package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +27 -27
  22. package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +16 -16
  23. package/lib/internal/template/date-input/index.d.ts +1 -1
  24. package/lib/internal/template/date-input/index.d.ts.map +1 -1
  25. package/lib/internal/template/date-input/index.js.map +1 -1
  26. package/lib/internal/template/date-input/interfaces.d.ts +29 -0
  27. package/lib/internal/template/date-input/interfaces.d.ts.map +1 -1
  28. package/lib/internal/template/date-input/interfaces.js.map +1 -1
  29. package/lib/internal/template/date-input/internal.d.ts +1 -4
  30. package/lib/internal/template/date-input/internal.d.ts.map +1 -1
  31. package/lib/internal/template/date-input/internal.js +39 -4
  32. package/lib/internal/template/date-input/internal.js.map +1 -1
  33. package/lib/internal/template/date-input/utils.d.ts +8 -0
  34. package/lib/internal/template/date-input/utils.d.ts.map +1 -1
  35. package/lib/internal/template/date-input/utils.js +32 -7
  36. package/lib/internal/template/date-input/utils.js.map +1 -1
  37. package/lib/internal/template/help-panel/styles.css.js +6 -6
  38. package/lib/internal/template/help-panel/styles.scoped.css +73 -73
  39. package/lib/internal/template/help-panel/styles.selectors.js +6 -6
  40. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  41. package/lib/internal/template/internal/components/masked-input/index.d.ts.map +1 -1
  42. package/lib/internal/template/internal/components/masked-input/index.js +2 -2
  43. package/lib/internal/template/internal/components/masked-input/index.js.map +1 -1
  44. package/lib/internal/template/internal/components/masked-input/interfaces.d.ts +6 -1
  45. package/lib/internal/template/internal/components/masked-input/interfaces.d.ts.map +1 -1
  46. package/lib/internal/template/internal/components/masked-input/interfaces.js.map +1 -1
  47. package/lib/internal/template/internal/components/masked-input/use-mask.d.ts +1 -1
  48. package/lib/internal/template/internal/components/masked-input/use-mask.d.ts.map +1 -1
  49. package/lib/internal/template/internal/components/masked-input/use-mask.js +7 -5
  50. package/lib/internal/template/internal/components/masked-input/use-mask.js.map +1 -1
  51. package/lib/internal/template/internal/components/masked-input/utils/mask-format.d.ts.map +1 -1
  52. package/lib/internal/template/internal/components/masked-input/utils/mask-format.js +19 -20
  53. package/lib/internal/template/internal/components/masked-input/utils/mask-format.js.map +1 -1
  54. package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
  55. package/lib/internal/template/internal/components/token-list/styles.scoped.css +25 -25
  56. package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
  57. package/lib/internal/template/internal/environment.js +2 -2
  58. package/lib/internal/template/internal/environment.json +2 -2
  59. package/lib/internal/template/internal/plugins/helpers/use-global-breadcrumbs.d.ts.map +1 -1
  60. package/lib/internal/template/internal/plugins/helpers/use-global-breadcrumbs.js +5 -1
  61. package/lib/internal/template/internal/plugins/helpers/use-global-breadcrumbs.js.map +1 -1
  62. package/lib/internal/template/internal/utils/date-time/format-date-iso.d.ts.map +1 -1
  63. package/lib/internal/template/internal/utils/date-time/format-date-iso.js.map +1 -1
  64. package/lib/internal/template/internal/utils/date-time/interfaces.d.ts +17 -0
  65. package/lib/internal/template/internal/utils/date-time/interfaces.d.ts.map +1 -0
  66. package/lib/internal/template/internal/utils/date-time/interfaces.js +4 -0
  67. package/lib/internal/template/internal/utils/date-time/interfaces.js.map +1 -0
  68. package/lib/internal/template/link/index.d.ts.map +1 -1
  69. package/lib/internal/template/link/index.js +2 -2
  70. package/lib/internal/template/link/index.js.map +1 -1
  71. package/lib/internal/template/link/interfaces.d.ts +24 -0
  72. package/lib/internal/template/link/interfaces.d.ts.map +1 -1
  73. package/lib/internal/template/link/interfaces.js.map +1 -1
  74. package/lib/internal/template/link/internal.d.ts.map +1 -1
  75. package/lib/internal/template/link/internal.js +3 -2
  76. package/lib/internal/template/link/internal.js.map +1 -1
  77. package/lib/internal/template/link/style.d.ts +3 -0
  78. package/lib/internal/template/link/style.d.ts.map +1 -0
  79. package/lib/internal/template/link/style.js +21 -0
  80. package/lib/internal/template/link/style.js.map +1 -0
  81. package/lib/internal/template/link/styles.css.js +20 -20
  82. package/lib/internal/template/link/styles.scoped.css +103 -102
  83. package/lib/internal/template/link/styles.selectors.js +20 -20
  84. package/lib/internal/template/table/body-cell/styles.css.js +47 -47
  85. package/lib/internal/template/table/body-cell/styles.scoped.css +374 -375
  86. package/lib/internal/template/table/body-cell/styles.selectors.js +47 -47
  87. package/lib/internal/template/tag-editor/styles.css.js +3 -3
  88. package/lib/internal/template/tag-editor/styles.scoped.css +13 -13
  89. package/lib/internal/template/tag-editor/styles.selectors.js +3 -3
  90. package/lib/internal/template/text-content/styles.css.js +1 -1
  91. package/lib/internal/template/text-content/styles.scoped.css +66 -66
  92. package/lib/internal/template/text-content/styles.selectors.js +1 -1
  93. package/package.json +1 -1
@@ -142,7 +142,7 @@
142
142
  */
143
143
  /* Style used for links in slots/components that are text heavy, to help links stand out among
144
144
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
145
- .awsui_item-element_93a1u_2mxwp_145:not(#\9) {
145
+ .awsui_item-element_93a1u_9solc_145:not(#\9) {
146
146
  position: relative;
147
147
  z-index: 1;
148
148
  border-block: var(--border-item-width-acvlhx, 1px) solid transparent;
@@ -154,17 +154,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
154
154
  margin-block-start: calc(-1 * var(--border-width-dropdown-qic2p4, 1px));
155
155
  cursor: pointer;
156
156
  }
157
- .awsui_item-element_93a1u_2mxwp_145.awsui_disabled_93a1u_2mxwp_157:not(#\9) {
157
+ .awsui_item-element_93a1u_9solc_145.awsui_disabled_93a1u_9solc_157:not(#\9) {
158
158
  cursor: default;
159
159
  color: var(--color-text-dropdown-item-disabled-oysy8n, #aab7b8);
160
160
  }
161
- .awsui_item-element_93a1u_2mxwp_145:not(#\9):first-child {
161
+ .awsui_item-element_93a1u_9solc_145:not(#\9):first-child {
162
162
  margin-block-start: 0;
163
163
  }
164
- .awsui_item-element_93a1u_2mxwp_145.awsui_show-divider_93a1u_2mxwp_164:not(#\9) {
164
+ .awsui_item-element_93a1u_9solc_145.awsui_show-divider_93a1u_9solc_164:not(#\9) {
165
165
  border-block-end: var(--border-item-width-acvlhx, 1px) solid var(--color-border-dropdown-group-dg9zg5, #eaeded);
166
166
  }
167
- .awsui_item-element_93a1u_2mxwp_145.awsui_highlighted_93a1u_2mxwp_167:not(#\9) {
167
+ .awsui_item-element_93a1u_9solc_145.awsui_highlighted_93a1u_9solc_167:not(#\9) {
168
168
  color: var(--color-text-dropdown-item-highlighted-bchk26, #16191f);
169
169
  z-index: 2;
170
170
  background-color: var(--color-background-dropdown-item-hover-353r6f, #f2f3f3);
@@ -174,19 +174,19 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
174
174
  border-end-start-radius: var(--border-radius-item-xggxkd, 0px);
175
175
  border-end-end-radius: var(--border-radius-item-xggxkd, 0px);
176
176
  }
177
- .awsui_item-element_93a1u_2mxwp_145.awsui_highlighted_93a1u_2mxwp_167.awsui_disabled_93a1u_2mxwp_157:not(#\9) {
177
+ .awsui_item-element_93a1u_9solc_145.awsui_highlighted_93a1u_9solc_167.awsui_disabled_93a1u_9solc_157:not(#\9) {
178
178
  color: var(--color-text-dropdown-item-dimmed-0xf8v3, #aab7b8);
179
179
  border-color: var(--color-border-dropdown-item-dimmed-hover-twsd8z, #879596);
180
180
  background-color: var(--color-background-dropdown-item-dimmed-2hwvu9, transparent);
181
181
  }
182
- .awsui_item-element_93a1u_2mxwp_145.awsui_highlighted_93a1u_2mxwp_167.awsui_is-focused_93a1u_2mxwp_182:not(#\9) {
182
+ .awsui_item-element_93a1u_9solc_145.awsui_highlighted_93a1u_9solc_167.awsui_is-focused_93a1u_9solc_182:not(#\9) {
183
183
  border-color: var(--color-border-dropdown-item-focused-xty1zx, #0073bb);
184
184
  }
185
- .awsui_item-element_93a1u_2mxwp_145.awsui_highlighted_93a1u_2mxwp_167.awsui_is-focused_93a1u_2mxwp_182:not(#\9):not(.awsui_visual-refresh_93a1u_2mxwp_185) {
185
+ .awsui_item-element_93a1u_9solc_145.awsui_highlighted_93a1u_9solc_167.awsui_is-focused_93a1u_9solc_182:not(#\9):not(.awsui_visual-refresh_93a1u_9solc_185) {
186
186
  box-shadow: inset 0 0 0 var(--border-control-focus-ring-shadow-spread-ql2vj7, 1px) var(--color-border-item-focused-r5f6xl, #0073bb);
187
187
  }
188
188
 
189
- .awsui_menu-item_93a1u_2mxwp_189:not(#\9) {
189
+ .awsui_menu-item_93a1u_9solc_189:not(#\9) {
190
190
  min-inline-size: 0;
191
191
  word-break: break-word;
192
192
  display: flex;
@@ -198,11 +198,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
198
198
  /* stylelint-disable selector-max-type */
199
199
  /* stylelint-enable selector-max-type */
200
200
  }
201
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9) {
201
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9) {
202
202
  padding-block-end: calc(var(--space-xxs-jnczic, 4px) + var(--space-xxxs-3w1kr2, 2px));
203
203
  text-underline-offset: 0.25em;
204
204
  text-decoration-thickness: 1px;
205
- color: var(--color-text-link-default-x6cnv5, #0073bb);
205
+ color: var(--awsui-style-color-default-kcc2gu, var(--color-text-link-default-x6cnv5, #0073bb));
206
206
  font-weight: inherit;
207
207
  letter-spacing: normal;
208
208
  text-decoration-line: underline;
@@ -213,30 +213,30 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
213
213
  transition-duration: var(--motion-duration-refresh-only-medium-h3wrr6, 0ms);
214
214
  }
215
215
  @media (prefers-reduced-motion: reduce) {
216
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9) {
216
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9) {
217
217
  animation: none;
218
218
  transition: none;
219
219
  }
220
220
  }
221
- .awsui-motion-disabled .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9), .awsui-mode-entering .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9) {
221
+ .awsui-motion-disabled .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9), .awsui-mode-entering .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9) {
222
222
  animation: none;
223
223
  transition: none;
224
224
  }
225
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9):hover {
225
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9):hover {
226
226
  cursor: pointer;
227
- color: var(--color-text-link-hover-tk5gkv, #0a4a74);
227
+ color: var(--awsui-style-color-hover-kcc2gu, var(--color-text-link-hover-tk5gkv, #0a4a74));
228
228
  }
229
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9):focus {
229
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9):focus {
230
230
  outline: none;
231
231
  }
232
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9):active {
233
- color: var(--color-text-link-hover-tk5gkv, #0a4a74);
232
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9):active {
233
+ color: var(--awsui-style-color-active-kcc2gu, var(--color-text-link-hover-tk5gkv, #0a4a74));
234
234
  }
235
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9):active, .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9):focus, .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201:not(#\9):hover {
235
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9):active, .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9):focus, .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201:not(#\9):hover {
236
236
  text-decoration-line: underline;
237
237
  text-decoration-color: currentColor;
238
238
  }
239
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201.awsui_current-breadcrumb_93a1u_2mxwp_237:not(#\9) {
239
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201.awsui_current-breadcrumb_93a1u_9solc_237:not(#\9) {
240
240
  font-weight: var(--font-weight-button-hh0ago, 700);
241
241
  -webkit-font-smoothing: var(--font-smoothing-webkit-px4az4, auto);
242
242
  -moz-osx-font-smoothing: var(--font-smoothing-moz-osx-ev3sgf, auto);
@@ -244,27 +244,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
244
244
  font-weight: 700;
245
245
  text-decoration: none;
246
246
  }
247
- .awsui_menu-item_93a1u_2mxwp_189.awsui_link-style_93a1u_2mxwp_201.awsui_link-style-highlighted_93a1u_2mxwp_245:not(#\9) {
247
+ .awsui_menu-item_93a1u_9solc_189.awsui_link-style_93a1u_9solc_201.awsui_link-style-highlighted_93a1u_9solc_245:not(#\9) {
248
248
  color: var(--color-text-link-hover-tk5gkv, #0a4a74);
249
249
  }
250
- .awsui_menu-item_93a1u_2mxwp_189:not(#\9):focus {
250
+ .awsui_menu-item_93a1u_9solc_189:not(#\9):focus {
251
251
  outline: none;
252
252
  }
253
- .awsui_has-category-header_93a1u_2mxwp_251 > .awsui_menu-item_93a1u_2mxwp_189:not(#\9), .awsui_has-category-header_93a1u_2mxwp_251 > .awsui_item-tooltip-wrapper_93a1u_2mxwp_251 > .awsui_menu-item_93a1u_2mxwp_189:not(#\9), .awsui_has-category-header_93a1u_2mxwp_251:not(#\9):not(.awsui_has-checkmark_93a1u_2mxwp_251) > span > .awsui_menu-item_93a1u_2mxwp_189 {
253
+ .awsui_has-category-header_93a1u_9solc_251 > .awsui_menu-item_93a1u_9solc_189:not(#\9), .awsui_has-category-header_93a1u_9solc_251 > .awsui_item-tooltip-wrapper_93a1u_9solc_251 > .awsui_menu-item_93a1u_9solc_189:not(#\9), .awsui_has-category-header_93a1u_9solc_251:not(#\9):not(.awsui_has-checkmark_93a1u_9solc_251) > span > .awsui_menu-item_93a1u_9solc_189 {
254
254
  padding-inline-start: calc(var(--space-xs-kw7k3v, 8px) + var(--space-l-3cws6j, 20px));
255
255
  }
256
256
 
257
- .awsui_icon_93a1u_2mxwp_255:not(#\9) {
257
+ .awsui_icon_93a1u_9solc_255:not(#\9) {
258
258
  padding-inline-end: var(--space-xxs-jnczic, 4px);
259
259
  flex-shrink: 0;
260
260
  }
261
- .awsui_icon_93a1u_2mxwp_255.awsui_checkmark_93a1u_2mxwp_259:not(#\9) {
261
+ .awsui_icon_93a1u_9solc_255.awsui_checkmark_93a1u_9solc_259:not(#\9) {
262
262
  color: var(--color-text-status-info-xt2ka7, #0073bb);
263
263
  }
264
- .awsui_icon_93a1u_2mxwp_255.awsui_disabled_93a1u_2mxwp_157:not(#\9) {
264
+ .awsui_icon_93a1u_9solc_255.awsui_disabled_93a1u_9solc_157:not(#\9) {
265
265
  color: var(--color-text-interactive-disabled-xwt2jl, #aab7b8);
266
266
  }
267
267
 
268
- .awsui_external-icon_93a1u_2mxwp_266:not(#\9) {
268
+ .awsui_external-icon_93a1u_9solc_266:not(#\9) {
269
269
  margin-inline-start: var(--space-xxs-jnczic, 4px);
270
270
  }
@@ -2,21 +2,21 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "item-element": "awsui_item-element_93a1u_2mxwp_145",
6
- "disabled": "awsui_disabled_93a1u_2mxwp_157",
7
- "show-divider": "awsui_show-divider_93a1u_2mxwp_164",
8
- "highlighted": "awsui_highlighted_93a1u_2mxwp_167",
9
- "is-focused": "awsui_is-focused_93a1u_2mxwp_182",
10
- "visual-refresh": "awsui_visual-refresh_93a1u_2mxwp_185",
11
- "menu-item": "awsui_menu-item_93a1u_2mxwp_189",
12
- "link-style": "awsui_link-style_93a1u_2mxwp_201",
13
- "current-breadcrumb": "awsui_current-breadcrumb_93a1u_2mxwp_237",
14
- "link-style-highlighted": "awsui_link-style-highlighted_93a1u_2mxwp_245",
15
- "has-category-header": "awsui_has-category-header_93a1u_2mxwp_251",
16
- "item-tooltip-wrapper": "awsui_item-tooltip-wrapper_93a1u_2mxwp_251",
17
- "has-checkmark": "awsui_has-checkmark_93a1u_2mxwp_251",
18
- "icon": "awsui_icon_93a1u_2mxwp_255",
19
- "checkmark": "awsui_checkmark_93a1u_2mxwp_259",
20
- "external-icon": "awsui_external-icon_93a1u_2mxwp_266"
5
+ "item-element": "awsui_item-element_93a1u_9solc_145",
6
+ "disabled": "awsui_disabled_93a1u_9solc_157",
7
+ "show-divider": "awsui_show-divider_93a1u_9solc_164",
8
+ "highlighted": "awsui_highlighted_93a1u_9solc_167",
9
+ "is-focused": "awsui_is-focused_93a1u_9solc_182",
10
+ "visual-refresh": "awsui_visual-refresh_93a1u_9solc_185",
11
+ "menu-item": "awsui_menu-item_93a1u_9solc_189",
12
+ "link-style": "awsui_link-style_93a1u_9solc_201",
13
+ "current-breadcrumb": "awsui_current-breadcrumb_93a1u_9solc_237",
14
+ "link-style-highlighted": "awsui_link-style-highlighted_93a1u_9solc_245",
15
+ "has-category-header": "awsui_has-category-header_93a1u_9solc_251",
16
+ "item-tooltip-wrapper": "awsui_item-tooltip-wrapper_93a1u_9solc_251",
17
+ "has-checkmark": "awsui_has-checkmark_93a1u_9solc_251",
18
+ "icon": "awsui_icon_93a1u_9solc_255",
19
+ "checkmark": "awsui_checkmark_93a1u_9solc_259",
20
+ "external-icon": "awsui_external-icon_93a1u_9solc_266"
21
21
  };
22
22
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DateInputProps } from './interfaces';
3
3
  export { DateInputProps };
4
- declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
4
+ declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<import("..").InputProps.Ref>>;
5
5
  export default DateInput;
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-input/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAc,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,yFAKb,CAAC;AAIH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-input/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAc,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,oGAKb,CAAC;AAIH,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,YAAY,CAAC;AACb,OAAO,KAAc,MAAM,OAAO,CAAC;AAEnC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAI3C,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAqB,EAAE,GAA0B,EAAE,EAAE;IACvF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;KAChE,CAAC,CAAC;IACH,OAAO,oBAAC,iBAAiB,oBAAK,KAAK,EAAM,kBAAkB,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5E,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\nimport React, { Ref } from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { DateInputProps } from './interfaces';\nimport InternalDateInput from './internal';\n\nexport { DateInputProps };\n\nconst DateInput = React.forwardRef((props: DateInputProps, ref: Ref<HTMLInputElement>) => {\n const baseComponentProps = useBaseComponent('DateInput', {\n props: { autoFocus: props.autoFocus, readOnly: props.readOnly },\n });\n return <InternalDateInput {...props} {...baseComponentProps} ref={ref} />;\n});\n\napplyDisplayName(DateInput, 'DateInput');\n\nexport default DateInput;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,YAAY,CAAC;AACb,OAAO,KAAc,MAAM,OAAO,CAAC;AAEnC,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAI3C,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAqB,EAAE,GAA4B,EAAE,EAAE;IACzF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,EAAE;QACvD,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;KAChE,CAAC,CAAC;IACH,OAAO,oBAAC,iBAAiB,oBAAK,KAAK,EAAM,kBAAkB,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5E,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEzC,eAAe,SAAS,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\nimport React, { Ref } from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { DateInputProps } from './interfaces';\nimport InternalDateInput from './internal';\n\nexport { DateInputProps };\n\nconst DateInput = React.forwardRef((props: DateInputProps, ref: Ref<DateInputProps.Ref>) => {\n const baseComponentProps = useBaseComponent('DateInput', {\n props: { autoFocus: props.autoFocus, readOnly: props.readOnly },\n });\n return <InternalDateInput {...props} {...baseComponentProps} ref={ref} />;\n});\n\napplyDisplayName(DateInput, 'DateInput');\n\nexport default DateInput;\n"]}
@@ -1,13 +1,42 @@
1
1
  import { BaseInputProps, InputProps } from '../input/interfaces';
2
2
  import { BaseComponentProps } from '../internal/base-component';
3
3
  import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
4
+ import { DateFormat, DateGranularity, EditableDateFormat } from '../internal/utils/date-time/interfaces';
4
5
  export interface DateInputProps extends BaseInputProps, FormFieldValidationControlProps, BaseComponentProps {
5
6
  /**
6
7
  * The current input value, in YYYY-MM-DD format.
7
8
  */
8
9
  value: string;
10
+ /**
11
+ * Specifies the locale to use to render month names and determine the starting day of the week.
12
+ * If you don't provide this, the locale is determined by the page and browser locales.
13
+ * Supported values and formats are listed in the [JavaScript Intl API specification](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation).
14
+ */
15
+ locale?: string;
16
+ /**
17
+ * Specifies the granularity at which users will be able to select a date.
18
+ * Defaults to `day`.
19
+ **/
20
+ granularity?: DateInputProps.Granularity;
21
+ /**
22
+ * The format as it is displayed. It can take the following values:
23
+ * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01).
24
+ * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024 (or January, 2024).
25
+ * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01).
26
+ */
27
+ format?: DateInputProps.Format;
28
+ /**
29
+ * Specifies the date format to use when the format is 'long-localized' and editing the date.
30
+ * The format of the input as it is being interacted with. It can take the following values:
31
+ * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01).
32
+ * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01).
33
+ */
34
+ inputFormat?: DateInputProps.InputFormat;
9
35
  }
10
36
  export declare namespace DateInputProps {
11
37
  type Ref = InputProps.Ref;
38
+ type Format = DateFormat;
39
+ type InputFormat = EditableDateFormat;
40
+ type Granularity = DateGranularity;
12
41
  }
13
42
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/date-input/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAEzF,MAAM,WAAW,cAAe,SAAQ,cAAc,EAAE,+BAA+B,EAAE,kBAAkB;IACzG;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,yBAAiB,cAAc,CAAC;IAC9B,KAAY,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;CAClC"}
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/date-input/interfaces.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAEzG,MAAM,WAAW,cAAe,SAAQ,cAAc,EAAE,+BAA+B,EAAE,kBAAkB;IACzG;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;QAGI;IACJ,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;IAEzC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC;IAE/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;CAC1C;AAED,yBAAiB,cAAc,CAAC;IAC9B,KAAY,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;IAEjC,KAAY,MAAM,GAAG,UAAU,CAAC;IAEhC,KAAY,WAAW,GAAG,kBAAkB,CAAC;IAE7C,KAAY,WAAW,GAAG,eAAe,CAAC;CAC3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-input/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 { BaseInputProps, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\n\nexport interface DateInputProps extends BaseInputProps, FormFieldValidationControlProps, BaseComponentProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\n}\n\nexport namespace DateInputProps {\n export type Ref = InputProps.Ref;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/date-input/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 { BaseInputProps, InputProps } from '../input/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { DateFormat, DateGranularity, EditableDateFormat } from '../internal/utils/date-time/interfaces';\n\nexport interface DateInputProps extends BaseInputProps, FormFieldValidationControlProps, BaseComponentProps {\n /**\n * The current input value, in YYYY-MM-DD format.\n */\n value: string;\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 [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 * Specifies the granularity at which users will be able to select a date.\n * Defaults to `day`.\n **/\n granularity?: DateInputProps.Granularity;\n\n /**\n * The format as it is displayed. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01).\n * * `long-localized`: a more human-readable, localized format, e.g.: January 30, 2024 (or January, 2024).\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01).\n */\n format?: DateInputProps.Format;\n\n /**\n * Specifies the date format to use when the format is 'long-localized' and editing the date.\n * The format of the input as it is being interacted with. It can take the following values:\n * * `iso`: ISO 8601 format without time, e.g.: 2024-01-30 (or 2024-01).\n * * `slashed`: similar to ISO 8601 but with '/' in place of '-'. e.g.: 2024/01/30 (or 2024/01).\n */\n inputFormat?: DateInputProps.InputFormat;\n}\n\nexport namespace DateInputProps {\n export type Ref = InputProps.Ref;\n\n export type Format = DateFormat;\n\n export type InputFormat = EditableDateFormat;\n\n export type Granularity = DateGranularity;\n}\n"]}
@@ -1,9 +1,6 @@
1
1
  import React from 'react';
2
- import { CalendarProps } from '../calendar/interfaces';
3
2
  import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
4
3
  import { DateInputProps } from './interfaces';
5
- declare const InternalDateInput: React.ForwardRefExoticComponent<DateInputProps & InternalBaseComponentProps<any> & {
6
- granularity?: CalendarProps.Granularity | undefined;
7
- } & React.RefAttributes<HTMLInputElement>>;
4
+ declare const InternalDateInput: React.ForwardRefExoticComponent<DateInputProps & InternalBaseComponentProps<any> & React.RefAttributes<import("..").InputProps.Ref>>;
8
5
  export default InternalDateInput;
9
6
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAc,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,QAAA,MAAM,iBAAiB;;0CAqBtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAM9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAIlF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAO9C,QAAA,MAAM,iBAAiB,sIAyEtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,16 +1,51 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { __rest } from "tslib";
4
- import React from 'react';
4
+ import React, { useMemo, useRef, useState } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import MaskedInput from '../internal/components/masked-input';
7
7
  import { fireNonCancelableEvent } from '../internal/events';
8
+ import useForwardFocus from '../internal/hooks/forward-focus';
8
9
  import { displayToIso, isoToDisplay } from '../internal/utils/date-time';
9
- import { generateMaskArgs } from './utils';
10
+ import formatDateIso from '../internal/utils/date-time/format-date-iso';
11
+ import formatDateLocalized from '../internal/utils/date-time/format-date-localized';
12
+ import { generateMaskArgs, normalizeIsoDateString } from './utils';
10
13
  import styles from './styles.css.js';
11
14
  const InternalDateInput = React.forwardRef((_a, ref) => {
12
- var { value, onChange, granularity, __internalRootRef = null } = _a, props = __rest(_a, ["value", "onChange", "granularity", "__internalRootRef"]);
13
- return (React.createElement(MaskedInput, Object.assign({ ref: ref }, props, { value: isoToDisplay(value || ''), onChange: event => fireNonCancelableEvent(onChange, { value: displayToIso(event.detail.value) }), className: clsx(styles.root, props.className), mask: generateMaskArgs({ granularity }), autofix: true, autoComplete: false, disableAutocompleteOnBlur: false, disableBrowserAutocorrect: true, __internalRootRef: __internalRootRef })));
15
+ var { value, onChange, onBlur, onFocus, granularity = 'day', locale, format = 'slashed', inputFormat = 'slashed', __internalRootRef = null } = _a, props = __rest(_a, ["value", "onChange", "onBlur", "onFocus", "granularity", "locale", "format", "inputFormat", "__internalRootRef"]);
16
+ const [isFocused, setIsFocused] = useState(false);
17
+ const inputRef = useRef(null);
18
+ const isIso = format === 'iso' || (format === 'long-localized' && inputFormat === 'iso');
19
+ useForwardFocus(ref, inputRef);
20
+ const onInputFocus = (event) => {
21
+ setIsFocused(true);
22
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
23
+ };
24
+ const onInputBlur = (event) => {
25
+ setIsFocused(false);
26
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
27
+ };
28
+ const onInputChange = (event) => {
29
+ const isNonFocusedLongLocalized = format === 'long-localized' && !(isFocused || props.readOnly);
30
+ if (!isNonFocusedLongLocalized) {
31
+ fireNonCancelableEvent(onChange, { value: displayToIso(event.detail.value) });
32
+ }
33
+ };
34
+ const usesLongLocalizedValue = format === 'long-localized' && !(isFocused && !props.readOnly);
35
+ const displayedValue = useMemo(() => {
36
+ if (!value) {
37
+ return '';
38
+ }
39
+ const isoValue = displayToIso(value);
40
+ const formatProps = { hideTimeOffset: true, isDateOnly: true, isMonthOnly: granularity === 'month', locale };
41
+ const normalizedValue = normalizeIsoDateString(isoValue, granularity);
42
+ return usesLongLocalizedValue && normalizedValue
43
+ ? formatDateLocalized(Object.assign({ date: normalizedValue }, formatProps))
44
+ : isIso
45
+ ? formatDateIso(Object.assign({ date: isoValue }, formatProps))
46
+ : isoToDisplay(isoValue);
47
+ }, [value, isIso, granularity, locale, usesLongLocalizedValue]);
48
+ return (React.createElement(MaskedInput, Object.assign({ ref: inputRef }, props, { value: displayedValue, onChange: onInputChange, onFocus: onInputFocus, onBlur: onInputBlur, className: clsx(styles.root, props.className), mask: generateMaskArgs({ granularity, isIso }), autofix: !usesLongLocalizedValue, disableAutocompleteOnBlur: false, disableBrowserAutocorrect: true, showUnmaskedValue: usesLongLocalizedValue, autoComplete: false, __internalRootRef: __internalRootRef })));
14
49
  });
15
50
  export default InternalDateInput;
16
51
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAOrC,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CACxC,CACE,EAA4F,EAC5F,GAA0B,EAC1B,EAAE;QAFF,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,OAAoC,EAA/B,KAAK,cAAlE,yDAAoE,CAAF;IAGlE,OAAO,CACL,oBAAC,WAAW,kBACV,GAAG,EAAE,GAAG,IACJ,KAAK,IACT,KAAK,EAAE,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC,EAChC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAChG,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,EAC7C,IAAI,EAAE,gBAAgB,CAAC,EAAE,WAAW,EAAE,CAAC,EACvC,OAAO,EAAE,IAAI,EACb,YAAY,EAAE,KAAK,EACnB,yBAAyB,EAAE,KAAK,EAChC,yBAAyB,EAAE,IAAI,EAC/B,iBAAiB,EAAE,iBAAiB,IACpC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref } from 'react';\nimport clsx from 'clsx';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport MaskedInput from '../internal/components/masked-input';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { displayToIso, isoToDisplay } from '../internal/utils/date-time';\nimport { DateInputProps } from './interfaces';\nimport { generateMaskArgs } from './utils';\n\nimport styles from './styles.css.js';\n\ntype InternalDateInputProps = DateInputProps &\n InternalBaseComponentProps & {\n granularity?: CalendarProps.Granularity;\n };\n\nconst InternalDateInput = React.forwardRef(\n (\n { value, onChange, granularity, __internalRootRef = null, ...props }: InternalDateInputProps,\n ref: Ref<HTMLInputElement>\n ) => {\n return (\n <MaskedInput\n ref={ref}\n {...props}\n value={isoToDisplay(value || '')}\n onChange={event => fireNonCancelableEvent(onChange, { value: displayToIso(event.detail.value) })}\n className={clsx(styles.root, props.className)}\n mask={generateMaskArgs({ granularity })}\n autofix={true}\n autoComplete={false}\n disableAutocompleteOnBlur={false}\n disableBrowserAutocorrect={true}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalDateInput;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"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","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Ref, useMemo, useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport MaskedInput from '../internal/components/masked-input';\nimport { fireNonCancelableEvent, NonCancelableCustomEvent } from '../internal/events';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { displayToIso, isoToDisplay } from '../internal/utils/date-time';\nimport formatDateIso from '../internal/utils/date-time/format-date-iso';\nimport formatDateLocalized from '../internal/utils/date-time/format-date-localized';\nimport { DateInputProps } from './interfaces';\nimport { generateMaskArgs, normalizeIsoDateString } from './utils';\n\nimport styles from './styles.css.js';\n\ntype InternalDateInputProps = DateInputProps & InternalBaseComponentProps;\n\nconst InternalDateInput = React.forwardRef(\n (\n {\n value,\n onChange,\n onBlur,\n onFocus,\n granularity = 'day',\n locale,\n format = 'slashed',\n inputFormat = 'slashed',\n __internalRootRef = null,\n ...props\n }: InternalDateInputProps,\n ref: Ref<DateInputProps.Ref>\n ) => {\n const [isFocused, setIsFocused] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n const isIso = format === 'iso' || (format === 'long-localized' && inputFormat === 'iso');\n\n useForwardFocus(ref, inputRef);\n\n const onInputFocus = (event: NonCancelableCustomEvent<null>) => {\n setIsFocused(true);\n onFocus?.(event);\n };\n\n const onInputBlur = (event: NonCancelableCustomEvent<null>) => {\n setIsFocused(false);\n onBlur?.(event);\n };\n\n const onInputChange = (event: NonCancelableCustomEvent<{ value: string }>) => {\n const isNonFocusedLongLocalized = format === 'long-localized' && !(isFocused || props.readOnly);\n if (!isNonFocusedLongLocalized) {\n fireNonCancelableEvent(onChange, { value: displayToIso(event.detail.value) });\n }\n };\n\n const usesLongLocalizedValue = format === 'long-localized' && !(isFocused && !props.readOnly);\n const displayedValue = useMemo(() => {\n if (!value) {\n return '';\n }\n const isoValue = displayToIso(value);\n const formatProps = { hideTimeOffset: true, isDateOnly: true, isMonthOnly: granularity === 'month', locale };\n const normalizedValue = normalizeIsoDateString(isoValue, granularity);\n return usesLongLocalizedValue && normalizedValue\n ? formatDateLocalized({ date: normalizedValue, ...formatProps })\n : isIso\n ? formatDateIso({ date: isoValue, ...formatProps })\n : isoToDisplay(isoValue);\n }, [value, isIso, granularity, locale, usesLongLocalizedValue]);\n\n return (\n <MaskedInput\n ref={inputRef}\n {...props}\n value={displayedValue}\n onChange={onInputChange}\n onFocus={onInputFocus}\n onBlur={onInputBlur}\n className={clsx(styles.root, props.className)}\n mask={generateMaskArgs({ granularity, isIso })}\n autofix={!usesLongLocalizedValue}\n disableAutocompleteOnBlur={false}\n disableBrowserAutocorrect={true}\n showUnmaskedValue={usesLongLocalizedValue}\n autoComplete={false}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalDateInput;\n"]}
@@ -4,4 +4,12 @@ export interface GenerateMaskArgsProps extends Pick<CalendarProps, 'granularity'
4
4
  isIso?: boolean;
5
5
  }
6
6
  export declare const generateMaskArgs: ({ granularity, isIso, }?: GenerateMaskArgsProps) => MaskArgs;
7
+ /**
8
+ * Normalizes a partial ISO date string by trimming incomplete segments.
9
+ *
10
+ * @param dateString - The date string to normalize (e.g., "2012-", "2012-0", "2012-01-3").
11
+ * @param granularity - The level of detail required ('month' or 'day').
12
+ * @returns a properly formatted date string or empty string, if invalid.
13
+ */
14
+ export declare function normalizeIsoDateString(dateString: string, granularity: CalendarProps.Granularity): string;
7
15
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/date-input/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uDAAuD,CAAC;AAajF,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,gBAAgB,6BAO1B,qBAAqB,KAAQ,QAM/B,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/date-input/utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uDAAuD,CAAC;AAcjF,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,gBAAgB,6BAO1B,qBAAqB,KAAQ,QAM/B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,WAAW,GAAG,MAAM,CAgBzG"}
@@ -2,24 +2,49 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { getDaysInMonth } from 'date-fns';
4
4
  import { displayToIso, parseDate } from '../internal/utils/date-time';
5
- function daysMax(value) {
6
- // force to first day in month, as new Date('2018-02-30') -> March 2nd 2018
5
+ const yearMask = { min: 0, max: 9999, default: 2000, length: 4 };
6
+ const monthMask = { min: 1, max: 12, length: 2 };
7
+ const dayMask = { min: 1, max: getMaxDaysForDate, length: 2 };
8
+ function getMaxDaysForDate(value) {
9
+ // Forcing to first day in month to ensure the correct month is used in case the date is incorrect.
10
+ // For example, the date '2018-02-30' is parsed as '2018-03-02' (because there is only 28 days in February 2018).
7
11
  const baseDate = displayToIso(value).substring(0, 7);
8
12
  return getDaysInMonth(parseDate(baseDate));
9
13
  }
10
- const yearMask = { min: 0, max: 9999, default: 2000, length: 4 };
11
- const monthMask = { min: 1, max: 12, length: 2 };
12
- const dayMask = { min: 1, max: daysMax, length: 2 };
13
14
  export const generateMaskArgs = ({ granularity = 'day',
14
15
  /**
15
16
  * There are only two options, 'iso' and 'slashed' which is our current default format. If more formats are entered
16
- * we should take the formatting type rather than teh boolean when we make an update
17
+ * we should take the formatting type rather than the boolean when we make an update.
17
18
  */
18
19
  isIso = false, } = {}) => {
19
20
  return {
20
21
  separator: isIso ? '-' : '/',
21
- inputSeparators: [...(isIso ? ['/'] : ['-']), '.', ' '],
22
+ inputSeparators: isIso ? ['/', '.', ' '] : ['-', '.', ' '],
22
23
  segments: granularity === 'month' ? [yearMask, monthMask] : [yearMask, monthMask, dayMask],
23
24
  };
24
25
  };
26
+ /**
27
+ * Normalizes a partial ISO date string by trimming incomplete segments.
28
+ *
29
+ * @param dateString - The date string to normalize (e.g., "2012-", "2012-0", "2012-01-3").
30
+ * @param granularity - The level of detail required ('month' or 'day').
31
+ * @returns a properly formatted date string or empty string, if invalid.
32
+ */
33
+ export function normalizeIsoDateString(dateString, granularity) {
34
+ if (!dateString) {
35
+ return '';
36
+ }
37
+ const match = dateString.match(/^(\d{4})(?:-(\d{1,2})?)?(?:-(\d{1,2})?)?$/);
38
+ if (!match) {
39
+ return '';
40
+ }
41
+ const [, year, month, day] = match;
42
+ if (granularity === 'day' && (month === null || month === void 0 ? void 0 : month.length) === 2 && (day === null || day === void 0 ? void 0 : day.length) === 2) {
43
+ return `${year}-${month}-${day}`;
44
+ }
45
+ if ((month === null || month === void 0 ? void 0 : month.length) === 2) {
46
+ return `${year}-${month}`;
47
+ }
48
+ return year;
49
+ }
25
50
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/date-input/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEtE,SAAS,OAAO,CAAC,KAAa;IAC5B,2EAA2E;IAC3E,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACjE,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACjD,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAMpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,WAAW,GAAG,KAAK;AACnB;;;GAGG;AACH,KAAK,GAAG,KAAK,MACY,EAAE,EAAY,EAAE;IACzC,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;QAC5B,eAAe,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC;QACvD,QAAQ,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;KAC3F,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getDaysInMonth } from 'date-fns';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { MaskArgs } from '../internal/components/masked-input/utils/mask-format';\nimport { displayToIso, parseDate } from '../internal/utils/date-time';\n\nfunction daysMax(value: string): number {\n // force to first day in month, as new Date('2018-02-30') -> March 2nd 2018\n const baseDate = displayToIso(value).substring(0, 7);\n return getDaysInMonth(parseDate(baseDate));\n}\n\nconst yearMask = { min: 0, max: 9999, default: 2000, length: 4 };\nconst monthMask = { min: 1, max: 12, length: 2 };\nconst dayMask = { min: 1, max: daysMax, length: 2 };\n\nexport interface GenerateMaskArgsProps extends Pick<CalendarProps, 'granularity'> {\n isIso?: boolean;\n}\n\nexport const generateMaskArgs = ({\n granularity = 'day',\n /**\n * There are only two options, 'iso' and 'slashed' which is our current default format. If more formats are entered\n * we should take the formatting type rather than teh boolean when we make an update\n */\n isIso = false,\n}: GenerateMaskArgsProps = {}): MaskArgs => {\n return {\n separator: isIso ? '-' : '/',\n inputSeparators: [...(isIso ? ['/'] : ['-']), '.', ' '],\n segments: granularity === 'month' ? [yearMask, monthMask] : [yearMask, monthMask, dayMask],\n };\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/date-input/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI1C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACjE,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACjD,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AAE9D,SAAS,iBAAiB,CAAC,KAAa;IACtC,mGAAmG;IACnG,iHAAiH;IACjH,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACrD,OAAO,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC7C,CAAC;AAMD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAC/B,WAAW,GAAG,KAAK;AACnB;;;GAGG;AACH,KAAK,GAAG,KAAK,MACY,EAAE,EAAY,EAAE;IACzC,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;QAC5B,eAAe,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;QAC1D,QAAQ,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;KAC3F,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,WAAsC;IAC/F,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAC;KACX;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC5E,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,EAAE,CAAC;KACX;IACD,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC;IACnC,IAAI,WAAW,KAAK,KAAK,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAK,CAAC,IAAI,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,MAAK,CAAC,EAAE;QACrE,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;KAClC;IACD,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAK,CAAC,EAAE;QACvB,OAAO,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC;KAC3B;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getDaysInMonth } from 'date-fns';\n\nimport { CalendarProps } from '../calendar/interfaces';\nimport { MaskArgs } from '../internal/components/masked-input/utils/mask-format';\nimport { displayToIso, parseDate } from '../internal/utils/date-time';\n\nconst yearMask = { min: 0, max: 9999, default: 2000, length: 4 };\nconst monthMask = { min: 1, max: 12, length: 2 };\nconst dayMask = { min: 1, max: getMaxDaysForDate, length: 2 };\n\nfunction getMaxDaysForDate(value: string): number {\n // Forcing to first day in month to ensure the correct month is used in case the date is incorrect.\n // For example, the date '2018-02-30' is parsed as '2018-03-02' (because there is only 28 days in February 2018).\n const baseDate = displayToIso(value).substring(0, 7);\n return getDaysInMonth(parseDate(baseDate));\n}\n\nexport interface GenerateMaskArgsProps extends Pick<CalendarProps, 'granularity'> {\n isIso?: boolean;\n}\n\nexport const generateMaskArgs = ({\n granularity = 'day',\n /**\n * There are only two options, 'iso' and 'slashed' which is our current default format. If more formats are entered\n * we should take the formatting type rather than the boolean when we make an update.\n */\n isIso = false,\n}: GenerateMaskArgsProps = {}): MaskArgs => {\n return {\n separator: isIso ? '-' : '/',\n inputSeparators: isIso ? ['/', '.', ' '] : ['-', '.', ' '],\n segments: granularity === 'month' ? [yearMask, monthMask] : [yearMask, monthMask, dayMask],\n };\n};\n\n/**\n * Normalizes a partial ISO date string by trimming incomplete segments.\n *\n * @param dateString - The date string to normalize (e.g., \"2012-\", \"2012-0\", \"2012-01-3\").\n * @param granularity - The level of detail required ('month' or 'day').\n * @returns a properly formatted date string or empty string, if invalid.\n */\nexport function normalizeIsoDateString(dateString: string, granularity: CalendarProps.Granularity): string {\n if (!dateString) {\n return '';\n }\n const match = dateString.match(/^(\\d{4})(?:-(\\d{1,2})?)?(?:-(\\d{1,2})?)?$/);\n if (!match) {\n return '';\n }\n const [, year, month, day] = match;\n if (granularity === 'day' && month?.length === 2 && day?.length === 2) {\n return `${year}-${month}-${day}`;\n }\n if (month?.length === 2) {\n return `${year}-${month}`;\n }\n return year;\n}\n"]}
@@ -1,11 +1,11 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "help-panel": "awsui_help-panel_1d237_74hml_181",
5
- "loading": "awsui_loading_1d237_74hml_348",
6
- "header": "awsui_header_1d237_74hml_353",
7
- "with-toolbar": "awsui_with-toolbar_1d237_74hml_371",
8
- "content": "awsui_content_1d237_74hml_390",
9
- "footer": "awsui_footer_1d237_74hml_441"
4
+ "help-panel": "awsui_help-panel_1d237_aqguo_181",
5
+ "loading": "awsui_loading_1d237_aqguo_348",
6
+ "header": "awsui_header_1d237_aqguo_353",
7
+ "with-toolbar": "awsui_with-toolbar_1d237_aqguo_371",
8
+ "content": "awsui_content_1d237_aqguo_390",
9
+ "footer": "awsui_footer_1d237_aqguo_441"
10
10
  };
11
11