xmlui 0.10.18 → 0.10.20
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/dist/lib/{apiInterceptorWorker-DPgtUtdA.mjs → apiInterceptorWorker-QiltRtq1.mjs} +1 -1
- package/dist/lib/{index-Cy6Emsex.mjs → index-Ckhnrf1F.mjs} +1093 -714
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-D0wDKF_I.mjs → lib/initMock-qnCFw6Zc.mjs} +25 -15
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-CtY0QcvH.mjs → metadata-utils-BTIt1_wE.mjs} +1 -1
- package/dist/lib/{server-common-Cine5nRR.mjs → server-common-DYZtsdM7.mjs} +51 -14
- package/dist/lib/{transform-bHBjkKSL.mjs → transform-Tooy42EB.mjs} +16 -18
- package/dist/lib/xmlui-parser.mjs +2 -2
- package/dist/lib/{xmlui-serializer-DB6BLiXK.mjs → xmlui-serializer-uCYa8_tZ.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +11 -3
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{apiInterceptorWorker-BmKP8bnq.mjs → apiInterceptorWorker-Dql7QGw2.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-CB63ngkU.mjs → collectedComponentMetadata-Dg7P-zOz.mjs} +1071 -701
- package/dist/{lib/initMock-B-rmnC-t.mjs → metadata/initMock-ZyyFNOpL.mjs} +25 -15
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Animation/AnimationNative.js +28 -28
- package/dist/scripts/src/components/App/App.spec.js +17 -17
- package/dist/scripts/src/components/AppState/AppState.js +3 -2
- package/dist/scripts/src/components/AppState/AppState.spec.js +26 -2
- package/dist/scripts/src/components/AppState/AppStateNative.js +3 -4
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +15 -10
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +25 -4
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +4 -4
- package/dist/scripts/src/components/Carousel/Carousel.spec.js +214 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +5 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +193 -0
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +28 -23
- package/dist/scripts/src/components/DatePicker/DatePicker.js +14 -9
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +21 -18
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +24 -21
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +3 -3
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +7 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +4 -13
- package/dist/scripts/src/components/Form/Form.spec.js +25 -9
- package/dist/scripts/src/components/Form/FormNative.js +7 -4
- package/dist/scripts/src/components/FormItem/FormItem.js +3 -1
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +5 -14
- package/dist/scripts/src/components/FormItem/FormItemNative.js +12 -8
- package/dist/scripts/src/components/FormItem/Validations.js +2 -2
- package/dist/scripts/src/components/Icon/Icon.js +1 -1
- package/dist/scripts/src/components/IconRegistryContext.js +1 -1
- package/dist/scripts/src/components/List/ListNative.js +2 -2
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +3 -12
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +2 -2
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +6 -3
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +3 -3
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +7 -2
- package/dist/scripts/src/components/Pagination/Pagination.spec.js +5 -0
- package/dist/scripts/src/components/Pagination/PaginationNative.js +1 -3
- package/dist/scripts/src/components/Queue/Queue.spec.js +45 -47
- package/dist/scripts/src/components/Queue/QueueNative.js +1 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +14 -5
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +1 -1
- package/dist/scripts/src/components/Select/MultiSelectOption.js +42 -0
- package/dist/scripts/src/components/Select/Select.js +3 -3
- package/dist/scripts/src/components/Select/Select.spec.js +286 -217
- package/dist/scripts/src/components/Select/SelectContext.js +8 -1
- package/dist/scripts/src/components/Select/SelectNative.js +134 -142
- package/dist/scripts/src/components/Select/SelectOption.js +34 -0
- package/dist/scripts/src/components/Select/SimpleSelect.js +57 -0
- package/dist/scripts/src/components/Slider/Slider.spec.js +7 -0
- package/dist/scripts/src/components/Spinner/Spinner.spec.js +1 -1
- package/dist/scripts/src/components/Switch/Switch.spec.js +24 -17
- package/dist/scripts/src/components/Table/Table.js +11 -1
- package/dist/scripts/src/components/Table/Table.spec.js +272 -0
- package/dist/scripts/src/components/Table/TableNative.js +162 -5
- package/dist/scripts/src/components/Table/useRowSelection.js +14 -23
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +59 -8
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +7 -0
- package/dist/scripts/src/components/Theme/Theme.js +2 -1
- package/dist/scripts/src/components/Theme/Theme.spec.js +266 -0
- package/dist/scripts/src/components/Theme/ThemeNative.js +8 -1
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +47 -40
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +6 -20
- package/dist/scripts/src/components/Toggle/Toggle.js +3 -1
- package/dist/scripts/src/components/Tree/TreeNative.js +9 -11
- package/dist/scripts/src/components-core/InspectorContext.js +1 -1
- package/dist/scripts/src/components-core/StandaloneApp.js +6 -8
- package/dist/scripts/src/components-core/action/FileUploadAction.js +1 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +50 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +6 -1
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +9 -11
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +3 -3
- package/dist/scripts/src/components-core/interception/Backend.js +1 -1
- package/dist/scripts/src/components-core/interception/IndexedDb.js +64 -66
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +2 -2
- package/dist/scripts/src/components-core/loader/DataLoader.js +6 -14
- package/dist/scripts/src/components-core/loader/Loader.js +11 -11
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +4 -2
- package/dist/scripts/src/components-core/loader/PageableLoader.js +10 -9
- package/dist/scripts/src/components-core/rendering/AppContent.js +1 -7
- package/dist/scripts/src/components-core/rendering/ErrorBoundary.js +1 -1
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +1 -1
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +180 -186
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +6 -6
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +2 -2
- package/dist/scripts/src/components-core/utils/actionUtils.js +1 -1
- package/dist/scripts/src/components-core/utils/hooks.js +1 -1
- package/dist/scripts/src/components-core/utils/misc.js +4 -4
- package/dist/scripts/src/components-core/xmlui-parser.js +47 -31
- package/dist/scripts/src/language-server/server-common.js +25 -24
- package/dist/scripts/src/language-server/services/common/lsp-utils.js +2 -2
- package/dist/scripts/src/language-server/services/completion.js +20 -2
- package/dist/scripts/src/language-server/services/diagnostic.js +1 -1
- package/dist/scripts/src/language-server/services/hover.js +2 -2
- package/dist/scripts/src/parsers/common/utils.js +2 -2
- package/dist/scripts/src/parsers/scripting/Lexer.js +21 -15
- package/dist/scripts/src/parsers/scripting/Parser.js +8 -9
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +22 -22
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +70 -68
- package/dist/scripts/src/testing/ComponentDrivers.js +20 -39
- package/dist/scripts/src/testing/component-test-helpers.js +34 -50
- package/dist/scripts/src/testing/fixtures.js +114 -113
- package/dist/scripts/src/testing/themed-app-test-helpers.js +7 -13
- package/dist/standalone/xmlui-standalone.es.d.ts +11 -3
- package/dist/standalone/xmlui-standalone.umd.js +34 -34
- package/package.json +1 -1
|
@@ -179,7 +179,7 @@ fixtures_1.test.describe("initialValue property", () => {
|
|
|
179
179
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
180
180
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
181
181
|
}));
|
|
182
|
-
(0, fixtures_1.test)("handles numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
182
|
+
(0, fixtures_1.test)("handles numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
183
183
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{123456789}" />`);
|
|
184
184
|
const driver = yield createDateInputDriver("dateInput");
|
|
185
185
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
@@ -193,14 +193,14 @@ fixtures_1.test.describe("initialValue property", () => {
|
|
|
193
193
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
194
194
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
195
195
|
}));
|
|
196
|
-
(0, fixtures_1.test)("handles boolean initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
196
|
+
(0, fixtures_1.test)("handles boolean initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
197
197
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{true}" />`);
|
|
198
198
|
const driver = yield createDateInputDriver("dateInput");
|
|
199
199
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
200
200
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
201
201
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
202
202
|
}));
|
|
203
|
-
(0, fixtures_1.test)("handles false boolean initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
203
|
+
(0, fixtures_1.test)("handles false boolean initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
204
204
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{false}" />`);
|
|
205
205
|
const driver = yield createDateInputDriver("dateInput");
|
|
206
206
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
@@ -214,28 +214,28 @@ fixtures_1.test.describe("initialValue property", () => {
|
|
|
214
214
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
215
215
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
216
216
|
}));
|
|
217
|
-
(0, fixtures_1.test)("handles function initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
217
|
+
(0, fixtures_1.test)("handles function initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
218
218
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{() => '2024-01-01'}" />`);
|
|
219
219
|
const driver = yield createDateInputDriver("dateInput");
|
|
220
220
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
221
221
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
222
222
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
223
223
|
}));
|
|
224
|
-
(0, fixtures_1.test)("handles zero numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
224
|
+
(0, fixtures_1.test)("handles zero numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
225
225
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{0}" />`);
|
|
226
226
|
const driver = yield createDateInputDriver("dateInput");
|
|
227
227
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
228
228
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
229
229
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
230
230
|
}));
|
|
231
|
-
(0, fixtures_1.test)("handles negative numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
231
|
+
(0, fixtures_1.test)("handles negative numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
232
232
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{-123}" />`);
|
|
233
233
|
const driver = yield createDateInputDriver("dateInput");
|
|
234
234
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
235
235
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
236
236
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
237
237
|
}));
|
|
238
|
-
(0, fixtures_1.test)("handles float numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
238
|
+
(0, fixtures_1.test)("handles float numeric initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
239
239
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{123.456}" />`);
|
|
240
240
|
const driver = yield createDateInputDriver("dateInput");
|
|
241
241
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
@@ -249,21 +249,21 @@ fixtures_1.test.describe("initialValue property", () => {
|
|
|
249
249
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
250
250
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
251
251
|
}));
|
|
252
|
-
(0, fixtures_1.test)("handles Infinity initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
252
|
+
(0, fixtures_1.test)("handles Infinity initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
253
253
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{Infinity}" />`);
|
|
254
254
|
const driver = yield createDateInputDriver("dateInput");
|
|
255
255
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
256
256
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
257
257
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
258
258
|
}));
|
|
259
|
-
(0, fixtures_1.test)("handles Date object initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
259
|
+
(0, fixtures_1.test)("handles Date object initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
260
260
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{Date.now()}" />`);
|
|
261
261
|
const driver = yield createDateInputDriver("dateInput");
|
|
262
262
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
263
263
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
264
264
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("");
|
|
265
265
|
}));
|
|
266
|
-
(0, fixtures_1.test)("handles complex object initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
266
|
+
(0, fixtures_1.test)("handles complex object initialValue gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
267
267
|
yield initTestBed(`<DateInput testId="dateInput" initialValue="{{year: 2024, month: 5, day: 25}}" />`);
|
|
268
268
|
const driver = yield createDateInputDriver("dateInput");
|
|
269
269
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
@@ -492,7 +492,7 @@ fixtures_1.test.describe("User Interactions", () => {
|
|
|
492
492
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("05");
|
|
493
493
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("25");
|
|
494
494
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("2024");
|
|
495
|
-
driver.dayInput.fill("18");
|
|
495
|
+
yield driver.dayInput.fill("18");
|
|
496
496
|
yield driver.clearButton.click();
|
|
497
497
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("05");
|
|
498
498
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("25");
|
|
@@ -504,7 +504,7 @@ fixtures_1.test.describe("User Interactions", () => {
|
|
|
504
504
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("05");
|
|
505
505
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("25");
|
|
506
506
|
yield (0, fixtures_1.expect)(driver.yearInput).toHaveValue("2024");
|
|
507
|
-
driver.dayInput.fill("18");
|
|
507
|
+
yield driver.dayInput.fill("18");
|
|
508
508
|
yield driver.clearButton.click();
|
|
509
509
|
yield (0, fixtures_1.expect)(driver.monthInput).toHaveValue("");
|
|
510
510
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveValue("");
|
|
@@ -548,6 +548,11 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
548
548
|
yield driver.dayInput.focus();
|
|
549
549
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
550
550
|
}));
|
|
551
|
+
(0, fixtures_1.test)("fires gotFocus event when label receives focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
552
|
+
const { testStateDriver } = yield initTestBed(`<DateInput testId="dateInput" onGotFocus="testState = 'focused'" label="test" />`);
|
|
553
|
+
yield page.getByText("test").click();
|
|
554
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
555
|
+
}));
|
|
551
556
|
(0, fixtures_1.test)("fires lostFocus event when input loses focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, page, }) {
|
|
552
557
|
const { testStateDriver } = yield initTestBed(`<DateInput testId="dateInput" onLostFocus="testState = 'blurred'" />`);
|
|
553
558
|
const driver = yield createDateInputDriver("dateInput");
|
|
@@ -557,7 +562,7 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
557
562
|
yield page.keyboard.press("Tab"); // Move focus away from all inputs
|
|
558
563
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("blurred");
|
|
559
564
|
}));
|
|
560
|
-
(0, fixtures_1.test)("preserves field values when date combination becomes invalid", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, page }) {
|
|
565
|
+
(0, fixtures_1.test)("preserves field values when date combination becomes invalid", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, page, }) {
|
|
561
566
|
yield initTestBed(`<DateInput testId="dateInput" dateFormat="MM/dd/yyyy" initialValue="01/30/2024" />`);
|
|
562
567
|
const driver = yield createDateInputDriver("dateInput");
|
|
563
568
|
// Verify initial state
|
|
@@ -576,7 +581,7 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
576
581
|
// The day field should also be marked as invalid visually
|
|
577
582
|
yield (0, fixtures_1.expect)(driver.dayInput).toHaveClass(/invalid/);
|
|
578
583
|
}));
|
|
579
|
-
(0, fixtures_1.test)("does not clear all fields when invalid date is entered", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, page }) {
|
|
584
|
+
(0, fixtures_1.test)("does not clear all fields when invalid date is entered", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, page, }) {
|
|
580
585
|
yield initTestBed(`<DateInput testId="dateInput" dateFormat="MM/dd/yyyy" />`);
|
|
581
586
|
const driver = yield createDateInputDriver("dateInput");
|
|
582
587
|
// Create a scenario where the complete date would be invalid
|
|
@@ -665,7 +670,7 @@ fixtures_1.test.describe("API Methods", () => {
|
|
|
665
670
|
yield page.getByTestId("getIsoBtn").click();
|
|
666
671
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("2024-05-25");
|
|
667
672
|
}));
|
|
668
|
-
(0, fixtures_1.test)("isoValue() method handles different date formats correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
673
|
+
(0, fixtures_1.test)("isoValue() method handles different date formats correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
669
674
|
const { testStateDriver } = yield initTestBed(`
|
|
670
675
|
<Fragment>
|
|
671
676
|
<DateInput id="dateInput" dateFormat="dd/MM/yyyy" initialValue="25/05/2024" />
|
|
@@ -675,7 +680,7 @@ fixtures_1.test.describe("API Methods", () => {
|
|
|
675
680
|
yield page.getByTestId("getIsoBtn").click();
|
|
676
681
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("2024-05-25");
|
|
677
682
|
}));
|
|
678
|
-
(0, fixtures_1.test)("isoValue() method returns null for incomplete date", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createDateInputDriver }) {
|
|
683
|
+
(0, fixtures_1.test)("isoValue() method returns null for incomplete date", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createDateInputDriver, }) {
|
|
679
684
|
const { testStateDriver } = yield initTestBed(`
|
|
680
685
|
<Fragment>
|
|
681
686
|
<DateInput id="dateInput" testId="dateInput" />
|
|
@@ -689,7 +694,7 @@ fixtures_1.test.describe("API Methods", () => {
|
|
|
689
694
|
yield page.getByTestId("getIsoBtn").click();
|
|
690
695
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(null);
|
|
691
696
|
}));
|
|
692
|
-
(0, fixtures_1.test)("isoValue() method returns null for invalid date", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createDateInputDriver }) {
|
|
697
|
+
(0, fixtures_1.test)("isoValue() method returns null for invalid date", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createDateInputDriver, }) {
|
|
693
698
|
const { testStateDriver } = yield initTestBed(`
|
|
694
699
|
<Fragment>
|
|
695
700
|
<DateInput id="dateInput" testId="dateInput" />
|
|
@@ -704,7 +709,7 @@ fixtures_1.test.describe("API Methods", () => {
|
|
|
704
709
|
yield page.getByTestId("getIsoBtn").click();
|
|
705
710
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(null);
|
|
706
711
|
}));
|
|
707
|
-
(0, fixtures_1.test)("isoValue() method updates when date is changed programmatically", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
712
|
+
(0, fixtures_1.test)("isoValue() method updates when date is changed programmatically", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
708
713
|
const { testStateDriver } = yield initTestBed(`
|
|
709
714
|
<Fragment>
|
|
710
715
|
<DateInput id="dateInput" initialValue="05/25/2024" />
|
|
@@ -800,8 +805,8 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
800
805
|
fixtures_1.test.describe("Theme Variables", () => {
|
|
801
806
|
(0, fixtures_1.test)("component renders with theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
802
807
|
yield initTestBed(`
|
|
803
|
-
<DateInput
|
|
804
|
-
testId="dateInput"
|
|
808
|
+
<DateInput
|
|
809
|
+
testId="dateInput"
|
|
805
810
|
style="--color-divider: red; --width-input: 100px; --backgroundColor-input-invalid: rgb(255, 200, 200);"
|
|
806
811
|
/>
|
|
807
812
|
`);
|
|
@@ -811,10 +816,10 @@ fixtures_1.test.describe("Theme Variables", () => {
|
|
|
811
816
|
yield (0, fixtures_1.expect)(driver.monthInput).toBeVisible();
|
|
812
817
|
yield (0, fixtures_1.expect)(driver.yearInput).toBeVisible();
|
|
813
818
|
}));
|
|
814
|
-
(0, fixtures_1.test)("component renders with clearable and theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver }) {
|
|
819
|
+
(0, fixtures_1.test)("component renders with clearable and theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDateInputDriver, }) {
|
|
815
820
|
yield initTestBed(`
|
|
816
|
-
<DateInput
|
|
817
|
-
testId="dateInput"
|
|
821
|
+
<DateInput
|
|
822
|
+
testId="dateInput"
|
|
818
823
|
clearable="{true}"
|
|
819
824
|
style="--padding-button: 15px; --outlineColor-button--focused: green;"
|
|
820
825
|
/>
|
|
@@ -76,22 +76,27 @@ exports.DatePickerMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
76
76
|
},
|
|
77
77
|
],
|
|
78
78
|
},
|
|
79
|
-
|
|
80
|
-
description: "The
|
|
81
|
-
"allows any dates in the past."
|
|
79
|
+
startDate: {
|
|
80
|
+
description: "The earliest month to start the month navigation from (inclusive). " +
|
|
81
|
+
"If not defined, the component allows any dates in the past. " +
|
|
82
|
+
"Accepts the same date format as the `initialValue`." +
|
|
83
|
+
"Example: '2023-01-01' ensures the first month to select a date from is January 2023.",
|
|
82
84
|
valueType: "string",
|
|
83
85
|
},
|
|
84
|
-
|
|
85
|
-
description: "The
|
|
86
|
-
"any future dates."
|
|
86
|
+
endDate: {
|
|
87
|
+
description: "The latest month to start the month navigation from (inclusive). " +
|
|
88
|
+
"If not defined, the component allows any future dates. " +
|
|
89
|
+
"Accepts the same date format as the `initialValue`." +
|
|
90
|
+
"Example: '2023-12-31' ensures the last month to select a date from is December 2023.",
|
|
87
91
|
valueType: "string",
|
|
88
92
|
},
|
|
89
93
|
disabledDates: {
|
|
90
|
-
description: "An optional array of dates that are disabled",
|
|
94
|
+
description: "An optional array of dates that are to be disabled.",
|
|
91
95
|
valueType: "any",
|
|
92
96
|
},
|
|
93
97
|
inline: {
|
|
94
|
-
description: "
|
|
98
|
+
description: "If set to true, the calendar is always visible and its panel is rendered as part of the layout." +
|
|
99
|
+
" If false, the calendar is shown in a popup when the input is focused or clicked.",
|
|
95
100
|
valueType: "boolean",
|
|
96
101
|
defaultValue: DatePickerNative_1.defaultProps.inline,
|
|
97
102
|
},
|
|
@@ -137,5 +142,5 @@ exports.DatePickerMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
137
142
|
});
|
|
138
143
|
exports.datePickerComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.DatePickerMd, ({ node, state, updateState, extractValue, className, lookupEventHandler, registerComponentApi, }) => {
|
|
139
144
|
var _a;
|
|
140
|
-
return ((0, jsx_runtime_1.jsx)(DatePickerNative_1.DatePicker, { className: className, mode: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.mode), value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue(node.props.initialValue), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, dateFormat: extractValue(node.props.dateFormat), showWeekNumber: extractValue.asOptionalBoolean(node.props.showWeekNumber), weekStartsOn: extractValue(node.props.weekStartsOn),
|
|
145
|
+
return ((0, jsx_runtime_1.jsx)(DatePickerNative_1.DatePicker, { className: className, mode: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.mode), value: state === null || state === void 0 ? void 0 : state.value, initialValue: extractValue(node.props.initialValue), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), updateState: updateState, onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, dateFormat: extractValue(node.props.dateFormat), showWeekNumber: extractValue.asOptionalBoolean(node.props.showWeekNumber), weekStartsOn: extractValue(node.props.weekStartsOn), startDate: extractValue(node.props.startDate), endDate: extractValue(node.props.endDate), disabledDates: extractValue(node.props.disabledDates), inline: extractValue.asOptionalBoolean(node.props.inline), startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus) }));
|
|
141
146
|
});
|
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
13
12
|
const fixtures_1 = require("../../testing/fixtures");
|
|
14
13
|
const date_fns_1 = require("date-fns");
|
|
15
14
|
// =============================================================================
|
|
@@ -179,6 +178,13 @@ const date_fns_1 = require("date-fns");
|
|
|
179
178
|
yield page.getByTestId("datePicker").focus();
|
|
180
179
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
|
|
181
180
|
}));
|
|
181
|
+
(0, fixtures_1.test)("component fires proper focus event on label focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
182
|
+
const { testStateDriver } = yield initTestBed(`
|
|
183
|
+
<DatePicker testId="datePicker" onGotFocus="testState = 'focused'" label="test" />
|
|
184
|
+
`);
|
|
185
|
+
yield page.getByText("test").click();
|
|
186
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
|
|
187
|
+
}));
|
|
182
188
|
(0, fixtures_1.test)("component fires proper blur event on lostFocus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
183
189
|
const { testStateDriver } = yield initTestBed(`
|
|
184
190
|
<DatePicker testId="datePicker" onLostFocus="testState = 'blurred'" />
|
|
@@ -278,40 +284,37 @@ const date_fns_1 = require("date-fns");
|
|
|
278
284
|
// The date should not change
|
|
279
285
|
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText(initialDate);
|
|
280
286
|
}));
|
|
281
|
-
fixtures_1.test
|
|
287
|
+
(0, fixtures_1.test)("component handles startDate restrictions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
282
288
|
yield initTestBed(`<DatePicker
|
|
283
289
|
testId="datePicker"
|
|
284
290
|
mode="range"
|
|
285
|
-
|
|
291
|
+
startDate="05/01/2024"
|
|
286
292
|
dateFormat="MM/dd/yyyy"
|
|
287
293
|
initialValue="{{ from: '05/26/2024', to: '05/27/2024' }}"
|
|
288
294
|
/>`);
|
|
289
295
|
yield page.getByTestId("datePicker").click();
|
|
290
|
-
yield page.getByRole(
|
|
291
|
-
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 24th")).toBeDisabled();
|
|
296
|
+
yield (0, fixtures_1.expect)(page.getByRole('button', { name: 'Go to the Previous Month' })).toBeDisabled();
|
|
292
297
|
}));
|
|
293
|
-
fixtures_1.test
|
|
298
|
+
(0, fixtures_1.test)("component handles endDate restrictions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
294
299
|
yield initTestBed(`<DatePicker
|
|
295
300
|
testId="datePicker"
|
|
296
301
|
mode="range"
|
|
297
|
-
|
|
302
|
+
endDate="06/01/2024"
|
|
298
303
|
initialValue="{{ from: '05/26/2024', to: '05/27/2024' }}"
|
|
299
304
|
dateFormat="MM/dd/yyyy"
|
|
300
305
|
/>`);
|
|
301
306
|
yield page.getByTestId("datePicker").click();
|
|
302
|
-
yield page.getByRole(
|
|
303
|
-
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 24th")).toBeDisabled();
|
|
307
|
+
yield (0, fixtures_1.expect)(page.getByRole('button', { name: 'Go to the Next Month' })).toBeDisabled();
|
|
304
308
|
}));
|
|
305
|
-
fixtures_1.test
|
|
309
|
+
(0, fixtures_1.test)("component handles disabledDates correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
310
|
+
const testDay = 15;
|
|
306
311
|
const today = new Date();
|
|
307
|
-
const testDayFormatted = (0, date_fns_1.format)(new Date(today.getFullYear(), today.getMonth(),
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
yield page.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const testDayCell = page.locator(".rdp-day").filter({ hasText: testDay }).first();
|
|
314
|
-
yield (0, fixtures_1.expect)(testDayCell).toHaveClass(/disabled/);
|
|
312
|
+
const testDayFormatted = (0, date_fns_1.format)(new Date(today.getFullYear(), today.getMonth(), testDay), "MM/dd/yyyy");
|
|
313
|
+
const testMonthName = (0, date_fns_1.format)(today, "LLLL");
|
|
314
|
+
yield initTestBed(`<DatePicker testId="datePicker" disabledDates="{['${testDayFormatted}']}" />`, {});
|
|
315
|
+
yield page.getByTestId("datePicker").click();
|
|
316
|
+
const testDayCell = page.getByRole("grid", { name: testMonthName }).getByLabel(testDay.toString());
|
|
317
|
+
yield (0, fixtures_1.expect)(testDayCell).toBeDisabled();
|
|
315
318
|
}));
|
|
316
319
|
// =============================================================================
|
|
317
320
|
// INTEGRATION TESTS
|
|
@@ -77,7 +77,7 @@ const Chevron = (_a) => {
|
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRef) {
|
|
80
|
-
var { id, initialValue, value, mode = exports.defaultProps.mode, enabled = exports.defaultProps.enabled, placeholder, updateState = constants_1.noop, validationStatus = exports.defaultProps.validationStatus, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, dateFormat = exports.defaultProps.dateFormat, showWeekNumber = exports.defaultProps.showWeekNumber, weekStartsOn = exports.defaultProps.weekStartsOn,
|
|
80
|
+
var { id, initialValue, value, mode = exports.defaultProps.mode, enabled = exports.defaultProps.enabled, placeholder, updateState = constants_1.noop, validationStatus = exports.defaultProps.validationStatus, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, dateFormat = exports.defaultProps.dateFormat, showWeekNumber = exports.defaultProps.showWeekNumber, weekStartsOn = exports.defaultProps.weekStartsOn, startDate, endDate, disabledDates = exports.defaultProps.disabledDates, style, className, registerComponentApi, inline = exports.defaultProps.inline, startText, startIcon, endText, endIcon, label, labelPosition, labelWidth, labelBreak, readOnly = false, required, autoFocus = false } = _a, rest = __rest(_a, ["id", "initialValue", "value", "mode", "enabled", "placeholder", "updateState", "validationStatus", "onDidChange", "onFocus", "onBlur", "dateFormat", "showWeekNumber", "weekStartsOn", "startDate", "endDate", "disabledDates", "style", "className", "registerComponentApi", "inline", "startText", "startIcon", "endText", "endIcon", "label", "labelPosition", "labelWidth", "labelBreak", "readOnly", "required", "autoFocus"]);
|
|
81
81
|
const _weekStartsOn = weekStartsOn >= 0 && weekStartsOn <= 6 ? weekStartsOn : WeekDays.Sunday;
|
|
82
82
|
const [_, setIsMenuFocused] = (0, react_2.useState)(false);
|
|
83
83
|
const [referenceElement, setReferenceElement] = (0, react_2.useState)(null);
|
|
@@ -101,12 +101,12 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
101
101
|
throw new Error(`Invalid dateFormat: ${dateFormat}. Supported formats are: ${exports.dateFormats.join(", ")}`);
|
|
102
102
|
}
|
|
103
103
|
}, [dateFormat]);
|
|
104
|
-
const
|
|
105
|
-
return
|
|
106
|
-
}, [
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
}, [
|
|
104
|
+
const _startDate = (0, react_2.useMemo)(() => {
|
|
105
|
+
return startDate ? (0, date_fns_1.parse)(startDate, dateFormat, new Date()) : undefined;
|
|
106
|
+
}, [startDate, dateFormat]);
|
|
107
|
+
const _endDate = (0, react_2.useMemo)(() => {
|
|
108
|
+
return endDate ? (0, date_fns_1.parse)(endDate, dateFormat, new Date()) : undefined;
|
|
109
|
+
}, [endDate, dateFormat]);
|
|
110
110
|
const defaultMonth = (0, react_2.useMemo)(() => {
|
|
111
111
|
if (mode === "single" && selected) {
|
|
112
112
|
return selected;
|
|
@@ -124,7 +124,7 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
124
124
|
if (dateValue instanceof Date) {
|
|
125
125
|
return dateValue;
|
|
126
126
|
}
|
|
127
|
-
if (typeof dateValue ===
|
|
127
|
+
if (typeof dateValue === "string") {
|
|
128
128
|
// Try to parse as ISO date first
|
|
129
129
|
const isoDate = parseISODate(dateValue);
|
|
130
130
|
if (isoDate) {
|
|
@@ -140,15 +140,15 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
140
140
|
};
|
|
141
141
|
const convertMatcher = (matcher) => {
|
|
142
142
|
// Handle boolean - disable all dates
|
|
143
|
-
if (typeof matcher ===
|
|
143
|
+
if (typeof matcher === "boolean") {
|
|
144
144
|
return matcher;
|
|
145
145
|
}
|
|
146
146
|
// Handle function matcher - pass through as is
|
|
147
|
-
if (typeof matcher ===
|
|
147
|
+
if (typeof matcher === "function") {
|
|
148
148
|
return matcher;
|
|
149
149
|
}
|
|
150
150
|
// Handle single Date or string
|
|
151
|
-
if (matcher instanceof Date || typeof matcher ===
|
|
151
|
+
if (matcher instanceof Date || typeof matcher === "string") {
|
|
152
152
|
const convertedDate = convertStringToDate(matcher);
|
|
153
153
|
return convertedDate || undefined;
|
|
154
154
|
}
|
|
@@ -156,14 +156,17 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
156
156
|
if (Array.isArray(matcher)) {
|
|
157
157
|
const convertedMatchers = [];
|
|
158
158
|
for (const item of matcher) {
|
|
159
|
-
if (typeof item ===
|
|
159
|
+
if (typeof item === "object" &&
|
|
160
|
+
item !== null &&
|
|
161
|
+
!Array.isArray(item) &&
|
|
162
|
+
!(item instanceof Date)) {
|
|
160
163
|
// Handle nested matcher objects in array (e.g., {dayOfWeek: [0,6]}, {from: date, to: date})
|
|
161
164
|
const nestedResult = convertMatcher(item);
|
|
162
165
|
if (nestedResult) {
|
|
163
166
|
convertedMatchers.push(nestedResult);
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
|
-
else if (item instanceof Date || typeof item ===
|
|
169
|
+
else if (item instanceof Date || typeof item === "string") {
|
|
167
170
|
// Handle individual dates in the array
|
|
168
171
|
const convertedDate = convertStringToDate(item);
|
|
169
172
|
if (convertedDate) {
|
|
@@ -175,9 +178,9 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
175
178
|
return convertedMatchers.length > 0 ? convertedMatchers : undefined;
|
|
176
179
|
}
|
|
177
180
|
// Handle object matchers (DateRange, DateBefore, DateAfter, DateInterval, DayOfWeek)
|
|
178
|
-
if (typeof matcher ===
|
|
181
|
+
if (typeof matcher === "object" && matcher !== null) {
|
|
179
182
|
// Handle DateRange: { from: Date, to?: Date }
|
|
180
|
-
if (
|
|
183
|
+
if ("from" in matcher) {
|
|
181
184
|
const fromDate = convertStringToDate(matcher.from);
|
|
182
185
|
const toDate = matcher.to ? convertStringToDate(matcher.to) : undefined;
|
|
183
186
|
if (fromDate) {
|
|
@@ -185,21 +188,21 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
190
|
// Handle DateBefore: { before: Date }
|
|
188
|
-
if (
|
|
191
|
+
if ("before" in matcher && !("after" in matcher)) {
|
|
189
192
|
const beforeDate = convertStringToDate(matcher.before);
|
|
190
193
|
if (beforeDate) {
|
|
191
194
|
return { before: beforeDate };
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
197
|
// Handle DateAfter: { after: Date }
|
|
195
|
-
if (
|
|
198
|
+
if ("after" in matcher && !("before" in matcher)) {
|
|
196
199
|
const afterDate = convertStringToDate(matcher.after);
|
|
197
200
|
if (afterDate) {
|
|
198
201
|
return { after: afterDate };
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
// Handle DateInterval: { before: Date, after: Date }
|
|
202
|
-
if (
|
|
205
|
+
if ("before" in matcher && "after" in matcher) {
|
|
203
206
|
const beforeDate = convertStringToDate(matcher.before);
|
|
204
207
|
const afterDate = convertStringToDate(matcher.after);
|
|
205
208
|
if (beforeDate && afterDate) {
|
|
@@ -207,7 +210,7 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
207
210
|
}
|
|
208
211
|
}
|
|
209
212
|
// Handle DayOfWeek: { dayOfWeek: number | number[] }
|
|
210
|
-
if (
|
|
213
|
+
if ("dayOfWeek" in matcher) {
|
|
211
214
|
return { dayOfWeek: matcher.dayOfWeek };
|
|
212
215
|
}
|
|
213
216
|
}
|
|
@@ -289,14 +292,14 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, forwardedRe
|
|
|
289
292
|
setOpen(false);
|
|
290
293
|
}
|
|
291
294
|
}, [onDidChange, updateState, mode, dateFormat, readOnly]);
|
|
292
|
-
return inline ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref }, rest, { style: style, className: (0, classnames_1.default)(DatePicker_module_scss_1.default.inlinePickerMenu, className), tabIndex: 0, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { id: id, required: undefined, captionLayout: "dropdown", fixedWeeks: true, startMonth:
|
|
295
|
+
return inline ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref }, rest, { style: style, className: (0, classnames_1.default)(DatePicker_module_scss_1.default.inlinePickerMenu, className), tabIndex: 0, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { id: id, required: undefined, captionLayout: "dropdown", fixedWeeks: true, startMonth: _startDate, endMonth: _endDate, month: inlineMonth, onMonthChange: setInlineMonth, disabled: disabled, weekStartsOn: _weekStartsOn, showWeekNumber: showWeekNumber, showOutsideDays: true, classNames: DatePicker_module_scss_1.default, mode: mode === "single" ? "single" : "range", selected: selected, onSelect: handleSelect, autoFocus: autoFocus, numberOfMonths: mode === "range" ? 2 : 1, components: {
|
|
293
296
|
Chevron,
|
|
294
297
|
} }) }))) : ((0, jsx_runtime_1.jsxs)(react_popover_1.Popover, { open: open, onOpenChange: setOpen, modal: false, children: [(0, jsx_runtime_1.jsxs)(react_popover_1.PopoverTrigger, { id: id, ref: (0, react_compose_refs_1.composeRefs)(setReferenceElement, ref), "aria-haspopup": true, disabled: !enabled, style: style, "aria-expanded": open, className: (0, classnames_1.default)(className, DatePicker_module_scss_1.default.datePicker, {
|
|
295
298
|
[DatePicker_module_scss_1.default.disabled]: !enabled,
|
|
296
299
|
[DatePicker_module_scss_1.default.error]: validationStatus === "error",
|
|
297
300
|
[DatePicker_module_scss_1.default.warning]: validationStatus === "warning",
|
|
298
301
|
[DatePicker_module_scss_1.default.valid]: validationStatus === "valid",
|
|
299
|
-
}, className), autoFocus: autoFocus, onFocus: onFocus, onBlur: onBlur, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: DatePicker_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("div", { className: DatePicker_module_scss_1.default.datePickerValue, children: mode === "single" && selected ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, date_fns_1.format)(selected, dateFormat) })) : mode === "range" && typeof selected === "object" && selected.from ? (selected.to ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, date_fns_1.format)(selected.from, dateFormat), " - ", (0, date_fns_1.format)(selected.to, dateFormat)] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, date_fns_1.format)(selected.from, dateFormat) }))) : placeholder ? ((0, jsx_runtime_1.jsx)("span", { className: DatePicker_module_scss_1.default.placeholder, placeholder: placeholder, children: placeholder })) : ((0, jsx_runtime_1.jsx)("span", { children: "\u00A0" })) }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: DatePicker_module_scss_1.default.adornment })] }), (0, jsx_runtime_1.jsx)(react_popover_1.PopoverPortal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { role: "menu", align: "start", sideOffset: 5, className: DatePicker_module_scss_1.default.datePickerMenu, onFocus: handleOnMenuFocus, onBlur: handleOnMenuBlur, onInteractOutside: handleOnMenuBlur, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { required: undefined, animate: true, fixedWeeks: true, autoFocus: autoFocus, classNames: DatePicker_module_scss_1.default, captionLayout: "dropdown", startMonth:
|
|
302
|
+
}, className), autoFocus: autoFocus, onFocus: onFocus, onBlur: onBlur, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: DatePicker_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("div", { className: DatePicker_module_scss_1.default.datePickerValue, children: mode === "single" && selected ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, date_fns_1.format)(selected, dateFormat) })) : mode === "range" && typeof selected === "object" && selected.from ? (selected.to ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, date_fns_1.format)(selected.from, dateFormat), " - ", (0, date_fns_1.format)(selected.to, dateFormat)] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, date_fns_1.format)(selected.from, dateFormat) }))) : placeholder ? ((0, jsx_runtime_1.jsx)("span", { className: DatePicker_module_scss_1.default.placeholder, placeholder: placeholder, children: placeholder })) : ((0, jsx_runtime_1.jsx)("span", { children: "\u00A0" })) }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: DatePicker_module_scss_1.default.adornment })] }), (0, jsx_runtime_1.jsx)(react_popover_1.PopoverPortal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { role: "menu", align: "start", sideOffset: 5, className: DatePicker_module_scss_1.default.datePickerMenu, onFocus: handleOnMenuFocus, onBlur: handleOnMenuBlur, onInteractOutside: handleOnMenuBlur, children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { required: undefined, animate: true, fixedWeeks: true, autoFocus: autoFocus, classNames: DatePicker_module_scss_1.default, captionLayout: "dropdown", startMonth: _startDate, endMonth: _endDate, defaultMonth: defaultMonth, disabled: disabled, weekStartsOn: _weekStartsOn, showWeekNumber: showWeekNumber, showOutsideDays: true, mode: mode === "single" ? "single" : "range", selected: selected, onSelect: handleSelect, numberOfMonths: mode === "range" ? 2 : 1, components: {
|
|
300
303
|
Chevron,
|
|
301
304
|
} }) }) })] }));
|
|
302
305
|
});
|
|
@@ -141,7 +141,7 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
141
141
|
yield (0, fixtures_1.expect)(btn).toHaveAttribute("aria-haspopup", "menu");
|
|
142
142
|
yield (0, fixtures_1.expect)(btn).toHaveAttribute("aria-expanded", "false");
|
|
143
143
|
yield driver.open();
|
|
144
|
-
page.getByRole("button", { includeHidden: true, expanded: true }).waitFor();
|
|
144
|
+
yield page.getByRole("button", { includeHidden: true, expanded: true }).waitFor();
|
|
145
145
|
yield page.getByRole("menu").waitFor();
|
|
146
146
|
}));
|
|
147
147
|
(0, fixtures_1.test)("is keyboard accessible", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createDropdownMenuDriver, page }) {
|
|
@@ -151,10 +151,10 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
151
151
|
</DropdownMenu>
|
|
152
152
|
`);
|
|
153
153
|
const btn = page.getByRole("button");
|
|
154
|
-
page.keyboard.press("Tab");
|
|
154
|
+
yield page.keyboard.press("Tab");
|
|
155
155
|
yield (0, fixtures_1.expect)(btn).toBeFocused();
|
|
156
156
|
// Open with Enter
|
|
157
|
-
page.keyboard.press("Enter");
|
|
157
|
+
yield page.keyboard.press("Enter");
|
|
158
158
|
yield (0, fixtures_1.expect)(page.getByRole("menuitem", { name: "Item 1" })).toBeVisible();
|
|
159
159
|
// Navigate and select with keyboard
|
|
160
160
|
yield page.keyboard.press("ArrowDown");
|
|
@@ -215,6 +215,13 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
215
215
|
yield driver.getTextBox().focus();
|
|
216
216
|
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
217
217
|
}));
|
|
218
|
+
(0, fixtures_1.test)("gotFocus event fires on label focus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
219
|
+
const { testStateDriver } = yield initTestBed(`
|
|
220
|
+
<FileInput testId="fileInput" onGotFocus="testState = 'focused'" label="test" />
|
|
221
|
+
`);
|
|
222
|
+
yield page.getByText("test").click();
|
|
223
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("focused");
|
|
224
|
+
}));
|
|
218
225
|
(0, fixtures_1.test)("lostFocus event fires on blue", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFileInputDriver }) {
|
|
219
226
|
const { testStateDriver } = yield initTestBed(`
|
|
220
227
|
<FileInput testId="fileInput" onLostFocus="testState = 'blurred'" />
|
|
@@ -32,15 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
45
36
|
var t = {};
|
|
46
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -81,7 +72,7 @@ exports.FileUploadDropZone = (0, react_1.forwardRef)(function FileUploadDropZone
|
|
|
81
72
|
const accept = acceptedFileTypes
|
|
82
73
|
? acceptedFileTypes.split(",").reduce((acc, type) => (Object.assign(Object.assign({}, acc), { [type.trim()]: [] })), {})
|
|
83
74
|
: undefined;
|
|
84
|
-
const onDrop = (0, react_1.useCallback)((acceptedFiles) =>
|
|
75
|
+
const onDrop = (0, react_1.useCallback)((acceptedFiles) => {
|
|
85
76
|
if (!acceptedFiles.length) {
|
|
86
77
|
return;
|
|
87
78
|
}
|
|
@@ -89,7 +80,7 @@ exports.FileUploadDropZone = (0, react_1.forwardRef)(function FileUploadDropZone
|
|
|
89
80
|
value: acceptedFiles,
|
|
90
81
|
});
|
|
91
82
|
onUpload === null || onUpload === void 0 ? void 0 : onUpload(acceptedFiles);
|
|
92
|
-
}
|
|
83
|
+
}, [onUpload, updateState]);
|
|
93
84
|
const { getRootProps, getInputProps, isDragActive, open, inputRef, isDragAccept } = useDropzone({
|
|
94
85
|
onDrop,
|
|
95
86
|
noClick: true,
|
|
@@ -97,7 +88,7 @@ exports.FileUploadDropZone = (0, react_1.forwardRef)(function FileUploadDropZone
|
|
|
97
88
|
noDragEventsBubbling: true,
|
|
98
89
|
disabled,
|
|
99
90
|
accept,
|
|
100
|
-
maxFiles
|
|
91
|
+
maxFiles,
|
|
101
92
|
});
|
|
102
93
|
const doOpen = (0, misc_1.useEvent)(() => {
|
|
103
94
|
open();
|
|
@@ -139,5 +130,5 @@ exports.FileUploadDropZone = (0, react_1.forwardRef)(function FileUploadDropZone
|
|
|
139
130
|
}, [doOpen, registerComponentApi, uid]);
|
|
140
131
|
const _b = getRootProps(Object.assign(Object.assign({}, rest), { style, className: (0, classnames_1.default)(FileUploadDropZone_module_scss_1.default.wrapper, className), onPaste: handleOnPaste })), { ref } = _b, rootProps = __rest(_b, ["ref"]);
|
|
141
132
|
const rootRef = (0, component_utils_1.getComposedRef)(ref, forwardedRef);
|
|
142
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rootProps, { "data-drop-enabled": !disabled, ref: rootRef, children: [(0, jsx_runtime_1.jsx)("input", Object.assign({}, getInputProps())), children,
|
|
133
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rootProps, { "data-drop-enabled": !disabled, ref: rootRef, children: [(0, jsx_runtime_1.jsx)("input", Object.assign({}, getInputProps())), children, isDragActive && isDragAccept && ((0, jsx_runtime_1.jsxs)("div", { className: FileUploadDropZone_module_scss_1.default.dropPlaceholder, children: [(0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "upload" }), text] }))] })));
|
|
143
134
|
});
|