@apipass/design-system 5.4.0 → 5.5.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.
@@ -1,105 +1,127 @@
1
- import { jsx as e, jsxs as m, Fragment as T } from "react/jsx-runtime";
2
- import { clsx as c } from "../../../vendor/clsx/dist/clsx.js";
3
- import { Table as x, Column as $, TableBody as v, useTableOptions as h, TableHeader as w, Checkbox as u, Collection as N, Row as y, Button as B, Cell as k } from "react-aria-components";
1
+ import { jsx as e, jsxs as b, Fragment as v } from "react/jsx-runtime";
2
+ import { clsx as a } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { createContext as $, useContext as N } from "react";
4
+ import { Table as k, Column as w, TableBody as B, useTableOptions as f, TableHeader as R, Checkbox as g, Collection as p, Row as U, Button as j, Cell as D } from "react-aria-components";
4
5
  /* empty css */
5
- import { IconChevronDown as U } from "../../icons/IconChevronDown.js";
6
- import { IconChevronUp as j } from "../../icons/IconChevronUp.js";
7
- import { Checkbox as f } from "../Checkbox/Checkbox.js";
8
- function D(l) {
9
- const s = Number(l);
10
- return `${l}`.trim() !== "" && Number.isFinite(s) ? `${s}px` : `${l}`;
6
+ import { IconChevronDown as F } from "../../icons/IconChevronDown.js";
7
+ import { IconChevronUp as I } from "../../icons/IconChevronUp.js";
8
+ import { Checkbox as C } from "../Checkbox/Checkbox.js";
9
+ import { Radio as S } from "../Radio/Radio.js";
10
+ const d = $("checkbox");
11
+ function V(l) {
12
+ const t = Number(l);
13
+ return `${l}`.trim() !== "" && Number.isFinite(t) ? `${t}px` : `${l}`;
11
14
  }
12
- function O({
15
+ function G({
13
16
  bleed: l = !1,
14
- dense: s = !1,
15
- grid: a = !1,
16
- striped: t = !1,
17
+ dense: t = !1,
18
+ grid: s = !1,
19
+ striped: o = !1,
20
+ selectionType: c = "checkbox",
17
21
  maxHeight: n,
18
- className: o,
19
- ...r
22
+ className: m,
23
+ ...i
20
24
  }) {
21
- const i = n !== void 0, g = c(
22
- o,
25
+ const r = n !== void 0, x = a(
26
+ m,
23
27
  "table-container",
24
28
  l && "table-container-bleed",
25
- i && "table-container-scrollable"
26
- ), C = i ? { "--table-max-height": D(n) } : void 0, p = c(
29
+ r && "table-container-scrollable"
30
+ ), T = r ? { "--table-max-height": V(n) } : void 0, y = a(
27
31
  "sds-table",
28
32
  l && "table-bleed",
29
- s && "table-dense",
30
- a && "table-grid",
31
- t && "sds-table-striped"
33
+ t && "table-dense",
34
+ s && "table-grid",
35
+ o && "sds-table-striped"
32
36
  );
33
- return /* @__PURE__ */ e("div", { className: g, style: C, children: /* @__PURE__ */ e(x, { className: p, ...r }) });
37
+ return /* @__PURE__ */ e("div", { className: x, style: T, children: /* @__PURE__ */ e(d.Provider, { value: c, children: /* @__PURE__ */ e(k, { className: y, ...i }) }) });
34
38
  }
35
- function b({
39
+ function h({
36
40
  align: l = "start",
37
- className: s,
38
- ...a
41
+ className: t,
42
+ ...s
39
43
  }) {
40
- const t = c(s, "table-column", `table-align-${l}`);
41
- return /* @__PURE__ */ e($, { className: t, ...a, children: ({ allowsSorting: n, sortDirection: o }) => /* @__PURE__ */ e("div", { className: c("table-column-inner"), children: /* @__PURE__ */ m(T, { children: [
42
- a.children,
43
- n && /* @__PURE__ */ e(
44
+ const o = a(t, "table-column", `table-align-${l}`);
45
+ return /* @__PURE__ */ e(w, { className: o, ...s, children: ({ allowsSorting: c, sortDirection: n }) => /* @__PURE__ */ e("div", { className: a("table-column-inner"), children: /* @__PURE__ */ b(v, { children: [
46
+ s.children,
47
+ c && /* @__PURE__ */ e(
44
48
  "span",
45
49
  {
46
50
  "aria-hidden": "true",
47
- className: c(
51
+ className: a(
48
52
  "sort-indicator",
49
- !o && "sort-indicator-unsorted"
53
+ !n && "sort-indicator-unsorted"
50
54
  ),
51
- children: o === "descending" ? /* @__PURE__ */ e(U, {}) : /* @__PURE__ */ e(j, {})
55
+ children: n === "descending" ? /* @__PURE__ */ e(F, {}) : /* @__PURE__ */ e(I, {})
52
56
  }
53
57
  )
54
58
  ] }) }) });
55
59
  }
56
- function S({
60
+ function J({
57
61
  className: l,
58
- ...s
62
+ ...t
59
63
  }) {
60
- return /* @__PURE__ */ e(v, { ...s });
64
+ return /* @__PURE__ */ e(B, { ...t });
61
65
  }
62
- function q({
66
+ function K({
63
67
  className: l,
64
- columns: s,
65
- children: a,
66
- ...t
68
+ columns: t,
69
+ children: s,
70
+ ...o
67
71
  }) {
68
- const { selectionBehavior: n, selectionMode: o, allowsDragging: r } = h(), i = c(l, "table-head");
69
- return /* @__PURE__ */ m(w, { className: i, ...t, children: [
70
- r && /* @__PURE__ */ e(b, {}),
71
- n === "toggle" && /* @__PURE__ */ e(b, { className: "table-selection-col", children: o === "multiple" && /* @__PURE__ */ e(u, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(f, {}) }) }),
72
- /* @__PURE__ */ e(N, { items: s, children: a })
72
+ const { selectionBehavior: c, selectionMode: n, allowsDragging: m } = f(), i = N(d), r = a(l, "table-head");
73
+ return /* @__PURE__ */ b(R, { className: r, ...o, children: [
74
+ m && /* @__PURE__ */ e(h, {}),
75
+ c === "toggle" && /* @__PURE__ */ e(
76
+ h,
77
+ {
78
+ className: a(
79
+ "table-selection-col",
80
+ i === "radio" && "table-selection-col--radio"
81
+ ),
82
+ children: n === "multiple" && /* @__PURE__ */ e(g, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(C, {}) })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ e(p, { items: t, children: s })
73
86
  ] });
74
87
  }
75
- function z({
88
+ function Q({
76
89
  id: l,
77
- columns: s,
78
- children: a,
79
- className: t,
80
- ...n
90
+ columns: t,
91
+ children: s,
92
+ className: o,
93
+ ...c
81
94
  }) {
82
- const { selectionBehavior: o, allowsDragging: r } = h(), i = c(t, "table-row");
83
- return /* @__PURE__ */ m(y, { id: l, ...n, className: i, children: [
84
- r && /* @__PURE__ */ e(d, { children: /* @__PURE__ */ e(B, { slot: "drag", children: "≡" }) }),
85
- o === "toggle" && /* @__PURE__ */ e(d, { className: "table-selection-cell", children: /* @__PURE__ */ e(u, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(f, {}) }) }),
86
- /* @__PURE__ */ e(N, { items: s, children: a })
95
+ const { selectionBehavior: n, allowsDragging: m } = f(), i = N(d), r = a(o, "table-row");
96
+ return /* @__PURE__ */ b(U, { id: l, ...c, className: r, children: [
97
+ m && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(j, { slot: "drag", children: "≡" }) }),
98
+ n === "toggle" && /* @__PURE__ */ e(
99
+ u,
100
+ {
101
+ className: a(
102
+ "table-selection-cell",
103
+ i === "radio" && "table-selection-cell--radio"
104
+ ),
105
+ children: /* @__PURE__ */ e(g, { slot: "selection", className: "table-selection-checkbox", children: i === "radio" ? /* @__PURE__ */ e(S, {}) : /* @__PURE__ */ e(C, {}) })
106
+ }
107
+ ),
108
+ /* @__PURE__ */ e(p, { items: t, children: s })
87
109
  ] });
88
110
  }
89
- function d({
111
+ function u({
90
112
  align: l = "start",
91
- className: s,
92
- ...a
113
+ className: t,
114
+ ...s
93
115
  }) {
94
- const t = c(s, "table-cell", `table-align-${l}`);
95
- return /* @__PURE__ */ e(k, { className: t, ...a });
116
+ const o = a(t, "table-cell", `table-align-${l}`);
117
+ return /* @__PURE__ */ e(D, { className: o, ...s });
96
118
  }
97
119
  export {
98
- O as Table,
99
- S as TableBody,
100
- d as TableCell,
101
- b as TableColumn,
102
- q as TableHead,
103
- z as TableRow
120
+ G as Table,
121
+ J as TableBody,
122
+ u as TableCell,
123
+ h as TableColumn,
124
+ K as TableHead,
125
+ Q as TableRow
104
126
  };
105
127
  //# sourceMappingURL=Table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../../../src/ui/primitives/Table/Table.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconChevronDown, IconChevronUp } from \"icons\";\nimport type { CSSProperties } from \"react\";\nimport { Checkbox } from \"primitives\";\nimport {\n Button as RACButton,\n Cell as RACCell,\n Checkbox as RACSelectionCheckbox,\n Collection as RACCollection,\n Column as RACColumn,\n Row as RACRow,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n useTableOptions,\n type CellProps as RACCellProps,\n type ColumnProps as RACColumnProps,\n type RowProps as RACRowProps,\n type TableBodyProps as RACTableBodyProps,\n type TableHeaderProps as RACTableHeaderProps,\n type TableProps as RACTableProps,\n} from \"react-aria-components\";\nimport \"./table.css\";\n\ntype TableAlign = \"start\" | \"center\" | \"right\";\n\nfunction toCssLength(value: number | string): string {\n const numericValue = Number(value);\n const isUnitlessNumber =\n `${value}`.trim() !== \"\" && Number.isFinite(numericValue);\n return isUnitlessNumber ? `${numericValue}px` : `${value}`;\n}\n\nexport type TableProps = RACTableProps & {\n bleed?: boolean;\n dense?: boolean;\n grid?: boolean;\n striped?: boolean;\n maxHeight?: number | string;\n};\nexport function Table({\n bleed = false,\n dense = false,\n grid = false,\n striped = false,\n maxHeight,\n className,\n ...props\n}: TableProps) {\n const scrollsVertically = maxHeight !== undefined;\n const containerClassNames = clsx(\n className,\n \"table-container\",\n bleed && \"table-container-bleed\",\n scrollsVertically && \"table-container-scrollable\",\n );\n const containerStyle = scrollsVertically\n ? ({ \"--table-max-height\": toCssLength(maxHeight) } as CSSProperties)\n : undefined;\n const tableClassNames = clsx(\n \"sds-table\",\n bleed && \"table-bleed\",\n dense && \"table-dense\",\n grid && \"table-grid\",\n striped && \"sds-table-striped\",\n );\n return (\n <div className={containerClassNames} style={containerStyle}>\n <RACTable className={tableClassNames} {...props} />\n </div>\n );\n}\n\nexport type TableColumnProps = RACColumnProps & {\n align?: TableAlign;\n};\nexport function TableColumn({\n align = \"start\",\n className,\n ...props\n}: TableColumnProps) {\n const classNames = clsx(className, \"table-column\", `table-align-${align}`);\n return (\n <RACColumn className={classNames} {...props}>\n {({ allowsSorting, sortDirection }) => (\n <div className={clsx(\"table-column-inner\")}>\n <>\n {props.children}\n {allowsSorting && (\n <span\n aria-hidden=\"true\"\n className={clsx(\n \"sort-indicator\",\n !sortDirection && \"sort-indicator-unsorted\",\n )}\n >\n {sortDirection === \"descending\" ? (\n <IconChevronDown />\n ) : (\n <IconChevronUp />\n )}\n </span>\n )}\n </>\n </div>\n )}\n </RACColumn>\n );\n}\n\nexport type TableBodyProps<T> = RACTableBodyProps<T>;\nexport function TableBody<T extends object>({\n className,\n ...props\n}: TableBodyProps<T>) {\n return <RACTableBody {...props} />;\n}\n\nexport type TableHeadProps<T> = RACTableHeaderProps<T>;\nexport function TableHead<T extends object>({\n className,\n columns,\n children,\n ...props\n}: TableHeadProps<T>) {\n const { selectionBehavior, selectionMode, allowsDragging } =\n useTableOptions();\n const classNames = clsx(className, \"table-head\");\n return (\n <RACTableHeader className={classNames} {...props}>\n {/* Add extra columns for drag and drop and selection. */}\n {allowsDragging && <TableColumn />}\n {selectionBehavior === \"toggle\" && (\n <TableColumn className=\"table-selection-col\">\n {selectionMode === \"multiple\" && (\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n )}\n </TableColumn>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACTableHeader>\n );\n}\n\nexport type TableRowProps<T> = RACRowProps<T>;\nexport function TableRow<T extends object>({\n id,\n columns,\n children,\n className,\n ...otherProps\n}: TableRowProps<T>) {\n const { selectionBehavior, allowsDragging } = useTableOptions();\n const classNames = clsx(className, \"table-row\");\n return (\n <RACRow id={id} {...otherProps} className={classNames}>\n {allowsDragging && (\n <TableCell>\n <RACButton slot=\"drag\">≡</RACButton>\n </TableCell>\n )}\n {selectionBehavior === \"toggle\" && (\n <TableCell className=\"table-selection-cell\">\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n </TableCell>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACRow>\n );\n}\n\nexport type TableCellProps = RACCellProps & { align?: TableAlign };\nexport function TableCell({\n align = \"start\",\n className,\n ...props\n}: TableCellProps) {\n const classNames = clsx(className, \"table-cell\", `table-align-${align}`);\n return <RACCell className={classNames} {...props} />;\n}\n"],"names":["toCssLength","value","numericValue","Table","bleed","dense","grid","striped","maxHeight","className","props","scrollsVertically","containerClassNames","clsx","containerStyle","tableClassNames","jsx","RACTable","TableColumn","align","classNames","RACColumn","allowsSorting","sortDirection","jsxs","Fragment","IconChevronDown","IconChevronUp","TableBody","RACTableBody","TableHead","columns","children","selectionBehavior","selectionMode","allowsDragging","useTableOptions","RACTableHeader","RACSelectionCheckbox","Checkbox","RACCollection","TableRow","id","otherProps","RACRow","TableCell","RACButton","RACCell"],"mappings":";;;;;;;AA0BA,SAASA,EAAYC,GAAgC;AACnD,QAAMC,IAAe,OAAOD,CAAK;AAGjC,SADE,GAAGA,CAAK,GAAG,WAAW,MAAM,OAAO,SAASC,CAAY,IAChC,GAAGA,CAAY,OAAO,GAAGD,CAAK;AAC1D;AASO,SAASE,EAAM;AAAA,EACpB,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GAAe;AACb,QAAMC,IAAoBH,MAAc,QAClCI,IAAsBC;AAAA,IAC1BJ;AAAA,IACA;AAAA,IACAL,KAAS;AAAA,IACTO,KAAqB;AAAA,EAAA,GAEjBG,IAAiBH,IAClB,EAAE,sBAAsBX,EAAYQ,CAAS,MAC9C,QACEO,IAAkBF;AAAA,IACtB;AAAA,IACAT,KAAS;AAAA,IACTC,KAAS;AAAA,IACTC,KAAQ;AAAA,IACRC,KAAW;AAAA,EAAA;AAEb,SACE,gBAAAS,EAAC,OAAA,EAAI,WAAWJ,GAAqB,OAAOE,GAC1C,UAAA,gBAAAE,EAACC,GAAA,EAAS,WAAWF,GAAkB,GAAGL,EAAA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,gBAAAlB,EAACsB,GAAA,EAAqB,MAAK,aAAY,WAAU,4BAC/C,UAAA,gBAAAtB,EAACuB,GAAA,CAAA,CAAS,GACZ,GAEJ;AAAA,IAEF,gBAAAvB,EAACwB,GAAA,EAAc,OAAOT,GAAU,UAAAC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;AAGO,SAASS,EAA2B;AAAA,EACzC,IAAAC;AAAA,EACA,SAAAX;AAAA,EACA,UAAAC;AAAA,EACA,WAAAvB;AAAA,EACA,GAAGkC;AACL,GAAqB;AACnB,QAAM,EAAE,mBAAAV,GAAmB,gBAAAE,EAAA,IAAmBC,EAAA,GACxChB,IAAaP,EAAKJ,GAAW,WAAW;AAC9C,2BACGmC,GAAA,EAAO,IAAAF,GAAS,GAAGC,GAAY,WAAWvB,GACxC,UAAA;AAAA,IAAAe,uBACEU,GAAA,EACC,UAAA,gBAAA7B,EAAC8B,KAAU,MAAK,QAAO,eAAC,EAAA,CAC1B;AAAA,IAEDb,MAAsB,YACrB,gBAAAjB,EAAC6B,GAAA,EAAU,WAAU,wBACnB,UAAA,gBAAA7B,EAACsB,GAAA,EAAqB,MAAK,aAAY,WAAU,4BAC/C,UAAA,gBAAAtB,EAACuB,GAAA,CAAA,CAAS,GACZ,GACF;AAAA,IAEF,gBAAAvB,EAACwB,GAAA,EAAc,OAAOT,GAAU,UAAAC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;AAGO,SAASa,EAAU;AAAA,EACxB,OAAA1B,IAAQ;AAAA,EACR,WAAAV;AAAA,EACA,GAAGC;AACL,GAAmB;AACjB,QAAMU,IAAaP,EAAKJ,GAAW,cAAc,eAAeU,CAAK,EAAE;AACvE,SAAO,gBAAAH,EAAC+B,GAAA,EAAQ,WAAW3B,GAAa,GAAGV,GAAO;AACpD;"}
1
+ {"version":3,"file":"Table.js","sources":["../../../../../src/ui/primitives/Table/Table.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconChevronDown, IconChevronUp } from \"icons\";\nimport { Checkbox, Radio } from \"primitives\";\nimport { createContext, useContext, type CSSProperties } from \"react\";\nimport {\n Button as RACButton,\n Cell as RACCell,\n Checkbox as RACSelectionCheckbox,\n Collection as RACCollection,\n Column as RACColumn,\n Row as RACRow,\n Table as RACTable,\n TableBody as RACTableBody,\n TableHeader as RACTableHeader,\n useTableOptions,\n type CellProps as RACCellProps,\n type ColumnProps as RACColumnProps,\n type RowProps as RACRowProps,\n type TableBodyProps as RACTableBodyProps,\n type TableHeaderProps as RACTableHeaderProps,\n type TableProps as RACTableProps,\n} from \"react-aria-components\";\nimport \"./table.css\";\n\ntype TableAlign = \"start\" | \"center\" | \"right\";\n\n/**\n * Visual style of the built-in selection control rendered in the selection\n * column (header \"select all\" + per-row toggle). \"radio\" is for\n * `selectionMode=\"single\"` tables where a round, single-choice control reads\n * better than a checkbox — the header never renders a control either way\n * (there is no \"select all\" for a single choice).\n */\ntype SelectionType = \"checkbox\" | \"radio\";\nconst SelectionTypeContext = createContext<SelectionType>(\"checkbox\");\n\nfunction toCssLength(value: number | string): string {\n const numericValue = Number(value);\n const isUnitlessNumber =\n `${value}`.trim() !== \"\" && Number.isFinite(numericValue);\n return isUnitlessNumber ? `${numericValue}px` : `${value}`;\n}\n\nexport type TableProps = RACTableProps & {\n bleed?: boolean;\n dense?: boolean;\n grid?: boolean;\n striped?: boolean;\n selectionType?: SelectionType;\n maxHeight?: number | string;\n};\nexport function Table({\n bleed = false,\n dense = false,\n grid = false,\n striped = false,\n selectionType = \"checkbox\",\n maxHeight,\n className,\n ...props\n}: TableProps) {\n const scrollsVertically = maxHeight !== undefined;\n const containerClassNames = clsx(\n className,\n \"table-container\",\n bleed && \"table-container-bleed\",\n scrollsVertically && \"table-container-scrollable\",\n );\n const containerStyle = scrollsVertically\n ? ({ \"--table-max-height\": toCssLength(maxHeight) } as CSSProperties)\n : undefined;\n const tableClassNames = clsx(\n \"sds-table\",\n bleed && \"table-bleed\",\n dense && \"table-dense\",\n grid && \"table-grid\",\n striped && \"sds-table-striped\",\n );\n return (\n <div className={containerClassNames} style={containerStyle}>\n <SelectionTypeContext.Provider value={selectionType}>\n <RACTable className={tableClassNames} {...props} />\n </SelectionTypeContext.Provider>\n </div>\n );\n}\n\nexport type TableColumnProps = RACColumnProps & {\n align?: TableAlign;\n};\nexport function TableColumn({\n align = \"start\",\n className,\n ...props\n}: TableColumnProps) {\n const classNames = clsx(className, \"table-column\", `table-align-${align}`);\n return (\n <RACColumn className={classNames} {...props}>\n {({ allowsSorting, sortDirection }) => (\n <div className={clsx(\"table-column-inner\")}>\n <>\n {props.children}\n {allowsSorting && (\n <span\n aria-hidden=\"true\"\n className={clsx(\n \"sort-indicator\",\n !sortDirection && \"sort-indicator-unsorted\",\n )}\n >\n {sortDirection === \"descending\" ? (\n <IconChevronDown />\n ) : (\n <IconChevronUp />\n )}\n </span>\n )}\n </>\n </div>\n )}\n </RACColumn>\n );\n}\n\nexport type TableBodyProps<T> = RACTableBodyProps<T>;\nexport function TableBody<T extends object>({\n className,\n ...props\n}: TableBodyProps<T>) {\n return <RACTableBody {...props} />;\n}\n\nexport type TableHeadProps<T> = RACTableHeaderProps<T>;\nexport function TableHead<T extends object>({\n className,\n columns,\n children,\n ...props\n}: TableHeadProps<T>) {\n const { selectionBehavior, selectionMode, allowsDragging } =\n useTableOptions();\n const selectionType = useContext(SelectionTypeContext);\n const classNames = clsx(className, \"table-head\");\n return (\n <RACTableHeader className={classNames} {...props}>\n {/* Add extra columns for drag and drop and selection. */}\n {allowsDragging && <TableColumn />}\n {selectionBehavior === \"toggle\" && (\n <TableColumn\n className={clsx(\n \"table-selection-col\",\n selectionType === \"radio\" && \"table-selection-col--radio\",\n )}\n >\n {selectionMode === \"multiple\" && (\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n <Checkbox />\n </RACSelectionCheckbox>\n )}\n </TableColumn>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACTableHeader>\n );\n}\n\nexport type TableRowProps<T> = RACRowProps<T>;\nexport function TableRow<T extends object>({\n id,\n columns,\n children,\n className,\n ...otherProps\n}: TableRowProps<T>) {\n const { selectionBehavior, allowsDragging } = useTableOptions();\n const selectionType = useContext(SelectionTypeContext);\n const classNames = clsx(className, \"table-row\");\n return (\n <RACRow id={id} {...otherProps} className={classNames}>\n {allowsDragging && (\n <TableCell>\n <RACButton slot=\"drag\">≡</RACButton>\n </TableCell>\n )}\n {selectionBehavior === \"toggle\" && (\n <TableCell\n className={clsx(\n \"table-selection-cell\",\n selectionType === \"radio\" && \"table-selection-cell--radio\",\n )}\n >\n <RACSelectionCheckbox slot=\"selection\" className=\"table-selection-checkbox\">\n {selectionType === \"radio\" ? <Radio /> : <Checkbox />}\n </RACSelectionCheckbox>\n </TableCell>\n )}\n <RACCollection items={columns}>{children}</RACCollection>\n </RACRow>\n );\n}\n\nexport type TableCellProps = RACCellProps & { align?: TableAlign };\nexport function TableCell({\n align = \"start\",\n className,\n ...props\n}: TableCellProps) {\n const classNames = clsx(className, \"table-cell\", `table-align-${align}`);\n return <RACCell className={classNames} {...props} />;\n}\n"],"names":["SelectionTypeContext","createContext","toCssLength","value","numericValue","Table","bleed","dense","grid","striped","selectionType","maxHeight","className","props","scrollsVertically","containerClassNames","clsx","containerStyle","tableClassNames","RACTable","TableColumn","align","classNames","RACColumn","allowsSorting","sortDirection","jsx","jsxs","Fragment","IconChevronDown","IconChevronUp","TableBody","RACTableBody","TableHead","columns","children","selectionBehavior","selectionMode","allowsDragging","useTableOptions","useContext","RACTableHeader","RACSelectionCheckbox","Checkbox","RACCollection","TableRow","id","otherProps","RACRow","TableCell","RACButton","Radio","RACCell"],"mappings":";;;;;;;;;AAkCA,MAAMA,IAAuBC,EAA6B,UAAU;AAEpE,SAASC,EAAYC,GAAgC;AACnD,QAAMC,IAAe,OAAOD,CAAK;AAGjC,SADE,GAAGA,CAAK,GAAG,WAAW,MAAM,OAAO,SAASC,CAAY,IAChC,GAAGA,CAAY,OAAO,GAAGD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,IAAaN,EAAKJ,GAAW,WAAW;AAC9C,2BACGoC,GAAA,EAAO,IAAAF,GAAS,GAAGC,GAAY,WAAWzB,GACxC,UAAA;AAAA,IAAAgB,uBACEW,GAAA,EACC,UAAA,gBAAAvB,EAACwB,KAAU,MAAK,QAAO,eAAC,EAAA,CAC1B;AAAA,IAEDd,MAAsB,YACrB,gBAAAV;AAAA,MAACuB;AAAA,MAAA;AAAA,QACC,WAAWjC;AAAA,UACT;AAAA,UACAN,MAAkB,WAAW;AAAA,QAAA;AAAA,QAG/B,UAAA,gBAAAgB,EAACgB,GAAA,EAAqB,MAAK,aAAY,WAAU,4BAC9C,UAAAhC,MAAkB,UAAU,gBAAAgB,EAACyB,GAAA,CAAA,CAAM,IAAK,gBAAAzB,EAACiB,KAAS,EAAA,CACrD;AAAA,MAAA;AAAA,IAAA;AAAA,IAGJ,gBAAAjB,EAACkB,GAAA,EAAc,OAAOV,GAAU,UAAAC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;AAGO,SAASc,EAAU;AAAA,EACxB,OAAA5B,IAAQ;AAAA,EACR,WAAAT;AAAA,EACA,GAAGC;AACL,GAAmB;AACjB,QAAMS,IAAaN,EAAKJ,GAAW,cAAc,eAAeS,CAAK,EAAE;AACvE,SAAO,gBAAAK,EAAC0B,GAAA,EAAQ,WAAW9B,GAAa,GAAGT,GAAO;AACpD;"}
@@ -32,10 +32,18 @@ export interface DataTableProps<T extends {
32
32
  /** Label for the row actions column header. Defaults to empty string. */
33
33
  rowActionsLabel?: string;
34
34
  /**
35
- * When true, renders a checkbox column before the first data column — a per-row checkbox on
36
- * every row, plus a "select all" checkbox in the header. Off by default.
35
+ * When true, renders a selection column before the first data column — a per-row control on
36
+ * every row (see `selectionType`), plus a "select all" checkbox in the header when
37
+ * `selectionType` is "checkbox". Off by default.
37
38
  */
38
39
  selectable?: boolean;
40
+ /**
41
+ * Visual style of the built-in selection control. "checkbox" (default) allows selecting
42
+ * multiple rows and shows a "select all" in the header. "radio" restricts selection to a
43
+ * single row (no "select all" — there is nothing to select all *to* with one choice) and
44
+ * renders a round control instead of a checkbox.
45
+ */
46
+ selectionType?: "checkbox" | "radio";
39
47
  /** Controlled selection state. Omit to let the table manage its own selection internally. */
40
48
  selectedKeys?: Selection;
41
49
  onSelectionChange?: (keys: Selection) => void;
@@ -58,4 +66,4 @@ export interface DataTableProps<T extends {
58
66
  }
59
67
  export declare function DataTable<T extends {
60
68
  id: string;
61
- }>({ columns, data, actions, rowActions, rowActionsLabel, selectable, selectedKeys, onSelectionChange, searchPlaceholder, searchKeys, isLoading, loadingMessage, emptyMessage, previousLabel, nextLabel, pageSize, nestedColumns, getNestedData, nestedLoadingMessage, nestedEmptyMessage, nestedSearchKeys, nestedSearchPlaceholder, nestedActions, nestedPageSize, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
69
+ }>({ columns, data, actions, rowActions, rowActionsLabel, selectable, selectionType, selectedKeys, onSelectionChange, searchPlaceholder, searchKeys, isLoading, loadingMessage, emptyMessage, previousLabel, nextLabel, pageSize, nestedColumns, getNestedData, nestedLoadingMessage, nestedEmptyMessage, nestedSearchKeys, nestedSearchPlaceholder, nestedActions, nestedPageSize, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,23 @@
1
1
  import { type CellProps as RACCellProps, type ColumnProps as RACColumnProps, type RowProps as RACRowProps, type TableBodyProps as RACTableBodyProps, type TableHeaderProps as RACTableHeaderProps, type TableProps as RACTableProps } from "react-aria-components";
2
2
  import "./table.css";
3
3
  type TableAlign = "start" | "center" | "right";
4
+ /**
5
+ * Visual style of the built-in selection control rendered in the selection
6
+ * column (header "select all" + per-row toggle). "radio" is for
7
+ * `selectionMode="single"` tables where a round, single-choice control reads
8
+ * better than a checkbox — the header never renders a control either way
9
+ * (there is no "select all" for a single choice).
10
+ */
11
+ type SelectionType = "checkbox" | "radio";
4
12
  export type TableProps = RACTableProps & {
5
13
  bleed?: boolean;
6
14
  dense?: boolean;
7
15
  grid?: boolean;
8
16
  striped?: boolean;
17
+ selectionType?: SelectionType;
9
18
  maxHeight?: number | string;
10
19
  };
11
- export declare function Table({ bleed, dense, grid, striped, maxHeight, className, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Table({ bleed, dense, grid, striped, selectionType, maxHeight, className, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
12
21
  export type TableColumnProps = RACColumnProps & {
13
22
  align?: TableAlign;
14
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/design-system",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "type": "module",
5
5
  "description": "APIPass React Design System",
6
6
  "sideEffects": [