xmlui 0.10.13 → 0.10.14
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/{index-Db5iQkFp.mjs → index-779mp2Bm.mjs} +943 -736
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-B9LtmFJG.mjs → initMock-CAXdczCj.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +16 -1
- package/dist/lib/xmlui.mjs +33 -32
- package/dist/metadata/{collectedComponentMetadata-BN8eg9Gr.mjs → collectedComponentMetadata-7DFXlw-J.mjs} +15057 -14865
- package/dist/metadata/{initMock-J7pN8owj.mjs → initMock-AFWEftc6.mjs} +1 -1
- 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/bin/build-lib.js +21 -13
- package/dist/scripts/bin/viteConfig.js +3 -1
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/abstractions/scripting/Token.js +2 -0
- package/dist/scripts/src/abstractions/scripting/TryScope.js +2 -0
- package/dist/scripts/src/abstractions/scripting/modules.js +2 -0
- package/dist/scripts/src/components/APICall/APICall.spec.js +910 -0
- package/dist/scripts/src/components/Accordion/Accordion.spec.js +969 -0
- package/dist/scripts/src/components/Animation/Animation.js +50 -0
- package/dist/scripts/src/components/App/App.spec.js +219 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.spec.js +169 -0
- package/dist/scripts/src/components/AppState/AppState.spec.js +268 -0
- package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +383 -0
- package/dist/scripts/src/components/Avatar/Avatar.spec.js +1543 -0
- package/dist/scripts/src/components/Backdrop/Backdrop.spec.js +131 -0
- package/dist/scripts/src/components/Badge/Badge.spec.js +2214 -0
- package/dist/scripts/src/components/Bookmark/Bookmark.spec.js +230 -0
- package/dist/scripts/src/components/Breakout/Breakout.spec.js +56 -0
- package/dist/scripts/src/components/Button/Button-style.spec.js +274 -0
- package/dist/scripts/src/components/Button/Button.spec.js +454 -0
- package/dist/scripts/src/components/Card/Card.spec.js +150 -0
- package/dist/scripts/src/components/Carousel/Carousel.spec.js +343 -0
- package/dist/scripts/src/components/Carousel/CarouselNative.js +2 -2
- package/dist/scripts/src/components/ChangeListener/ChangeListener.spec.js +169 -0
- package/dist/scripts/src/components/Charts/AreaChart/AreaChart.spec.js +999 -0
- package/dist/scripts/src/components/Charts/BarChart/BarChart.spec.js +597 -0
- package/dist/scripts/src/components/Charts/DonutChart/DonutChart.spec.js +608 -0
- package/dist/scripts/src/components/Charts/LabelList/LabelList.spec.js +539 -0
- package/dist/scripts/src/components/Charts/Legend/Legend.spec.js +558 -0
- package/dist/scripts/src/components/Charts/LineChart/LineChart.spec.js +450 -0
- package/dist/scripts/src/components/Charts/PieChart/PieChart.spec.js +584 -0
- package/dist/scripts/src/components/Charts/RadarChart/RadarChart.spec.js +571 -0
- package/dist/scripts/src/components/Charts/Tooltip/TooltipContent.spec.js +449 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +964 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlock.spec.js +196 -0
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +283 -0
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +9 -26
- package/dist/scripts/src/components/Column/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/ComponentProvider.js +6 -2
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +338 -0
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +918 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +362 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +3 -3
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +331 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.spec.js +29 -0
- package/dist/scripts/src/components/ExpandableItem/ExpandableItem.spec.js +435 -0
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +249 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.spec.js +296 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.spec.js +518 -0
- package/dist/scripts/src/components/Footer/Footer.spec.js +991 -0
- package/dist/scripts/src/components/Form/Form.spec.js +1257 -0
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +723 -0
- package/dist/scripts/src/components/FormSection/FormSection.js +6 -31
- package/dist/scripts/src/components/Fragment/Fragment.spec.js +50 -0
- package/dist/scripts/src/components/Heading/H1.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H2.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H3.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H4.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H5.spec.js +66 -0
- package/dist/scripts/src/components/Heading/H6.spec.js +66 -0
- package/dist/scripts/src/components/Heading/Heading.spec.js +897 -0
- package/dist/scripts/src/components/HtmlTags/HtmlTags.spec.js +69 -0
- package/dist/scripts/src/components/IFrame/IFrame.spec.js +527 -0
- package/dist/scripts/src/components/Icon/ArrowDropDown.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowDropUp.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowLeft.js +11 -0
- package/dist/scripts/src/components/Icon/ArrowRight.js +11 -0
- package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.spec.js +527 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Image/Image.js +2 -1
- package/dist/scripts/src/components/Image/Image.spec.js +198 -0
- package/dist/scripts/src/components/Image/ImageNative.js +30 -2
- package/dist/scripts/src/components/Input/InputLabel.js +25 -0
- package/dist/scripts/src/components/Input/index.js +5 -0
- package/dist/scripts/src/components/Items/Items.spec.js +397 -0
- package/dist/scripts/src/components/Link/Link.spec.js +894 -0
- package/dist/scripts/src/components/List/List.spec.js +927 -0
- package/dist/scripts/src/components/List/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/Markdown/Markdown.spec.js +188 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +162 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +153 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -2
- package/dist/scripts/src/components/NavLink/NavLink.spec.js +864 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.spec.js +864 -0
- package/dist/scripts/src/components/NoResult/NoResult.spec.js +863 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +1231 -0
- package/dist/scripts/src/components/Option/Option.spec.js +472 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.spec.js +80 -0
- package/dist/scripts/src/components/Pagination/Pagination.spec.js +1003 -0
- package/dist/scripts/src/components/ProfileMenu/ProfileMenu.js +20 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBar.spec.js +166 -0
- package/dist/scripts/src/components/Queue/Queue.spec.js +626 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +479 -0
- package/dist/scripts/src/components/Redirect/Redirect.spec.js +527 -0
- package/dist/scripts/src/components/ResponsiveBar/ResponsiveBar.spec.js +76 -0
- package/dist/scripts/src/components/Select/Select.spec.js +527 -0
- package/dist/scripts/src/components/Slider/Slider.js +2 -0
- package/dist/scripts/src/components/Slider/Slider.spec.js +574 -0
- package/dist/scripts/src/components/Slider/SliderNative.js +62 -25
- package/dist/scripts/src/components/Slot/Slot.spec.js +368 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.spec.js +184 -0
- package/dist/scripts/src/components/Spinner/Spinner.spec.js +161 -0
- package/dist/scripts/src/components/Splitter/HSplitter.spec.js +104 -0
- package/dist/scripts/src/components/Splitter/Splitter.spec.js +543 -0
- package/dist/scripts/src/components/Splitter/VSplitter.spec.js +104 -0
- package/dist/scripts/src/components/Stack/CHStack.spec.js +86 -0
- package/dist/scripts/src/components/Stack/CVStack.spec.js +86 -0
- package/dist/scripts/src/components/Stack/HStack.spec.js +67 -0
- package/dist/scripts/src/components/Stack/Stack.spec.js +654 -0
- package/dist/scripts/src/components/Stack/VStack.spec.js +67 -0
- package/dist/scripts/src/components/Switch/Switch.spec.js +829 -0
- package/dist/scripts/src/components/Table/Table.spec.js +555 -0
- package/dist/scripts/src/components/Table/doc-resources/list-component-data.js +53 -0
- package/dist/scripts/src/components/TableOfContents/TableOfContents.spec.js +838 -0
- package/dist/scripts/src/components/Tabs/Tabs.spec.js +875 -0
- package/dist/scripts/src/components/Text/Text.spec.js +1075 -0
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +714 -0
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +643 -0
- package/dist/scripts/src/components/Theme/Theme.spec.js +124 -0
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +1122 -0
- package/dist/scripts/src/components/Timer/Timer.spec.js +358 -0
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.spec.js +414 -0
- package/dist/scripts/src/components/ToneSwitch/ToneSwitch.spec.js +89 -0
- package/dist/scripts/src/components/Tooltip/Tooltip.spec.js +418 -0
- package/dist/scripts/src/components/chart-color-schemes.js +43 -0
- package/dist/scripts/src/components-core/CompoundComponent.js +1 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +85 -8
- package/dist/scripts/src/components-core/devtools/InspectorDialogVisibilityContext.js +8 -0
- package/dist/scripts/src/components-core/renderers.js +31 -0
- package/dist/scripts/src/components-core/script-runner/simplify-expression.js +386 -0
- package/dist/scripts/src/components-core/theming/component-layout-resolver.js +153 -0
- package/dist/scripts/src/components-core/theming/parse-layout-props.js +98 -0
- package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
- package/dist/scripts/src/components-core/utils/audio-utils.js +83 -0
- package/dist/scripts/src/index-standalone.js +61 -0
- package/dist/scripts/src/index.js +2 -1
- package/dist/scripts/src/language-server/server-common.js +151 -0
- package/dist/scripts/src/language-server/server-web-worker.js +47 -0
- package/dist/scripts/src/language-server/server.js +42 -0
- package/dist/scripts/src/language-server/services/common/docs-generation.js +73 -0
- package/dist/scripts/src/language-server/services/common/lsp-utils.js +9 -0
- package/dist/scripts/src/language-server/services/common/syntax-node-utilities.js +135 -0
- package/dist/scripts/src/language-server/services/completion.js +270 -0
- package/dist/scripts/src/language-server/services/diagnostic.js +19 -0
- package/dist/scripts/src/language-server/services/format.js +430 -0
- package/dist/scripts/src/language-server/services/hover.js +164 -0
- package/dist/scripts/src/language-server/xmlui-metadata-generated.mjs +16266 -0
- package/dist/scripts/src/logging/xmlui.js +21 -0
- package/dist/scripts/src/parsers/common/utils.js +19 -0
- package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +286 -0
- package/dist/scripts/src/syntax/monaco/index.js +14 -0
- package/dist/scripts/src/syntax/monaco/xmlui-dark.js +25 -0
- package/dist/scripts/src/syntax/monaco/xmlui-light.js +25 -0
- package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +310 -0
- package/dist/scripts/src/syntax/textMate/index.js +14 -0
- package/dist/scripts/src/syntax/textMate/xmlui-dark.json +631 -0
- package/dist/scripts/src/syntax/textMate/xmlui-light.json +565 -0
- package/dist/scripts/src/syntax/textMate/xmlui.json +564 -0
- package/dist/scripts/src/syntax/textMate/xmlui.tmLanguage.json +341 -0
- package/dist/scripts/src/testing/ComponentDrivers.js +1355 -0
- package/dist/scripts/src/testing/assertions.js +444 -0
- package/dist/scripts/src/testing/component-test-helpers.js +389 -0
- package/dist/scripts/src/testing/drivers/DateInputDriver.js +19 -0
- package/dist/scripts/src/testing/drivers/ModalDialogDriver.js +10 -0
- package/dist/scripts/src/testing/drivers/TimeInputDriver.js +22 -0
- package/dist/scripts/src/testing/drivers/TimerDriver.js +64 -0
- package/dist/scripts/src/testing/fixtures.js +487 -0
- package/dist/scripts/src/testing/infrastructure/TestBed.js +17 -0
- package/dist/scripts/src/testing/infrastructure/main.js +9 -0
- package/dist/scripts/src/testing/infrastructure/public/mockServiceWorker.js +266 -0
- package/dist/scripts/src/testing/themed-app-test-helpers.js +139 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +18 -1
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
13
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
14
|
+
const date_fns_1 = require("date-fns");
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// BASIC FUNCTIONALITY TESTS
|
|
17
|
+
// =============================================================================
|
|
18
|
+
(0, fixtures_1.test)("component renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
19
|
+
yield initTestBed(`<DatePicker testId="datePicker" />`);
|
|
20
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toBeVisible();
|
|
21
|
+
}));
|
|
22
|
+
(0, fixtures_1.test)("component renders inline", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
23
|
+
yield initTestBed(`<DatePicker inline testId="datePicker" />`);
|
|
24
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toBeVisible();
|
|
25
|
+
}));
|
|
26
|
+
(0, fixtures_1.test)("component handles correct date format", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
27
|
+
yield initTestBed(`<DatePicker testId="datePicker" dateFormat="MM/dd/yyyy" initialValue="05/25/2024" />`);
|
|
28
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("05/25/2024");
|
|
29
|
+
}));
|
|
30
|
+
(0, fixtures_1.test)("component displays initialValue correctly (single)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
31
|
+
yield initTestBed(`
|
|
32
|
+
<DatePicker
|
|
33
|
+
initialValue="05/25/2024"
|
|
34
|
+
dateFormat="MM/dd/yyyy"
|
|
35
|
+
testId="datePicker"
|
|
36
|
+
mode="single"
|
|
37
|
+
/>`);
|
|
38
|
+
yield (0, fixtures_1.expect)(page.getByText("05/25/2024")).toBeVisible();
|
|
39
|
+
}));
|
|
40
|
+
(0, fixtures_1.test)("component displays initialValue correctly (range)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
41
|
+
yield initTestBed(`
|
|
42
|
+
<DatePicker
|
|
43
|
+
initialValue="{{ from: '05/25/2024', to: '05/26/2024' }}"
|
|
44
|
+
dateFormat="MM/dd/yyyy"
|
|
45
|
+
mode="range"
|
|
46
|
+
testId="datePicker"
|
|
47
|
+
/>`);
|
|
48
|
+
yield (0, fixtures_1.expect)(page.getByText("05/25/2024 - 05/26/2024")).toBeVisible();
|
|
49
|
+
}));
|
|
50
|
+
(0, fixtures_1.test)("component opens calendar when clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
51
|
+
yield initTestBed(`<DatePicker testId="datePicker" />`);
|
|
52
|
+
yield page.getByTestId("datePicker").click();
|
|
53
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
54
|
+
}));
|
|
55
|
+
(0, fixtures_1.test)("component formats input to provided date format", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
56
|
+
yield initTestBed(`<DatePicker testId="datePicker" dateFormat="dd-MM-yyyy" initialValue="05/25/2024" />`);
|
|
57
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("25-05-2024");
|
|
58
|
+
}));
|
|
59
|
+
(0, fixtures_1.test)("component allows date selection in single mode", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
60
|
+
yield initTestBed(`
|
|
61
|
+
<DatePicker testId="datePicker" mode="single" dateFormat="MM/dd/yyyy" initialValue="05/25/2024" />
|
|
62
|
+
`);
|
|
63
|
+
yield page.getByTestId("datePicker").click();
|
|
64
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
65
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("26").click();
|
|
66
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("05/26/2024");
|
|
67
|
+
}));
|
|
68
|
+
(0, fixtures_1.test)("date changes when selecting a new date in single mode", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
69
|
+
yield initTestBed(`
|
|
70
|
+
<DatePicker testId="datePicker" mode="single" dateFormat="MM/dd/yyyy" initialValue="05/25/2024" />
|
|
71
|
+
`);
|
|
72
|
+
const datePicker = page.getByTestId("datePicker");
|
|
73
|
+
yield datePicker.click();
|
|
74
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("26").click();
|
|
75
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("05/26/2024");
|
|
76
|
+
yield datePicker.click();
|
|
77
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("27").click();
|
|
78
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("05/27/2024");
|
|
79
|
+
}));
|
|
80
|
+
(0, fixtures_1.test)("component allows date range selection", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
81
|
+
yield initTestBed(`<DatePicker testId="datePicker" mode="range" dateFormat="MM/dd/yyyy" initialValue="{{ from: '05/25/2024', to: '05/26/2024' }}" />`);
|
|
82
|
+
yield page.getByTestId("datePicker").click();
|
|
83
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
84
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("26").click();
|
|
85
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("27").click();
|
|
86
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("05/26/2024 - 05/27/2024");
|
|
87
|
+
}));
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// ACCESSIBILITY TESTS
|
|
90
|
+
// =============================================================================
|
|
91
|
+
(0, fixtures_1.test)("component has correct accessibility attributes", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
92
|
+
yield initTestBed(`<DatePicker testId="datePicker" />`);
|
|
93
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveAttribute("aria-haspopup", "true");
|
|
94
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveAttribute("aria-expanded", "false");
|
|
95
|
+
}));
|
|
96
|
+
(0, fixtures_1.test)("component is focusable via label", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
97
|
+
yield initTestBed(`<DatePicker testId="datePicker" label="Birth Date" />`);
|
|
98
|
+
yield page.getByText("Birth Date").click();
|
|
99
|
+
// --- clicking the label to focus the input opens up the dialog
|
|
100
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu").getByRole("button", { name: "Go to the Previous Month" })).toBeFocused();
|
|
101
|
+
}));
|
|
102
|
+
(0, fixtures_1.test)("component respects autoFocus property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
103
|
+
yield initTestBed(`<DatePicker testId="datePicker" autoFocus="true" />`);
|
|
104
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toBeFocused();
|
|
105
|
+
}));
|
|
106
|
+
(0, fixtures_1.test)("component is keyboard navigable: open/close calendar menu", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
107
|
+
yield initTestBed(`<DatePicker testId="datePicker" />`);
|
|
108
|
+
// Focus the button
|
|
109
|
+
yield page.getByTestId("datePicker").focus();
|
|
110
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toBeFocused();
|
|
111
|
+
// Press Enter to open calendar
|
|
112
|
+
yield page.keyboard.press("Enter");
|
|
113
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
114
|
+
// Press Escape to close
|
|
115
|
+
yield page.keyboard.press("Escape");
|
|
116
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).not.toBeVisible();
|
|
117
|
+
}));
|
|
118
|
+
(0, fixtures_1.test)("component is keyboard navigable: navigate controls inside calendar menu", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
119
|
+
yield initTestBed(`<DatePicker testId="datePicker" initialValue="05/25/2024" dateFormat="MM/dd/yyyy" />`);
|
|
120
|
+
// Focus the button
|
|
121
|
+
yield page.getByTestId("datePicker").click();
|
|
122
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
123
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu").getByRole("button", { name: "Go to the Previous Month" })).toBeFocused();
|
|
124
|
+
// Tab to the calendar grid
|
|
125
|
+
yield page.keyboard.press("Tab");
|
|
126
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu").getByRole("button", { name: "Go to the Next Month" })).toBeFocused();
|
|
127
|
+
yield page.keyboard.press("Tab");
|
|
128
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu").getByLabel("Choose the Month")).toBeFocused();
|
|
129
|
+
yield page.keyboard.press("Tab");
|
|
130
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu").getByLabel("Choose the Year")).toBeFocused();
|
|
131
|
+
yield page.keyboard.press("Tab");
|
|
132
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("25")).toBeFocused();
|
|
133
|
+
}));
|
|
134
|
+
(0, fixtures_1.test)("component is keyboard navigable: navigate days inside calendar menu", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
|
|
135
|
+
yield initTestBed(`<DatePicker testId="datePicker" initialValue="05/15/2024" dateFormat="MM/dd/yyyy" />`);
|
|
136
|
+
yield page.getByTestId("datePicker").click();
|
|
137
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
138
|
+
// The back navigation button is focused first
|
|
139
|
+
// Tab to next nav button
|
|
140
|
+
yield page.keyboard.press("Tab");
|
|
141
|
+
// Tab to month select
|
|
142
|
+
yield page.keyboard.press("Tab");
|
|
143
|
+
// Tab to year select
|
|
144
|
+
yield page.keyboard.press("Tab");
|
|
145
|
+
// Tab to the calendar grid
|
|
146
|
+
yield page.keyboard.press("Tab");
|
|
147
|
+
yield page.keyboard.press("ArrowLeft");
|
|
148
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 14th")).toBeFocused();
|
|
149
|
+
yield page.keyboard.press("ArrowUp");
|
|
150
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 7th")).toBeFocused();
|
|
151
|
+
yield page.keyboard.press("ArrowRight");
|
|
152
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 8th")).toBeFocused();
|
|
153
|
+
yield page.keyboard.press("ArrowDown");
|
|
154
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 15th")).toBeFocused();
|
|
155
|
+
}));
|
|
156
|
+
(0, fixtures_1.test)("component is keyboard navigable: enter new date", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
157
|
+
yield initTestBed(`<DatePicker testId="datePicker" initialValue="05/15/2024" dateFormat="MM/dd/yyyy"/>`);
|
|
158
|
+
yield page.getByTestId("datePicker").click();
|
|
159
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).toBeVisible();
|
|
160
|
+
// The back navigation button is focused first
|
|
161
|
+
// Tab to next nav button
|
|
162
|
+
yield page.keyboard.press("Tab");
|
|
163
|
+
// Tab to month select
|
|
164
|
+
yield page.keyboard.press("Tab");
|
|
165
|
+
// Tab to year select
|
|
166
|
+
yield page.keyboard.press("Tab");
|
|
167
|
+
// Tab to the calendar grid
|
|
168
|
+
yield page.keyboard.press("Tab");
|
|
169
|
+
yield page.keyboard.press("ArrowLeft");
|
|
170
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 14th")).toBeFocused();
|
|
171
|
+
yield page.keyboard.press("Enter");
|
|
172
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("05/14/2024");
|
|
173
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).not.toBeVisible();
|
|
174
|
+
}));
|
|
175
|
+
(0, fixtures_1.test)("component fires proper focus event on gotFocus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
176
|
+
const { testStateDriver } = yield initTestBed(`
|
|
177
|
+
<DatePicker testId="datePicker" onGotFocus="testState = 'focused'" />
|
|
178
|
+
`);
|
|
179
|
+
yield page.getByTestId("datePicker").focus();
|
|
180
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("focused");
|
|
181
|
+
}));
|
|
182
|
+
(0, fixtures_1.test)("component fires proper blur event on lostFocus", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
183
|
+
const { testStateDriver } = yield initTestBed(`
|
|
184
|
+
<DatePicker testId="datePicker" onLostFocus="testState = 'blurred'" />
|
|
185
|
+
`);
|
|
186
|
+
yield page.getByTestId("datePicker").focus();
|
|
187
|
+
yield page.getByTestId("datePicker").blur();
|
|
188
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("blurred");
|
|
189
|
+
}));
|
|
190
|
+
// =============================================================================
|
|
191
|
+
// VISUAL STATE TESTS
|
|
192
|
+
// =============================================================================
|
|
193
|
+
(0, fixtures_1.test)("component shows error validation states", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
194
|
+
// Error state
|
|
195
|
+
yield initTestBed(`<DatePicker testId="datePicker" validationStatus="error" />`, {
|
|
196
|
+
testThemeVars: {
|
|
197
|
+
"borderColor-DatePicker-error": "rgb(220, 38, 38)",
|
|
198
|
+
"backgroundColor-DatePicker-error": "rgb(254, 202, 202)",
|
|
199
|
+
"textColor-DatePicker-error": "rgb(127, 29, 29)",
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("border-color", "rgb(220, 38, 38)");
|
|
203
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("background-color", "rgb(254, 202, 202)");
|
|
204
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("color", "rgb(127, 29, 29)");
|
|
205
|
+
}));
|
|
206
|
+
(0, fixtures_1.test)("component shows warning validation states", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
207
|
+
// Warning state
|
|
208
|
+
yield initTestBed(`<DatePicker testId="datePicker" validationStatus="warning" />`, {
|
|
209
|
+
testThemeVars: {
|
|
210
|
+
"borderColor-DatePicker-warning": "rgb(255, 165, 0)",
|
|
211
|
+
"backgroundColor-DatePicker-warning": "rgb(255, 235, 156)",
|
|
212
|
+
"textColor-DatePicker-warning": "rgb(127, 29, 29)",
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("border-color", "rgb(255, 165, 0)");
|
|
216
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("background-color", "rgb(255, 235, 156)");
|
|
217
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("color", "rgb(127, 29, 29)");
|
|
218
|
+
}));
|
|
219
|
+
(0, fixtures_1.test)("component shows valid validation states", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
220
|
+
// Valid state
|
|
221
|
+
yield initTestBed(`<DatePicker testId="datePicker" validationStatus="valid" />`, {
|
|
222
|
+
testThemeVars: {
|
|
223
|
+
"borderColor-DatePicker-success": "rgb(0, 128, 0)",
|
|
224
|
+
"backgroundColor-DatePicker-success": "rgb(220, 255, 220)",
|
|
225
|
+
"textColor-DatePicker-success": "rgb(0, 100, 0)",
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("border-color", "rgb(0, 128, 0)");
|
|
229
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("background-color", "rgb(220, 255, 220)");
|
|
230
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveCSS("color", "rgb(0, 100, 0)");
|
|
231
|
+
}));
|
|
232
|
+
(0, fixtures_1.test)("component displays placeholder text", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
233
|
+
yield initTestBed(`<DatePicker testId="datePicker" placeholder="Select a date" />`);
|
|
234
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toContainText("Select a date");
|
|
235
|
+
}));
|
|
236
|
+
(0, fixtures_1.test)("component shows week numbers when enabled", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
237
|
+
yield initTestBed(`<DatePicker testId="datePicker" showWeekNumber="true" />`);
|
|
238
|
+
yield page.getByTestId("datePicker").click();
|
|
239
|
+
yield (0, fixtures_1.expect)(page.locator("[role='rowheader']").first()).toBeVisible();
|
|
240
|
+
}));
|
|
241
|
+
(0, fixtures_1.test)("component renders with adornments", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
242
|
+
const startText = "From";
|
|
243
|
+
const endText = "Select";
|
|
244
|
+
yield initTestBed(`
|
|
245
|
+
<DatePicker
|
|
246
|
+
testId="datePicker"
|
|
247
|
+
startText="${startText}"
|
|
248
|
+
endText="${endText}"
|
|
249
|
+
startIcon="test"
|
|
250
|
+
endIcon="test"
|
|
251
|
+
/>
|
|
252
|
+
`, {
|
|
253
|
+
resources: {
|
|
254
|
+
"icon.test": "resources/bell.svg",
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
yield (0, fixtures_1.expect)(page.getByText(startText)).toBeVisible();
|
|
258
|
+
yield (0, fixtures_1.expect)(page.getByText(endText)).toBeVisible();
|
|
259
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker").locator("svg")).toHaveCount(2);
|
|
260
|
+
}));
|
|
261
|
+
// =============================================================================
|
|
262
|
+
// EDGE CASE TESTS
|
|
263
|
+
// =============================================================================
|
|
264
|
+
(0, fixtures_1.test)("component handles disabled state correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
265
|
+
yield initTestBed(`<DatePicker testId="datePicker" enabled="false" />`);
|
|
266
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toBeDisabled();
|
|
267
|
+
}));
|
|
268
|
+
(0, fixtures_1.test)("disabled component does not react to user interactions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
269
|
+
yield initTestBed(`<DatePicker testId="datePicker" enabled="false" />`);
|
|
270
|
+
yield page.getByTestId("datePicker").click({ force: true });
|
|
271
|
+
yield (0, fixtures_1.expect)(page.getByRole("menu")).not.toBeVisible();
|
|
272
|
+
}));
|
|
273
|
+
(0, fixtures_1.test)("component handles readOnly mode correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
274
|
+
const initialDate = "05/25/2024";
|
|
275
|
+
yield initTestBed(`<DatePicker testId="datePicker" readOnly="true" initialValue="${initialDate}" dateFormat="MM/dd/yyyy" />`);
|
|
276
|
+
yield page.getByTestId("datePicker").click();
|
|
277
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("26").click();
|
|
278
|
+
// The date should not change
|
|
279
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText(initialDate);
|
|
280
|
+
}));
|
|
281
|
+
fixtures_1.test.fixme("component handles minValue restrictions", component_test_helpers_1.SKIP_REASON.XMLUI_BUG("Prop does not work"), (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
282
|
+
yield initTestBed(`<DatePicker
|
|
283
|
+
testId="datePicker"
|
|
284
|
+
mode="range"
|
|
285
|
+
minValue="05/25/2024"
|
|
286
|
+
dateFormat="MM/dd/yyyy"
|
|
287
|
+
initialValue="{{ from: '05/26/2024', to: '05/27/2024' }}"
|
|
288
|
+
/>`);
|
|
289
|
+
yield page.getByTestId("datePicker").click();
|
|
290
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("May 24th").click();
|
|
291
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 24th")).toBeDisabled();
|
|
292
|
+
}));
|
|
293
|
+
fixtures_1.test.fixme("component handles maxValue restrictions", component_test_helpers_1.SKIP_REASON.XMLUI_BUG("Prop does not work"), (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
294
|
+
yield initTestBed(`<DatePicker
|
|
295
|
+
testId="datePicker"
|
|
296
|
+
mode="range"
|
|
297
|
+
minValue="05/25/2024"
|
|
298
|
+
initialValue="{{ from: '05/26/2024', to: '05/27/2024' }}"
|
|
299
|
+
dateFormat="MM/dd/yyyy"
|
|
300
|
+
/>`);
|
|
301
|
+
yield page.getByTestId("datePicker").click();
|
|
302
|
+
yield page.getByRole("grid", { name: "May" }).getByLabel("May 24th").click();
|
|
303
|
+
yield (0, fixtures_1.expect)(page.getByRole("grid", { name: "May" }).getByLabel("May 24th")).toBeDisabled();
|
|
304
|
+
}));
|
|
305
|
+
fixtures_1.test.fixme("component handles disabledDates correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
306
|
+
const today = new Date();
|
|
307
|
+
const testDayFormatted = (0, date_fns_1.format)(new Date(today.getFullYear(), today.getMonth(), 15), "MM/dd/yyyy");
|
|
308
|
+
yield initTestBed(`<DatePicker disabledDates={['${testDayFormatted}']} />`, {});
|
|
309
|
+
// Open the calendar
|
|
310
|
+
yield page.locator("button").click();
|
|
311
|
+
// The 15th day should be disabled
|
|
312
|
+
const testDay = "15";
|
|
313
|
+
const testDayCell = page.locator(".rdp-day").filter({ hasText: testDay }).first();
|
|
314
|
+
yield (0, fixtures_1.expect)(testDayCell).toHaveClass(/disabled/);
|
|
315
|
+
}));
|
|
316
|
+
// =============================================================================
|
|
317
|
+
// INTEGRATION TESTS
|
|
318
|
+
// =============================================================================
|
|
319
|
+
(0, fixtures_1.test)("component value API works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
320
|
+
yield initTestBed(`
|
|
321
|
+
<Fragment>
|
|
322
|
+
<DatePicker id="datePicker" initialValue="05/25/2024" dateFormat="MM/dd/yyyy" />
|
|
323
|
+
<Text testId="text">{datePicker.value}</Text>
|
|
324
|
+
</Fragment>
|
|
325
|
+
`);
|
|
326
|
+
yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveText("05/25/2024");
|
|
327
|
+
}));
|
|
328
|
+
(0, fixtures_1.test)("component setValue API works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
329
|
+
yield initTestBed(`
|
|
330
|
+
<Fragment>
|
|
331
|
+
<DatePicker id="datePicker" initialValue="05/25/2024" dateFormat="MM/dd/yyyy" />
|
|
332
|
+
<Button testId="btn" onClick="datePicker.setValue('06/01/2024')" />
|
|
333
|
+
</Fragment>
|
|
334
|
+
`);
|
|
335
|
+
yield page.getByTestId("btn").click();
|
|
336
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toHaveText("06/01/2024");
|
|
337
|
+
}));
|
|
338
|
+
(0, fixtures_1.test)("component focus API works", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
339
|
+
yield initTestBed(`
|
|
340
|
+
<Fragment>
|
|
341
|
+
<DatePicker id="datePicker" initialValue="05/25/2024" dateFormat="MM/dd/yyyy" />
|
|
342
|
+
<Button testId="focusBtn" onClick="datePicker.focus()" />
|
|
343
|
+
</Fragment>
|
|
344
|
+
`);
|
|
345
|
+
yield page.getByTestId("focusBtn").click();
|
|
346
|
+
yield (0, fixtures_1.expect)(page.getByTestId("datePicker")).toBeFocused();
|
|
347
|
+
}));
|
|
348
|
+
(0, fixtures_1.test)("component works correctly within a form", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
349
|
+
const { testStateDriver } = yield initTestBed(`
|
|
350
|
+
<Form onSubmit="(data) => testState = data.testField" data="{{ testField: '05/25/2024' }}">
|
|
351
|
+
<FormItem type="datePicker" label="Choose Date" bindTo="testField" />
|
|
352
|
+
</Form>
|
|
353
|
+
`);
|
|
354
|
+
const formElement = page.locator("form");
|
|
355
|
+
const dateInput = formElement.getByLabel("Choose Date");
|
|
356
|
+
yield (0, fixtures_1.expect)(dateInput).toBeVisible();
|
|
357
|
+
yield (0, fixtures_1.expect)(dateInput).toHaveText("05/25/2024");
|
|
358
|
+
// Submit the form
|
|
359
|
+
yield page.locator("[type=submit]").click();
|
|
360
|
+
// Check that the form was submitted
|
|
361
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual("05/25/2024");
|
|
362
|
+
}));
|
|
@@ -79,7 +79,7 @@ const Chevron = (_a) => {
|
|
|
79
79
|
exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, ref) {
|
|
80
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, minValue, maxValue, 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", "minValue", "maxValue", "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
|
-
const [
|
|
82
|
+
const [_, setIsMenuFocused] = (0, react_2.useState)(false);
|
|
83
83
|
const [referenceElement, setReferenceElement] = (0, react_2.useState)(null);
|
|
84
84
|
const [inlineMonth, setInlineMonth] = (0, react_2.useState)();
|
|
85
85
|
const generatedId = (0, react_1.useId)();
|
|
@@ -96,13 +96,13 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, ref) {
|
|
|
96
96
|
}
|
|
97
97
|
return undefined;
|
|
98
98
|
}, [value, mode]);
|
|
99
|
-
console.log("sel", selected);
|
|
100
99
|
(0, react_2.useEffect)(() => {
|
|
101
100
|
if (!exports.dateFormats.includes(dateFormat)) {
|
|
102
101
|
throw new Error(`Invalid dateFormat: ${dateFormat}. Supported formats are: ${exports.dateFormats.join(", ")}`);
|
|
103
102
|
}
|
|
104
103
|
}, [dateFormat]);
|
|
105
104
|
const startDate = (0, react_2.useMemo)(() => {
|
|
105
|
+
console.log(minValue, (0, date_fns_1.parse)(minValue, dateFormat, new Date()));
|
|
106
106
|
return minValue ? (0, date_fns_1.parse)(minValue, dateFormat, new Date()) : undefined;
|
|
107
107
|
}, [minValue, dateFormat]);
|
|
108
108
|
const endDate = (0, react_2.useMemo)(() => {
|
|
@@ -289,7 +289,7 @@ exports.DatePicker = (0, react_2.forwardRef)(function DatePicker(_a, ref) {
|
|
|
289
289
|
if (mode === "single") {
|
|
290
290
|
setOpen(false);
|
|
291
291
|
}
|
|
292
|
-
}, [onDidChange, updateState, mode, dateFormat]);
|
|
292
|
+
}, [onDidChange, updateState, mode, dateFormat, readOnly]);
|
|
293
293
|
return inline ? ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { id: inputId, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, ref: ref, children: (0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: DatePicker_module_scss_1.default.inlinePickerMenu, ref: (ref) => setReferenceElement(ref), children: (0, jsx_runtime_1.jsx)(react_day_picker_1.DayPicker, { id: inputId, 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: {
|
|
294
294
|
Chevron,
|
|
295
295
|
} }) })) })) : ((0, jsx_runtime_1.jsxs)(react_popover_1.Popover, { open: open, onOpenChange: setOpen, modal: false, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { id: inputId, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, className: className, ref: ref, children: (0, jsx_runtime_1.jsxs)(react_popover_1.PopoverTrigger, { ref: setReferenceElement, id: inputId, "aria-haspopup": true, disabled: !enabled, style: style, "aria-expanded": open, className: (0, classnames_1.default)(DatePicker_module_scss_1.default.datePicker, {
|