xmlui 0.10.19 → 0.10.21
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-cuh97e2e.mjs → index-BiS4wEuu.mjs} +1486 -1211
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-C-cnv--V.mjs → lib/initMock-CB_cMi6U.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-Cp-9lpnG.mjs → collectedComponentMetadata-MFUg6aSX.mjs} +1655 -1390
- package/dist/{lib/initMock-BMxsanHc.mjs → metadata/initMock-Dw9wrVkQ.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 +3 -6
- package/dist/scripts/src/components/Animation/AnimationNative.js +28 -28
- package/dist/scripts/src/components/App/App.js +4 -4
- package/dist/scripts/src/components/App/App.spec.js +17 -17
- package/dist/scripts/src/components/App/AppNative.js +1 -1
- 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/AutoCompleteNative.js +4 -4
- package/dist/scripts/src/components/Carousel/Carousel.spec.js +214 -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 +6 -6
- package/dist/scripts/src/components/DateInput/DateInputNative.js +0 -1
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +3 -3
- 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 -5
- 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/IFrame/IFrameNative.js +0 -2
- 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 +2 -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 +5 -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/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/Spinner/Spinner.spec.js +1 -1
- package/dist/scripts/src/components/Table/useRowSelection.js +14 -23
- package/dist/scripts/src/components/Text/Text.js +5 -1
- package/dist/scripts/src/components/Text/Text.spec.js +317 -0
- package/dist/scripts/src/components/Text/TextNative.js +112 -1
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +8 -8
- 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 +3 -3
- package/dist/scripts/src/components/TimeInput/TimeInputNative.js +0 -1
- package/dist/scripts/src/components/Timer/TimerNative.js +0 -1
- package/dist/scripts/src/components/Tree/TreeNative.js +16 -23
- 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 +35 -35
- package/package.json +3 -6
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const abstractions_1 = require("../abstractions");
|
|
13
13
|
const fixtures_1 = require("../../testing/fixtures");
|
|
14
|
+
const component_test_helpers_1 = require("../../testing/component-test-helpers");
|
|
14
15
|
// Test data constants
|
|
15
16
|
const errorDisplayInterceptor = {
|
|
16
17
|
initialize: `
|
|
@@ -177,6 +178,21 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
177
178
|
const driver = yield createFormDriver("form");
|
|
178
179
|
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
179
180
|
}));
|
|
181
|
+
(0, fixtures_1.test)("handles theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createFormItemDriver }) {
|
|
182
|
+
const spaceBase = 0.25; //rem
|
|
183
|
+
const labelSize = 10;
|
|
184
|
+
const widthInPx = labelSize * spaceBase * 16; //px
|
|
185
|
+
yield initTestBed(`
|
|
186
|
+
<Theme space-base="${spaceBase}rem">
|
|
187
|
+
<Form itemLabelWidth="$space-${labelSize}">
|
|
188
|
+
<FormItem label="Test Label" bindTo="test" testId="testField" />
|
|
189
|
+
</Form>
|
|
190
|
+
</Theme>
|
|
191
|
+
`);
|
|
192
|
+
const driver = yield createFormItemDriver("testField");
|
|
193
|
+
const labelWidth = yield (0, component_test_helpers_1.getElementStyle)(driver.label, "width");
|
|
194
|
+
(0, fixtures_1.expect)(labelWidth).toBe(`${widthInPx}px`);
|
|
195
|
+
}));
|
|
180
196
|
});
|
|
181
197
|
// =============================================================================
|
|
182
198
|
// ITEM LABEL BREAK TESTS
|
|
@@ -272,7 +288,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
272
288
|
}));
|
|
273
289
|
(0, fixtures_1.test)("onSuccess event fires on successful submission", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormDriver, }) {
|
|
274
290
|
const { testStateDriver } = yield initTestBed(`
|
|
275
|
-
<Form
|
|
291
|
+
<Form
|
|
276
292
|
testId="form"
|
|
277
293
|
submitUrl="/test-success"
|
|
278
294
|
onSuccess="testState = 'success'; console.log('Submitted successfully')"
|
|
@@ -296,7 +312,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
296
312
|
}));
|
|
297
313
|
(0, fixtures_1.test)("onReset event fires when form is reset", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
298
314
|
const { testStateDriver } = yield initTestBed(`
|
|
299
|
-
<Form
|
|
315
|
+
<Form
|
|
300
316
|
id="testForm"
|
|
301
317
|
onReset="testState = 'reset'"
|
|
302
318
|
data="{{ name: 'Test' }}">
|
|
@@ -314,7 +330,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
314
330
|
fixtures_1.test.describe("APIs", () => {
|
|
315
331
|
(0, fixtures_1.test)("update method updates form data", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
316
332
|
yield initTestBed(`
|
|
317
|
-
<Form
|
|
333
|
+
<Form
|
|
318
334
|
id="testForm"
|
|
319
335
|
data="{{ name: 'Original', age: 25 }}">
|
|
320
336
|
<FormItem label="Name" bindTo="name" testId="nameField" />
|
|
@@ -334,7 +350,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
334
350
|
}));
|
|
335
351
|
(0, fixtures_1.test)("reset method resets form to initial state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
336
352
|
yield initTestBed(`
|
|
337
|
-
<Form
|
|
353
|
+
<Form
|
|
338
354
|
id="testForm"
|
|
339
355
|
data="{{ name: 'Initial' }}">
|
|
340
356
|
<FormItem label="Name" bindTo="name" testId="nameField" />
|
|
@@ -603,7 +619,7 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
603
619
|
}));
|
|
604
620
|
(0, fixtures_1.test)("handles form with empty string properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
605
621
|
yield initTestBed(`
|
|
606
|
-
<Form
|
|
622
|
+
<Form
|
|
607
623
|
cancelLabel=""
|
|
608
624
|
saveLabel=""
|
|
609
625
|
data="{{ name: '' }}">
|
|
@@ -829,8 +845,8 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
829
845
|
</property>
|
|
830
846
|
</Form>`);
|
|
831
847
|
const driver = yield createFormDriver("form");
|
|
832
|
-
(0, fixtures_1.expect)(driver.submitButton).not.toBeVisible();
|
|
833
|
-
(0, fixtures_1.expect)(driver.cancelButton).not.toBeVisible();
|
|
848
|
+
yield (0, fixtures_1.expect)(driver.submitButton).not.toBeVisible();
|
|
849
|
+
yield (0, fixtures_1.expect)(driver.cancelButton).not.toBeVisible();
|
|
834
850
|
}));
|
|
835
851
|
(0, fixtures_1.test)("setting buttonRowTemplate without buttons still runs submit on Enter", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createFormDriver, }) {
|
|
836
852
|
const { testStateDriver } = yield initTestBed(`
|
|
@@ -1105,7 +1121,7 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
1105
1121
|
yield formDriver.submitForm();
|
|
1106
1122
|
yield (0, fixtures_1.expect)(fieldDriver.validationStatusIndicator).toHaveAttribute(fieldDriver.validationStatusTag, "warning");
|
|
1107
1123
|
}));
|
|
1108
|
-
fixtures_1.test.skip("field-related errors disappear if user updates FormItems", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver }) {
|
|
1124
|
+
fixtures_1.test.skip("field-related errors disappear if user updates FormItems", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, }) {
|
|
1109
1125
|
yield initTestBed(`
|
|
1110
1126
|
<Form testId="form">
|
|
1111
1127
|
<FormItem testId="testField" bindTo="test" label="test" required />
|
|
@@ -1196,7 +1212,7 @@ const smartCrudInterceptor = {
|
|
|
1196
1212
|
const formDriver = yield createFormDriver("modalForm");
|
|
1197
1213
|
const inputElement = (yield createFormItemDriver("nameInput")).input;
|
|
1198
1214
|
const inputDriver = yield createTextBoxDriver(inputElement);
|
|
1199
|
-
(yield createButtonDriver("openModalButton")).click();
|
|
1215
|
+
yield (yield createButtonDriver("openModalButton")).click();
|
|
1200
1216
|
yield (0, fixtures_1.expect)(inputDriver.field).toHaveValue("Smith");
|
|
1201
1217
|
yield inputDriver.field.fill("EDITED-Smith");
|
|
1202
1218
|
yield formDriver.submitForm("click");
|
|
@@ -45,6 +45,7 @@ const FormContext_1 = require("./FormContext");
|
|
|
45
45
|
const lodash_es_1 = require("lodash-es");
|
|
46
46
|
const classnames_1 = __importDefault(require("classnames"));
|
|
47
47
|
const react_slot_1 = require("@radix-ui/react-slot");
|
|
48
|
+
const layout_resolver_1 = require("../../components-core/theming/layout-resolver");
|
|
48
49
|
const PART_CANCEL_BUTTON = "cancelButton";
|
|
49
50
|
const PART_SUBMIT_BUTTON = "submitButton";
|
|
50
51
|
const getByPath = (obj, path) => {
|
|
@@ -204,7 +205,6 @@ function cleanUpSubject(subject) {
|
|
|
204
205
|
const Form = (0, react_2.forwardRef)(function (_a, ref) {
|
|
205
206
|
var { formState, dispatch, initialValue = constants_1.EMPTY_OBJECT, children, style, className, enabled = true, cancelLabel = exports.defaultProps.cancelLabel, saveLabel = exports.defaultProps.saveLabel, saveInProgressLabel = exports.defaultProps.saveInProgressLabel, swapCancelAndSave, onSubmit, onCancel, onReset, onSuccess, buttonRow, id, registerComponentApi, itemLabelBreak = exports.defaultProps.itemLabelBreak, itemLabelWidth, itemLabelPosition = exports.defaultProps.itemLabelPosition, keepModalOpenOnSubmit = exports.defaultProps.keepModalOpenOnSubmit, hideButtonRowUntilDirty } = _a, rest = __rest(_a, ["formState", "dispatch", "initialValue", "children", "style", "className", "enabled", "cancelLabel", "saveLabel", "saveInProgressLabel", "swapCancelAndSave", "onSubmit", "onCancel", "onReset", "onSuccess", "buttonRow", "id", "registerComponentApi", "itemLabelBreak", "itemLabelWidth", "itemLabelPosition", "keepModalOpenOnSubmit", "hideButtonRowUntilDirty"]);
|
|
206
207
|
const formRef = (0, react_2.useRef)(null);
|
|
207
|
-
(0, react_2.useImperativeHandle)(ref, () => formRef.current);
|
|
208
208
|
const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = (0, react_2.useState)(false);
|
|
209
209
|
const requestModalFormClose = (0, ModalVisibilityContext_1.useModalFormClose)();
|
|
210
210
|
const isEnabled = enabled && !formState.submitInProgress;
|
|
@@ -241,7 +241,7 @@ const Form = (0, react_2.forwardRef)(function (_a, ref) {
|
|
|
241
241
|
]);
|
|
242
242
|
const doCancel = (0, misc_1.useEvent)(() => {
|
|
243
243
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
244
|
-
requestModalFormClose();
|
|
244
|
+
void requestModalFormClose();
|
|
245
245
|
});
|
|
246
246
|
const doSubmit = (0, misc_1.useEvent)((event) => __awaiter(this, void 0, void 0, function* () {
|
|
247
247
|
var _a;
|
|
@@ -277,7 +277,7 @@ const Form = (0, react_2.forwardRef)(function (_a, ref) {
|
|
|
277
277
|
dispatch((0, formActions_1.formSubmitted)());
|
|
278
278
|
yield (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(result));
|
|
279
279
|
if (!keepModalOpenOnSubmit) {
|
|
280
|
-
requestModalFormClose();
|
|
280
|
+
void requestModalFormClose();
|
|
281
281
|
}
|
|
282
282
|
// we only reset the form automatically if the initial value is empty ()
|
|
283
283
|
if (initialValue === constants_1.EMPTY_OBJECT) {
|
|
@@ -353,7 +353,7 @@ const Form = (0, react_2.forwardRef)(function (_a, ref) {
|
|
|
353
353
|
update: updateData,
|
|
354
354
|
});
|
|
355
355
|
}, [doReset, updateData, registerComponentApi]);
|
|
356
|
-
let safeButtonRow = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] })) });
|
|
356
|
+
let safeButtonRow = ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] })) }));
|
|
357
357
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, react_1.createElement)("form", Object.assign({}, rest, { style: style, className: (0, classnames_1.default)(Form_module_scss_1.default.wrapper, className), onSubmit: doSubmit, onReset: doReset, id: id, key: formState.resetVersion, ref: formRef }),
|
|
358
358
|
(0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults }),
|
|
359
359
|
(0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, { value: formContextValue, children: children }),
|
|
@@ -395,7 +395,9 @@ exports.FormWithContextVar = (0, react_2.forwardRef)(function ({ node, renderChi
|
|
|
395
395
|
const errorNotificationMessage = extractValue.asOptionalString(node.props.errorNotificationMessage) || "";
|
|
396
396
|
const submitUrl = extractValue.asOptionalString(node.props.submitUrl) ||
|
|
397
397
|
extractValue.asOptionalString(node.props._data_url);
|
|
398
|
-
|
|
398
|
+
const itemLabelWidth = extractValue.asOptionalString(node.props.itemLabelWidth);
|
|
399
|
+
const { cssProps: itemLabelWidthCssProps } = (0, layout_resolver_1.resolveLayoutProps)({ width: itemLabelWidth });
|
|
400
|
+
return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { ref: ref, style: style, children: (0, jsx_runtime_1.jsx)(Form, { keepModalOpenOnSubmit: extractValue.asOptionalBoolean(node.props.keepModalOpenOnSubmit), itemLabelPosition: extractValue.asOptionalString(node.props.itemLabelPosition), itemLabelBreak: extractValue.asOptionalBoolean(node.props.itemLabelBreak), itemLabelWidth: itemLabelWidthCssProps.width, hideButtonRowUntilDirty: extractValue.asOptionalBoolean(node.props.hideButtonRowUntilDirty), formState: formState, dispatch: dispatch, id: node.uid, className: className, cancelLabel: extractValue(node.props.cancelLabel), saveLabel: extractValue(node.props.saveLabel), saveInProgressLabel: extractValue(node.props.saveInProgressLabel), swapCancelAndSave: extractValue.asOptionalBoolean(node.props.swapCancelAndSave, false), onSubmit: lookupEventHandler("submit", {
|
|
399
401
|
defaultHandler: submitUrl
|
|
400
402
|
? `(eventArgs)=> Actions.callApi({ url: "${submitUrl}", method: "${submitMethod}", body: eventArgs, inProgressNotificationMessage: "${inProgressNotificationMessage}", completedNotificationMessage: "${completedNotificationMessage}", errorNotificationMessage: "${errorNotificationMessage}" })`
|
|
401
403
|
: undefined,
|
|
@@ -33,7 +33,9 @@ exports.FormItemMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
33
33
|
description: "`FormItem` wraps individual input controls within a `Form`, providing data " +
|
|
34
34
|
"binding, validation, labeling, and layout functionality. It connects form " +
|
|
35
35
|
"controls to the parent form's data model and handles validation feedback " +
|
|
36
|
-
"automatically."
|
|
36
|
+
"automatically." +
|
|
37
|
+
"\n\n" +
|
|
38
|
+
"> **Note:** `FormItem` must be used inside a `Form` component.",
|
|
37
39
|
props: {
|
|
38
40
|
bindTo: {
|
|
39
41
|
description: "This property binds a particular input field to one of the attributes of the \`Form\` data. " +
|
|
@@ -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
|
// =============================================================================
|
|
15
14
|
// BASIC FUNCTIONALITY TESTS
|
|
@@ -855,18 +854,10 @@ fixtures_1.test.describe("Other Edge Cases", () => {
|
|
|
855
854
|
yield input.field.blur();
|
|
856
855
|
yield (0, fixtures_1.expect)(driver.validationStatusIndicator).toBeVisible();
|
|
857
856
|
}));
|
|
858
|
-
fixtures_1.test
|
|
859
|
-
yield initTestBed(
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
// Component should either render with fallback behavior or be gracefully hidden
|
|
864
|
-
const isVisible = yield driver.component.isVisible();
|
|
865
|
-
if (isVisible) {
|
|
866
|
-
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
867
|
-
}
|
|
868
|
-
else {
|
|
869
|
-
(0, fixtures_1.expect)(isVisible).toBe(false);
|
|
870
|
-
}
|
|
857
|
+
(0, fixtures_1.test)("handles FormItem with no Form parent gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
858
|
+
yield initTestBed(`<FormItem label="Standalone FormItem" type="text" />`);
|
|
859
|
+
const field = page.getByRole("textbox");
|
|
860
|
+
yield (0, fixtures_1.expect)(field).not.toBeVisible();
|
|
861
|
+
yield (0, fixtures_1.expect)(page.locator("[data-error-boundary]")).toBeVisible();
|
|
871
862
|
}));
|
|
872
863
|
});
|
|
@@ -112,15 +112,15 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
112
112
|
return safeBindTo;
|
|
113
113
|
}
|
|
114
114
|
}, [bindTo, defaultId, itemIndex, parentFormItemId]);
|
|
115
|
-
const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || value.itemLabelWidth);
|
|
116
|
-
const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value.itemLabelBreak);
|
|
117
|
-
const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || value.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type]);
|
|
118
|
-
const initialValueFromSubject = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.originalSubject, formItemId));
|
|
115
|
+
const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || (value === null || value === void 0 ? void 0 : value.itemLabelWidth));
|
|
116
|
+
const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value === null || value === void 0 ? void 0 : value.itemLabelBreak);
|
|
117
|
+
const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || (value === null || value === void 0 ? void 0 : value.itemLabelPosition) || DEFAULT_LABEL_POSITIONS[type]);
|
|
118
|
+
const initialValueFromSubject = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value === null || value === void 0 ? void 0 : value.originalSubject, formItemId));
|
|
119
119
|
const initialValue = initialValueFromSubject === undefined ? initialValueFromProps : initialValueFromSubject;
|
|
120
|
-
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, formItemId));
|
|
121
|
-
const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[formItemId]);
|
|
122
|
-
const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
|
|
123
|
-
const formEnabled = (0, FormContext_1.useFormContextPart)((value) => value.enabled);
|
|
120
|
+
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value === null || value === void 0 ? void 0 : value.subject, formItemId));
|
|
121
|
+
const validationResult = (0, FormContext_1.useFormContextPart)((value) => value === null || value === void 0 ? void 0 : value.validationResults[formItemId]);
|
|
122
|
+
const dispatch = (0, FormContext_1.useFormContextPart)((value) => value === null || value === void 0 ? void 0 : value.dispatch);
|
|
123
|
+
const formEnabled = (0, FormContext_1.useFormContextPart)((value) => value === null || value === void 0 ? void 0 : value.enabled);
|
|
124
124
|
const isEnabled = enabled && formEnabled;
|
|
125
125
|
(0, react_1.useEffect)(() => {
|
|
126
126
|
if (initialValue !== undefined) {
|
|
@@ -217,6 +217,10 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
const [animateContainerRef] = (0, react_2.useAutoAnimate)({ duration: 100 });
|
|
220
|
+
const isInsideForm = (0, FormContext_1.useIsInsideForm)();
|
|
221
|
+
if (!isInsideForm) {
|
|
222
|
+
throw new Error("FormItem must be used inside a Form");
|
|
223
|
+
}
|
|
220
224
|
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { labelPosition: labelPositionValue, label: label, labelWidth: labelWidthValue, labelBreak: labelBreakValue, enabled: isEnabled, required: validations.required, validationInProgress: validationResult === null || validationResult === void 0 ? void 0 : validationResult.partial, onFocus: onFocus, onBlur: onBlur, style: style, className: className, validationResult: (0, jsx_runtime_1.jsx)("div", { ref: animateContainerRef, children: isHelperTextShown &&
|
|
221
225
|
(validationResult === null || validationResult === void 0 ? void 0 : validationResult.validations.map((singleValidation, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [singleValidation.isValid && !!singleValidation.validMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.validMessage, status: "valid", style: { opacity: singleValidation.stale ? 0.5 : undefined } })), !singleValidation.isValid && !!singleValidation.invalidMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.invalidMessage, status: singleValidation.severity, style: { opacity: singleValidation.stale ? 0.5 : undefined } }))] }, i)))) }), children: formControl }));
|
|
222
226
|
});
|
|
@@ -273,7 +273,7 @@ function useValidation(validations, onValidate, value, dispatch, bindTo, throttl
|
|
|
273
273
|
if (!ignore) {
|
|
274
274
|
dispatch((0, formActions_1.fieldValidated)(bindTo, partialResult));
|
|
275
275
|
if (partialResult.partial) {
|
|
276
|
-
(() => __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
277
277
|
const result = yield throttledAsyncValidate(validations, onValidate, deferredValue);
|
|
278
278
|
if (!ignore) {
|
|
279
279
|
// console.log(`async validation result for ${bindTo}`, result);
|
|
@@ -288,7 +288,7 @@ function useValidation(validations, onValidate, value, dispatch, bindTo, throttl
|
|
|
288
288
|
}, [bindTo, deferredValue, dispatch, onValidate, throttledAsyncValidate, validations]);
|
|
289
289
|
}
|
|
290
290
|
function useValidationDisplay(bindTo, value, validationResult, validationMode = FormContext_1.defaultValidationMode) {
|
|
291
|
-
const interactionFlags = (0, FormContext_1.useFormContextPart)((value) => value.interactionFlags[bindTo]) || constants_1.EMPTY_OBJECT;
|
|
291
|
+
const interactionFlags = (0, FormContext_1.useFormContextPart)((value) => value === null || value === void 0 ? void 0 : value.interactionFlags[bindTo]) || constants_1.EMPTY_OBJECT;
|
|
292
292
|
const forceShowValidationResult = interactionFlags.forceShowValidationResult;
|
|
293
293
|
const focused = interactionFlags.focused;
|
|
294
294
|
const afterFirstDirtyBlur = interactionFlags.afterFirstDirtyBlur;
|
|
@@ -22,8 +22,6 @@ const IFrame_module_scss_1 = __importDefault(require("./IFrame.module.scss"));
|
|
|
22
22
|
exports.IFrame = (0, react_1.memo)((0, react_1.forwardRef)(function IFrame(_a, ref) {
|
|
23
23
|
var { src, srcdoc, allow, name, referrerPolicy, sandbox, style, className, onLoad, registerComponentApi } = _a, rest = __rest(_a, ["src", "srcdoc", "allow", "name", "referrerPolicy", "sandbox", "style", "className", "onLoad", "registerComponentApi"]);
|
|
24
24
|
const iframeRef = (0, react_1.useRef)(null);
|
|
25
|
-
// Expose the iframe element to parent via ref
|
|
26
|
-
(0, react_1.useImperativeHandle)(ref, () => iframeRef.current, []);
|
|
27
25
|
// Register component APIs
|
|
28
26
|
(0, react_1.useEffect)(() => {
|
|
29
27
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
@@ -293,7 +293,7 @@ function useCustomSvgIconRenderer(resourceUrl) {
|
|
|
293
293
|
if (!resourceUrl) {
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
ensureCustomSvgIcon(resourceUrl);
|
|
296
|
+
void ensureCustomSvgIcon(resourceUrl);
|
|
297
297
|
}, [ensureCustomSvgIcon, resourceUrl]);
|
|
298
298
|
const customSvg = resourceUrl ? customSvgs[resourceUrl] : null;
|
|
299
299
|
const iconRenderer = (0, react_1.useCallback)(({ style, className }) => {
|
|
@@ -293,7 +293,7 @@ exports.ListNative = (0, react_1.forwardRef)(function DynamicHeightList(_a, ref)
|
|
|
293
293
|
!pageInfo.isFetchingPrevPage &&
|
|
294
294
|
!isFetchingPrevPage.current) {
|
|
295
295
|
isFetchingPrevPage.current = true;
|
|
296
|
-
(function doFetch() {
|
|
296
|
+
void (function doFetch() {
|
|
297
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
298
298
|
try {
|
|
299
299
|
yield requestFetchPrevPage();
|
|
@@ -314,7 +314,7 @@ exports.ListNative = (0, react_1.forwardRef)(function DynamicHeightList(_a, ref)
|
|
|
314
314
|
!pageInfo.isFetchingNextPage &&
|
|
315
315
|
!isFetchingNextPage.current) {
|
|
316
316
|
isFetchingNextPage.current = true;
|
|
317
|
-
(function doFetch() {
|
|
317
|
+
void (function doFetch() {
|
|
318
318
|
return __awaiter(this, void 0, void 0, function* () {
|
|
319
319
|
try {
|
|
320
320
|
yield requestFetchNextPage();
|
|
@@ -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
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
36
|
exports.ConfirmationModalContextProvider = exports.useConfirm = void 0;
|
|
46
37
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -49,7 +40,7 @@ const ButtonNative_1 = require("../Button/ButtonNative");
|
|
|
49
40
|
const StackNative_1 = require("../Stack/StackNative");
|
|
50
41
|
const Dialog_1 = require("./Dialog");
|
|
51
42
|
const ConfirmationModalContext = react_1.default.createContext({
|
|
52
|
-
confirm: (title, message, actionLabel) =>
|
|
43
|
+
confirm: (title, message, actionLabel) => Promise.resolve(false),
|
|
53
44
|
});
|
|
54
45
|
const useConfirm = () => (0, react_1.useContext)(ConfirmationModalContext);
|
|
55
46
|
exports.useConfirm = useConfirm;
|
|
@@ -73,7 +64,7 @@ const ConfirmationModalContextProvider = ({ children }) => {
|
|
|
73
64
|
}, 0);
|
|
74
65
|
}
|
|
75
66
|
}, [showConfirmationModal]);
|
|
76
|
-
const handleShow = (0, react_1.useCallback)((title, message, actionLabel) =>
|
|
67
|
+
const handleShow = (0, react_1.useCallback)((title, message, actionLabel) => {
|
|
77
68
|
if (typeof title === "string") {
|
|
78
69
|
setTitle(title);
|
|
79
70
|
setButtons([
|
|
@@ -93,7 +84,7 @@ const ConfirmationModalContextProvider = ({ children }) => {
|
|
|
93
84
|
return new Promise(function (resolve) {
|
|
94
85
|
resolver.current = resolve;
|
|
95
86
|
});
|
|
96
|
-
}
|
|
87
|
+
}, []);
|
|
97
88
|
const handleOk = (0, react_1.useCallback)((value) => {
|
|
98
89
|
if (resolver.current) {
|
|
99
90
|
resolver.current(value);
|
|
@@ -25,7 +25,7 @@ exports.ModalDialogMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
25
25
|
},
|
|
26
26
|
title: {
|
|
27
27
|
description: "The title area of the modal dialog.",
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
29
|
},
|
|
30
30
|
props: {
|
|
31
31
|
fullScreen: {
|
|
@@ -81,5 +81,5 @@ exports.modalViewComponentRenderer = (0, renderers_1.createComponentRenderer)(CO
|
|
|
81
81
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node, renderChild: renderChild, layoutContext: { _insideModalFrame: true }, contextVars: { $param: openParams === null || openParams === void 0 ? void 0 : openParams[0], $params: openParams } }));
|
|
82
82
|
} }));
|
|
83
83
|
}
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { className: className, fullScreen: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.fullScreen), title: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.title), closeButtonVisible: extractValue.asOptionalBoolean(node.props.closeButtonVisible), children: renderChild(node.children, { type: "Stack" }) }));
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { className: className, fullScreen: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.fullScreen), title: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.title), closeButtonVisible: extractValue.asOptionalBoolean(node.props.closeButtonVisible), externalAnimation: extractValue.asOptionalBoolean(node.props.externalAnimation), children: renderChild(node.children, { type: "Stack" }) }));
|
|
85
85
|
});
|
|
@@ -130,7 +130,7 @@ function useModalOpenState(isInitiallyOpen = true, onOpen, onClose) {
|
|
|
130
130
|
return modalStateContext || modalLocalOpenState;
|
|
131
131
|
}
|
|
132
132
|
exports.ModalDialog = react_1.default.forwardRef((_a, ref) => {
|
|
133
|
-
var { children, style, isInitiallyOpen, fullScreen = exports.defaultProps.fullScreen, title, closeButtonVisible = exports.defaultProps.closeButtonVisible, className, onOpen, onClose } = _a, rest = __rest(_a, ["children", "style", "isInitiallyOpen", "fullScreen", "title", "closeButtonVisible", "className", "onOpen", "onClose"]);
|
|
133
|
+
var { children, style, isInitiallyOpen, fullScreen = exports.defaultProps.fullScreen, title, closeButtonVisible = exports.defaultProps.closeButtonVisible, className, onOpen, onClose, externalAnimation = true } = _a, rest = __rest(_a, ["children", "style", "isInitiallyOpen", "fullScreen", "title", "closeButtonVisible", "className", "onOpen", "onClose", "externalAnimation"]);
|
|
134
134
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
135
135
|
// NOTE: at this point, we can't use useAppContext here,
|
|
136
136
|
// since the ModalDialog context provider (via ConfirmationModalContextProvider) is mounted outside of the AppContext,
|
|
@@ -180,9 +180,12 @@ exports.ModalDialog = react_1.default.forwardRef((_a, ref) => {
|
|
|
180
180
|
if (!root) {
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
|
-
const Content = ((0, jsx_runtime_1.jsxs)(Dialog.Content, Object.assign({}, rest, { "data-part-id": PART_CONTENT, className: (0, classnames_1.default)(
|
|
183
|
+
const Content = ((0, jsx_runtime_1.jsxs)(Dialog.Content, Object.assign({}, rest, { "data-part-id": PART_CONTENT, className: (0, classnames_1.default)({
|
|
184
|
+
[ModalDialog_module_scss_1.default.contentAnimation]: !externalAnimation,
|
|
185
|
+
}, ModalDialog_module_scss_1.default.content, className), onPointerDownOutside: (event) => {
|
|
184
186
|
if (event.target instanceof Element &&
|
|
185
|
-
(event.target.closest("._debug-inspect-button") !== null ||
|
|
187
|
+
(event.target.closest("._debug-inspect-button") !== null ||
|
|
188
|
+
event.target.localName === "com-1password-button")) {
|
|
186
189
|
//we prevent the auto modal close on clicking the inspect button
|
|
187
190
|
event.preventDefault();
|
|
188
191
|
}
|
|
@@ -70,7 +70,7 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
|
|
|
70
70
|
[NestedApp_module_scss_1.default.show]: !showCode,
|
|
71
71
|
[NestedApp_module_scss_1.default.hide]: showCode,
|
|
72
72
|
}), children: "UI" })] })] })), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.wrapper, style: { width: controlsWidth }, children: [allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
73
|
-
openPlayground();
|
|
73
|
+
void openPlayground();
|
|
74
74
|
}, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
75
75
|
setShowCode(false);
|
|
76
76
|
setRefreshVersion(refreshVersion + 1);
|
|
@@ -137,7 +137,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
137
137
|
return null;
|
|
138
138
|
}));
|
|
139
139
|
// When your component mounts and the shadow root is available...
|
|
140
|
-
Promise.all(sheetPromises).then((sheets) => {
|
|
140
|
+
void Promise.all(sheetPromises).then((sheets) => {
|
|
141
141
|
// Filter out any sheets that failed to load
|
|
142
142
|
const validSheets = sheets.filter(Boolean);
|
|
143
143
|
// Apply the array of constructed stylesheets to the shadow root
|
|
@@ -217,7 +217,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
217
217
|
[NestedApp_module_scss_1.default.initialized]: initialized,
|
|
218
218
|
}) })] }));
|
|
219
219
|
}
|
|
220
|
-
function NestedAppRoot({ children, themeStylesToReset }) {
|
|
220
|
+
function NestedAppRoot({ children, themeStylesToReset, }) {
|
|
221
221
|
// css variables are leaking into to shadow dom, so we reset them here
|
|
222
222
|
const themeVarReset = (0, react_1.useMemo)(() => {
|
|
223
223
|
const vars = {};
|
|
@@ -227,5 +227,5 @@ function NestedAppRoot({ children, themeStylesToReset }) {
|
|
|
227
227
|
return vars;
|
|
228
228
|
}, [themeStylesToReset]);
|
|
229
229
|
const resetClassName = (0, StyleContext_1.useStyles)(themeVarReset, { prepend: true });
|
|
230
|
-
return (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(resetClassName, NestedApp_module_scss_1.default.shadowRoot), id: "nested-app-root", children: (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.content, children: children }) });
|
|
230
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(resetClassName, NestedApp_module_scss_1.default.shadowRoot), id: "nested-app-root", children: (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.content, children: children }) }));
|
|
231
231
|
}
|
|
@@ -201,9 +201,9 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
201
201
|
yield initTestBed(`<NumberBox zeroOrPositive="true" initialValue="1" />`);
|
|
202
202
|
const driver = yield createNumberBoxDriver();
|
|
203
203
|
yield driver.decrement();
|
|
204
|
-
(0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
204
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
205
205
|
yield driver.decrement();
|
|
206
|
-
(0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
206
|
+
yield (0, fixtures_1.expect)(driver.input).toHaveValue("0");
|
|
207
207
|
}));
|
|
208
208
|
// --- Range validation (min/max)
|
|
209
209
|
(0, fixtures_1.test)("minValue prevents values below minimum spinner button", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createNumberBoxDriver, }) {
|
|
@@ -634,6 +634,11 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
634
634
|
yield page.keyboard.press("Tab");
|
|
635
635
|
yield (0, fixtures_1.expect)(page.getByRole("button", { name: "Page 2" })).toBeFocused();
|
|
636
636
|
}));
|
|
637
|
+
(0, fixtures_1.test)("page size selector is focused when label is clicked", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
638
|
+
yield initTestBed(`<Pagination itemCount="50" pageSize="10" pageSizeOptions="{[5, 10, 20]}"/>`);
|
|
639
|
+
yield page.getByText("Items per page").click();
|
|
640
|
+
yield (0, fixtures_1.expect)(page.locator("select")).toBeFocused();
|
|
641
|
+
}));
|
|
637
642
|
});
|
|
638
643
|
// =============================================================================
|
|
639
644
|
// INTERACTION TESTS
|
|
@@ -140,9 +140,7 @@ exports.PaginationNative = (0, react_1.forwardRef)(function PaginationNative(_a,
|
|
|
140
140
|
visiblePages.map((pageNum) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: pageNum === currentPageNumber ? "solid" : "ghost", disabled: !enabled, size: "sm", onClick: () => handlePageChange(pageNum - 1), contextualLabel: `Page ${pageNum}`, "aria-current": pageNum === currentPageNumber || undefined, "aria-label": `Page ${pageNum}${pageNum === currentPageNumber ? " (current)" : ""}`, children: pageNum }) }, `page-${pageNum}`))), visiblePages.length <= 2 && ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", size: "sm", disabled: !enabled || isLastPage, onClick: () => handlePageChange(currentPage + 1), contextualLabel: "Next page", style: { minHeight: "36px", padding: "8px" }, "aria-label": "Next page", children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: `next:Pagination`, fallback: orientation === "vertical" ? "chevrondown" : "chevronright", size: "sm" }) }) })), (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", size: "sm", disabled: !enabled || isLastPage, onClick: () => handlePageChange(totalPages - 1), contextualLabel: "Last page", style: { minHeight: "36px", padding: "8px" }, "aria-label": "Last page", children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: `last:Pagination`, fallback: orientation === "vertical" ? "doublechevrondown" : "doublechevronright", size: "sm" }) }) })] }));
|
|
141
141
|
const pageSizeSelector = showPageSizeSelector &&
|
|
142
142
|
pageSizeOptions &&
|
|
143
|
-
pageSizeOptions.length > 1 && ((0, jsx_runtime_1.jsx)("div", { "data-component": `page-size-selector-container`, className: (0, classnames_1.default)(Pagination_module_scss_1.default.selectorContainer), children: (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { id: `${id}-page-size-selector`, label: "Items per page", enabled: enabled, style: style, className: className, labelPosition: orientation === "vertical" ? "top" : "start",
|
|
144
|
-
// NOTE: This is a band-aid solution to handle the multiple IDs issue - remove after resolving focus bug
|
|
145
|
-
isInputTemplateUsed: true, children: (0, jsx_runtime_1.jsx)("select", { id: `${id}-page-size-selector`, value: pageSize, onChange: (e) => handlePageSizeChange(Number(e.target.value)), disabled: !enabled, className: Pagination_module_scss_1.default.pageSizeSelect, children: pageSizeOptions.map((size) => ((0, jsx_runtime_1.jsx)("option", { value: size, children: size }, size))) }) }) }));
|
|
143
|
+
pageSizeOptions.length > 1 && ((0, jsx_runtime_1.jsx)("div", { "data-component": `page-size-selector-container`, className: (0, classnames_1.default)(Pagination_module_scss_1.default.selectorContainer), children: (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { id: `${id}-page-size-selector`, label: "Items per page", enabled: enabled, style: style, className: className, labelPosition: orientation === "vertical" ? "top" : "start", children: (0, jsx_runtime_1.jsx)("select", { id: `${id}-page-size-selector`, value: pageSize, onChange: (e) => handlePageSizeChange(Number(e.target.value)), disabled: !enabled, className: Pagination_module_scss_1.default.pageSizeSelect, children: pageSizeOptions.map((size) => ((0, jsx_runtime_1.jsx)("option", { value: size, children: size }, size))) }) }) }));
|
|
146
144
|
const pageInfo = showPageInfo && ((0, jsx_runtime_1.jsx)("div", { "data-component": `page-info`, className: (0, classnames_1.default)(Pagination_module_scss_1.default.pageInfo), children: (0, jsx_runtime_1.jsxs)(TextNative_1.Text, { variant: "secondary", children: ["Page ", currentPageNumber, " of ", totalPages, " (", itemCount, " items)"] }) }));
|
|
147
145
|
// Used the following resource to provide a11y:
|
|
148
146
|
// https://a11ymatters.com/pattern/pagination/
|