@oods/components-vue 0.4.0 → 0.4.2

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/ported.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { dateTimeInputValue, formatDateTime, formatReadOnlyValue, STATUS_ICON_SVG_ATTRS, STATUS_ICON_SHAPES, getStatusPresentation, resolveStatusIcon, currencyMinorUnits } from '@oods/component-contracts';
2
- import { defineComponent, h, useId, computed, ref, onMounted, watch, onBeforeUnmount } from 'vue';
2
+ import { defineComponent, h, useId, computed, ref, onMounted, onBeforeUnmount, watch } from 'vue';
3
3
 
4
4
  // src/ported.ts
5
5
  function statusIcon(name) {
@@ -185,6 +185,31 @@ defineComponent({
185
185
  }
186
186
  });
187
187
  var canShowModal = () => typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
188
+ var pageLocks = 0;
189
+ var pageStyle;
190
+ function lockPageScroll() {
191
+ const page = document.documentElement;
192
+ if (pageLocks++ === 0) {
193
+ const scrollbar = window.innerWidth - page.clientWidth;
194
+ pageStyle = { overflow: page.style.overflow, paddingRight: page.style.paddingRight };
195
+ if (scrollbar > 0) page.style.paddingRight = `${parseFloat(getComputedStyle(page).paddingRight) + scrollbar}px`;
196
+ page.style.overflow = "hidden";
197
+ }
198
+ let held = true;
199
+ return () => {
200
+ if (!held) return;
201
+ held = false;
202
+ if (--pageLocks === 0 && pageStyle) {
203
+ page.style.overflow = pageStyle.overflow;
204
+ page.style.paddingRight = pageStyle.paddingRight;
205
+ pageStyle = void 0;
206
+ }
207
+ };
208
+ }
209
+ var outsideBox = (event, dialog) => {
210
+ const box = dialog.getBoundingClientRect();
211
+ return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
212
+ };
188
213
  defineComponent({
189
214
  name: "OodsDialog",
190
215
  props: {
@@ -206,15 +231,24 @@ defineComponent({
206
231
  const element = ref(null);
207
232
  const mounted = ref(false);
208
233
  const managed = computed(() => props.modal && mounted.value && canShowModal());
234
+ let unlockScroll;
235
+ let pressedBackdrop = false;
236
+ const releaseScroll = () => {
237
+ unlockScroll?.();
238
+ unlockScroll = void 0;
239
+ };
209
240
  const sync = () => {
210
241
  const dialog = element.value;
211
242
  if (!dialog || !managed.value) return;
212
- if (props.open && !dialog.open) dialog.showModal();
213
- else if (!props.open && dialog.open) dialog.close();
243
+ if (props.open && !dialog.open) {
244
+ dialog.showModal();
245
+ unlockScroll ??= lockPageScroll();
246
+ } else if (!props.open && dialog.open) dialog.close();
214
247
  };
215
248
  onMounted(() => {
216
249
  mounted.value = true;
217
250
  });
251
+ onBeforeUnmount(releaseScroll);
218
252
  watch([() => props.open, managed], sync, { flush: "post" });
219
253
  const requestClose = (event) => {
220
254
  event.preventDefault();
@@ -237,10 +271,23 @@ defineComponent({
237
271
  if (event.key === "Escape" && !event.defaultPrevented) requestClose(event);
238
272
  },
239
273
  onCancel: requestClose,
240
- // The browser closed it (a close request it would not let be cancelled) while open is still true. A close event
241
- // from moving a mounted dialog into the top layer finds it open again, and is not reported.
274
+ // A close event from moving a mounted dialog into the top layer finds it open again, and is not reported. Any other
275
+ // close releases the page; when the browser closed it (a close request it would not let be cancelled) while open is
276
+ // still true, it is reported.
242
277
  onClose: () => {
243
- if (props.open && !element.value?.open) emit("close");
278
+ if (element.value?.open) return;
279
+ releaseScroll();
280
+ if (props.open) emit("close");
281
+ },
282
+ onMousedown: (event) => {
283
+ pressedBackdrop = managed.value && event.target === event.currentTarget && outsideBox(event, event.currentTarget);
284
+ },
285
+ // s223-m02 (#2527 ruling 13b): a click on the backdrop emits close, as the close control does. A press that began
286
+ // inside the dialog (text selected and dragged out) is not a backdrop click.
287
+ onClick: (event) => {
288
+ const backdrop = pressedBackdrop && event.target === event.currentTarget && outsideBox(event, event.currentTarget);
289
+ pressedBackdrop = false;
290
+ if (backdrop) emit("close");
244
291
  }
245
292
  }, [
246
293
  h("div", { class: "oods-dialog__header" }, [
@@ -1061,12 +1108,15 @@ var CancellationSummary = defineComponent({
1061
1108
  cancelAtPeriodEndField: String,
1062
1109
  requestedAtField: String,
1063
1110
  reasonField: String,
1064
- codeField: String
1111
+ codeField: String,
1112
+ // s224-m01 (#2542 ruling 6): Boolean first, as the badges' hideWhenFalse is (a bare attribute casts to true).
1113
+ hideWhenDefault: { type: [Boolean, String], default: void 0 }
1065
1114
  },
1066
1115
  setup(props, { attrs, slots }) {
1067
1116
  return () => {
1068
1117
  const slotValue = slotSummaryValue(slots);
1069
1118
  const cancellationValue = props.cancelAtPeriodEnd ?? slotValue;
1119
+ if (props.hideWhenDefault === true && props.cancelAtPeriodEnd === false && !props.requestedAt && !props.reason && !props.code && slotValue === void 0) return null;
1070
1120
  const rows = [];
1071
1121
  if (cancellationValue !== void 0) {
1072
1122
  rows.push(summaryEntry(
@@ -2262,6 +2262,79 @@
2262
2262
  }
2263
2263
  }
2264
2264
  },
2265
+ {
2266
+ "componentId": "Combobox",
2267
+ "state": "implemented-evidence-complete",
2268
+ "emissionEligible": true,
2269
+ "evidence": {
2270
+ "versionedContract": {
2271
+ "status": "passed",
2272
+ "refs": [
2273
+ "packages/component-contracts/src/contracts.ts#Combobox"
2274
+ ]
2275
+ },
2276
+ "targetImplementation": {
2277
+ "status": "passed",
2278
+ "refs": [
2279
+ "packages/components-vue/src/combobox.ts#Combobox"
2280
+ ]
2281
+ },
2282
+ "packageExport": {
2283
+ "status": "passed",
2284
+ "refs": [
2285
+ "packages/components-vue/src/index.ts#Combobox"
2286
+ ]
2287
+ },
2288
+ "publicDeclaration": {
2289
+ "status": "passed",
2290
+ "refs": [
2291
+ "packages/components-vue/dist/index.d.ts#Combobox"
2292
+ ]
2293
+ },
2294
+ "dependencyClosure": {
2295
+ "status": "passed",
2296
+ "refs": [
2297
+ "packages/components-vue/test/package-contract.spec.ts#dependency-closure"
2298
+ ]
2299
+ },
2300
+ "frameworkScenario": {
2301
+ "status": "passed",
2302
+ "refs": [
2303
+ "packages/components-vue/test/scenarios.spec.ts#combobox-filter-and-pick"
2304
+ ]
2305
+ },
2306
+ "accessibility": {
2307
+ "status": "passed",
2308
+ "classification": "verified",
2309
+ "refs": [
2310
+ "artifacts/product-reality/sprint-223/m02/combobox/vue-measured.json#Combobox"
2311
+ ]
2312
+ },
2313
+ "interaction": {
2314
+ "status": "passed",
2315
+ "classification": "verified",
2316
+ "refs": [
2317
+ "artifacts/product-reality/sprint-223/m02/combobox/vue-measured.json#Combobox"
2318
+ ]
2319
+ },
2320
+ "visualThemes": {
2321
+ "status": "passed",
2322
+ "classification": "verified",
2323
+ "cells": [
2324
+ "A-light",
2325
+ "A-dark",
2326
+ "A-hc",
2327
+ "B-light",
2328
+ "B-dark",
2329
+ "B-hc"
2330
+ ],
2331
+ "refs": [
2332
+ "artifacts/product-reality/sprint-223/m02/combobox/vue-theme/report.json#Combobox"
2333
+ ]
2334
+ }
2335
+ },
2336
+ "measurementRoot": "artifacts/product-reality/sprint-223/m02/combobox"
2337
+ },
2265
2338
  {
2266
2339
  "componentId": "CommunicationDetailPanel",
2267
2340
  "state": "implemented-evidence-complete",
@@ -4812,6 +4885,79 @@
4812
4885
  }
4813
4886
  }
4814
4887
  },
4888
+ {
4889
+ "componentId": "SegmentedControl",
4890
+ "state": "implemented-evidence-complete",
4891
+ "emissionEligible": true,
4892
+ "evidence": {
4893
+ "versionedContract": {
4894
+ "status": "passed",
4895
+ "refs": [
4896
+ "packages/component-contracts/src/contracts.ts#SegmentedControl"
4897
+ ]
4898
+ },
4899
+ "targetImplementation": {
4900
+ "status": "passed",
4901
+ "refs": [
4902
+ "packages/components-vue/src/segmented-control.ts#SegmentedControl"
4903
+ ]
4904
+ },
4905
+ "packageExport": {
4906
+ "status": "passed",
4907
+ "refs": [
4908
+ "packages/components-vue/src/index.ts#SegmentedControl"
4909
+ ]
4910
+ },
4911
+ "publicDeclaration": {
4912
+ "status": "passed",
4913
+ "refs": [
4914
+ "packages/components-vue/dist/index.d.ts#SegmentedControl"
4915
+ ]
4916
+ },
4917
+ "dependencyClosure": {
4918
+ "status": "passed",
4919
+ "refs": [
4920
+ "packages/components-vue/test/package-contract.spec.ts#dependency-closure"
4921
+ ]
4922
+ },
4923
+ "frameworkScenario": {
4924
+ "status": "passed",
4925
+ "refs": [
4926
+ "packages/components-vue/test/scenarios.spec.ts#segmented-control-billing-period"
4927
+ ]
4928
+ },
4929
+ "accessibility": {
4930
+ "status": "passed",
4931
+ "classification": "verified",
4932
+ "refs": [
4933
+ "artifacts/product-reality/sprint-223/m02/segmented-control/vue-measured.json#SegmentedControl"
4934
+ ]
4935
+ },
4936
+ "interaction": {
4937
+ "status": "passed",
4938
+ "classification": "verified",
4939
+ "refs": [
4940
+ "artifacts/product-reality/sprint-223/m02/segmented-control/vue-measured.json#SegmentedControl"
4941
+ ]
4942
+ },
4943
+ "visualThemes": {
4944
+ "status": "passed",
4945
+ "classification": "verified",
4946
+ "cells": [
4947
+ "A-light",
4948
+ "A-dark",
4949
+ "A-hc",
4950
+ "B-light",
4951
+ "B-dark",
4952
+ "B-hc"
4953
+ ],
4954
+ "refs": [
4955
+ "artifacts/product-reality/sprint-223/m02/segmented-control/vue-theme/report.json#SegmentedControl"
4956
+ ]
4957
+ }
4958
+ },
4959
+ "measurementRoot": "artifacts/product-reality/sprint-223/m02/segmented-control"
4960
+ },
4815
4961
  {
4816
4962
  "componentId": "Select",
4817
4963
  "state": "implemented-evidence-complete",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oods/components-vue",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Vue 3 components for OODS Foundry: the controls, layouts and domain views its generated screens use.",
5
5
  "homepage": "https://oods-foundry.com/",
6
6
  "bugs": {
@@ -53,8 +53,8 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "dependencies": {
56
- "@oods/component-contracts": "0.4.0",
57
- "@oods/component-styles": "0.4.0"
56
+ "@oods/component-contracts": "0.4.2",
57
+ "@oods/component-styles": "0.4.2"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "vue": "^3.5.0"