@cloudscape-design/components 3.0.681 → 3.0.682
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.
- package/button/index.d.ts.map +1 -1
- package/button/index.js +2 -2
- package/button/index.js.map +1 -1
- package/button/interfaces.d.ts +6 -0
- package/button/interfaces.d.ts.map +1 -1
- package/button/interfaces.js.map +1 -1
- package/button/internal.d.ts.map +1 -1
- package/button/internal.js +15 -4
- package/button/internal.js.map +1 -1
- package/button/styles.css.js +20 -19
- package/button/styles.scoped.css +161 -167
- package/button/styles.selectors.js +20 -19
- package/button/test-classes/styles.css.js +6 -0
- package/button/test-classes/styles.scoped.css +7 -0
- package/button/test-classes/styles.selectors.js +7 -0
- package/button-dropdown/category-elements/expandable-category-element.js +1 -1
- package/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.js +1 -1
- package/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
- package/button-dropdown/index.d.ts.map +1 -1
- package/button-dropdown/index.js +2 -2
- package/button-dropdown/index.js.map +1 -1
- package/button-dropdown/interfaces.d.ts +7 -0
- package/button-dropdown/interfaces.d.ts.map +1 -1
- package/button-dropdown/interfaces.js.map +1 -1
- package/button-dropdown/internal.d.ts.map +1 -1
- package/button-dropdown/internal.js +4 -2
- package/button-dropdown/internal.js.map +1 -1
- package/button-dropdown/item-element/index.js +1 -1
- package/button-dropdown/item-element/index.js.map +1 -1
- package/calendar/grid/index.d.ts +3 -1
- package/calendar/grid/index.d.ts.map +1 -1
- package/calendar/grid/index.js +26 -6
- package/calendar/grid/index.js.map +1 -1
- package/calendar/grid/use-calendar-grid-keyboard-navigation.d.ts +2 -1
- package/calendar/grid/use-calendar-grid-keyboard-navigation.d.ts.map +1 -1
- package/calendar/grid/use-calendar-grid-keyboard-navigation.js +8 -5
- package/calendar/grid/use-calendar-grid-keyboard-navigation.js.map +1 -1
- package/calendar/interfaces.d.ts +9 -0
- package/calendar/interfaces.d.ts.map +1 -1
- package/calendar/interfaces.js.map +1 -1
- package/calendar/internal.d.ts +1 -1
- package/calendar/internal.d.ts.map +1 -1
- package/calendar/internal.js +7 -5
- package/calendar/internal.js.map +1 -1
- package/calendar/styles.css.js +21 -20
- package/calendar/styles.scoped.css +46 -42
- package/calendar/styles.selectors.js +21 -20
- package/calendar/utils/navigation.d.ts +10 -10
- package/calendar/utils/navigation.d.ts.map +1 -1
- package/calendar/utils/navigation.js +29 -29
- package/calendar/utils/navigation.js.map +1 -1
- package/date-picker/index.d.ts.map +1 -1
- package/date-picker/index.js +2 -2
- package/date-picker/index.js.map +1 -1
- package/date-range-picker/calendar/grids/grid.d.ts +2 -1
- package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/grid.js +55 -7
- package/date-range-picker/calendar/grids/grid.js.map +1 -1
- package/date-range-picker/calendar/grids/index.d.ts +2 -1
- package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
- package/date-range-picker/calendar/grids/index.js +20 -12
- package/date-range-picker/calendar/grids/index.js.map +1 -1
- package/date-range-picker/calendar/grids/styles.css.js +28 -27
- package/date-range-picker/calendar/grids/styles.scoped.css +46 -42
- package/date-range-picker/calendar/grids/styles.selectors.js +28 -27
- package/date-range-picker/calendar/index.d.ts +2 -1
- package/date-range-picker/calendar/index.d.ts.map +1 -1
- package/date-range-picker/calendar/index.js +2 -2
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/dropdown.d.ts +2 -2
- package/date-range-picker/dropdown.d.ts.map +1 -1
- package/date-range-picker/dropdown.js +2 -2
- package/date-range-picker/dropdown.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +2 -2
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/interfaces.d.ts +9 -0
- package/date-range-picker/interfaces.d.ts.map +1 -1
- package/date-range-picker/interfaces.js.map +1 -1
- package/internal/base-component/styles.scoped.css +12 -10
- package/internal/components/option/interfaces.d.ts +2 -0
- package/internal/components/option/interfaces.d.ts.map +1 -1
- package/internal/components/option/interfaces.js.map +1 -1
- package/internal/components/selectable-item/index.d.ts +1 -0
- package/internal/components/selectable-item/index.d.ts.map +1 -1
- package/internal/components/selectable-item/index.js +3 -0
- package/internal/components/selectable-item/index.js.map +1 -1
- package/internal/components/tooltip/index.d.ts +3 -1
- package/internal/components/tooltip/index.d.ts.map +1 -1
- package/internal/components/tooltip/index.js +3 -3
- package/internal/components/tooltip/index.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/environment.json +1 -1
- package/internal/generated/styles/tokens.d.ts +2 -0
- package/internal/generated/styles/tokens.js +4 -2
- package/internal/generated/theming/index.cjs +78 -12
- package/internal/generated/theming/index.cjs.d.ts +16 -0
- package/internal/generated/theming/index.d.ts +16 -0
- package/internal/generated/theming/index.js +78 -12
- package/{button-dropdown/utils/use-hidden-description.d.ts → internal/hooks/use-hidden-description/index.d.ts} +2 -1
- package/internal/hooks/use-hidden-description/index.d.ts.map +1 -0
- package/{button-dropdown/utils/use-hidden-description.js → internal/hooks/use-hidden-description/index.js} +3 -2
- package/internal/hooks/use-hidden-description/index.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/package.json +1 -1
- package/segmented-control/interfaces.d.ts +2 -0
- package/segmented-control/interfaces.d.ts.map +1 -1
- package/segmented-control/interfaces.js.map +1 -1
- package/segmented-control/internal-segmented-control.d.ts.map +1 -1
- package/segmented-control/internal-segmented-control.js +11 -8
- package/segmented-control/internal-segmented-control.js.map +1 -1
- package/segmented-control/segment.d.ts.map +1 -1
- package/segmented-control/segment.js +14 -4
- package/segmented-control/segment.js.map +1 -1
- package/segmented-control/styles.css.js +15 -14
- package/segmented-control/styles.scoped.css +37 -33
- package/segmented-control/styles.selectors.js +15 -14
- package/select/interfaces.d.ts +1 -0
- package/select/interfaces.d.ts.map +1 -1
- package/select/interfaces.js.map +1 -1
- package/select/parts/filter.d.ts +1 -1
- package/select/parts/item.d.ts.map +1 -1
- package/select/parts/item.js +13 -3
- package/select/parts/item.js.map +1 -1
- package/select/parts/multiselect-item.d.ts.map +1 -1
- package/select/parts/multiselect-item.js +15 -3
- package/select/parts/multiselect-item.js.map +1 -1
- package/select/parts/styles.css.js +17 -16
- package/select/parts/styles.scoped.css +21 -17
- package/select/parts/styles.selectors.js +17 -16
- package/split-panel/icons/styles.css.js +22 -22
- package/split-panel/icons/styles.scoped.css +25 -25
- package/split-panel/icons/styles.selectors.js +22 -22
- package/table/body-cell/disabled-inline-editor.js +1 -1
- package/table/body-cell/disabled-inline-editor.js.map +1 -1
- package/tabs/interfaces.d.ts +5 -0
- package/tabs/interfaces.d.ts.map +1 -1
- package/tabs/interfaces.js.map +1 -1
- package/tabs/styles.css.js +28 -25
- package/tabs/styles.scoped.css +60 -49
- package/tabs/styles.selectors.js +28 -25
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +38 -14
- package/tabs/tab-header-bar.js.map +1 -1
- package/test-utils/dom/button/index.d.ts +1 -0
- package/test-utils/dom/button/index.js +6 -2
- package/test-utils/dom/button/index.js.map +1 -1
- package/test-utils/dom/button-dropdown/index.d.ts +2 -1
- package/test-utils/dom/button-dropdown/index.js +5 -1
- package/test-utils/dom/button-dropdown/index.js.map +1 -1
- package/test-utils/dom/calendar/index.d.ts +4 -1
- package/test-utils/dom/calendar/index.js +8 -1
- package/test-utils/dom/calendar/index.js.map +1 -1
- package/test-utils/dom/date-range-picker/index.d.ts +4 -1
- package/test-utils/dom/date-range-picker/index.js +8 -2
- package/test-utils/dom/date-range-picker/index.js.map +1 -1
- package/test-utils/dom/internal/dropdown-host.js.map +1 -1
- package/test-utils/dom/internal/option.d.ts +1 -0
- package/test-utils/dom/internal/option.js +4 -0
- package/test-utils/dom/internal/option.js.map +1 -1
- package/test-utils/dom/segmented-control/index.d.ts +9 -0
- package/test-utils/dom/segmented-control/index.js +15 -0
- package/test-utils/dom/segmented-control/index.js.map +1 -1
- package/test-utils/dom/tabs/index.d.ts +9 -2
- package/test-utils/dom/tabs/index.js +15 -2
- package/test-utils/dom/tabs/index.js.map +1 -1
- package/test-utils/selectors/button/index.d.ts +1 -0
- package/test-utils/selectors/button/index.js +6 -2
- package/test-utils/selectors/button/index.js.map +1 -1
- package/test-utils/selectors/button-dropdown/index.d.ts +2 -1
- package/test-utils/selectors/button-dropdown/index.js +5 -1
- package/test-utils/selectors/button-dropdown/index.js.map +1 -1
- package/test-utils/selectors/calendar/index.d.ts +4 -1
- package/test-utils/selectors/calendar/index.js +8 -1
- package/test-utils/selectors/calendar/index.js.map +1 -1
- package/test-utils/selectors/date-range-picker/index.d.ts +4 -1
- package/test-utils/selectors/date-range-picker/index.js +8 -2
- package/test-utils/selectors/date-range-picker/index.js.map +1 -1
- package/test-utils/selectors/internal/dropdown-host.js.map +1 -1
- package/test-utils/selectors/internal/option.d.ts +1 -0
- package/test-utils/selectors/internal/option.js +4 -0
- package/test-utils/selectors/internal/option.js.map +1 -1
- package/test-utils/selectors/segmented-control/index.d.ts +9 -0
- package/test-utils/selectors/segmented-control/index.js +15 -0
- package/test-utils/selectors/segmented-control/index.js.map +1 -1
- package/test-utils/selectors/tabs/index.d.ts +9 -2
- package/test-utils/selectors/tabs/index.js +15 -2
- package/test-utils/selectors/tabs/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/button-dropdown/utils/use-hidden-description.d.ts.map +0 -1
- package/button-dropdown/utils/use-hidden-description.js.map +0 -1
|
@@ -94,11 +94,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
94
94
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
95
95
|
SPDX-License-Identifier: Apache-2.0
|
|
96
96
|
*/
|
|
97
|
-
.
|
|
98
|
-
animation: awsui_awsui-motion-fade-in-
|
|
97
|
+
.awsui_calendar_1ykar_tn512_97:not(#\9) {
|
|
98
|
+
animation: awsui_awsui-motion-fade-in-0_1ykar_tn512_1 var(--motion-duration-show-quick-aq3ump, 135ms) var(--motion-easing-show-quick-vc5zgd, ease-out);
|
|
99
99
|
animation-fill-mode: both;
|
|
100
100
|
}
|
|
101
|
-
@keyframes awsui_awsui-motion-fade-in-
|
|
101
|
+
@keyframes awsui_awsui-motion-fade-in-0_1ykar_tn512_1 {
|
|
102
102
|
from {
|
|
103
103
|
opacity: 0;
|
|
104
104
|
}
|
|
@@ -107,12 +107,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
@media (prefers-reduced-motion: reduce) {
|
|
110
|
-
.
|
|
110
|
+
.awsui_calendar_1ykar_tn512_97:not(#\9) {
|
|
111
111
|
animation: none;
|
|
112
112
|
transition: none;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
.awsui-motion-disabled .
|
|
115
|
+
.awsui-motion-disabled .awsui_calendar_1ykar_tn512_97:not(#\9), .awsui-mode-entering .awsui_calendar_1ykar_tn512_97:not(#\9) {
|
|
116
116
|
animation: none;
|
|
117
117
|
transition: none;
|
|
118
118
|
}
|
|
@@ -125,11 +125,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
125
125
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
126
126
|
SPDX-License-Identifier: Apache-2.0
|
|
127
127
|
*/
|
|
128
|
-
.
|
|
128
|
+
.awsui_root_1ykar_tn512_128:not(#\9) {
|
|
129
129
|
/* used in test-utils */
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.
|
|
132
|
+
.awsui_calendar_1ykar_tn512_97:not(#\9) {
|
|
133
133
|
display: block;
|
|
134
134
|
inline-size: var(--size-calendar-grid-width-lrunz7, 238px);
|
|
135
135
|
overflow: auto;
|
|
@@ -167,16 +167,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
167
167
|
-webkit-font-smoothing: auto;
|
|
168
168
|
-moz-osx-font-smoothing: auto;
|
|
169
169
|
}
|
|
170
|
-
.awsui_calendar-
|
|
170
|
+
.awsui_calendar-inner_1ykar_tn512_169:not(#\9) {
|
|
171
171
|
margin-block: var(--space-xs-zb16t3, 8px);
|
|
172
172
|
margin-inline: var(--space-xs-zb16t3, 8px);
|
|
173
173
|
}
|
|
174
|
-
.awsui_calendar-
|
|
174
|
+
.awsui_calendar-header_1ykar_tn512_173:not(#\9) {
|
|
175
175
|
display: flex;
|
|
176
176
|
justify-content: space-between;
|
|
177
177
|
align-items: center;
|
|
178
178
|
}
|
|
179
|
-
.awsui_calendar-header-
|
|
179
|
+
.awsui_calendar-header-title_1ykar_tn512_178:not(#\9) {
|
|
180
180
|
font-size: var(--font-size-body-m-x4okxb, 14px);
|
|
181
181
|
line-height: var(--line-height-body-m-30ar75, 20px);
|
|
182
182
|
font-weight: 700;
|
|
@@ -184,30 +184,30 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
184
184
|
margin-block: 0;
|
|
185
185
|
margin-inline: 0;
|
|
186
186
|
}
|
|
187
|
-
.awsui_calendar-next-
|
|
187
|
+
.awsui_calendar-next-btn_1ykar_tn512_186:not(#\9) {
|
|
188
188
|
/* used for identifying element */
|
|
189
189
|
}
|
|
190
|
-
.awsui_calendar-prev-
|
|
190
|
+
.awsui_calendar-prev-btn_1ykar_tn512_189:not(#\9) {
|
|
191
191
|
/* used for identifying element */
|
|
192
192
|
}
|
|
193
|
-
.awsui_calendar-
|
|
193
|
+
.awsui_calendar-grid_1ykar_tn512_192:not(#\9) {
|
|
194
194
|
inline-size: 100%;
|
|
195
195
|
table-layout: fixed;
|
|
196
196
|
}
|
|
197
|
-
.awsui_calendar-
|
|
197
|
+
.awsui_calendar-grid_1ykar_tn512_192:not(#\9):not(.awsui_calendar-grid-dense_1ykar_tn512_196) {
|
|
198
198
|
border-spacing: var(--space-calendar-grid-gutter-2jsrps, 6px);
|
|
199
199
|
padding-block: var(--space-xs-zb16t3, 8px);
|
|
200
200
|
padding-inline: var(--space-xs-zb16t3, 8px);
|
|
201
201
|
}
|
|
202
|
-
.awsui_calendar-grid-
|
|
202
|
+
.awsui_calendar-grid-dense_1ykar_tn512_196:not(#\9) {
|
|
203
203
|
border-spacing: 0;
|
|
204
204
|
}
|
|
205
|
-
.awsui_calendar-grid-
|
|
205
|
+
.awsui_calendar-grid-cell_1ykar_tn512_204:not(#\9) {
|
|
206
206
|
word-break: break-word;
|
|
207
207
|
text-align: center;
|
|
208
208
|
font-weight: unset;
|
|
209
209
|
}
|
|
210
|
-
.awsui_calendar-date-
|
|
210
|
+
.awsui_calendar-date-header_1ykar_tn512_209:not(#\9) {
|
|
211
211
|
padding-block-start: var(--space-s-34lx8l, 12px);
|
|
212
212
|
padding-block-end: var(--space-xxs-p8yyaw, 4px);
|
|
213
213
|
padding-inline: 0;
|
|
@@ -216,7 +216,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
216
216
|
line-height: var(--line-height-body-s-7zv1j5, 16px);
|
|
217
217
|
letter-spacing: var(--letter-spacing-body-s-z9jkwp, 0.005em);
|
|
218
218
|
}
|
|
219
|
-
.awsui_calendar-
|
|
219
|
+
.awsui_calendar-date_1ykar_tn512_209:not(#\9) {
|
|
220
220
|
border-block-end: 1px solid var(--color-border-calendar-grid-u86q1u, transparent);
|
|
221
221
|
border-inline-end: 1px solid var(--color-border-calendar-grid-u86q1u, transparent);
|
|
222
222
|
padding-block: var(--space-xxs-p8yyaw, 4px);
|
|
@@ -224,23 +224,23 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
224
224
|
color: var(--color-text-dropdown-item-disabled-6oq3n6, #9ba7b6);
|
|
225
225
|
position: relative;
|
|
226
226
|
}
|
|
227
|
-
.awsui_calendar-
|
|
227
|
+
.awsui_calendar-date_1ykar_tn512_209:not(#\9):first-child {
|
|
228
228
|
border-inline-start: 1px solid var(--color-border-calendar-grid-u86q1u, transparent);
|
|
229
229
|
}
|
|
230
|
-
.awsui_calendar-date-
|
|
230
|
+
.awsui_calendar-date-enabled_1ykar_tn512_229:not(#\9) {
|
|
231
231
|
cursor: pointer;
|
|
232
232
|
color: var(--color-text-dropdown-item-secondary-jho0ju, #5f6b7a);
|
|
233
233
|
}
|
|
234
|
-
.awsui_calendar-date-
|
|
234
|
+
.awsui_calendar-date-enabled_1ykar_tn512_229:not(#\9)::after {
|
|
235
235
|
border-start-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
236
236
|
border-start-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
237
237
|
border-end-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
238
238
|
border-end-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
239
239
|
}
|
|
240
|
-
.awsui_calendar-date-
|
|
240
|
+
.awsui_calendar-date-enabled_1ykar_tn512_229.awsui_calendar-date-current-page_1ykar_tn512_239:not(#\9) {
|
|
241
241
|
color: var(--color-text-dropdown-item-default-4o4hes, #000716);
|
|
242
242
|
}
|
|
243
|
-
.awsui_calendar-date-
|
|
243
|
+
.awsui_calendar-date-enabled_1ykar_tn512_229.awsui_calendar-date-current-page_1ykar_tn512_239:not(#\9):hover {
|
|
244
244
|
border-start-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
245
245
|
border-start-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
246
246
|
border-end-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
@@ -248,11 +248,11 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
248
248
|
color: var(--color-text-calendar-date-hover-llr4as, #000716);
|
|
249
249
|
background-color: var(--color-background-dropdown-item-hover-swsulg, #f4f4f4);
|
|
250
250
|
}
|
|
251
|
-
.awsui_calendar-date-
|
|
251
|
+
.awsui_calendar-date-enabled_1ykar_tn512_229.awsui_calendar-date-current-page_1ykar_tn512_239:not(#\9):hover:not(.awsui_calendar-date-selected_1ykar_tn512_250)::after {
|
|
252
252
|
border-block: var(--border-item-width-yel47s, 2px) solid var(--color-border-dropdown-item-hover-461g78, #7d8998);
|
|
253
253
|
border-inline: var(--border-item-width-yel47s, 2px) solid var(--color-border-dropdown-item-hover-461g78, #7d8998);
|
|
254
254
|
}
|
|
255
|
-
.awsui_calendar-date-
|
|
255
|
+
.awsui_calendar-date-current_1ykar_tn512_239:not(#\9) {
|
|
256
256
|
border-start-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
257
257
|
border-start-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
258
258
|
border-end-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
@@ -260,7 +260,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
260
260
|
background-color: var(--color-background-calendar-current-date-kmb0ji, #f4f4f4);
|
|
261
261
|
font-weight: 700;
|
|
262
262
|
}
|
|
263
|
-
.awsui_calendar-
|
|
263
|
+
.awsui_calendar-date_1ykar_tn512_209:not(#\9)::after {
|
|
264
264
|
content: "";
|
|
265
265
|
position: absolute;
|
|
266
266
|
z-index: 1;
|
|
@@ -269,29 +269,29 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
269
269
|
inset-inline-start: calc(-1 * var(--border-item-width-yel47s, 2px));
|
|
270
270
|
inset-inline-end: calc(-1 * var(--border-item-width-yel47s, 2px));
|
|
271
271
|
}
|
|
272
|
-
.awsui_calendar-
|
|
272
|
+
.awsui_calendar-date_1ykar_tn512_209:not(#\9):not(.awsui_calendar-date-dense_1ykar_tn512_271)::after {
|
|
273
273
|
inset-block-end: calc(-1 * var(--border-item-width-yel47s, 2px));
|
|
274
274
|
inset-inline-start: calc(-1 * var(--border-item-width-yel47s, 2px));
|
|
275
275
|
}
|
|
276
|
-
.awsui_calendar-date-
|
|
276
|
+
.awsui_calendar-date-dense_1ykar_tn512_271:not(#\9)::after {
|
|
277
277
|
inset-block-end: -1px;
|
|
278
278
|
inset-inline-start: -1px;
|
|
279
279
|
}
|
|
280
|
-
.awsui_calendar-
|
|
280
|
+
.awsui_calendar-date_1ykar_tn512_209 > .awsui_date-inner_1ykar_tn512_279:not(#\9) {
|
|
281
281
|
position: relative;
|
|
282
282
|
z-index: 1;
|
|
283
283
|
}
|
|
284
|
-
.awsui_calendar-
|
|
284
|
+
.awsui_calendar-date_1ykar_tn512_209:not(#\9):focus {
|
|
285
285
|
outline: none;
|
|
286
286
|
}
|
|
287
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-
|
|
287
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date_1ykar_tn512_209:not(#\9):focus:focus {
|
|
288
288
|
position: relative;
|
|
289
289
|
}
|
|
290
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-
|
|
290
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date_1ykar_tn512_209:not(#\9):focus:focus {
|
|
291
291
|
outline: 2px dotted transparent;
|
|
292
292
|
outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-g00bgj, -5px) - 1px);
|
|
293
293
|
}
|
|
294
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-
|
|
294
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date_1ykar_tn512_209:not(#\9):focus:focus::before {
|
|
295
295
|
content: " ";
|
|
296
296
|
display: block;
|
|
297
297
|
position: absolute;
|
|
@@ -305,23 +305,23 @@ body[data-awsui-focus-visible=true] .awsui_calendar-date_1ykar_183yz_209:not(#\9
|
|
|
305
305
|
border-end-end-radius: var(--border-radius-calendar-day-focus-ring-545h0w, 3px);
|
|
306
306
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-b2ntyl, #0972d3);
|
|
307
307
|
}
|
|
308
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-
|
|
308
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date_1ykar_tn512_209:not(#\9):focus:focus::before {
|
|
309
309
|
z-index: 2;
|
|
310
310
|
}
|
|
311
|
-
.awsui_calendar-date-
|
|
311
|
+
.awsui_calendar-date-selected_1ykar_tn512_250:not(#\9) {
|
|
312
312
|
border-color: transparent;
|
|
313
313
|
position: relative;
|
|
314
314
|
z-index: 2;
|
|
315
315
|
font-weight: 700;
|
|
316
316
|
}
|
|
317
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-date-
|
|
317
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date-selected_1ykar_tn512_250:not(#\9):focus:focus {
|
|
318
318
|
position: relative;
|
|
319
319
|
}
|
|
320
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-date-
|
|
320
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date-selected_1ykar_tn512_250:not(#\9):focus:focus {
|
|
321
321
|
outline: 2px dotted transparent;
|
|
322
322
|
outline-offset: calc(var(--space-calendar-grid-focus-outline-gutter-g00bgj, -5px) - 1px);
|
|
323
323
|
}
|
|
324
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-date-
|
|
324
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date-selected_1ykar_tn512_250:not(#\9):focus:focus::before {
|
|
325
325
|
content: " ";
|
|
326
326
|
display: block;
|
|
327
327
|
position: absolute;
|
|
@@ -335,10 +335,10 @@ body[data-awsui-focus-visible=true] .awsui_calendar-date-selected_1ykar_183yz_25
|
|
|
335
335
|
border-end-end-radius: var(--border-radius-calendar-day-focus-ring-545h0w, 3px);
|
|
336
336
|
box-shadow: 0 0 0 2px var(--color-border-calendar-grid-selected-focus-ring-thqa8y, #fbfbfb);
|
|
337
337
|
}
|
|
338
|
-
body[data-awsui-focus-visible=true] .awsui_calendar-date-
|
|
338
|
+
body[data-awsui-focus-visible=true] .awsui_calendar-date-selected_1ykar_tn512_250:not(#\9):focus:focus::before {
|
|
339
339
|
z-index: 2;
|
|
340
340
|
}
|
|
341
|
-
.awsui_calendar-date-
|
|
341
|
+
.awsui_calendar-date-selected_1ykar_tn512_250:not(#\9)::after {
|
|
342
342
|
border-start-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
343
343
|
border-start-end-radius: var(--border-radius-item-05df9h, 8px);
|
|
344
344
|
border-end-start-radius: var(--border-radius-item-05df9h, 8px);
|
|
@@ -347,11 +347,15 @@ body[data-awsui-focus-visible=true] .awsui_calendar-date-selected_1ykar_183yz_25
|
|
|
347
347
|
border-block: var(--border-item-width-yel47s, 2px) solid var(--color-background-control-checked-w517i0, #0972d3);
|
|
348
348
|
border-inline: var(--border-item-width-yel47s, 2px) solid var(--color-background-control-checked-w517i0, #0972d3);
|
|
349
349
|
}
|
|
350
|
-
.awsui_calendar-date-
|
|
350
|
+
.awsui_calendar-date-selected_1ykar_tn512_250 > .awsui_date-inner_1ykar_tn512_279:not(#\9) {
|
|
351
351
|
z-index: 2;
|
|
352
352
|
color: var(--color-background-control-default-qzruqy, #ffffff);
|
|
353
353
|
position: relative;
|
|
354
354
|
}
|
|
355
|
-
.awsui_calendar-
|
|
355
|
+
.awsui_calendar-row_1ykar_tn512_354:not(#\9):first-child > .awsui_calendar-date_1ykar_tn512_209 {
|
|
356
356
|
border-block-start: 1px solid var(--color-border-calendar-grid-u86q1u, transparent);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.awsui_disabled-reason-tooltip_1ykar_tn512_358:not(#\9) {
|
|
360
|
+
/* used in test-utils or tests */
|
|
357
361
|
}
|
|
@@ -2,25 +2,26 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"calendar": "
|
|
6
|
-
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-
|
|
7
|
-
"root": "
|
|
8
|
-
"calendar-inner": "awsui_calendar-
|
|
9
|
-
"calendar-header": "awsui_calendar-
|
|
10
|
-
"calendar-header-title": "awsui_calendar-header-
|
|
11
|
-
"calendar-next-btn": "awsui_calendar-next-
|
|
12
|
-
"calendar-prev-btn": "awsui_calendar-prev-
|
|
13
|
-
"calendar-grid": "awsui_calendar-
|
|
14
|
-
"calendar-grid-dense": "awsui_calendar-grid-
|
|
15
|
-
"calendar-grid-cell": "awsui_calendar-grid-
|
|
16
|
-
"calendar-date-header": "awsui_calendar-date-
|
|
17
|
-
"calendar-date": "awsui_calendar-
|
|
18
|
-
"calendar-date-enabled": "awsui_calendar-date-
|
|
19
|
-
"calendar-date-current-page": "awsui_calendar-date-current-
|
|
20
|
-
"calendar-date-selected": "awsui_calendar-date-
|
|
21
|
-
"calendar-date-current": "awsui_calendar-date-
|
|
22
|
-
"calendar-date-dense": "awsui_calendar-date-
|
|
23
|
-
"date-inner": "awsui_date-
|
|
24
|
-
"calendar-row": "awsui_calendar-
|
|
5
|
+
"calendar": "awsui_calendar_1ykar_tn512_97",
|
|
6
|
+
"awsui-motion-fade-in-0": "awsui_awsui-motion-fade-in-0_1ykar_tn512_1",
|
|
7
|
+
"root": "awsui_root_1ykar_tn512_128",
|
|
8
|
+
"calendar-inner": "awsui_calendar-inner_1ykar_tn512_169",
|
|
9
|
+
"calendar-header": "awsui_calendar-header_1ykar_tn512_173",
|
|
10
|
+
"calendar-header-title": "awsui_calendar-header-title_1ykar_tn512_178",
|
|
11
|
+
"calendar-next-btn": "awsui_calendar-next-btn_1ykar_tn512_186",
|
|
12
|
+
"calendar-prev-btn": "awsui_calendar-prev-btn_1ykar_tn512_189",
|
|
13
|
+
"calendar-grid": "awsui_calendar-grid_1ykar_tn512_192",
|
|
14
|
+
"calendar-grid-dense": "awsui_calendar-grid-dense_1ykar_tn512_196",
|
|
15
|
+
"calendar-grid-cell": "awsui_calendar-grid-cell_1ykar_tn512_204",
|
|
16
|
+
"calendar-date-header": "awsui_calendar-date-header_1ykar_tn512_209",
|
|
17
|
+
"calendar-date": "awsui_calendar-date_1ykar_tn512_209",
|
|
18
|
+
"calendar-date-enabled": "awsui_calendar-date-enabled_1ykar_tn512_229",
|
|
19
|
+
"calendar-date-current-page": "awsui_calendar-date-current-page_1ykar_tn512_239",
|
|
20
|
+
"calendar-date-selected": "awsui_calendar-date-selected_1ykar_tn512_250",
|
|
21
|
+
"calendar-date-current": "awsui_calendar-date-current_1ykar_tn512_239",
|
|
22
|
+
"calendar-date-dense": "awsui_calendar-date-dense_1ykar_tn512_271",
|
|
23
|
+
"date-inner": "awsui_date-inner_1ykar_tn512_279",
|
|
24
|
+
"calendar-row": "awsui_calendar-row_1ykar_tn512_354",
|
|
25
|
+
"disabled-reason-tooltip": "awsui_disabled-reason-tooltip_1ykar_tn512_358"
|
|
25
26
|
};
|
|
26
27
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CalendarProps } from '../interfaces';
|
|
2
|
-
export declare function moveNextDay(startDate: Date,
|
|
3
|
-
export declare function movePrevDay(startDate: Date,
|
|
4
|
-
export declare function moveNextWeek(startDate: Date,
|
|
5
|
-
export declare function movePrevWeek(startDate: Date,
|
|
6
|
-
export declare function moveNextMonth(startDate: Date,
|
|
7
|
-
export declare function movePrevMonth(startDate: Date,
|
|
8
|
-
export declare function moveMonthDown(startDate: Date,
|
|
9
|
-
export declare function moveMonthUp(startDate: Date,
|
|
10
|
-
export declare function getBaseDay(date: Date,
|
|
11
|
-
export declare function getBaseMonth(date: Date,
|
|
2
|
+
export declare function moveNextDay(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
3
|
+
export declare function movePrevDay(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
4
|
+
export declare function moveNextWeek(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
5
|
+
export declare function movePrevWeek(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
6
|
+
export declare function moveNextMonth(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
7
|
+
export declare function movePrevMonth(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
8
|
+
export declare function moveMonthDown(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
9
|
+
export declare function moveMonthUp(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
10
|
+
export declare function getBaseDay(date: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
11
|
+
export declare function getBaseMonth(date: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction): Date;
|
|
12
12
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/navigation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,wBAAgB,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../src/calendar/utils/navigation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,wBAAgB,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAEhG;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAEhG;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAEjG;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAEjG;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAElG;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAElG;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAElG;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAEhG;AAID,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAE1F;AAID,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,CAAC,qBAAqB,QAE5F"}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { addDays, addMonths, differenceInYears, isSameMonth, isSameYear, startOfMonth, startOfYear } from 'date-fns';
|
|
4
|
-
export function moveNextDay(startDate,
|
|
5
|
-
return moveDay(startDate,
|
|
4
|
+
export function moveNextDay(startDate, isDateFocusable) {
|
|
5
|
+
return moveDay(startDate, isDateFocusable, 1);
|
|
6
6
|
}
|
|
7
|
-
export function movePrevDay(startDate,
|
|
8
|
-
return moveDay(startDate,
|
|
7
|
+
export function movePrevDay(startDate, isDateFocusable) {
|
|
8
|
+
return moveDay(startDate, isDateFocusable, -1);
|
|
9
9
|
}
|
|
10
|
-
export function moveNextWeek(startDate,
|
|
11
|
-
return moveDay(startDate,
|
|
10
|
+
export function moveNextWeek(startDate, isDateFocusable) {
|
|
11
|
+
return moveDay(startDate, isDateFocusable, 7);
|
|
12
12
|
}
|
|
13
|
-
export function movePrevWeek(startDate,
|
|
14
|
-
return moveDay(startDate,
|
|
13
|
+
export function movePrevWeek(startDate, isDateFocusable) {
|
|
14
|
+
return moveDay(startDate, isDateFocusable, -7);
|
|
15
15
|
}
|
|
16
|
-
export function moveNextMonth(startDate,
|
|
17
|
-
return moveMonth(startDate,
|
|
16
|
+
export function moveNextMonth(startDate, isDateFocusable) {
|
|
17
|
+
return moveMonth(startDate, isDateFocusable, 1);
|
|
18
18
|
}
|
|
19
|
-
export function movePrevMonth(startDate,
|
|
20
|
-
return moveMonth(startDate,
|
|
19
|
+
export function movePrevMonth(startDate, isDateFocusable) {
|
|
20
|
+
return moveMonth(startDate, isDateFocusable, -1);
|
|
21
21
|
}
|
|
22
|
-
export function moveMonthDown(startDate,
|
|
23
|
-
return moveMonth(startDate,
|
|
22
|
+
export function moveMonthDown(startDate, isDateFocusable) {
|
|
23
|
+
return moveMonth(startDate, isDateFocusable, 3);
|
|
24
24
|
}
|
|
25
|
-
export function moveMonthUp(startDate,
|
|
26
|
-
return moveMonth(startDate,
|
|
25
|
+
export function moveMonthUp(startDate, isDateFocusable) {
|
|
26
|
+
return moveMonth(startDate, isDateFocusable, -3);
|
|
27
27
|
}
|
|
28
28
|
// Returns first enabled date of the month corresponding to the given date.
|
|
29
29
|
// If all month's days are disabled, the first day of the month is returned.
|
|
30
|
-
export function getBaseDay(date,
|
|
31
|
-
return getBaseDate({ date,
|
|
30
|
+
export function getBaseDay(date, isDateFocusable) {
|
|
31
|
+
return getBaseDate({ date, isDateFocusable, granularity: 'day' });
|
|
32
32
|
}
|
|
33
33
|
// Returns first enabled month of the year corresponding to the given date.
|
|
34
34
|
// If all year's months are disabled, the first month of the year is returned.
|
|
35
|
-
export function getBaseMonth(date,
|
|
36
|
-
return getBaseDate({ date,
|
|
35
|
+
export function getBaseMonth(date, isDateFocusable) {
|
|
36
|
+
return getBaseDate({ date, isDateFocusable, granularity: 'month' });
|
|
37
37
|
}
|
|
38
|
-
function getBaseDate({ date, granularity,
|
|
38
|
+
function getBaseDate({ date, granularity, isDateFocusable, }) {
|
|
39
39
|
const isMonthGranularity = granularity === 'month';
|
|
40
40
|
const getStartDate = isMonthGranularity ? startOfYear : startOfMonth;
|
|
41
41
|
const moveDate = isMonthGranularity ? moveMonth : moveDay;
|
|
42
42
|
const isSamePage = isMonthGranularity ? isSameYear : isSameMonth;
|
|
43
43
|
const startDate = getStartDate(date);
|
|
44
|
-
if (
|
|
44
|
+
if (isDateFocusable(startDate)) {
|
|
45
45
|
return startDate;
|
|
46
46
|
}
|
|
47
|
-
const firstEnabledDate = moveDate(startDate,
|
|
47
|
+
const firstEnabledDate = moveDate(startDate, isDateFocusable, 1);
|
|
48
48
|
return isSamePage(startDate, firstEnabledDate) ? firstEnabledDate : startDate;
|
|
49
49
|
}
|
|
50
50
|
// Iterates days forwards or backwards until the next active day is found.
|
|
51
51
|
// If there is no active day in a year range, the start day is returned.
|
|
52
|
-
function moveDay(startDate,
|
|
53
|
-
return moveDate({ startDate, granularity: 'day',
|
|
52
|
+
function moveDay(startDate, isDateFocusable, step) {
|
|
53
|
+
return moveDate({ startDate, granularity: 'day', isDateFocusable, step });
|
|
54
54
|
}
|
|
55
55
|
// Iterates months forwards or backwards until the next active month is found.
|
|
56
56
|
// If there is no active month in a 10 year range, the start month is returned.
|
|
57
|
-
function moveMonth(startDate,
|
|
58
|
-
return moveDate({ startDate, granularity: 'month',
|
|
57
|
+
function moveMonth(startDate, isDateFocusable, step) {
|
|
58
|
+
return moveDate({ startDate, granularity: 'month', isDateFocusable, step });
|
|
59
59
|
}
|
|
60
|
-
function moveDate({ startDate, granularity,
|
|
60
|
+
function moveDate({ startDate, granularity, isDateFocusable, step, }) {
|
|
61
61
|
const isMonthGranularity = granularity === 'month';
|
|
62
62
|
const addSteps = isMonthGranularity ? addMonths : addDays;
|
|
63
63
|
const limitYears = isMonthGranularity ? 1 : 10;
|
|
64
64
|
let current = addSteps(startDate, step);
|
|
65
|
-
while (!
|
|
65
|
+
while (!isDateFocusable(current)) {
|
|
66
66
|
if (Math.abs(differenceInYears(startDate, current)) > limitYears) {
|
|
67
67
|
return startDate;
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../../src/calendar/utils/navigation.ts"],"names":[],"mappings":"AAAA,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AAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAED,0EAA0E;AAC1E,wEAAwE;AACxE,SAAS,OAAO,CAAC,SAAe,EAAE,eAAoD,EAAE,IAAY;IAClG,OAAO,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,8EAA8E;AAC9E,+EAA+E;AAC/E,SAAS,SAAS,CAAC,SAAe,EAAE,eAAoD,EAAE,IAAY;IACpG,OAAO,QAAQ,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,EAChB,SAAS,EACT,WAAW,EACX,eAAe,EACf,IAAI,GAML;IACC,MAAM,kBAAkB,GAAG,WAAW,KAAK,OAAO,CAAC;IACnD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1D,MAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE/C,IAAI,OAAO,GAAG,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAExC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE;QAChC,IAAI,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,EAAE;YAChE,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;KACnC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { addDays, addMonths, differenceInYears, isSameMonth, isSameYear, startOfMonth, startOfYear } from 'date-fns';\nimport { CalendarProps } from '../interfaces';\n\nexport function moveNextDay(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveDay(startDate, isDateFocusable, 1);\n}\n\nexport function movePrevDay(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveDay(startDate, isDateFocusable, -1);\n}\n\nexport function moveNextWeek(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveDay(startDate, isDateFocusable, 7);\n}\n\nexport function movePrevWeek(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveDay(startDate, isDateFocusable, -7);\n}\n\nexport function moveNextMonth(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveMonth(startDate, isDateFocusable, 1);\n}\n\nexport function movePrevMonth(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveMonth(startDate, isDateFocusable, -1);\n}\n\nexport function moveMonthDown(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveMonth(startDate, isDateFocusable, 3);\n}\n\nexport function moveMonthUp(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return moveMonth(startDate, isDateFocusable, -3);\n}\n\n// Returns first enabled date of the month corresponding to the given date.\n// If all month's days are disabled, the first day of the month is returned.\nexport function getBaseDay(date: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return getBaseDate({ date, isDateFocusable, granularity: 'day' });\n}\n\n// Returns first enabled month of the year corresponding to the given date.\n// If all year's months are disabled, the first month of the year is returned.\nexport function getBaseMonth(date: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction) {\n return getBaseDate({ date, isDateFocusable, granularity: 'month' });\n}\n\nfunction getBaseDate({\n date,\n granularity,\n isDateFocusable,\n}: {\n date: Date;\n granularity: CalendarProps.Granularity;\n isDateFocusable: CalendarProps.IsDateEnabledFunction;\n}) {\n const isMonthGranularity = granularity === 'month';\n const getStartDate = isMonthGranularity ? startOfYear : startOfMonth;\n const moveDate = isMonthGranularity ? moveMonth : moveDay;\n const isSamePage = isMonthGranularity ? isSameYear : isSameMonth;\n\n const startDate = getStartDate(date);\n if (isDateFocusable(startDate)) {\n return startDate;\n }\n const firstEnabledDate = moveDate(startDate, isDateFocusable, 1);\n return isSamePage(startDate, firstEnabledDate) ? firstEnabledDate : startDate;\n}\n\n// Iterates days forwards or backwards until the next active day is found.\n// If there is no active day in a year range, the start day is returned.\nfunction moveDay(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction, step: number): Date {\n return moveDate({ startDate, granularity: 'day', isDateFocusable, step });\n}\n\n// Iterates months forwards or backwards until the next active month is found.\n// If there is no active month in a 10 year range, the start month is returned.\nfunction moveMonth(startDate: Date, isDateFocusable: CalendarProps.IsDateEnabledFunction, step: number): Date {\n return moveDate({ startDate, granularity: 'month', isDateFocusable, step });\n}\n\nfunction moveDate({\n startDate,\n granularity,\n isDateFocusable,\n step,\n}: {\n startDate: Date;\n granularity: CalendarProps.Granularity;\n isDateFocusable: CalendarProps.IsDateEnabledFunction;\n step: number;\n}) {\n const isMonthGranularity = granularity === 'month';\n const addSteps = isMonthGranularity ? addMonths : addDays;\n const limitYears = isMonthGranularity ? 1 : 10;\n\n let current = addSteps(startDate, step);\n\n while (!isDateFocusable(current)) {\n if (Math.abs(differenceInYears(startDate, current)) > limitYears) {\n return startDate;\n }\n current = addSteps(current, step);\n }\n\n return current;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAyB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAyB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FAgMf,CAAC;AAGF,eAAe,UAAU,CAAC"}
|
package/date-picker/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { useLocale } from '../i18n/context.js';
|
|
|
27
27
|
import { getBaseDateLabel, getSelectedDateLabel, isValidFullDate } from './utils';
|
|
28
28
|
const DatePicker = React.forwardRef((_a, ref) => {
|
|
29
29
|
var _b, _c, _d;
|
|
30
|
-
var { locale = '', startOfWeek, isDateEnabled, nextMonthAriaLabel, previousMonthAriaLabel, todayAriaLabel, i18nStrings, placeholder = '', value = '', readOnly = false, disabled = false, onBlur, autoFocus = false, onChange, onFocus, name, ariaLabel, ariaRequired, controlId, invalid, warning, openCalendarAriaLabel, expandToViewport, granularity = 'day' } = _a, restProps = __rest(_a, ["locale", "startOfWeek", "isDateEnabled", "nextMonthAriaLabel", "previousMonthAriaLabel", "todayAriaLabel", "i18nStrings", "placeholder", "value", "readOnly", "disabled", "onBlur", "autoFocus", "onChange", "onFocus", "name", "ariaLabel", "ariaRequired", "controlId", "invalid", "warning", "openCalendarAriaLabel", "expandToViewport", "granularity"]);
|
|
30
|
+
var { locale = '', startOfWeek, isDateEnabled, dateDisabledReason, nextMonthAriaLabel, previousMonthAriaLabel, todayAriaLabel, i18nStrings, placeholder = '', value = '', readOnly = false, disabled = false, onBlur, autoFocus = false, onChange, onFocus, name, ariaLabel, ariaRequired, controlId, invalid, warning, openCalendarAriaLabel, expandToViewport, granularity = 'day' } = _a, restProps = __rest(_a, ["locale", "startOfWeek", "isDateEnabled", "dateDisabledReason", "nextMonthAriaLabel", "previousMonthAriaLabel", "todayAriaLabel", "i18nStrings", "placeholder", "value", "readOnly", "disabled", "onBlur", "autoFocus", "onChange", "onFocus", "name", "ariaLabel", "ariaRequired", "controlId", "invalid", "warning", "openCalendarAriaLabel", "expandToViewport", "granularity"]);
|
|
31
31
|
const { __internalRootRef } = useBaseComponent('DatePicker', {
|
|
32
32
|
props: { autoFocus, expandToViewport, granularity, readOnly },
|
|
33
33
|
});
|
|
@@ -92,7 +92,7 @@ const DatePicker = React.forwardRef((_a, ref) => {
|
|
|
92
92
|
fireNonCancelableEvent(onChange, e.detail);
|
|
93
93
|
(_a = buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
94
94
|
setIsDropDownOpen(false);
|
|
95
|
-
}, locale: normalizedLocale, startOfWeek: startOfWeek, ariaDescribedby: calendarDescriptionId, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, granularity: granularity, isDateEnabled: isDateEnabled, i18nStrings: Object.assign(Object.assign({}, i18nStrings), { todayAriaLabel: (_b = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.todayAriaLabel) !== null && _b !== void 0 ? _b : todayAriaLabel, nextMonthAriaLabel: (_c = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.nextMonthAriaLabel) !== null && _c !== void 0 ? _c : nextMonthAriaLabel, previousMonthAriaLabel: (_d = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.previousMonthAriaLabel) !== null && _d !== void 0 ? _d : previousMonthAriaLabel }) }),
|
|
95
|
+
}, locale: normalizedLocale, startOfWeek: startOfWeek, ariaDescribedby: calendarDescriptionId, ariaLabel: ariaLabel, ariaLabelledby: ariaLabelledby, granularity: granularity, isDateEnabled: isDateEnabled, dateDisabledReason: dateDisabledReason, i18nStrings: Object.assign(Object.assign({}, i18nStrings), { todayAriaLabel: (_b = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.todayAriaLabel) !== null && _b !== void 0 ? _b : todayAriaLabel, nextMonthAriaLabel: (_c = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.nextMonthAriaLabel) !== null && _c !== void 0 ? _c : nextMonthAriaLabel, previousMonthAriaLabel: (_d = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.previousMonthAriaLabel) !== null && _d !== void 0 ? _d : previousMonthAriaLabel }) }),
|
|
96
96
|
React.createElement(LiveRegion, { id: calendarDescriptionId }, getBaseDateLabel({ date: baseDate, granularity, locale: normalizedLocale })))))))));
|
|
97
97
|
});
|
|
98
98
|
applyDisplayName(DatePicker, 'DatePicker');
|
package/date-picker/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE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,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useCallback, useRef, useState } from 'react';\nimport styles from './styles.css.js';\nimport { DatePickerProps } from './interfaces';\nimport InternalCalendar from '../calendar/internal';\nimport { normalizeLocale } from '../internal/utils/locale';\nimport { InputProps } from '../input/interfaces';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Dropdown from '../internal/components/dropdown';\nimport InternalDateInput from '../date-input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name.js';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker.js';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport FocusLock from '../internal/components/focus-lock';\nimport { parseDate } from '../internal/utils/date-time';\nimport LiveRegion from '../internal/components/live-region';\nimport { useFormFieldContext } from '../contexts/form-field.js';\nimport { useLocale } from '../i18n/context.js';\nimport { getBaseDateLabel, getSelectedDateLabel, isValidFullDate } from './utils';\n\nexport { DatePickerProps };\n\nconst DatePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n todayAriaLabel,\n i18nStrings,\n placeholder = '',\n value = '',\n readOnly = false,\n disabled = false,\n onBlur,\n autoFocus = false,\n onChange,\n onFocus,\n name,\n ariaLabel,\n ariaRequired,\n controlId,\n invalid,\n warning,\n openCalendarAriaLabel,\n expandToViewport,\n granularity = 'day',\n ...restProps\n }: DatePickerProps,\n ref: Ref<DatePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DatePicker', {\n props: { autoFocus, expandToViewport, granularity, readOnly },\n });\n checkControlled('DatePicker', 'value', value, 'onChange', onChange);\n\n const contextLocale = useLocale();\n const normalizedLocale = normalizeLocale('DatePicker', locale || contextLocale);\n\n const baseProps = getBaseProps(restProps);\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n const { ariaLabelledby, ariaDescribedby } = useFormFieldContext(restProps);\n\n const internalInputRef = useRef<HTMLInputElement>(null);\n const buttonRef = useRef<ButtonProps.Ref>(null);\n useForwardFocus(ref, internalInputRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('calender');\n const calendarDescriptionId = useUniqueId('calendar-description-');\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n useFocusTracker({ rootRef, onBlur, onFocus });\n\n const onDropdownCloseHandler = useCallback(() => setIsDropDownOpen(false), [setIsDropDownOpen]);\n\n const onButtonClickHandler = () => {\n if (!isDropDownOpen) {\n setIsDropDownOpen(true);\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape && isDropDownOpen) {\n event.stopPropagation();\n buttonRef.current?.focus();\n setIsDropDownOpen(false);\n }\n };\n\n const onInputChangeHandler: InputProps['onChange'] = event => {\n fireNonCancelableEvent(onChange, { value: event.detail.value });\n };\n\n const onInputBlurHandler: InputProps['onBlur'] = () => {\n if (!isDropDownOpen) {\n setIsDropDownOpen(false);\n }\n };\n\n // Set displayed date to value if defined or to current date otherwise.\n const parsedValue = value && value.length >= 4 ? parseDate(value) : null;\n const baseDate = parsedValue || new Date();\n\n const hasFullValue = isValidFullDate({ date: value, granularity });\n\n const buttonAriaLabel =\n openCalendarAriaLabel &&\n openCalendarAriaLabel(\n hasFullValue && parsedValue\n ? getSelectedDateLabel({ date: parsedValue, granularity, locale: normalizedLocale })\n : null\n );\n\n const trigger = (\n <div className={styles['date-picker-trigger']}>\n <div className={styles['date-picker-input']}>\n <InternalDateInput\n name={name}\n invalid={invalid}\n warning={warning}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n value={value}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onInputChangeHandler}\n onBlur={onInputBlurHandler}\n placeholder={placeholder}\n ref={internalInputRef}\n autoFocus={autoFocus}\n onFocus={onDropdownCloseHandler}\n granularity={granularity}\n />\n </div>\n <div>\n <InternalButton\n iconName=\"calendar\"\n className={styles['open-calendar-button']}\n onClick={onButtonClickHandler}\n ref={buttonRef}\n ariaLabel={buttonAriaLabel}\n disabled={disabled || readOnly}\n formAction=\"none\"\n />\n </div>\n </div>\n );\n\n baseProps.className = clsx(baseProps.className, styles.root, styles['date-picker-container']);\n\n const handleMouseDown = (event: React.MouseEvent) => {\n // prevent currently focused element from losing it\n event.preventDefault();\n };\n\n return (\n <div {...baseProps} ref={mergedRef} onKeyDown={!disabled && !readOnly ? onWrapperKeyDownHandler : undefined}>\n {disabled || readOnly ? (\n trigger\n ) : (\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={onDropdownCloseHandler}\n onMouseDown={handleMouseDown}\n trigger={trigger}\n expandToViewport={expandToViewport}\n scrollable={false}\n dropdownId={dropdownId}\n >\n {isDropDownOpen && (\n <FocusLock className={styles['focus-lock']} autoFocus={true}>\n <div tabIndex={0} className={styles.calendar} role=\"dialog\" aria-modal=\"true\">\n <InternalCalendar\n value={value}\n onChange={e => {\n fireNonCancelableEvent(onChange, e.detail);\n buttonRef?.current?.focus();\n setIsDropDownOpen(false);\n }}\n locale={normalizedLocale}\n startOfWeek={startOfWeek}\n ariaDescribedby={calendarDescriptionId}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n granularity={granularity}\n isDateEnabled={isDateEnabled}\n i18nStrings={{\n ...i18nStrings,\n todayAriaLabel: i18nStrings?.todayAriaLabel ?? todayAriaLabel,\n nextMonthAriaLabel: i18nStrings?.nextMonthAriaLabel ?? nextMonthAriaLabel,\n previousMonthAriaLabel: i18nStrings?.previousMonthAriaLabel ?? previousMonthAriaLabel,\n }}\n />\n <LiveRegion id={calendarDescriptionId}>\n {getBaseDateLabel({ date: baseDate, granularity, locale: normalizedLocale })}\n </LiveRegion>\n </div>\n </FocusLock>\n )}\n </Dropdown>\n )}\n </div>\n );\n }\n);\n\napplyDisplayName(DatePicker, 'DatePicker');\nexport default DatePicker;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,gBAAgB,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,W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EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { Ref, useCallback, useRef, useState } from 'react';\nimport styles from './styles.css.js';\nimport { DatePickerProps } from './interfaces';\nimport InternalCalendar from '../calendar/internal';\nimport { normalizeLocale } from '../internal/utils/locale';\nimport { InputProps } from '../input/interfaces';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Dropdown from '../internal/components/dropdown';\nimport InternalDateInput from '../date-input/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name.js';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { useFocusTracker } from '../internal/hooks/use-focus-tracker.js';\nimport useForwardFocus from '../internal/hooks/forward-focus';\nimport { ButtonProps } from '../button/interfaces';\nimport { InternalButton } from '../button/internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport FocusLock from '../internal/components/focus-lock';\nimport { parseDate } from '../internal/utils/date-time';\nimport LiveRegion from '../internal/components/live-region';\nimport { useFormFieldContext } from '../contexts/form-field.js';\nimport { useLocale } from '../i18n/context.js';\nimport { getBaseDateLabel, getSelectedDateLabel, isValidFullDate } from './utils';\n\nexport { DatePickerProps };\n\nconst DatePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled,\n dateDisabledReason,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n todayAriaLabel,\n i18nStrings,\n placeholder = '',\n value = '',\n readOnly = false,\n disabled = false,\n onBlur,\n autoFocus = false,\n onChange,\n onFocus,\n name,\n ariaLabel,\n ariaRequired,\n controlId,\n invalid,\n warning,\n openCalendarAriaLabel,\n expandToViewport,\n granularity = 'day',\n ...restProps\n }: DatePickerProps,\n ref: Ref<DatePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DatePicker', {\n props: { autoFocus, expandToViewport, granularity, readOnly },\n });\n checkControlled('DatePicker', 'value', value, 'onChange', onChange);\n\n const contextLocale = useLocale();\n const normalizedLocale = normalizeLocale('DatePicker', locale || contextLocale);\n\n const baseProps = getBaseProps(restProps);\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n const { ariaLabelledby, ariaDescribedby } = useFormFieldContext(restProps);\n\n const internalInputRef = useRef<HTMLInputElement>(null);\n const buttonRef = useRef<ButtonProps.Ref>(null);\n useForwardFocus(ref, internalInputRef);\n\n const rootRef = useRef<HTMLDivElement>(null);\n const dropdownId = useUniqueId('calender');\n const calendarDescriptionId = useUniqueId('calendar-description-');\n const mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n useFocusTracker({ rootRef, onBlur, onFocus });\n\n const onDropdownCloseHandler = useCallback(() => setIsDropDownOpen(false), [setIsDropDownOpen]);\n\n const onButtonClickHandler = () => {\n if (!isDropDownOpen) {\n setIsDropDownOpen(true);\n }\n };\n\n const onWrapperKeyDownHandler = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.keyCode === KeyCode.escape && isDropDownOpen) {\n event.stopPropagation();\n buttonRef.current?.focus();\n setIsDropDownOpen(false);\n }\n };\n\n const onInputChangeHandler: InputProps['onChange'] = event => {\n fireNonCancelableEvent(onChange, { value: event.detail.value });\n };\n\n const onInputBlurHandler: InputProps['onBlur'] = () => {\n if (!isDropDownOpen) {\n setIsDropDownOpen(false);\n }\n };\n\n // Set displayed date to value if defined or to current date otherwise.\n const parsedValue = value && value.length >= 4 ? parseDate(value) : null;\n const baseDate = parsedValue || new Date();\n\n const hasFullValue = isValidFullDate({ date: value, granularity });\n\n const buttonAriaLabel =\n openCalendarAriaLabel &&\n openCalendarAriaLabel(\n hasFullValue && parsedValue\n ? getSelectedDateLabel({ date: parsedValue, granularity, locale: normalizedLocale })\n : null\n );\n\n const trigger = (\n <div className={styles['date-picker-trigger']}>\n <div className={styles['date-picker-input']}>\n <InternalDateInput\n name={name}\n invalid={invalid}\n warning={warning}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n value={value}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onInputChangeHandler}\n onBlur={onInputBlurHandler}\n placeholder={placeholder}\n ref={internalInputRef}\n autoFocus={autoFocus}\n onFocus={onDropdownCloseHandler}\n granularity={granularity}\n />\n </div>\n <div>\n <InternalButton\n iconName=\"calendar\"\n className={styles['open-calendar-button']}\n onClick={onButtonClickHandler}\n ref={buttonRef}\n ariaLabel={buttonAriaLabel}\n disabled={disabled || readOnly}\n formAction=\"none\"\n />\n </div>\n </div>\n );\n\n baseProps.className = clsx(baseProps.className, styles.root, styles['date-picker-container']);\n\n const handleMouseDown = (event: React.MouseEvent) => {\n // prevent currently focused element from losing it\n event.preventDefault();\n };\n\n return (\n <div {...baseProps} ref={mergedRef} onKeyDown={!disabled && !readOnly ? onWrapperKeyDownHandler : undefined}>\n {disabled || readOnly ? (\n trigger\n ) : (\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={onDropdownCloseHandler}\n onMouseDown={handleMouseDown}\n trigger={trigger}\n expandToViewport={expandToViewport}\n scrollable={false}\n dropdownId={dropdownId}\n >\n {isDropDownOpen && (\n <FocusLock className={styles['focus-lock']} autoFocus={true}>\n <div tabIndex={0} className={styles.calendar} role=\"dialog\" aria-modal=\"true\">\n <InternalCalendar\n value={value}\n onChange={e => {\n fireNonCancelableEvent(onChange, e.detail);\n buttonRef?.current?.focus();\n setIsDropDownOpen(false);\n }}\n locale={normalizedLocale}\n startOfWeek={startOfWeek}\n ariaDescribedby={calendarDescriptionId}\n ariaLabel={ariaLabel}\n ariaLabelledby={ariaLabelledby}\n granularity={granularity}\n isDateEnabled={isDateEnabled}\n dateDisabledReason={dateDisabledReason}\n i18nStrings={{\n ...i18nStrings,\n todayAriaLabel: i18nStrings?.todayAriaLabel ?? todayAriaLabel,\n nextMonthAriaLabel: i18nStrings?.nextMonthAriaLabel ?? nextMonthAriaLabel,\n previousMonthAriaLabel: i18nStrings?.previousMonthAriaLabel ?? previousMonthAriaLabel,\n }}\n />\n <LiveRegion id={calendarDescriptionId}>\n {getBaseDateLabel({ date: baseDate, granularity, locale: normalizedLocale })}\n </LiveRegion>\n </div>\n </FocusLock>\n )}\n </Dropdown>\n )}\n </div>\n );\n }\n);\n\napplyDisplayName(DatePicker, 'DatePicker');\nexport default DatePicker;\n"]}
|
|
@@ -26,11 +26,12 @@ export interface GridProps {
|
|
|
26
26
|
onGridKeyDownHandler: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
27
27
|
onFocusedDateChange: React.Dispatch<React.SetStateAction<Date | null>>;
|
|
28
28
|
isDateEnabled: DateRangePickerProps.IsDateEnabledFunction;
|
|
29
|
+
dateDisabledReason: DateRangePickerProps.DateDisabledReasonFunction;
|
|
29
30
|
locale: string;
|
|
30
31
|
startOfWeek: DayIndex;
|
|
31
32
|
todayAriaLabel?: string;
|
|
32
33
|
ariaLabelledby: string;
|
|
33
34
|
className?: string;
|
|
34
35
|
}
|
|
35
|
-
export declare function Grid({ baseDate, selectedStartDate, selectedEndDate, rangeStartDate, rangeEndDate, focusedDate, focusedDateRef, onSelectDate, onGridKeyDownHandler, onFocusedDateChange, isDateEnabled, locale, startOfWeek, todayAriaLabel, ariaLabelledby, className, }: GridProps): JSX.Element;
|
|
36
|
+
export declare function Grid({ baseDate, selectedStartDate, selectedEndDate, rangeStartDate, rangeEndDate, focusedDate, focusedDateRef, onSelectDate, onGridKeyDownHandler, onFocusedDateChange, isDateEnabled, dateDisabledReason, locale, startOfWeek, todayAriaLabel, ariaLabelledby, className, }: GridProps): JSX.Element;
|
|
36
37
|
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../src/date-range-picker/calendar/grids/grid.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../src/date-range-picker/calendar/grids/grid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAcvF,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAUlE;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,IAAI,CAAC;IACf,iBAAiB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,IAAI,GAAG,IAAI,CAAC;IAE7B,cAAc,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,IAAI,GAAG,IAAI,CAAC;IAE1B,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;IAEtD,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,oBAAoB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACpE,mBAAmB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC;IAEvE,aAAa,EAAE,oBAAoB,CAAC,qBAAqB,CAAC;IAC1D,kBAAkB,EAAE,oBAAoB,CAAC,0BAA0B,CAAC;IAEpE,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,QAAQ,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsED,wBAAgB,IAA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