@apipass/design-system 6.1.0 → 7.0.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.
Files changed (41) hide show
  1. package/dist/lib/charts.index.cjs +1 -1
  2. package/dist/lib/charts.index.js +7 -5
  3. package/dist/lib/charts.index.js.map +1 -1
  4. package/dist/lib/embedded-styles.js +2 -2
  5. package/dist/lib/style.css +1 -1
  6. package/dist/lib/ui/components/DataTable/DataTable.cjs +1 -1
  7. package/dist/lib/ui/components/DataTable/DataTable.cjs.map +1 -1
  8. package/dist/lib/ui/components/DataTable/DataTable.js +81 -83
  9. package/dist/lib/ui/components/DataTable/DataTable.js.map +1 -1
  10. package/dist/lib/ui/components/charts/PieChart/PieChart.cjs +1 -1
  11. package/dist/lib/ui/components/charts/PieChart/PieChart.cjs.map +1 -1
  12. package/dist/lib/ui/components/charts/PieChart/PieChart.js +39 -38
  13. package/dist/lib/ui/components/charts/PieChart/PieChart.js.map +1 -1
  14. package/dist/lib/ui/components/charts/PieChart/pie-chart-option.cjs +1 -1
  15. package/dist/lib/ui/components/charts/PieChart/pie-chart-option.cjs.map +1 -1
  16. package/dist/lib/ui/components/charts/PieChart/pie-chart-option.js +65 -71
  17. package/dist/lib/ui/components/charts/PieChart/pie-chart-option.js.map +1 -1
  18. package/dist/lib/ui/components/charts/TopList/TopList.cjs +2 -0
  19. package/dist/lib/ui/components/charts/TopList/TopList.cjs.map +1 -0
  20. package/dist/lib/ui/components/charts/TopList/TopList.js +79 -0
  21. package/dist/lib/ui/components/charts/TopList/TopList.js.map +1 -0
  22. package/dist/lib/ui/components/charts/TopList/top-list-option.cjs +2 -0
  23. package/dist/lib/ui/components/charts/TopList/top-list-option.cjs.map +1 -0
  24. package/dist/lib/ui/components/charts/TopList/top-list-option.js +178 -0
  25. package/dist/lib/ui/components/charts/TopList/top-list-option.js.map +1 -0
  26. package/dist/lib/ui/components/charts/chart-share.cjs +2 -0
  27. package/dist/lib/ui/components/charts/chart-share.cjs.map +1 -0
  28. package/dist/lib/ui/components/charts/chart-share.js +11 -0
  29. package/dist/lib/ui/components/charts/chart-share.js.map +1 -0
  30. package/dist/lib/ui/primitives/Table/Table.cjs +1 -1
  31. package/dist/lib/ui/primitives/Table/Table.cjs.map +1 -1
  32. package/dist/lib/ui/primitives/Table/Table.js +53 -55
  33. package/dist/lib/ui/primitives/Table/Table.js.map +1 -1
  34. package/dist/types/charts.index.d.ts +1 -0
  35. package/dist/types/ui/components/DataTable/DataTable.d.ts +1 -3
  36. package/dist/types/ui/components/charts/PieChart/pie-chart-option.d.ts +0 -1
  37. package/dist/types/ui/components/charts/TopList/TopList.d.ts +13 -0
  38. package/dist/types/ui/components/charts/TopList/top-list-option.d.ts +24 -0
  39. package/dist/types/ui/components/charts/chart-share.d.ts +1 -0
  40. package/dist/types/ui/primitives/Table/Table.d.ts +1 -2
  41. package/package.json +1 -1
@@ -1,111 +1,109 @@
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";
1
+ import { jsx as e, jsxs as b, Fragment as y } from "react/jsx-runtime";
2
+ import { clsx as o } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { createContext as v, useContext as N } from "react";
4
+ import { Table as $, Column as k, TableBody as w, useTableOptions as f, TableHeader as B, Checkbox as p, Collection as g, Row as R, Button as U, Cell as j } from "react-aria-components";
5
5
  /* empty css */
6
- import { IconChevronDown as F } from "../../icons/IconChevronDown.js";
7
- import { IconChevronUp as I } from "../../icons/IconChevronUp.js";
6
+ import { IconChevronDown as D } from "../../icons/IconChevronDown.js";
7
+ import { IconChevronUp as F } from "../../icons/IconChevronUp.js";
8
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) {
9
+ import { Radio as I } from "../Radio/Radio.js";
10
+ const d = v("checkbox");
11
+ function S(l) {
12
12
  const t = Number(l);
13
13
  return `${l}`.trim() !== "" && Number.isFinite(t) ? `${t}px` : `${l}`;
14
14
  }
15
- function G({
15
+ function E({
16
16
  bleed: l = !1,
17
17
  dense: t = !1,
18
- grid: s = !1,
19
- striped: o = !1,
20
- selectionType: c = "checkbox",
18
+ striped: s = !1,
19
+ selectionType: a = "checkbox",
21
20
  maxHeight: n,
22
- className: m,
23
- ...i
21
+ className: c,
22
+ ...r
24
23
  }) {
25
- const r = n !== void 0, x = a(
26
- m,
24
+ const i = n !== void 0, m = o(
25
+ c,
27
26
  "table-container",
28
27
  l && "table-container-bleed",
29
- r && "table-container-scrollable"
30
- ), T = r ? { "--table-max-height": V(n) } : void 0, y = a(
28
+ i && "table-container-scrollable"
29
+ ), x = i ? { "--table-max-height": S(n) } : void 0, T = o(
31
30
  "sds-table",
32
31
  l && "table-bleed",
33
32
  t && "table-dense",
34
- s && "table-grid",
35
- o && "sds-table-striped"
33
+ s && "sds-table-striped"
36
34
  );
37
- return /* @__PURE__ */ e("div", { className: x, style: T, children: /* @__PURE__ */ e(d.Provider, { value: c, children: /* @__PURE__ */ e(k, { className: y, ...i }) }) });
35
+ return /* @__PURE__ */ e("div", { className: m, style: x, children: /* @__PURE__ */ e(d.Provider, { value: a, children: /* @__PURE__ */ e($, { className: T, ...r }) }) });
38
36
  }
39
37
  function h({
40
38
  align: l = "start",
41
39
  className: t,
42
40
  ...s
43
41
  }) {
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: [
42
+ const a = o(t, "table-column", `table-align-${l}`);
43
+ return /* @__PURE__ */ e(k, { className: a, ...s, children: ({ allowsSorting: n, sortDirection: c }) => /* @__PURE__ */ e("div", { className: o("table-column-inner"), children: /* @__PURE__ */ b(y, { children: [
46
44
  s.children,
47
- c && /* @__PURE__ */ e(
45
+ n && /* @__PURE__ */ e(
48
46
  "span",
49
47
  {
50
48
  "aria-hidden": "true",
51
- className: a(
49
+ className: o(
52
50
  "sort-indicator",
53
- !n && "sort-indicator-unsorted"
51
+ !c && "sort-indicator-unsorted"
54
52
  ),
55
- children: n === "descending" ? /* @__PURE__ */ e(F, {}) : /* @__PURE__ */ e(I, {})
53
+ children: c === "descending" ? /* @__PURE__ */ e(D, {}) : /* @__PURE__ */ e(F, {})
56
54
  }
57
55
  )
58
56
  ] }) }) });
59
57
  }
60
- function J({
58
+ function G({
61
59
  className: l,
62
60
  ...t
63
61
  }) {
64
- return /* @__PURE__ */ e(B, { ...t });
62
+ return /* @__PURE__ */ e(w, { ...t });
65
63
  }
66
- function K({
64
+ function J({
67
65
  className: l,
68
66
  columns: t,
69
67
  children: s,
70
- ...o
68
+ ...a
71
69
  }) {
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(
70
+ const { selectionBehavior: n, selectionMode: c, allowsDragging: r } = f(), i = N(d), m = o(l, "table-head");
71
+ return /* @__PURE__ */ b(B, { className: m, ...a, children: [
72
+ r && /* @__PURE__ */ e(h, {}),
73
+ n === "toggle" && /* @__PURE__ */ e(
76
74
  h,
77
75
  {
78
- className: a(
76
+ className: o(
79
77
  "table-selection-col",
80
78
  i === "radio" && "table-selection-col--radio"
81
79
  ),
82
- children: n === "multiple" && /* @__PURE__ */ e(g, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(C, {}) })
80
+ children: c === "multiple" && /* @__PURE__ */ e(p, { slot: "selection", className: "table-selection-checkbox", children: /* @__PURE__ */ e(C, {}) })
83
81
  }
84
82
  ),
85
- /* @__PURE__ */ e(p, { items: t, children: s })
83
+ /* @__PURE__ */ e(g, { items: t, children: s })
86
84
  ] });
87
85
  }
88
- function Q({
86
+ function K({
89
87
  id: l,
90
88
  columns: t,
91
89
  children: s,
92
- className: o,
93
- ...c
90
+ className: a,
91
+ ...n
94
92
  }) {
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(
93
+ const { selectionBehavior: c, allowsDragging: r } = f(), i = N(d), m = o(a, "table-row");
94
+ return /* @__PURE__ */ b(R, { id: l, ...n, className: m, children: [
95
+ r && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(U, { slot: "drag", children: "≡" }) }),
96
+ c === "toggle" && /* @__PURE__ */ e(
99
97
  u,
100
98
  {
101
- className: a(
99
+ className: o(
102
100
  "table-selection-cell",
103
101
  i === "radio" && "table-selection-cell--radio"
104
102
  ),
105
- children: /* @__PURE__ */ e(g, { slot: "selection", className: "table-selection-checkbox", children: i === "radio" ? /* @__PURE__ */ e(S, {}) : /* @__PURE__ */ e(C, {}) })
103
+ children: /* @__PURE__ */ e(p, { slot: "selection", className: "table-selection-checkbox", children: i === "radio" ? /* @__PURE__ */ e(I, {}) : /* @__PURE__ */ e(C, {}) })
106
104
  }
107
105
  ),
108
- /* @__PURE__ */ e(p, { items: t, children: s })
106
+ /* @__PURE__ */ e(g, { items: t, children: s })
109
107
  ] });
110
108
  }
111
109
  function u({
@@ -113,15 +111,15 @@ function u({
113
111
  className: t,
114
112
  ...s
115
113
  }) {
116
- const o = a(t, "table-cell", `table-align-${l}`);
117
- return /* @__PURE__ */ e(D, { className: o, ...s });
114
+ const a = o(t, "table-cell", `table-align-${l}`);
115
+ return /* @__PURE__ */ e(j, { className: a, ...s });
118
116
  }
119
117
  export {
120
- G as Table,
121
- J as TableBody,
118
+ E as Table,
119
+ G as TableBody,
122
120
  u as TableCell,
123
121
  h as TableColumn,
124
- K as TableHead,
125
- Q as TableRow
122
+ J as TableHead,
123
+ K as TableRow
126
124
  };
127
125
  //# 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 { 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,CAAK;AAC1D;AAUO,SAASE,EAAM;AAAA,EACpB,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,eAAAC,IAAgB;AAAA,EAChB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,GAAe;AACb,QAAMC,IAAoBH,MAAc,QAClCI,IAAsBC;AAAA,IAC1BJ;AAAA,IACA;AAAA,IACAN,KAAS;AAAA,IACTQ,KAAqB;AAAA,EAAA,GAEjBG,IAAiBH,IAClB,EAAE,sBAAsBZ,EAAYS,CAAS,MAC9C,QACEO,IAAkBF;AAAA,IACtB;AAAA,IACAV,KAAS;AAAA,IACTC,KAAS;AAAA,IACTC,KAAQ;AAAA,IACRC,KAAW;AAAA,EAAA;AAEb,2BACG,OAAA,EAAI,WAAWM,GAAqB,OAAOE,GAC1C,4BAACjB,EAAqB,UAArB,EAA8B,OAAOU,GACpC,4BAACS,GAAA,EAAS,WAAWD,GAAkB,GAAGL,GAAO,GACnD,EAAA,CACF;AAEJ;AAKO,SAASO,EAAY;AAAA,EAC1B,OAAAC,IAAQ;AAAA,EACR,WAAAT;AAAA,EACA,GAAGC;AACL,GAAqB;AACnB,QAAMS,IAAaN,EAAKJ,GAAW,gBAAgB,eAAeS,CAAK,EAAE;AACzE,2BACGE,GAAA,EAAU,WAAWD,GAAa,GAAGT,GACnC,UAAA,CAAC,EAAE,eAA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"],"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 striped?: boolean;\n selectionType?: SelectionType;\n maxHeight?: number | string;\n};\nexport function Table({\n bleed = false,\n dense = 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 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","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,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;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;"}
@@ -4,3 +4,4 @@ export * from "./ui/components/charts/ChartColorPicker/ChartColorPicker";
4
4
  export * from "./ui/components/charts/ChartLegend/ChartLegend";
5
5
  export * from "./ui/components/charts/PieChart/PieChart";
6
6
  export * from "./ui/components/charts/TimeSeriesChart/TimeSeriesChart";
7
+ export * from "./ui/components/charts/TopList/TopList";
@@ -49,8 +49,6 @@ export interface DataTableProps<T extends {
49
49
  * renders a round control instead of a checkbox.
50
50
  */
51
51
  selectionType?: "checkbox" | "radio";
52
- /** When true, draws vertical lines between columns. Off by default. */
53
- grid?: boolean;
54
52
  /** Controlled selection state. Omit to let the table manage its own selection internally. */
55
53
  selectedKeys?: Selection;
56
54
  onSelectionChange?: (keys: Selection) => void;
@@ -78,5 +76,5 @@ export interface DataTableProps<T extends {
78
76
  }
79
77
  export declare function DataTable<T extends {
80
78
  id: string;
81
- }>({ columns, data, actions, rowActions, rowActionsLabel, selectable, selectionType, grid, selectedKeys, onSelectionChange, defaultSortDescriptor, sortDescriptor: controlledSortDescriptor, onSortChange, searchPlaceholder, searchKeys, isLoading, loadingMessage, emptyMessage, previousLabel, nextLabel, pageSize, nestedColumns, getNestedData, nestedLoadingMessage, nestedEmptyMessage, nestedSearchKeys, nestedSearchPlaceholder, nestedActions, nestedPageSize, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
79
+ }>({ columns, data, actions, rowActions, rowActionsLabel, selectable, selectionType, selectedKeys, onSelectionChange, defaultSortDescriptor, sortDescriptor: controlledSortDescriptor, onSortChange, searchPlaceholder, searchKeys, isLoading, loadingMessage, emptyMessage, previousLabel, nextLabel, pageSize, nestedColumns, getNestedData, nestedLoadingMessage, nestedEmptyMessage, nestedSearchKeys, nestedSearchPlaceholder, nestedActions, nestedPageSize, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
82
80
  export {};
@@ -9,5 +9,4 @@ export interface PieChartOptionInput {
9
9
  theme: ChartTheme;
10
10
  valueFormatter?: (value: number) => string;
11
11
  }
12
- export declare function formatShare(share: number): string;
13
12
  export declare function buildPieChartOption(input: PieChartOptionInput): Record<string, unknown>;
@@ -0,0 +1,13 @@
1
+ import { type ComponentPropsWithoutRef } from "react";
2
+ import { type TopListItem, type TopListSort, type TopListValueDisplay } from "./top-list-option";
3
+ import "./top-list.css";
4
+ export type { TopListItem, TopListSort, TopListValueDisplay } from "./top-list-option";
5
+ export type TopListProps = Omit<ComponentPropsWithoutRef<"div">, "children"> & {
6
+ items: TopListItem[];
7
+ sort?: TopListSort;
8
+ total?: number;
9
+ valueDisplay?: TopListValueDisplay[];
10
+ valueFormatter?: (value: number) => string;
11
+ colorToken?: string;
12
+ };
13
+ export declare function TopList({ items, sort, total, valueDisplay, valueFormatter, colorToken, className, ...props }: TopListProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import type { ChartTheme } from "../chart-theme";
2
+ export interface TopListItem {
3
+ id: string;
4
+ name: string;
5
+ value: number | null;
6
+ colorToken?: string;
7
+ }
8
+ export type TopListSort = "desc" | "asc";
9
+ export type TopListValueDisplay = "value" | "percent";
10
+ export interface TopListOptionInput {
11
+ items: TopListItem[];
12
+ sort: TopListSort;
13
+ total?: number;
14
+ valueDisplay: TopListValueDisplay[];
15
+ theme: ChartTheme;
16
+ colorsByItemId: Record<string, string>;
17
+ animate: boolean;
18
+ labeledRowStep: number;
19
+ valueFormatter?: (value: number) => string;
20
+ }
21
+ export declare function rankById(items: TopListItem[], sort: TopListSort): Map<string, number>;
22
+ export declare function resolveTotal(items: TopListItem[], total?: number): number;
23
+ export declare function labeledRowStepFor(canvasHeightPx: number, itemCount: number): number;
24
+ export declare function buildTopListOption(input: TopListOptionInput): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export declare function formatShare(share: number): string;
@@ -12,12 +12,11 @@ type SelectionType = "checkbox" | "radio";
12
12
  export type TableProps = RACTableProps & {
13
13
  bleed?: boolean;
14
14
  dense?: boolean;
15
- grid?: boolean;
16
15
  striped?: boolean;
17
16
  selectionType?: SelectionType;
18
17
  maxHeight?: number | string;
19
18
  };
20
- export declare function Table({ bleed, dense, grid, striped, selectionType, maxHeight, className, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function Table({ bleed, dense, striped, selectionType, maxHeight, className, ...props }: TableProps): import("react/jsx-runtime").JSX.Element;
21
20
  export type TableColumnProps = RACColumnProps & {
22
21
  align?: TableAlign;
23
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/design-system",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "type": "module",
5
5
  "description": "APIPass React Design System",
6
6
  "sideEffects": [