@oods/components-vue 0.18.0 → 0.20.0

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/README.md CHANGED
@@ -30,8 +30,8 @@ Generated sample screens identify their sample data. A workflow's local store is
30
30
 
31
31
  ## Limits
32
32
 
33
- Generated apps pin the OODS release that generated them; to upgrade, regenerate the app or move all four pins together. These packages are separate from the local MCP server, `@oods/foundry`.
33
+ Generated apps use the OODS release that generated them. To upgrade, regenerate the app or update every OODS library listed in your app’s package.json to the same release, then reinstall. These packages are separate from the local MCP server, `@oods/foundry`.
34
34
 
35
35
  ## License
36
36
 
37
- Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/components-vue@0.18.0/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/components-vue@0.18.0/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
37
+ Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/components-vue@0.20.0/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/components-vue@0.20.0/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
package/dist/index.cjs CHANGED
@@ -1075,14 +1075,14 @@ var AuditEvent = vue.defineComponent({
1075
1075
  };
1076
1076
  }
1077
1077
  });
1078
- function normalizeSelectOptions(raw) {
1078
+ function normalizeSelectOptions(raw, labelFor = (value) => componentContracts.formatReadOnlyValue(value, "string", true)) {
1079
1079
  if (!Array.isArray(raw)) return [];
1080
1080
  const choices = [];
1081
1081
  for (const entry of raw) {
1082
1082
  if (isRecord(entry)) {
1083
1083
  const text = (key) => typeof entry[key] === "string" && entry[key].length > 0 ? entry[key] : void 0;
1084
1084
  const value2 = text("value") ?? text("id") ?? text("label") ?? "";
1085
- const label = text("label") ?? text("name") ?? componentContracts.formatReadOnlyValue(value2, "string", true);
1085
+ const label = text("label") ?? text("name") ?? labelFor(value2);
1086
1086
  if (!value2 && !label) continue;
1087
1087
  choices.push({ value: value2, label });
1088
1088
  continue;
@@ -1090,12 +1090,15 @@ function normalizeSelectOptions(raw) {
1090
1090
  if (entry === void 0 || entry === null) continue;
1091
1091
  const value = typeof entry === "object" ? JSON.stringify(entry) : String(entry);
1092
1092
  if (!value) continue;
1093
- choices.push({ value, label: componentContracts.formatReadOnlyValue(value, "string", true) });
1093
+ choices.push({ value, label: labelFor(value) });
1094
1094
  }
1095
1095
  return choices;
1096
1096
  }
1097
- function selectOptionNodes(choices, selected) {
1098
- return choices.length ? choices.map((choice, index) => vue.h("option", { key: index, value: choice.value, selected: choice.value === selected }, choice.label)) : [vue.h("option", { value: "" }, "Select...")];
1097
+ function selectOptionNodes(choices, selected, prompt) {
1098
+ if (!choices.length) return [vue.h("option", { value: "" }, "Select...")];
1099
+ const options = choices.map((choice, index) => vue.h("option", { key: index, value: choice.value, selected: choice.value === selected }, choice.label));
1100
+ if (prompt && !selected) options.unshift(vue.h("option", { key: "prompt", value: "", disabled: true, selected: true }, prompt));
1101
+ return options;
1099
1102
  }
1100
1103
  var preventSubmit = (event) => {
1101
1104
  event.preventDefault();
@@ -1182,7 +1185,7 @@ var PreferenceEditor = vue.defineComponent({
1182
1185
  const title = firstText(props.title, props.label, props.heading, props.name) ?? "Preference Editor";
1183
1186
  const subtitle = firstText(props.description, props.subtitle, props.hint);
1184
1187
  const choices = normalizeSelectOptions(Array.isArray(props.namespaces) ? props.namespaces : ["default"]);
1185
- const selected = firstText(props.namespace) ?? choices[0]?.value;
1188
+ const selected = firstText(props.namespace);
1186
1189
  return vue.h("form", {
1187
1190
  class: "oods-preference-editor",
1188
1191
  "data-oods-component": "PreferenceEditor",
@@ -1191,7 +1194,7 @@ var PreferenceEditor = vue.defineComponent({
1191
1194
  }, [
1192
1195
  formHeader(title, subtitle),
1193
1196
  vue.h("div", { "data-form-content": "true" }, content.length ? content : [
1194
- vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Namespace"), vue.h("select", { name: "namespace", value: selected }, selectOptionNodes(choices, selected))]),
1197
+ vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Namespace"), vue.h("select", { name: "namespace", value: selected ?? "" }, selectOptionNodes(choices, selected, "Choose a namespace"))]),
1195
1198
  vue.h("label", { "data-form-control": "textarea" }, [vue.h("span", "Preference Document"), vue.h("textarea", { name: "preferenceDocument", rows: 4, value: firstScalar(props.document, props.json, props.value) ?? "" })])
1196
1199
  ])
1197
1200
  ]);
@@ -1215,7 +1218,7 @@ var RoleAssignmentForm = vue.defineComponent({
1215
1218
  const title = firstText(props.title, props.label, props.heading, props.name) ?? "Role Assignment";
1216
1219
  const subtitle = firstText(props.description, props.subtitle, props.hint);
1217
1220
  const choices = normalizeSelectOptions(props.roles ?? props.availableRoles ?? []);
1218
- const selected = firstText(props.role, props.defaultRoleId) ?? choices[0]?.value;
1221
+ const selected = firstText(props.role, props.defaultRoleId);
1219
1222
  return vue.h("form", {
1220
1223
  class: "oods-role-assignment-form",
1221
1224
  "data-oods-component": "RoleAssignmentForm",
@@ -1224,7 +1227,7 @@ var RoleAssignmentForm = vue.defineComponent({
1224
1227
  }, [
1225
1228
  formHeader(title, subtitle),
1226
1229
  vue.h("div", { "data-form-content": "true" }, content.length ? content : [
1227
- vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Role"), vue.h("select", { name: "role", value: selected }, selectOptionNodes(choices, selected))]),
1230
+ vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Role"), vue.h("select", { name: "role", value: selected ?? "" }, selectOptionNodes(choices, selected, "Choose a role"))]),
1228
1231
  vue.h("label", { "data-form-control": "input" }, [vue.h("span", "Assignee"), vue.h("input", { type: "text", name: "assignee", value: firstText(props.assignee, props.member) })])
1229
1232
  ])
1230
1233
  ]);
@@ -1332,8 +1335,8 @@ var TemplatePicker = vue.defineComponent({
1332
1335
  const subtitle = firstText(props.description, props.subtitle, props.hint);
1333
1336
  const templateChoices = normalizeSelectOptions(props.templates ?? props.options ?? []);
1334
1337
  const channelChoices = normalizeSelectOptions(props.channels ?? ["email", "sms", "in_app"]);
1335
- const selectedTemplate = firstText(props.templateId, props.value) ?? templateChoices[0]?.value;
1336
- const selectedChannel = firstText(props.channel) ?? channelChoices[0]?.value;
1338
+ const selectedTemplate = firstText(props.templateId, props.value);
1339
+ const selectedChannel = firstText(props.channel);
1337
1340
  return vue.h("fieldset", {
1338
1341
  class: "oods-template-picker",
1339
1342
  "data-oods-component": "TemplatePicker",
@@ -1341,8 +1344,8 @@ var TemplatePicker = vue.defineComponent({
1341
1344
  }, [
1342
1345
  ...fieldsetHeader(title, subtitle),
1343
1346
  vue.h("div", { "data-form-content": "true" }, content.length ? content : [
1344
- vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Template"), vue.h("select", { name: "template", value: selectedTemplate }, selectOptionNodes(templateChoices, selectedTemplate))]),
1345
- vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Channel"), vue.h("select", { name: "channel", value: selectedChannel }, selectOptionNodes(channelChoices, selectedChannel))])
1347
+ vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Template"), vue.h("select", { name: "template", value: selectedTemplate ?? "" }, selectOptionNodes(templateChoices, selectedTemplate, "Choose a template"))]),
1348
+ vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Channel"), vue.h("select", { name: "channel", value: selectedChannel ?? "" }, selectOptionNodes(channelChoices, selectedChannel, "Choose a channel"))])
1346
1349
  ])
1347
1350
  ]);
1348
1351
  };
@@ -1430,14 +1433,14 @@ var ClassificationEditor = vue.defineComponent({
1430
1433
  return () => {
1431
1434
  const content = authoredContent(slots.default?.());
1432
1435
  const tagText = typeof props.tags === "string" ? props.tags : props.tags === void 0 ? "" : JSON.stringify(props.tags);
1433
- const choices = normalizeSelectOptions(Array.isArray(props.modes) ? props.modes : ["strict", "flexible"]);
1434
- const selected = firstText(props.mode, props.classificationMode) ?? choices[0]?.value;
1436
+ const choices = normalizeSelectOptions(Array.isArray(props.modes) ? props.modes : ["taxonomy", "tag", "hybrid"]);
1437
+ const selected = firstText(props.mode, props.classificationMode);
1435
1438
  return vue.h("form", { class: "oods-classification-editor", "data-oods-component": "ClassificationEditor", "data-form-type": "classification-editor", onSubmit: (event) => event.preventDefault() }, [
1436
1439
  formHeader(firstText(props.title, props.label, props.heading, props.name) ?? "Classification Editor", firstText(props.description, props.subtitle, props.hint)),
1437
1440
  vue.h("div", { "data-form-content": "true" }, content.length ? content : [
1438
1441
  vue.h("label", { "data-form-control": "input" }, [vue.h("span", "Category"), vue.h("input", { type: "text", name: "category", value: firstText(props.category, props.primaryCategory) ?? "" })]),
1439
1442
  vue.h("label", { "data-form-control": "input" }, [vue.h("span", "Tags"), vue.h("input", { type: "text", name: "tags", placeholder: "tag-1, tag-2", value: tagText })]),
1440
- vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Mode"), vue.h("select", { name: "mode", value: selected }, selectOptionNodes(choices, selected))])
1443
+ vue.h("label", { "data-form-control": "select" }, [vue.h("span", "Mode"), vue.h("select", { name: "mode", value: selected ?? "" }, selectOptionNodes(choices, selected, "Choose a mode"))])
1441
1444
  ])
1442
1445
  ]);
1443
1446
  };
@@ -1573,8 +1576,8 @@ var CancellationForm = vue.defineComponent({
1573
1576
  setup(props, { slots }) {
1574
1577
  return () => {
1575
1578
  const content = authoredContent(slots.default?.());
1576
- const choices = normalizeSelectOptions(props.allowedReasons ?? ["no_longer_needed", "budget", "duplicate"]);
1577
- if (props.reasonCode && !choices.some((choice) => choice.value === props.reasonCode)) choices.unshift({ value: props.reasonCode, label: props.reasonCode });
1579
+ const choices = normalizeSelectOptions(props.allowedReasons ?? ["no_longer_needed", "budget", "duplicate"], componentContracts.enumOptionLabel);
1580
+ if (props.reasonCode && !choices.some((choice) => choice.value === props.reasonCode)) choices.unshift({ value: props.reasonCode, label: componentContracts.enumOptionLabel(props.reasonCode) });
1578
1581
  return vue.h(props.embedded ? "fieldset" : "form", { class: "oods-cancellation-form", "data-oods-component": "CancellationForm", "data-form-type": "cancellation", onSubmit: props.embedded ? void 0 : (event) => event.preventDefault() }, [
1579
1582
  formHeader(firstText(props.title, props.label, props.heading, props.name) ?? "Cancellation Form", firstText(props.description, props.subtitle, props.hint)),
1580
1583
  vue.h("div", { "data-form-content": "true" }, content.length ? content : [
@@ -2446,7 +2449,7 @@ var StatusBadge = vue.defineComponent({
2446
2449
  const children = slots.default?.();
2447
2450
  const slotLabel = children?.length && children.every((node) => node.type === vue.Text) ? children.map((node) => node.children).join("") : void 0;
2448
2451
  const badgeSlots = children ? { ...slots, default: () => children } : slots;
2449
- const ariaLabel = stringValue(attrs["aria-label"]) ?? props.label ?? `Status: ${slotLabel ?? props.content ?? presentation.label}`;
2452
+ const ariaLabel = stringValue(attrs["aria-label"]) ?? `${props.label || "Status"}: ${slotLabel ?? props.content ?? presentation.label}`;
2450
2453
  return vue.h(Badge, {
2451
2454
  ...attrs,
2452
2455
  class: mergedClass("oods-status-badge", attrs.class),
@@ -2656,7 +2659,7 @@ var CancellationSummary = vue.defineComponent({
2656
2659
  ));
2657
2660
  }
2658
2661
  if (props.reason) rows.push(summaryEntry("Reason", props.reason, "reason"));
2659
- if (props.code) rows.push(summaryEntry("Code", componentContracts.formatReadOnlyValue(props.code, "string", true), "code"));
2662
+ if (props.code) rows.push(summaryEntry("Code", componentContracts.enumOptionLabel(props.code), "code"));
2660
2663
  return vue.h("section", {
2661
2664
  ...attrs,
2662
2665
  class: mergedClass("oods-cancellation-summary", attrs.class),
@@ -3125,9 +3128,9 @@ var StateTransitionEvent = eventRecipe("StateTransitionEvent", "transition", "St
3125
3128
  var CommunicationDetailPanel = vue.defineComponent({ name: "CommunicationDetailPanel", props: { id: String, title: { type: String, default: "Communication" }, channels: array, templates: array, policies: array, conversations: array }, setup: (props) => () => vue.h("section", { id: props.id, class: "oods-trait-recipe", "data-oods-component": "CommunicationDetailPanel", "aria-label": props.title }, [vue.h("h2", props.title), vue.h("div", { role: "status", "aria-live": "polite" }, `${props.conversations?.length ?? 0} conversations`), vue.h("dl", [["Channels", props.channels], ["Templates", props.templates], ["Delivery policies", props.policies], ["Conversations", props.conversations]].map(([label, rows]) => vue.h("div", { key: label }, [vue.h("dt", label), vue.h("dd", rows?.length ? vue.h("ul", componentContracts.recipeItemLabels(rows).map((text, index) => vue.h("li", { key: index }, text))) : "None recorded")])))]) });
3126
3129
  var ColorStatePicker = vue.defineComponent({ name: "ColorStatePicker", props: { id: String, title: { type: String, default: "Color state" }, colorStates: { type: Array, default: () => [...componentContracts.DEFAULT_COLOR_STATES] }, value: String, disabled: Boolean }, emits: { change: (value) => typeof value === "string" }, setup(props, { emit }) {
3127
3130
  const generatedId = vue.useId();
3128
- const selected = vue.ref(props.value ?? props.colorStates[0] ?? "");
3131
+ const selected = vue.ref(props.value ?? "");
3129
3132
  vue.watch(() => [props.value, props.colorStates], () => {
3130
- selected.value = props.value ?? props.colorStates[0] ?? "";
3133
+ selected.value = props.value ?? "";
3131
3134
  });
3132
3135
  return () => vue.h("fieldset", { id: props.id, class: "oods-trait-recipe", "data-oods-component": "ColorStatePicker" }, [vue.h("legend", props.title), vue.h(Select, { id: `${props.id ?? generatedId}-state`, label: "Color state", name: "color_state", modelValue: selected.value, disabled: props.disabled, options: [...!props.colorStates.includes(selected.value) ? [{ value: selected.value, label: selected.value || "Choose state", disabled: true }] : [], ...props.colorStates.map((value) => ({ value, label: componentContracts.formatReadOnlyValue(value, "string", true) }))], "onUpdate:modelValue": (next) => {
3133
3136
  selected.value = next;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { enumOptionLabel, vizPreviewLayers, svgCarriesTitle, formatPriceAmount, formatPriceCode, formatReferenceLabel, ownerKindLabel, ownershipPhrase, summaryValue, formatDateTime, dateTimeInputValue, formatReadOnlyValue, BILLING_MINOR_UNITS, billingSummary, formatBillingAmount, billingAmountText, billingAmountMessage, parseBillingAmount, BILLING_INTERVALS, billingIntervalMessage, billingCycle, auditSummary, initialSort, ariaSort, nextSort, recipeItemLabels, DEFAULT_COLOR_STATES, geoFieldMapping, STATUS_ICON_SVG_ATTRS, STATUS_ICON_SHAPES, getStatusPresentation, resolveStatusIcon, currencyMinorUnits, billingPaymentSummary, billingPaymentRows, traitEventRows, vizControlFields, VIZ_CONTROL_TITLES, vizFieldValue, vizSummaryRows, historyAttribution, editVizIntent } from '@oods/component-contracts';
1
+ import { enumOptionLabel, svgCarriesTitle, vizPreviewLayers, formatPriceAmount, formatPriceCode, formatReferenceLabel, ownerKindLabel, ownershipPhrase, summaryValue, formatDateTime, dateTimeInputValue, BILLING_MINOR_UNITS, billingSummary, formatBillingAmount, billingAmountText, billingAmountMessage, parseBillingAmount, BILLING_INTERVALS, billingIntervalMessage, formatReadOnlyValue, billingCycle, auditSummary, initialSort, ariaSort, nextSort, recipeItemLabels, DEFAULT_COLOR_STATES, geoFieldMapping, STATUS_ICON_SVG_ATTRS, STATUS_ICON_SHAPES, getStatusPresentation, resolveStatusIcon, currencyMinorUnits, billingPaymentSummary, billingPaymentRows, traitEventRows, VIZ_CONTROL_TITLES, vizControlFields, vizFieldValue, vizSummaryRows, historyAttribution, editVizIntent } from '@oods/component-contracts';
2
2
  import { defineComponent, h, useId, computed, ref, onMounted, onBeforeUnmount, watch, nextTick, Text as Text$1, isVNode, Comment, Fragment } from 'vue';
3
3
 
4
4
  // src/primitives.ts
@@ -1073,14 +1073,14 @@ var AuditEvent = defineComponent({
1073
1073
  };
1074
1074
  }
1075
1075
  });
1076
- function normalizeSelectOptions(raw) {
1076
+ function normalizeSelectOptions(raw, labelFor = (value) => formatReadOnlyValue(value, "string", true)) {
1077
1077
  if (!Array.isArray(raw)) return [];
1078
1078
  const choices = [];
1079
1079
  for (const entry of raw) {
1080
1080
  if (isRecord(entry)) {
1081
1081
  const text = (key) => typeof entry[key] === "string" && entry[key].length > 0 ? entry[key] : void 0;
1082
1082
  const value2 = text("value") ?? text("id") ?? text("label") ?? "";
1083
- const label = text("label") ?? text("name") ?? formatReadOnlyValue(value2, "string", true);
1083
+ const label = text("label") ?? text("name") ?? labelFor(value2);
1084
1084
  if (!value2 && !label) continue;
1085
1085
  choices.push({ value: value2, label });
1086
1086
  continue;
@@ -1088,12 +1088,15 @@ function normalizeSelectOptions(raw) {
1088
1088
  if (entry === void 0 || entry === null) continue;
1089
1089
  const value = typeof entry === "object" ? JSON.stringify(entry) : String(entry);
1090
1090
  if (!value) continue;
1091
- choices.push({ value, label: formatReadOnlyValue(value, "string", true) });
1091
+ choices.push({ value, label: labelFor(value) });
1092
1092
  }
1093
1093
  return choices;
1094
1094
  }
1095
- function selectOptionNodes(choices, selected) {
1096
- return choices.length ? choices.map((choice, index) => h("option", { key: index, value: choice.value, selected: choice.value === selected }, choice.label)) : [h("option", { value: "" }, "Select...")];
1095
+ function selectOptionNodes(choices, selected, prompt) {
1096
+ if (!choices.length) return [h("option", { value: "" }, "Select...")];
1097
+ const options = choices.map((choice, index) => h("option", { key: index, value: choice.value, selected: choice.value === selected }, choice.label));
1098
+ if (prompt && !selected) options.unshift(h("option", { key: "prompt", value: "", disabled: true, selected: true }, prompt));
1099
+ return options;
1097
1100
  }
1098
1101
  var preventSubmit = (event) => {
1099
1102
  event.preventDefault();
@@ -1180,7 +1183,7 @@ var PreferenceEditor = defineComponent({
1180
1183
  const title = firstText(props.title, props.label, props.heading, props.name) ?? "Preference Editor";
1181
1184
  const subtitle = firstText(props.description, props.subtitle, props.hint);
1182
1185
  const choices = normalizeSelectOptions(Array.isArray(props.namespaces) ? props.namespaces : ["default"]);
1183
- const selected = firstText(props.namespace) ?? choices[0]?.value;
1186
+ const selected = firstText(props.namespace);
1184
1187
  return h("form", {
1185
1188
  class: "oods-preference-editor",
1186
1189
  "data-oods-component": "PreferenceEditor",
@@ -1189,7 +1192,7 @@ var PreferenceEditor = defineComponent({
1189
1192
  }, [
1190
1193
  formHeader(title, subtitle),
1191
1194
  h("div", { "data-form-content": "true" }, content.length ? content : [
1192
- h("label", { "data-form-control": "select" }, [h("span", "Namespace"), h("select", { name: "namespace", value: selected }, selectOptionNodes(choices, selected))]),
1195
+ h("label", { "data-form-control": "select" }, [h("span", "Namespace"), h("select", { name: "namespace", value: selected ?? "" }, selectOptionNodes(choices, selected, "Choose a namespace"))]),
1193
1196
  h("label", { "data-form-control": "textarea" }, [h("span", "Preference Document"), h("textarea", { name: "preferenceDocument", rows: 4, value: firstScalar(props.document, props.json, props.value) ?? "" })])
1194
1197
  ])
1195
1198
  ]);
@@ -1213,7 +1216,7 @@ var RoleAssignmentForm = defineComponent({
1213
1216
  const title = firstText(props.title, props.label, props.heading, props.name) ?? "Role Assignment";
1214
1217
  const subtitle = firstText(props.description, props.subtitle, props.hint);
1215
1218
  const choices = normalizeSelectOptions(props.roles ?? props.availableRoles ?? []);
1216
- const selected = firstText(props.role, props.defaultRoleId) ?? choices[0]?.value;
1219
+ const selected = firstText(props.role, props.defaultRoleId);
1217
1220
  return h("form", {
1218
1221
  class: "oods-role-assignment-form",
1219
1222
  "data-oods-component": "RoleAssignmentForm",
@@ -1222,7 +1225,7 @@ var RoleAssignmentForm = defineComponent({
1222
1225
  }, [
1223
1226
  formHeader(title, subtitle),
1224
1227
  h("div", { "data-form-content": "true" }, content.length ? content : [
1225
- h("label", { "data-form-control": "select" }, [h("span", "Role"), h("select", { name: "role", value: selected }, selectOptionNodes(choices, selected))]),
1228
+ h("label", { "data-form-control": "select" }, [h("span", "Role"), h("select", { name: "role", value: selected ?? "" }, selectOptionNodes(choices, selected, "Choose a role"))]),
1226
1229
  h("label", { "data-form-control": "input" }, [h("span", "Assignee"), h("input", { type: "text", name: "assignee", value: firstText(props.assignee, props.member) })])
1227
1230
  ])
1228
1231
  ]);
@@ -1330,8 +1333,8 @@ var TemplatePicker = defineComponent({
1330
1333
  const subtitle = firstText(props.description, props.subtitle, props.hint);
1331
1334
  const templateChoices = normalizeSelectOptions(props.templates ?? props.options ?? []);
1332
1335
  const channelChoices = normalizeSelectOptions(props.channels ?? ["email", "sms", "in_app"]);
1333
- const selectedTemplate = firstText(props.templateId, props.value) ?? templateChoices[0]?.value;
1334
- const selectedChannel = firstText(props.channel) ?? channelChoices[0]?.value;
1336
+ const selectedTemplate = firstText(props.templateId, props.value);
1337
+ const selectedChannel = firstText(props.channel);
1335
1338
  return h("fieldset", {
1336
1339
  class: "oods-template-picker",
1337
1340
  "data-oods-component": "TemplatePicker",
@@ -1339,8 +1342,8 @@ var TemplatePicker = defineComponent({
1339
1342
  }, [
1340
1343
  ...fieldsetHeader(title, subtitle),
1341
1344
  h("div", { "data-form-content": "true" }, content.length ? content : [
1342
- h("label", { "data-form-control": "select" }, [h("span", "Template"), h("select", { name: "template", value: selectedTemplate }, selectOptionNodes(templateChoices, selectedTemplate))]),
1343
- h("label", { "data-form-control": "select" }, [h("span", "Channel"), h("select", { name: "channel", value: selectedChannel }, selectOptionNodes(channelChoices, selectedChannel))])
1345
+ h("label", { "data-form-control": "select" }, [h("span", "Template"), h("select", { name: "template", value: selectedTemplate ?? "" }, selectOptionNodes(templateChoices, selectedTemplate, "Choose a template"))]),
1346
+ h("label", { "data-form-control": "select" }, [h("span", "Channel"), h("select", { name: "channel", value: selectedChannel ?? "" }, selectOptionNodes(channelChoices, selectedChannel, "Choose a channel"))])
1344
1347
  ])
1345
1348
  ]);
1346
1349
  };
@@ -1428,14 +1431,14 @@ var ClassificationEditor = defineComponent({
1428
1431
  return () => {
1429
1432
  const content = authoredContent(slots.default?.());
1430
1433
  const tagText = typeof props.tags === "string" ? props.tags : props.tags === void 0 ? "" : JSON.stringify(props.tags);
1431
- const choices = normalizeSelectOptions(Array.isArray(props.modes) ? props.modes : ["strict", "flexible"]);
1432
- const selected = firstText(props.mode, props.classificationMode) ?? choices[0]?.value;
1434
+ const choices = normalizeSelectOptions(Array.isArray(props.modes) ? props.modes : ["taxonomy", "tag", "hybrid"]);
1435
+ const selected = firstText(props.mode, props.classificationMode);
1433
1436
  return h("form", { class: "oods-classification-editor", "data-oods-component": "ClassificationEditor", "data-form-type": "classification-editor", onSubmit: (event) => event.preventDefault() }, [
1434
1437
  formHeader(firstText(props.title, props.label, props.heading, props.name) ?? "Classification Editor", firstText(props.description, props.subtitle, props.hint)),
1435
1438
  h("div", { "data-form-content": "true" }, content.length ? content : [
1436
1439
  h("label", { "data-form-control": "input" }, [h("span", "Category"), h("input", { type: "text", name: "category", value: firstText(props.category, props.primaryCategory) ?? "" })]),
1437
1440
  h("label", { "data-form-control": "input" }, [h("span", "Tags"), h("input", { type: "text", name: "tags", placeholder: "tag-1, tag-2", value: tagText })]),
1438
- h("label", { "data-form-control": "select" }, [h("span", "Mode"), h("select", { name: "mode", value: selected }, selectOptionNodes(choices, selected))])
1441
+ h("label", { "data-form-control": "select" }, [h("span", "Mode"), h("select", { name: "mode", value: selected ?? "" }, selectOptionNodes(choices, selected, "Choose a mode"))])
1439
1442
  ])
1440
1443
  ]);
1441
1444
  };
@@ -1571,8 +1574,8 @@ var CancellationForm = defineComponent({
1571
1574
  setup(props, { slots }) {
1572
1575
  return () => {
1573
1576
  const content = authoredContent(slots.default?.());
1574
- const choices = normalizeSelectOptions(props.allowedReasons ?? ["no_longer_needed", "budget", "duplicate"]);
1575
- if (props.reasonCode && !choices.some((choice) => choice.value === props.reasonCode)) choices.unshift({ value: props.reasonCode, label: props.reasonCode });
1577
+ const choices = normalizeSelectOptions(props.allowedReasons ?? ["no_longer_needed", "budget", "duplicate"], enumOptionLabel);
1578
+ if (props.reasonCode && !choices.some((choice) => choice.value === props.reasonCode)) choices.unshift({ value: props.reasonCode, label: enumOptionLabel(props.reasonCode) });
1576
1579
  return h(props.embedded ? "fieldset" : "form", { class: "oods-cancellation-form", "data-oods-component": "CancellationForm", "data-form-type": "cancellation", onSubmit: props.embedded ? void 0 : (event) => event.preventDefault() }, [
1577
1580
  formHeader(firstText(props.title, props.label, props.heading, props.name) ?? "Cancellation Form", firstText(props.description, props.subtitle, props.hint)),
1578
1581
  h("div", { "data-form-content": "true" }, content.length ? content : [
@@ -2444,7 +2447,7 @@ var StatusBadge = defineComponent({
2444
2447
  const children = slots.default?.();
2445
2448
  const slotLabel = children?.length && children.every((node) => node.type === Text$1) ? children.map((node) => node.children).join("") : void 0;
2446
2449
  const badgeSlots = children ? { ...slots, default: () => children } : slots;
2447
- const ariaLabel = stringValue(attrs["aria-label"]) ?? props.label ?? `Status: ${slotLabel ?? props.content ?? presentation.label}`;
2450
+ const ariaLabel = stringValue(attrs["aria-label"]) ?? `${props.label || "Status"}: ${slotLabel ?? props.content ?? presentation.label}`;
2448
2451
  return h(Badge, {
2449
2452
  ...attrs,
2450
2453
  class: mergedClass("oods-status-badge", attrs.class),
@@ -2654,7 +2657,7 @@ var CancellationSummary = defineComponent({
2654
2657
  ));
2655
2658
  }
2656
2659
  if (props.reason) rows.push(summaryEntry("Reason", props.reason, "reason"));
2657
- if (props.code) rows.push(summaryEntry("Code", formatReadOnlyValue(props.code, "string", true), "code"));
2660
+ if (props.code) rows.push(summaryEntry("Code", enumOptionLabel(props.code), "code"));
2658
2661
  return h("section", {
2659
2662
  ...attrs,
2660
2663
  class: mergedClass("oods-cancellation-summary", attrs.class),
@@ -3123,9 +3126,9 @@ var StateTransitionEvent = eventRecipe("StateTransitionEvent", "transition", "St
3123
3126
  var CommunicationDetailPanel = defineComponent({ name: "CommunicationDetailPanel", props: { id: String, title: { type: String, default: "Communication" }, channels: array, templates: array, policies: array, conversations: array }, setup: (props) => () => h("section", { id: props.id, class: "oods-trait-recipe", "data-oods-component": "CommunicationDetailPanel", "aria-label": props.title }, [h("h2", props.title), h("div", { role: "status", "aria-live": "polite" }, `${props.conversations?.length ?? 0} conversations`), h("dl", [["Channels", props.channels], ["Templates", props.templates], ["Delivery policies", props.policies], ["Conversations", props.conversations]].map(([label, rows]) => h("div", { key: label }, [h("dt", label), h("dd", rows?.length ? h("ul", recipeItemLabels(rows).map((text, index) => h("li", { key: index }, text))) : "None recorded")])))]) });
3124
3127
  var ColorStatePicker = defineComponent({ name: "ColorStatePicker", props: { id: String, title: { type: String, default: "Color state" }, colorStates: { type: Array, default: () => [...DEFAULT_COLOR_STATES] }, value: String, disabled: Boolean }, emits: { change: (value) => typeof value === "string" }, setup(props, { emit }) {
3125
3128
  const generatedId = useId();
3126
- const selected = ref(props.value ?? props.colorStates[0] ?? "");
3129
+ const selected = ref(props.value ?? "");
3127
3130
  watch(() => [props.value, props.colorStates], () => {
3128
- selected.value = props.value ?? props.colorStates[0] ?? "";
3131
+ selected.value = props.value ?? "";
3129
3132
  });
3130
3133
  return () => h("fieldset", { id: props.id, class: "oods-trait-recipe", "data-oods-component": "ColorStatePicker" }, [h("legend", props.title), h(Select, { id: `${props.id ?? generatedId}-state`, label: "Color state", name: "color_state", modelValue: selected.value, disabled: props.disabled, options: [...!props.colorStates.includes(selected.value) ? [{ value: selected.value, label: selected.value || "Choose state", disabled: true }] : [], ...props.colorStates.map((value) => ({ value, label: formatReadOnlyValue(value, "string", true) }))], "onUpdate:modelValue": (next) => {
3131
3134
  selected.value = next;
package/dist/ported.cjs CHANGED
@@ -933,7 +933,7 @@ var StatusBadge = vue.defineComponent({
933
933
  const children = slots.default?.();
934
934
  const slotLabel = children?.length && children.every((node) => node.type === vue.Text) ? children.map((node) => node.children).join("") : void 0;
935
935
  const badgeSlots = children ? { ...slots, default: () => children } : slots;
936
- const ariaLabel = stringValue(attrs["aria-label"]) ?? props.label ?? `Status: ${slotLabel ?? props.content ?? presentation.label}`;
936
+ const ariaLabel = stringValue(attrs["aria-label"]) ?? `${props.label || "Status"}: ${slotLabel ?? props.content ?? presentation.label}`;
937
937
  return vue.h(Badge, {
938
938
  ...attrs,
939
939
  class: mergedClass("oods-status-badge", attrs.class),
@@ -1143,7 +1143,7 @@ var CancellationSummary = vue.defineComponent({
1143
1143
  ));
1144
1144
  }
1145
1145
  if (props.reason) rows.push(summaryEntry("Reason", props.reason, "reason"));
1146
- if (props.code) rows.push(summaryEntry("Code", componentContracts.formatReadOnlyValue(props.code, "string", true), "code"));
1146
+ if (props.code) rows.push(summaryEntry("Code", componentContracts.enumOptionLabel(props.code), "code"));
1147
1147
  return vue.h("section", {
1148
1148
  ...attrs,
1149
1149
  class: mergedClass("oods-cancellation-summary", attrs.class),
package/dist/ported.js CHANGED
@@ -1,4 +1,4 @@
1
- import { enumOptionLabel, dateTimeInputValue, formatDateTime, formatReadOnlyValue, STATUS_ICON_SVG_ATTRS, STATUS_ICON_SHAPES, getStatusPresentation, resolveStatusIcon, currencyMinorUnits, historyAttribution } from '@oods/component-contracts';
1
+ import { enumOptionLabel, dateTimeInputValue, formatDateTime, STATUS_ICON_SVG_ATTRS, STATUS_ICON_SHAPES, getStatusPresentation, resolveStatusIcon, currencyMinorUnits, historyAttribution, formatReadOnlyValue } from '@oods/component-contracts';
2
2
  import { defineComponent, h, useId, computed, ref, onMounted, onBeforeUnmount, watch, Text } from 'vue';
3
3
 
4
4
  // src/ported.ts
@@ -931,7 +931,7 @@ var StatusBadge = defineComponent({
931
931
  const children = slots.default?.();
932
932
  const slotLabel = children?.length && children.every((node) => node.type === Text) ? children.map((node) => node.children).join("") : void 0;
933
933
  const badgeSlots = children ? { ...slots, default: () => children } : slots;
934
- const ariaLabel = stringValue(attrs["aria-label"]) ?? props.label ?? `Status: ${slotLabel ?? props.content ?? presentation.label}`;
934
+ const ariaLabel = stringValue(attrs["aria-label"]) ?? `${props.label || "Status"}: ${slotLabel ?? props.content ?? presentation.label}`;
935
935
  return h(Badge, {
936
936
  ...attrs,
937
937
  class: mergedClass("oods-status-badge", attrs.class),
@@ -1141,7 +1141,7 @@ var CancellationSummary = defineComponent({
1141
1141
  ));
1142
1142
  }
1143
1143
  if (props.reason) rows.push(summaryEntry("Reason", props.reason, "reason"));
1144
- if (props.code) rows.push(summaryEntry("Code", formatReadOnlyValue(props.code, "string", true), "code"));
1144
+ if (props.code) rows.push(summaryEntry("Code", enumOptionLabel(props.code), "code"));
1145
1145
  return h("section", {
1146
1146
  ...attrs,
1147
1147
  class: mergedClass("oods-cancellation-summary", attrs.class),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oods/components-vue",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
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.18.0",
57
- "@oods/component-styles": "0.18.0"
56
+ "@oods/component-contracts": "0.20.0",
57
+ "@oods/component-styles": "0.20.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "vue": "^3.5.0"
@@ -64,11 +64,11 @@
64
64
  "@vue/compiler-sfc": "^3.5.42",
65
65
  "@vue/server-renderer": "^3.5.42",
66
66
  "@vue/test-utils": "^2.5.0",
67
- "jsdom": "^24.0.0",
67
+ "jsdom": "31.0.1",
68
68
  "playwright": "^1.56.1",
69
69
  "typescript": "^5.9.3",
70
- "vite": "^6.4.1",
71
- "vitest": "^3.2.4",
70
+ "vite": "6.4.6",
71
+ "vitest": "5.1.1",
72
72
  "vitest-axe": "^0.1.0",
73
73
  "vue": "^3.5.42",
74
74
  "vue-tsc": "^3.3.11"