@oods/components-react 0.4.1 → 0.4.3

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
@@ -32,4 +32,4 @@ Use matching versions of the OODS packages. These packages are separate from the
32
32
 
33
33
  ## License
34
34
 
35
- Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.4.1/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.4.1/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
35
+ Apache License 2.0. See [LICENSE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.4.3/LICENSE) and [NOTICE](https://cdn.jsdelivr.net/npm/@oods/components-react@0.4.3/NOTICE). Generated output belongs to its user; installed package dependencies retain their own licenses.
@@ -1054,10 +1054,12 @@ var CancellationSummary = React3.forwardRef(
1054
1054
  requestedAtField,
1055
1055
  reasonField,
1056
1056
  codeField,
1057
+ hideWhenDefault,
1057
1058
  className,
1058
1059
  ...rest
1059
1060
  }, ref) => {
1060
1061
  const childValue = typeof children === "boolean" ? children ? "Yes" : "No" : children;
1062
+ if (hideWhenDefault === true && cancelAtPeriodEnd === false && !requestedAt && !reason && !code && (childValue === void 0 || childValue === null)) return null;
1061
1063
  return /* @__PURE__ */ jsxs(
1062
1064
  "section",
1063
1065
  {
package/dist/index.cjs CHANGED
@@ -1251,40 +1251,44 @@ var Tabs = React9__namespace.forwardRef(
1251
1251
  "aria-label": ariaLabel ?? ariaLabelAttribute,
1252
1252
  children: [
1253
1253
  visibleItems.map(renderTab),
1254
- overflowItems.length ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oods-tabs__overflow", children: [
1255
- /* @__PURE__ */ jsxRuntime.jsx(
1256
- "button",
1257
- {
1258
- type: "button",
1259
- className: "tabs__overflow-trigger",
1260
- "aria-label": `${overflowLabel} tabs`,
1261
- "aria-haspopup": "menu",
1262
- "aria-expanded": menuOpen,
1263
- "data-tabs-overflow-trigger": "true",
1264
- onClick: () => setMenuOpen((open) => !open),
1265
- children: overflowLabel
1266
- }
1267
- ),
1268
- menuOpen ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tabs__overflow-menu", role: "menu", children: overflowItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
1269
- "button",
1270
- {
1271
- type: "button",
1272
- role: "menuitem",
1273
- disabled: item.disabled || item.isDisabled,
1274
- "aria-current": item.id === activeId ? "true" : void 0,
1275
- className: classes5(
1276
- "tabs__overflow-item",
1277
- item.id === activeId && "tabs__overflow-item--selected"
1278
- ),
1279
- onClick: () => {
1280
- select(item.id);
1281
- setMenuOpen(false);
1254
+ overflowItems.length ? (
1255
+ // s224-m01 (#2542 ruling 2): the overflow markup is Vue's too: both class families, the trigger's data
1256
+ // attribute and aria-current="true" on an item.
1257
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oods-tabs__overflow oods-tabs-overflow", children: [
1258
+ /* @__PURE__ */ jsxRuntime.jsx(
1259
+ "button",
1260
+ {
1261
+ type: "button",
1262
+ className: "tabs__overflow-trigger oods-tabs-overflow-trigger",
1263
+ "aria-label": `${overflowLabel} tabs`,
1264
+ "aria-haspopup": "menu",
1265
+ "aria-expanded": menuOpen,
1266
+ "data-tabs-overflow-trigger": "true",
1267
+ onClick: () => setMenuOpen((open) => !open),
1268
+ children: overflowLabel
1269
+ }
1270
+ ),
1271
+ menuOpen ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tabs__overflow-menu oods-tabs-overflow-menu", role: "menu", children: overflowItems.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
1272
+ "button",
1273
+ {
1274
+ type: "button",
1275
+ role: "menuitem",
1276
+ disabled: item.disabled || item.isDisabled,
1277
+ "aria-current": item.id === activeId ? "true" : void 0,
1278
+ className: classes5(
1279
+ "tabs__overflow-item",
1280
+ item.id === activeId && "tabs__overflow-item--selected"
1281
+ ),
1282
+ onClick: () => {
1283
+ select(item.id);
1284
+ setMenuOpen(false);
1285
+ },
1286
+ children: item.label
1282
1287
  },
1283
- children: item.label
1284
- },
1285
- item.id
1286
- )) }) : null
1287
- ] }) : null
1288
+ item.id
1289
+ )) }) : null
1290
+ ] })
1291
+ ) : null
1288
1292
  ]
1289
1293
  }
1290
1294
  ),
@@ -1626,10 +1630,12 @@ var CancellationSummary = React9__namespace.forwardRef(
1626
1630
  requestedAtField,
1627
1631
  reasonField,
1628
1632
  codeField,
1633
+ hideWhenDefault,
1629
1634
  className,
1630
1635
  ...rest
1631
1636
  }, ref) => {
1632
1637
  const childValue = typeof children === "boolean" ? children ? "Yes" : "No" : children;
1638
+ if (hideWhenDefault === true && cancelAtPeriodEnd === false && !requestedAt && !reason && !code && (childValue === void 0 || childValue === null)) return null;
1633
1639
  return /* @__PURE__ */ jsxRuntime.jsxs(
1634
1640
  "section",
1635
1641
  {
@@ -3035,8 +3041,9 @@ var CancellationBadge = createBadgeFamily({
3035
3041
  booleanLabels: ["Cancellation scheduled", "No cancellation scheduled"]
3036
3042
  });
3037
3043
  var ArchiveSummary = React9__namespace.forwardRef(
3038
- ({ title, label, heading, name, isArchived, archived, status, archivedAt, reason, archiveReason, summary: summary2, text, description, children, className, ...rest }, ref) => {
3044
+ ({ title, label, heading, name, isArchived, archived, status, archivedAt, reason, archiveReason, summary: summary2, text, description, hideWhenDefault, children, className, ...rest }, ref) => {
3039
3045
  const content = childContent(children);
3046
+ if (hideWhenDefault === true && (isArchived ?? archived ?? status) === false && !archivedAt && !firstText(reason, archiveReason) && !content.authored && content.scalar === void 0) return null;
3040
3047
  const terms = [["Archived", componentContracts.summaryValue(isArchived ?? archived ?? status)], ["Archived At", archivedAt ? componentContracts.formatDateTime(archivedAt) : void 0], ["Reason", firstText(reason, archiveReason)]].filter((entry) => entry[1] !== void 0);
3041
3048
  const fallback = firstText(summary2, text, description);
3042
3049
  return /* @__PURE__ */ jsxRuntime.jsxs("section", { ref, className: classes7("oods-archive-summary", className), "data-oods-component": "ArchiveSummary", "data-summary-type": "archive", ...rest, children: [
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Badge, StatusIcon, Select, Input, Checkbox, Text } from './chunk-NLWXBLPA.js';
2
- export { AuditTimeline, Badge, Banner, Button, CancellationSummary, Card, Checkbox, DatePicker, Dialog, Input, PaginationBar, PriceBadge, RelativeTimestamp, SearchInput, Select, StatusBadge, StatusTimeline, Switch, Text, Textarea } from './chunk-NLWXBLPA.js';
1
+ import { Badge, StatusIcon, Select, Input, Checkbox, Text } from './chunk-ICXOX5B3.js';
2
+ export { AuditTimeline, Badge, Banner, Button, CancellationSummary, Card, Checkbox, DatePicker, Dialog, Input, PaginationBar, PriceBadge, RelativeTimestamp, SearchInput, Select, StatusBadge, StatusTimeline, Switch, Text, Textarea } from './chunk-ICXOX5B3.js';
3
3
  export { Table } from './chunk-XEX22E24.js';
4
4
  import './chunk-2VEQWKGK.js';
5
5
  import * as React4 from 'react';
@@ -251,40 +251,44 @@ var Tabs = React4.forwardRef(
251
251
  "aria-label": ariaLabel ?? ariaLabelAttribute,
252
252
  children: [
253
253
  visibleItems.map(renderTab),
254
- overflowItems.length ? /* @__PURE__ */ jsxs("div", { className: "oods-tabs__overflow", children: [
255
- /* @__PURE__ */ jsx(
256
- "button",
257
- {
258
- type: "button",
259
- className: "tabs__overflow-trigger",
260
- "aria-label": `${overflowLabel} tabs`,
261
- "aria-haspopup": "menu",
262
- "aria-expanded": menuOpen,
263
- "data-tabs-overflow-trigger": "true",
264
- onClick: () => setMenuOpen((open) => !open),
265
- children: overflowLabel
266
- }
267
- ),
268
- menuOpen ? /* @__PURE__ */ jsx("div", { className: "tabs__overflow-menu", role: "menu", children: overflowItems.map((item) => /* @__PURE__ */ jsx(
269
- "button",
270
- {
271
- type: "button",
272
- role: "menuitem",
273
- disabled: item.disabled || item.isDisabled,
274
- "aria-current": item.id === activeId ? "true" : void 0,
275
- className: classes2(
276
- "tabs__overflow-item",
277
- item.id === activeId && "tabs__overflow-item--selected"
278
- ),
279
- onClick: () => {
280
- select(item.id);
281
- setMenuOpen(false);
254
+ overflowItems.length ? (
255
+ // s224-m01 (#2542 ruling 2): the overflow markup is Vue's too: both class families, the trigger's data
256
+ // attribute and aria-current="true" on an item.
257
+ /* @__PURE__ */ jsxs("div", { className: "oods-tabs__overflow oods-tabs-overflow", children: [
258
+ /* @__PURE__ */ jsx(
259
+ "button",
260
+ {
261
+ type: "button",
262
+ className: "tabs__overflow-trigger oods-tabs-overflow-trigger",
263
+ "aria-label": `${overflowLabel} tabs`,
264
+ "aria-haspopup": "menu",
265
+ "aria-expanded": menuOpen,
266
+ "data-tabs-overflow-trigger": "true",
267
+ onClick: () => setMenuOpen((open) => !open),
268
+ children: overflowLabel
269
+ }
270
+ ),
271
+ menuOpen ? /* @__PURE__ */ jsx("div", { className: "tabs__overflow-menu oods-tabs-overflow-menu", role: "menu", children: overflowItems.map((item) => /* @__PURE__ */ jsx(
272
+ "button",
273
+ {
274
+ type: "button",
275
+ role: "menuitem",
276
+ disabled: item.disabled || item.isDisabled,
277
+ "aria-current": item.id === activeId ? "true" : void 0,
278
+ className: classes2(
279
+ "tabs__overflow-item",
280
+ item.id === activeId && "tabs__overflow-item--selected"
281
+ ),
282
+ onClick: () => {
283
+ select(item.id);
284
+ setMenuOpen(false);
285
+ },
286
+ children: item.label
282
287
  },
283
- children: item.label
284
- },
285
- item.id
286
- )) }) : null
287
- ] }) : null
288
+ item.id
289
+ )) }) : null
290
+ ] })
291
+ ) : null
288
292
  ]
289
293
  }
290
294
  ),
@@ -1438,8 +1442,9 @@ var CancellationBadge = createBadgeFamily({
1438
1442
  booleanLabels: ["Cancellation scheduled", "No cancellation scheduled"]
1439
1443
  });
1440
1444
  var ArchiveSummary = React4.forwardRef(
1441
- ({ title, label, heading, name, isArchived, archived, status, archivedAt, reason, archiveReason, summary: summary2, text, description, children, className, ...rest }, ref) => {
1445
+ ({ title, label, heading, name, isArchived, archived, status, archivedAt, reason, archiveReason, summary: summary2, text, description, hideWhenDefault, children, className, ...rest }, ref) => {
1442
1446
  const content = childContent(children);
1447
+ if (hideWhenDefault === true && (isArchived ?? archived ?? status) === false && !archivedAt && !firstText(reason, archiveReason) && !content.authored && content.scalar === void 0) return null;
1443
1448
  const terms = [["Archived", summaryValue(isArchived ?? archived ?? status)], ["Archived At", archivedAt ? formatDateTime(archivedAt) : void 0], ["Reason", firstText(reason, archiveReason)]].filter((entry) => entry[1] !== void 0);
1444
1449
  const fallback = firstText(summary2, text, description);
1445
1450
  return /* @__PURE__ */ jsxs("section", { ref, className: classes3("oods-archive-summary", className), "data-oods-component": "ArchiveSummary", "data-summary-type": "archive", ...rest, children: [
package/dist/ported.cjs CHANGED
@@ -1076,10 +1076,12 @@ var CancellationSummary = React3__namespace.forwardRef(
1076
1076
  requestedAtField,
1077
1077
  reasonField,
1078
1078
  codeField,
1079
+ hideWhenDefault,
1079
1080
  className,
1080
1081
  ...rest
1081
1082
  }, ref) => {
1082
1083
  const childValue = typeof children === "boolean" ? children ? "Yes" : "No" : children;
1084
+ if (hideWhenDefault === true && cancelAtPeriodEnd === false && !requestedAt && !reason && !code && (childValue === void 0 || childValue === null)) return null;
1083
1085
  return /* @__PURE__ */ jsxRuntime.jsxs(
1084
1086
  "section",
1085
1087
  {
package/dist/ported.d.cts CHANGED
@@ -95,6 +95,8 @@ interface CancellationSummaryProps extends Omit<React.HTMLAttributes<HTMLElement
95
95
  readonly requestedAtField?: string;
96
96
  readonly reasonField?: string;
97
97
  readonly codeField?: string;
98
+ /** s224-m01: render nothing while the card would only say "Cancel at period end: No", so a detail page states no default. */
99
+ readonly hideWhenDefault?: boolean;
98
100
  }
99
101
  declare const CancellationSummary: React.ForwardRefExoticComponent<CancellationSummaryProps & React.RefAttributes<HTMLElement>>;
100
102
  type NativeSearchInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children' | 'type' | 'onChange' | 'value' | 'defaultValue'>;
package/dist/ported.d.ts CHANGED
@@ -95,6 +95,8 @@ interface CancellationSummaryProps extends Omit<React.HTMLAttributes<HTMLElement
95
95
  readonly requestedAtField?: string;
96
96
  readonly reasonField?: string;
97
97
  readonly codeField?: string;
98
+ /** s224-m01: render nothing while the card would only say "Cancel at period end: No", so a detail page states no default. */
99
+ readonly hideWhenDefault?: boolean;
98
100
  }
99
101
  declare const CancellationSummary: React.ForwardRefExoticComponent<CancellationSummaryProps & React.RefAttributes<HTMLElement>>;
100
102
  type NativeSearchInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children' | 'type' | 'onChange' | 'value' | 'defaultValue'>;
package/dist/ported.js CHANGED
@@ -1,2 +1,2 @@
1
- export { AuditTimeline, CancellationSummary, PaginationBar, PriceBadge, RelativeTimestamp, SearchInput, StatusBadge, StatusTimeline } from './chunk-NLWXBLPA.js';
1
+ export { AuditTimeline, CancellationSummary, PaginationBar, PriceBadge, RelativeTimestamp, SearchInput, StatusBadge, StatusTimeline } from './chunk-ICXOX5B3.js';
2
2
  import './chunk-2VEQWKGK.js';
package/dist/types.d.cts CHANGED
@@ -652,6 +652,8 @@ interface ArchiveSummaryProps extends React.HTMLAttributes<HTMLElement> {
652
652
  readonly summary?: string;
653
653
  readonly text?: string;
654
654
  readonly description?: string;
655
+ /** s224-m01: render nothing while the card would only say "Archived: No", so a detail page states no default. */
656
+ readonly hideWhenDefault?: boolean;
655
657
  }
656
658
  interface ArchivePillProps extends Omit<ClassificationBadgeProps, 'category' | 'mode' | 'value'> {
657
659
  readonly isArchived?: boolean | string;
package/dist/types.d.ts CHANGED
@@ -652,6 +652,8 @@ interface ArchiveSummaryProps extends React.HTMLAttributes<HTMLElement> {
652
652
  readonly summary?: string;
653
653
  readonly text?: string;
654
654
  readonly description?: string;
655
+ /** s224-m01: render nothing while the card would only say "Archived: No", so a detail page states no default. */
656
+ readonly hideWhenDefault?: boolean;
655
657
  }
656
658
  interface ArchivePillProps extends Omit<ClassificationBadgeProps, 'category' | 'mode' | 'value'> {
657
659
  readonly isArchived?: boolean | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oods/components-react",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "React components for OODS Foundry: the controls, layouts and domain views its generated screens use.",
5
5
  "homepage": "https://oods-foundry.com/",
6
6
  "bugs": {
@@ -64,8 +64,8 @@
64
64
  ],
65
65
  "dependencies": {
66
66
  "@radix-ui/react-slot": "^1.1.2",
67
- "@oods/component-contracts": "0.4.1",
68
- "@oods/component-styles": "0.4.1"
67
+ "@oods/component-contracts": "0.4.3",
68
+ "@oods/component-styles": "0.4.3"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": ">=18 <20",