@cloudscape-design/components-themeable 3.0.52 → 3.0.55
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/lib/internal/scss/collection-preferences/visible-content.scss +0 -1
- package/lib/internal/scss/date-input/styles.scss +8 -0
- package/lib/internal/scss/property-filter/styles.scss +39 -13
- package/lib/internal/template/collection-preferences/styles.css.js +19 -19
- package/lib/internal/template/collection-preferences/styles.scoped.css +20 -21
- package/lib/internal/template/collection-preferences/styles.selectors.js +19 -19
- package/lib/internal/template/{internal/components/date-input → date-input}/index.d.ts +1 -1
- package/lib/internal/template/date-input/index.d.ts.map +1 -0
- package/lib/internal/template/date-input/index.js +15 -0
- package/lib/internal/template/date-input/index.js.map +1 -0
- package/lib/internal/template/date-input/interfaces.d.ts +9 -0
- package/lib/internal/template/date-input/interfaces.d.ts.map +1 -0
- package/lib/internal/template/date-input/interfaces.js +4 -0
- package/lib/internal/template/date-input/interfaces.js.map +1 -0
- package/lib/internal/template/date-input/internal.d.ts +6 -0
- package/lib/internal/template/date-input/internal.d.ts.map +1 -0
- package/lib/internal/template/date-input/internal.js +30 -0
- package/lib/internal/template/date-input/internal.js.map +1 -0
- package/lib/internal/template/date-input/styles.css.js +6 -0
- package/lib/internal/template/date-input/styles.scoped.css +7 -0
- package/lib/internal/template/date-input/styles.selectors.js +7 -0
- package/lib/internal/template/date-picker/index.d.ts.map +1 -1
- package/lib/internal/template/date-picker/index.js +2 -2
- package/lib/internal/template/date-picker/index.js.map +1 -1
- package/lib/internal/template/date-range-picker/calendar/index.js +3 -3
- package/lib/internal/template/date-range-picker/calendar/index.js.map +1 -1
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/property-filter/styles.css.js +30 -27
- package/lib/internal/template/property-filter/styles.scoped.css +59 -34
- package/lib/internal/template/property-filter/styles.selectors.js +30 -27
- package/lib/internal/template/property-filter/token-editor.d.ts.map +1 -1
- package/lib/internal/template/property-filter/token-editor.js +17 -22
- package/lib/internal/template/property-filter/token-editor.js.map +1 -1
- package/lib/internal/template/test-utils/dom/date-input/index.d.ts +4 -0
- package/lib/internal/template/test-utils/dom/date-input/index.js +31 -0
- package/lib/internal/template/test-utils/dom/date-input/index.js.map +1 -0
- package/lib/internal/template/test-utils/selectors/date-input/index.d.ts +4 -0
- package/lib/internal/template/test-utils/selectors/date-input/index.js +31 -0
- package/lib/internal/template/test-utils/selectors/date-input/index.js.map +1 -0
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/internal/template/internal/components/date-input/index.d.ts.map +0 -1
- package/lib/internal/template/internal/components/date-input/index.js +0 -28
- package/lib/internal/template/internal/components/date-input/index.js.map +0 -1
- package/lib/internal/template/internal/components/date-input/interfaces.d.ts +0 -16
- package/lib/internal/template/internal/components/date-input/interfaces.d.ts.map +0 -1
- package/lib/internal/template/internal/components/date-input/interfaces.js +0 -2
- package/lib/internal/template/internal/components/date-input/interfaces.js.map +0 -1
|
@@ -43,23 +43,52 @@
|
|
|
43
43
|
display: flex;
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
justify-content: space-between;
|
|
46
|
-
&-
|
|
47
|
-
display:
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
&-form {
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: max-content minmax(awsui.$space-xl, 1fr) minmax(200px, min-content);
|
|
49
|
+
grid-row-gap: awsui.$space-scaled-l;
|
|
50
|
+
margin-bottom: awsui.$space-scaled-l;
|
|
50
51
|
}
|
|
51
52
|
&-label {
|
|
52
|
-
|
|
53
|
+
max-width: 200px;
|
|
54
|
+
align-self: center;
|
|
55
|
+
&-text {
|
|
56
|
+
@include styles.text-flex-wrapping;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
&-label-property {
|
|
60
|
+
grid-row: 1;
|
|
61
|
+
grid-column: 1;
|
|
62
|
+
}
|
|
63
|
+
&-label-operator {
|
|
64
|
+
grid-row: 2;
|
|
65
|
+
grid-column: 1;
|
|
66
|
+
}
|
|
67
|
+
&-label-value {
|
|
68
|
+
grid-row: 3;
|
|
69
|
+
grid-column: 1;
|
|
70
|
+
}
|
|
71
|
+
&-field-property {
|
|
72
|
+
grid-row: 1;
|
|
73
|
+
grid-column: 3;
|
|
74
|
+
}
|
|
75
|
+
&-field-operator {
|
|
76
|
+
grid-row: 2;
|
|
77
|
+
grid-column: 3;
|
|
53
78
|
}
|
|
54
|
-
&-field {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
margin-left: awsui.$space-xl;
|
|
79
|
+
&-field-value {
|
|
80
|
+
grid-row: 3;
|
|
81
|
+
grid-column: 3;
|
|
58
82
|
}
|
|
59
83
|
&-actions {
|
|
60
84
|
display: flex;
|
|
61
85
|
justify-content: flex-end;
|
|
62
|
-
|
|
86
|
+
padding-top: awsui.$space-s;
|
|
87
|
+
border-top: 1px solid #{awsui.$color-border-dropdown-item-default};
|
|
88
|
+
// The below code cancels horizontal padding of the popover and horizontal margin of the token-editor.
|
|
89
|
+
padding-right: calc(#{awsui.$space-m} + #{awsui.$space-xxs});
|
|
90
|
+
margin-left: calc(-1 * #{awsui.$space-m} + -1 * #{awsui.$space-xxs});
|
|
91
|
+
margin-right: calc(-1 * #{awsui.$space-m} + -1 * #{awsui.$space-xxs});
|
|
63
92
|
}
|
|
64
93
|
&-commit {
|
|
65
94
|
margin-left: awsui.$space-xs;
|
|
@@ -107,9 +136,6 @@
|
|
|
107
136
|
.remove-all,
|
|
108
137
|
.token-label,
|
|
109
138
|
.join-operation,
|
|
110
|
-
.property-selector,
|
|
111
|
-
.operator-selector,
|
|
112
|
-
.value-selector,
|
|
113
139
|
.token-editor-submit {
|
|
114
140
|
/* used in test-utils */
|
|
115
141
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"visible-content": "awsui_visible-
|
|
5
|
-
"visible-content-toggle": "awsui_visible-content-
|
|
6
|
-
"visible-content-groups": "awsui_visible-content-
|
|
7
|
-
"visible-content-group": "awsui_visible-content-
|
|
8
|
-
"visible-content-title": "awsui_visible-content-
|
|
9
|
-
"visible-content-group-label": "awsui_visible-content-group-
|
|
10
|
-
"visible-content-option": "awsui_visible-content-
|
|
11
|
-
"visible-content-option-label": "awsui_visible-content-option-
|
|
12
|
-
"root": "
|
|
13
|
-
"modal-root": "awsui_modal-
|
|
14
|
-
"trigger-button": "awsui_trigger-
|
|
15
|
-
"cancel-button": "awsui_cancel-
|
|
16
|
-
"confirm-button": "awsui_confirm-
|
|
17
|
-
"custom": "
|
|
18
|
-
"second-column-small": "awsui_second-column-
|
|
19
|
-
"wrap-lines": "awsui_wrap-
|
|
20
|
-
"page-size": "awsui_page-
|
|
21
|
-
"page-size-form-field": "awsui_page-size-form-
|
|
22
|
-
"page-size-radio-group": "awsui_page-size-radio-
|
|
4
|
+
"visible-content": "awsui_visible-content_tc96w_mj68r_185",
|
|
5
|
+
"visible-content-toggle": "awsui_visible-content-toggle_tc96w_mj68r_186",
|
|
6
|
+
"visible-content-groups": "awsui_visible-content-groups_tc96w_mj68r_187",
|
|
7
|
+
"visible-content-group": "awsui_visible-content-group_tc96w_mj68r_187",
|
|
8
|
+
"visible-content-title": "awsui_visible-content-title_tc96w_mj68r_192",
|
|
9
|
+
"visible-content-group-label": "awsui_visible-content-group-label_tc96w_mj68r_200",
|
|
10
|
+
"visible-content-option": "awsui_visible-content-option_tc96w_mj68r_206",
|
|
11
|
+
"visible-content-option-label": "awsui_visible-content-option-label_tc96w_mj68r_217",
|
|
12
|
+
"root": "awsui_root_tc96w_mj68r_224",
|
|
13
|
+
"modal-root": "awsui_modal-root_tc96w_mj68r_225",
|
|
14
|
+
"trigger-button": "awsui_trigger-button_tc96w_mj68r_226",
|
|
15
|
+
"cancel-button": "awsui_cancel-button_tc96w_mj68r_227",
|
|
16
|
+
"confirm-button": "awsui_confirm-button_tc96w_mj68r_228",
|
|
17
|
+
"custom": "awsui_custom_tc96w_mj68r_229",
|
|
18
|
+
"second-column-small": "awsui_second-column-small_tc96w_mj68r_233",
|
|
19
|
+
"wrap-lines": "awsui_wrap-lines_tc96w_mj68r_237",
|
|
20
|
+
"page-size": "awsui_page-size_tc96w_mj68r_238",
|
|
21
|
+
"page-size-form-field": "awsui_page-size-form-field_tc96w_mj68r_239",
|
|
22
|
+
"page-size-radio-group": "awsui_page-size-radio-group_tc96w_mj68r_240"
|
|
23
23
|
};
|
|
24
24
|
|
|
@@ -182,14 +182,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
182
182
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
183
183
|
SPDX-License-Identifier: Apache-2.0
|
|
184
184
|
*/
|
|
185
|
-
.awsui_visible-
|
|
186
|
-
.awsui_visible-content-
|
|
187
|
-
.awsui_visible-content-
|
|
188
|
-
.awsui_visible-content-
|
|
185
|
+
.awsui_visible-content_tc96w_mj68r_185:not(#\9),
|
|
186
|
+
.awsui_visible-content-toggle_tc96w_mj68r_186:not(#\9),
|
|
187
|
+
.awsui_visible-content-groups_tc96w_mj68r_187:not(#\9),
|
|
188
|
+
.awsui_visible-content-group_tc96w_mj68r_187:not(#\9) {
|
|
189
189
|
/* used in test-utils */
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
.awsui_visible-content-
|
|
192
|
+
.awsui_visible-content-title_tc96w_mj68r_192:not(#\9) {
|
|
193
193
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
194
194
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
195
195
|
font-weight: var(--font-display-label-weight-tjy9e4, 400);
|
|
@@ -197,47 +197,46 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
197
197
|
margin-bottom: var(--space-scaled-l-t03y3z, 20px);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
.awsui_visible-content-group-
|
|
200
|
+
.awsui_visible-content-group-label_tc96w_mj68r_200:not(#\9) {
|
|
201
201
|
color: var(--color-text-group-label-5rxtyp, #545b64);
|
|
202
202
|
padding-bottom: var(--space-xs-rsr2qu, 8px);
|
|
203
203
|
border-bottom: var(--border-divider-list-width-hacikr, 1px) solid var(--color-border-divider-default-k96bks, #eaeded);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
.awsui_visible-content-
|
|
206
|
+
.awsui_visible-content-option_tc96w_mj68r_206:not(#\9) {
|
|
207
207
|
display: flex;
|
|
208
208
|
flex-wrap: nowrap;
|
|
209
209
|
justify-content: space-between;
|
|
210
210
|
padding: var(--space-xs-rsr2qu, 8px) 0px var(--space-xs-rsr2qu, 8px) var(--space-scaled-l-t03y3z, 20px);
|
|
211
211
|
border-bottom: var(--border-divider-list-width-hacikr, 1px) solid var(--color-border-divider-default-k96bks, #eaeded);
|
|
212
212
|
}
|
|
213
|
-
.awsui_visible-content-
|
|
213
|
+
.awsui_visible-content-option_tc96w_mj68r_206:not(#\9):last-child {
|
|
214
214
|
border-bottom: none;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
.awsui_visible-content-option-
|
|
218
|
-
white-space: nowrap;
|
|
217
|
+
.awsui_visible-content-option-label_tc96w_mj68r_217:not(#\9) {
|
|
219
218
|
overflow: hidden;
|
|
220
219
|
text-overflow: ellipsis;
|
|
221
220
|
padding-right: var(--space-l-4vl6xu, 20px);
|
|
222
221
|
flex-grow: 1;
|
|
223
222
|
}
|
|
224
223
|
|
|
225
|
-
.
|
|
226
|
-
.awsui_modal-
|
|
227
|
-
.awsui_trigger-
|
|
228
|
-
.awsui_cancel-
|
|
229
|
-
.awsui_confirm-
|
|
230
|
-
.
|
|
224
|
+
.awsui_root_tc96w_mj68r_224:not(#\9),
|
|
225
|
+
.awsui_modal-root_tc96w_mj68r_225:not(#\9),
|
|
226
|
+
.awsui_trigger-button_tc96w_mj68r_226:not(#\9),
|
|
227
|
+
.awsui_cancel-button_tc96w_mj68r_227:not(#\9),
|
|
228
|
+
.awsui_confirm-button_tc96w_mj68r_228:not(#\9),
|
|
229
|
+
.awsui_custom_tc96w_mj68r_229:not(#\9) {
|
|
231
230
|
/* used in test-utils */
|
|
232
231
|
}
|
|
233
232
|
|
|
234
|
-
.awsui_second-column-
|
|
233
|
+
.awsui_second-column-small_tc96w_mj68r_233:not(#\9) {
|
|
235
234
|
padding-top: calc(2 * var(--space-scaled-l-t03y3z, 20px));
|
|
236
235
|
}
|
|
237
236
|
|
|
238
|
-
.awsui_wrap-
|
|
239
|
-
.awsui_page-
|
|
240
|
-
.awsui_page-size-form-
|
|
241
|
-
.awsui_page-size-radio-
|
|
237
|
+
.awsui_wrap-lines_tc96w_mj68r_237:not(#\9),
|
|
238
|
+
.awsui_page-size_tc96w_mj68r_238:not(#\9),
|
|
239
|
+
.awsui_page-size-form-field_tc96w_mj68r_239:not(#\9),
|
|
240
|
+
.awsui_page-size-radio-group_tc96w_mj68r_240:not(#\9) {
|
|
242
241
|
/* used in test-utils */
|
|
243
242
|
}
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"visible-content": "awsui_visible-
|
|
6
|
-
"visible-content-toggle": "awsui_visible-content-
|
|
7
|
-
"visible-content-groups": "awsui_visible-content-
|
|
8
|
-
"visible-content-group": "awsui_visible-content-
|
|
9
|
-
"visible-content-title": "awsui_visible-content-
|
|
10
|
-
"visible-content-group-label": "awsui_visible-content-group-
|
|
11
|
-
"visible-content-option": "awsui_visible-content-
|
|
12
|
-
"visible-content-option-label": "awsui_visible-content-option-
|
|
13
|
-
"root": "
|
|
14
|
-
"modal-root": "awsui_modal-
|
|
15
|
-
"trigger-button": "awsui_trigger-
|
|
16
|
-
"cancel-button": "awsui_cancel-
|
|
17
|
-
"confirm-button": "awsui_confirm-
|
|
18
|
-
"custom": "
|
|
19
|
-
"second-column-small": "awsui_second-column-
|
|
20
|
-
"wrap-lines": "awsui_wrap-
|
|
21
|
-
"page-size": "awsui_page-
|
|
22
|
-
"page-size-form-field": "awsui_page-size-form-
|
|
23
|
-
"page-size-radio-group": "awsui_page-size-radio-
|
|
5
|
+
"visible-content": "awsui_visible-content_tc96w_mj68r_185",
|
|
6
|
+
"visible-content-toggle": "awsui_visible-content-toggle_tc96w_mj68r_186",
|
|
7
|
+
"visible-content-groups": "awsui_visible-content-groups_tc96w_mj68r_187",
|
|
8
|
+
"visible-content-group": "awsui_visible-content-group_tc96w_mj68r_187",
|
|
9
|
+
"visible-content-title": "awsui_visible-content-title_tc96w_mj68r_192",
|
|
10
|
+
"visible-content-group-label": "awsui_visible-content-group-label_tc96w_mj68r_200",
|
|
11
|
+
"visible-content-option": "awsui_visible-content-option_tc96w_mj68r_206",
|
|
12
|
+
"visible-content-option-label": "awsui_visible-content-option-label_tc96w_mj68r_217",
|
|
13
|
+
"root": "awsui_root_tc96w_mj68r_224",
|
|
14
|
+
"modal-root": "awsui_modal-root_tc96w_mj68r_225",
|
|
15
|
+
"trigger-button": "awsui_trigger-button_tc96w_mj68r_226",
|
|
16
|
+
"cancel-button": "awsui_cancel-button_tc96w_mj68r_227",
|
|
17
|
+
"confirm-button": "awsui_confirm-button_tc96w_mj68r_228",
|
|
18
|
+
"custom": "awsui_custom_tc96w_mj68r_229",
|
|
19
|
+
"second-column-small": "awsui_second-column-small_tc96w_mj68r_233",
|
|
20
|
+
"wrap-lines": "awsui_wrap-lines_tc96w_mj68r_237",
|
|
21
|
+
"page-size": "awsui_page-size_tc96w_mj68r_238",
|
|
22
|
+
"page-size-form-field": "awsui_page-size-form-field_tc96w_mj68r_239",
|
|
23
|
+
"page-size-radio-group": "awsui_page-size-radio-group_tc96w_mj68r_240"
|
|
24
24
|
};
|
|
25
25
|
|
|
@@ -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<
|
|
4
|
+
declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
5
|
export default DateInput;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-input/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAc,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,QAAA,MAAM,SAAS,yFAYd,CAAC;AAIF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { __assign, __rest } from "tslib";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { applyDisplayName } from '../internal/utils/apply-display-name';
|
|
6
|
+
import useBaseComponent from '../internal/hooks/use-base-component';
|
|
7
|
+
import InternalDateInput from './internal';
|
|
8
|
+
var DateInput = React.forwardRef(function (_a, ref) {
|
|
9
|
+
var _b = _a.disableBrowserAutocorrect, disableBrowserAutocorrect = _b === void 0 ? true : _b, props = __rest(_a, ["disableBrowserAutocorrect"]);
|
|
10
|
+
var baseComponentProps = useBaseComponent('DateInput');
|
|
11
|
+
return (React.createElement(InternalDateInput, __assign({}, props, baseComponentProps, { disableBrowserAutocorrect: disableBrowserAutocorrect, ref: ref })));
|
|
12
|
+
});
|
|
13
|
+
applyDisplayName(DateInput, 'DateInput');
|
|
14
|
+
export default DateInput;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date-input/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAc,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,iBAAiB,MAAM,YAAY,CAAC;AAI3C,IAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,UAAC,EAA8D,EAAE,GAA0B;IAAxF,IAAA,iCAAgC,EAAhC,yBAAyB,mBAAG,IAAI,KAAA,EAAK,KAAK,cAA5C,6BAA8C,CAAF;IAC3C,IAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACzD,OAAO,CACL,oBAAC,iBAAiB,eACZ,KAAK,EACL,kBAAkB,IACtB,yBAAyB,EAAE,yBAAyB,EACpD,GAAG,EAAE,GAAG,IACR,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,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\nimport React, { Ref } from 'react';\n\nimport { DateInputProps } from './interfaces';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport InternalDateInput from './internal';\n\nexport { DateInputProps };\n\nconst DateInput = React.forwardRef(\n ({ disableBrowserAutocorrect = true, ...props }: DateInputProps, ref: Ref<HTMLInputElement>) => {\n const baseComponentProps = useBaseComponent('DateInput');\n return (\n <InternalDateInput\n {...props}\n {...baseComponentProps}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n ref={ref}\n />\n );\n }\n);\n\napplyDisplayName(DateInput, 'DateInput');\n\nexport default DateInput;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseInputProps, InputProps } from '../input/interfaces';
|
|
2
|
+
import { BaseComponentProps } from '../internal/base-component';
|
|
3
|
+
import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
|
|
4
|
+
export interface DateInputProps extends BaseInputProps, FormFieldValidationControlProps, BaseComponentProps {
|
|
5
|
+
}
|
|
6
|
+
export declare namespace DateInputProps {
|
|
7
|
+
type Ref = InputProps.Ref;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +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;CAAG;AAE9G,yBAAiB,cAAc,CAAC;IAC9B,KAAY,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;CAClC"}
|
|
@@ -0,0 +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\nexport namespace DateInputProps {\n export type Ref = InputProps.Ref;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateInputProps } from './interfaces';
|
|
3
|
+
import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
|
|
4
|
+
declare const InternalDateInput: React.ForwardRefExoticComponent<DateInputProps & InternalBaseComponentProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export default InternalDateInput;
|
|
6
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAc,MAAM,OAAO,CAAC;AAQnC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAoBlF,QAAA,MAAM,iBAAiB,sHAqBtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { __assign, __rest } from "tslib";
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { getDaysInMonth } from 'date-fns';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { fireNonCancelableEvent } from '../internal/events';
|
|
8
|
+
import { displayToIso, isoToDisplay, parseDate } from '../internal/utils/date-time';
|
|
9
|
+
import MaskedInput from '../internal/components/masked-input';
|
|
10
|
+
import styles from './styles.css.js';
|
|
11
|
+
function daysMax(value) {
|
|
12
|
+
// force to first day in month, as new Date('2018-02-30') -> March 2nd 2018
|
|
13
|
+
var baseDate = displayToIso(value).substring(0, 7);
|
|
14
|
+
return getDaysInMonth(parseDate(baseDate));
|
|
15
|
+
}
|
|
16
|
+
var maskArgs = {
|
|
17
|
+
separator: '/',
|
|
18
|
+
inputSeparators: ['-', '.', ' '],
|
|
19
|
+
segments: [
|
|
20
|
+
{ min: 0, max: 9999, "default": 2000, length: 4 },
|
|
21
|
+
{ min: 1, max: 12, length: 2 },
|
|
22
|
+
{ min: 1, max: daysMax, length: 2 },
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
var InternalDateInput = React.forwardRef(function (_a, ref) {
|
|
26
|
+
var value = _a.value, onChange = _a.onChange, _b = _a.disableBrowserAutocorrect, disableBrowserAutocorrect = _b === void 0 ? true : _b, _c = _a.__internalRootRef, __internalRootRef = _c === void 0 ? null : _c, props = __rest(_a, ["value", "onChange", "disableBrowserAutocorrect", "__internalRootRef"]);
|
|
27
|
+
return (React.createElement(MaskedInput, __assign({ ref: ref }, props, { value: isoToDisplay(value), onChange: function (event) { return fireNonCancelableEvent(onChange, { value: displayToIso(event.detail.value) }); }, className: clsx(styles.root, props.className), mask: maskArgs, autofix: true, autoComplete: false, disableAutocompleteOnBlur: false, disableBrowserAutocorrect: disableBrowserAutocorrect, __internalRootRef: __internalRootRef })));
|
|
28
|
+
});
|
|
29
|
+
export default InternalDateInput;
|
|
30
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/date-input/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAc,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAG9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,SAAS,OAAO,CAAC,KAAa;IAC5B,2EAA2E;IAC3E,IAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC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yB,EAAE,yBAAyB,EACpD,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 clsx from 'clsx';\nimport { getDaysInMonth } from 'date-fns';\nimport React, { Ref } from 'react';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { displayToIso, isoToDisplay, parseDate } from '../internal/utils/date-time';\n\nimport MaskedInput from '../internal/components/masked-input';\nimport { MaskArgs } from '../internal/components/masked-input/utils/mask-format';\n\nimport styles from './styles.css.js';\nimport { DateInputProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\ntype InternalDateInputProps = DateInputProps & InternalBaseComponentProps;\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 maskArgs: MaskArgs = {\n separator: '/',\n inputSeparators: ['-', '.', ' '],\n segments: [\n { min: 0, max: 9999, default: 2000, length: 4 },\n { min: 1, max: 12, length: 2 },\n { min: 1, max: daysMax, length: 2 },\n ],\n};\n\nconst InternalDateInput = React.forwardRef(\n (\n { value, onChange, disableBrowserAutocorrect = true, __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={maskArgs}\n autofix={true}\n autoComplete={false}\n disableAutocompleteOnBlur={false}\n disableBrowserAutocorrect={disableBrowserAutocorrect}\n __internalRootRef={__internalRootRef}\n />\n );\n }\n);\n\nexport default InternalDateInput;\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;AAsB/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;AAsB/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FA8Jf,CAAC;AAGF,eAAe,UAAU,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { memoizedDate } from './calendar/utils/memoized-date';
|
|
|
11
11
|
import { KeyCode } from '../internal/keycode';
|
|
12
12
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
13
13
|
import Dropdown from '../internal/components/dropdown';
|
|
14
|
-
import
|
|
14
|
+
import InternalDateInput from '../date-input/internal';
|
|
15
15
|
import { getBaseProps } from '../internal/base-component';
|
|
16
16
|
import { applyDisplayName } from '../internal/utils/apply-display-name.js';
|
|
17
17
|
import checkControlled from '../internal/hooks/check-controlled';
|
|
@@ -60,7 +60,7 @@ var DatePicker = React.forwardRef(function (_a, ref) {
|
|
|
60
60
|
var memoizedValue = memoizedDate('value', value);
|
|
61
61
|
var DateInputElement = (React.createElement("div", { className: styles['date-picker-trigger'] },
|
|
62
62
|
React.createElement("div", { className: styles['date-picker-input'] },
|
|
63
|
-
React.createElement(
|
|
63
|
+
React.createElement(InternalDateInput, { name: name, invalid: invalid, controlId: controlId, ariaLabelledby: ariaLabelledby, ariaDescribedby: ariaDescribedby, ariaLabel: ariaLabel, ariaRequired: ariaRequired, value: value, disabled: disabled, readOnly: readOnly, onChange: onInputChangeHandler, onBlur: onInputBlurHandler, placeholder: placeholder, ref: internalInputRef, autoFocus: autoFocus })),
|
|
64
64
|
React.createElement("div", null,
|
|
65
65
|
React.createElement(InternalButton, { iconName: "calendar", className: styles['open-calendar-button'], onClick: onButtonClickHandler, ref: buttonRef, ariaLabel: openCalendarAriaLabel &&
|
|
66
66
|
openCalendarAriaLabel(value.length === 10 ? getDateLabel(normalizedLocale, memoizedValue) : null), disabled: disabled || readOnly, formAction: "none" }))));
|
|
@@ -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,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,QAAQ,MAAM,iCAAiC,CAAC;AACvD,OAAO,SAAS,MAAM,mCAAmC,CAAC;AAC1D,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,M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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 Calendar from './calendar';\nimport { normalizeLocale } from './calendar/utils/locales';\nimport { getDateLabel } from './calendar/utils/intl';\nimport { memoizedDate } from './calendar/utils/memoized-date';\nimport { InputProps } from '../input/interfaces';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport Dropdown from '../internal/components/dropdown';\nimport DateInput from '../internal/components/date-input';\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';\n\nexport { DatePickerProps };\n\nconst DatePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n todayAriaLabel,\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 ariaLabelledby,\n ariaDescribedby,\n controlId,\n invalid,\n openCalendarAriaLabel,\n expandToViewport,\n ...rest\n }: DatePickerProps,\n ref: Ref<DatePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DatePicker');\n checkControlled('DatePicker', 'value', value, 'onChange', onChange);\n\n const baseProps = getBaseProps(rest);\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n const normalizedLocale = normalizeLocale('DatePicker', locale);\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 mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n useFocusTracker({ rootRef, onBlur, onFocus, viewportId: expandToViewport ? dropdownId : '' });\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 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 const memoizedValue = memoizedDate('value', value);\n\n const DateInputElement = (\n <div className={styles['date-picker-trigger']}>\n <div className={styles['date-picker-input']}>\n <DateInput\n name={name}\n invalid={invalid}\n controlId={controlId}\n ariaLabelledby={ariaLabelledby}\n ariaDescribedby={ariaDescribedby}\n ariaLabel={ariaLabel}\n ariaRequired={ariaRequired}\n value={value}\n autoComplete={false}\n disableBrowserAutocorrect={true}\n disableAutocompleteOnBlur={isDropDownOpen}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onInputChangeHandler}\n onBlur={onInputBlurHandler}\n placeholder={placeholder}\n ref={internalInputRef}\n autoFocus={autoFocus}\n />\n </div>\n <div>\n <InternalButton\n iconName=\"calendar\"\n className={styles['open-calendar-button']}\n onClick={onButtonClickHandler}\n ref={buttonRef}\n ariaLabel={\n openCalendarAriaLabel &&\n openCalendarAriaLabel(value.length === 10 ? getDateLabel(normalizedLocale, memoizedValue!) : null)\n }\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 if (readOnly || disabled) {\n return <div {...baseProps}>{DateInputElement}</div>;\n }\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={onWrapperKeyDownHandler}>\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={onDropdownCloseHandler}\n onMouseDown={handleMouseDown}\n trigger={DateInputElement}\n expandToViewport={expandToViewport}\n scrollable={false}\n dropdownId={dropdownId}\n >\n {isDropDownOpen && (\n <FocusLock autoFocus={true}>\n <Calendar\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 isDateEnabled={isDateEnabled}\n todayAriaLabel={todayAriaLabel}\n nextMonthAriaLabel={nextMonthAriaLabel}\n previousMonthAriaLabel={previousMonthAriaLabel}\n />\n </FocusLock>\n )}\n </Dropdown>\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,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,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SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,0CAAE,KAAK,EAAE,CAAC;oBAC5B,iBAAiB,CAAC,KAAK,CAAC,CAAC;gBAC3B,CAAC,EACD,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,kBAAkB,EAAE,kBAAkB,EACtC,sBAAsB,EAAE,sBAAsB,GAC9C,CACQ,CACb,CACQ,CACP,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,UAAU,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 Calendar from './calendar';\nimport { normalizeLocale } from './calendar/utils/locales';\nimport { getDateLabel } from './calendar/utils/intl';\nimport { memoizedDate } from './calendar/utils/memoized-date';\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';\n\nexport { DatePickerProps };\n\nconst DatePicker = React.forwardRef(\n (\n {\n locale = '',\n startOfWeek,\n isDateEnabled,\n nextMonthAriaLabel,\n previousMonthAriaLabel,\n todayAriaLabel,\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 ariaLabelledby,\n ariaDescribedby,\n controlId,\n invalid,\n openCalendarAriaLabel,\n expandToViewport,\n ...rest\n }: DatePickerProps,\n ref: Ref<DatePickerProps.Ref>\n ) => {\n const { __internalRootRef } = useBaseComponent('DatePicker');\n checkControlled('DatePicker', 'value', value, 'onChange', onChange);\n\n const baseProps = getBaseProps(rest);\n const [isDropDownOpen, setIsDropDownOpen] = useState<boolean>(false);\n const normalizedLocale = normalizeLocale('DatePicker', locale);\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 mergedRef = useMergeRefs(rootRef, __internalRootRef);\n\n useFocusTracker({ rootRef, onBlur, onFocus, viewportId: expandToViewport ? dropdownId : '' });\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 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 const memoizedValue = memoizedDate('value', value);\n\n const DateInputElement = (\n <div className={styles['date-picker-trigger']}>\n <div className={styles['date-picker-input']}>\n <InternalDateInput\n name={name}\n invalid={invalid}\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 />\n </div>\n <div>\n <InternalButton\n iconName=\"calendar\"\n className={styles['open-calendar-button']}\n onClick={onButtonClickHandler}\n ref={buttonRef}\n ariaLabel={\n openCalendarAriaLabel &&\n openCalendarAriaLabel(value.length === 10 ? getDateLabel(normalizedLocale, memoizedValue!) : null)\n }\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 if (readOnly || disabled) {\n return <div {...baseProps}>{DateInputElement}</div>;\n }\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={onWrapperKeyDownHandler}>\n <Dropdown\n stretchWidth={true}\n stretchHeight={true}\n open={isDropDownOpen}\n onDropdownClose={onDropdownCloseHandler}\n onMouseDown={handleMouseDown}\n trigger={DateInputElement}\n expandToViewport={expandToViewport}\n scrollable={false}\n dropdownId={dropdownId}\n >\n {isDropDownOpen && (\n <FocusLock autoFocus={true}>\n <Calendar\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 isDateEnabled={isDateEnabled}\n todayAriaLabel={todayAriaLabel}\n nextMonthAriaLabel={nextMonthAriaLabel}\n previousMonthAriaLabel={previousMonthAriaLabel}\n />\n </FocusLock>\n )}\n </Dropdown>\n </div>\n );\n }\n);\n\napplyDisplayName(DatePicker, 'DatePicker');\nexport default DatePicker;\n"]}
|
|
@@ -8,7 +8,7 @@ import { Grids, selectFocusedDate } from './grids';
|
|
|
8
8
|
import moveFocusHandler from '../../date-picker/calendar/utils/move-focus-handler';
|
|
9
9
|
import InternalSpaceBetween from '../../space-between/internal';
|
|
10
10
|
import InternalFormField from '../../form-field/internal';
|
|
11
|
-
import
|
|
11
|
+
import InternalDateInput from '../../date-input/internal';
|
|
12
12
|
import InternalTimeInput from '../../time-input/internal';
|
|
13
13
|
import clsx from 'clsx';
|
|
14
14
|
import { getBaseDate } from './get-base-date.js';
|
|
@@ -206,14 +206,14 @@ function Calendar(_a, ref) {
|
|
|
206
206
|
React.createElement("div", { className: styles['date-and-time-wrapper'] },
|
|
207
207
|
React.createElement("div", { className: styles['date-and-time-wrapper__date'] },
|
|
208
208
|
React.createElement(InternalFormField, { label: i18nStrings.startDateLabel, stretch: true },
|
|
209
|
-
React.createElement(
|
|
209
|
+
React.createElement(InternalDateInput, { value: startDateString, className: styles['start-date-input'], onChange: onChangeStartDate, placeholder: "YYYY/MM/DD", ariaDescribedby: constrainttextId }))),
|
|
210
210
|
!dateOnly && (React.createElement("div", { className: styles['date-and-time-wrapper__time'] },
|
|
211
211
|
React.createElement(InternalFormField, { label: i18nStrings.startTimeLabel, stretch: true },
|
|
212
212
|
React.createElement(InternalTimeInput, { value: startTimeString, onChange: function (e) { return setStartTimeString(e.detail.value); }, format: timeInputFormat, placeholder: timeInputFormat, className: styles['start-time-input'], ariaDescribedby: constrainttextId }))))),
|
|
213
213
|
React.createElement("div", { className: styles['date-and-time-wrapper'] },
|
|
214
214
|
React.createElement("div", { className: styles['date-and-time-wrapper__date'] },
|
|
215
215
|
React.createElement(InternalFormField, { label: i18nStrings.endDateLabel, stretch: true },
|
|
216
|
-
React.createElement(
|
|
216
|
+
React.createElement(InternalDateInput, { value: endDateString, className: styles['end-date-input'], onChange: onChangeEndDate, placeholder: "YYYY/MM/DD", ariaDescribedby: constrainttextId }))),
|
|
217
217
|
!dateOnly && (React.createElement("div", { className: styles['date-and-time-wrapper__time'] },
|
|
218
218
|
React.createElement(InternalFormField, { label: i18nStrings.endTimeLabel, stretch: true },
|
|
219
219
|
React.createElement(InternalTimeInput, { value: endTimeString, onChange: function (e) { return setEndTimeString(e.detail.value); }, format: timeInputFormat, placeholder: timeInputFormat, className: styles['end-time-input'], ariaDescribedby: constrainttextId })))))),
|