@abgov/react-components 6.11.0-dev.10 → 6.11.0-dev.11

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.
@@ -27,7 +27,7 @@ export * from './side-menu/side-menu';
27
27
  export * from './side-menu-group/side-menu-group';
28
28
  export * from './side-menu-heading/side-menu-heading';
29
29
  export * from './table/table';
30
- export * from './table/table-sort-header';
30
+ export * from './table-sort-header/table-sort-header';
31
31
  export * from './tab/tab';
32
32
  export * from './tabs/tabs';
33
33
  export * from './textarea/textarea';
@@ -1,10 +1,11 @@
1
- import { GoabTableOnSortDetail, GoabTableVariant, Margins } from '@abgov/ui-components-common';
1
+ import { GoabTableOnSortDetail, GoabTableOnMultiSortDetail, GoabTableSortMode, GoabTableVariant, Margins } from '@abgov/ui-components-common';
2
2
  import { ReactNode } from 'react';
3
3
  interface WCProps extends Margins {
4
4
  ref?: React.RefObject<HTMLElement | null>;
5
5
  width?: string;
6
6
  stickyheader?: string;
7
7
  variant?: GoabTableVariant;
8
+ "sort-mode"?: GoabTableSortMode;
8
9
  testid?: string;
9
10
  striped?: string;
10
11
  version?: string;
@@ -19,6 +20,8 @@ declare module "react" {
19
20
  export interface GoabxTableProps extends Margins {
20
21
  width?: string;
21
22
  onSort?: (detail: GoabTableOnSortDetail) => void;
23
+ onMultiSort?: (detail: GoabTableOnMultiSortDetail) => void;
24
+ sortMode?: GoabTableSortMode;
22
25
  variant?: GoabTableVariant;
23
26
  striped?: boolean;
24
27
  testId?: string;
@@ -26,5 +29,5 @@ export interface GoabxTableProps extends Margins {
26
29
  children?: ReactNode;
27
30
  }
28
31
  export type TableProps = GoabxTableProps;
29
- export declare function GoabxTable({ onSort, version, ...props }: GoabxTableProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function GoabxTable({ onSort, onMultiSort, sortMode, version, ...props }: GoabxTableProps): import("react/jsx-runtime").JSX.Element;
30
33
  export default GoabxTable;
@@ -1,8 +1,9 @@
1
- import { DataAttributes, GoabTableSortDirection } from '@abgov/ui-components-common';
1
+ import { DataAttributes, GoabTableSortDirection, GoabTableSortOrder } from '@abgov/ui-components-common';
2
2
  import { JSX } from 'react';
3
3
  interface WCProps {
4
4
  name?: string;
5
5
  direction?: GoabTableSortDirection;
6
+ "sort-order"?: GoabTableSortOrder;
6
7
  }
7
8
  declare module "react" {
8
9
  namespace JSX {
@@ -14,7 +15,8 @@ declare module "react" {
14
15
  export interface GoabxTableSortProps extends DataAttributes {
15
16
  name?: string;
16
17
  direction?: GoabTableSortDirection;
18
+ sortOrder?: GoabTableSortOrder;
17
19
  children?: React.ReactNode;
18
20
  }
19
- export declare function GoabxTableSortHeader({ children, ...rest }: GoabxTableSortProps): JSX.Element;
21
+ export declare function GoabxTableSortHeader({ name, direction, sortOrder, children, ...rest }: GoabxTableSortProps): JSX.Element;
20
22
  export default GoabxTableSortHeader;
package/experimental.js CHANGED
@@ -1088,7 +1088,7 @@ function GoabxSideMenuHeading({
1088
1088
  meta && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "meta", children: meta })
1089
1089
  ] });
1090
1090
  }
1091
- function GoabxTable({ onSort, version = "2", ...props }) {
1091
+ function GoabxTable({ onSort, onMultiSort, sortMode, version = "2", ...props }) {
1092
1092
  const ref = react.useRef(null);
1093
1093
  react.useEffect(() => {
1094
1094
  if (!ref.current) {
@@ -1099,17 +1099,24 @@ function GoabxTable({ onSort, version = "2", ...props }) {
1099
1099
  const detail = e.detail;
1100
1100
  onSort == null ? void 0 : onSort(detail);
1101
1101
  };
1102
+ const multiSortListener = (e) => {
1103
+ const detail = e.detail;
1104
+ onMultiSort == null ? void 0 : onMultiSort(detail);
1105
+ };
1102
1106
  current.addEventListener("_sort", sortListener);
1107
+ current.addEventListener("_multisort", multiSortListener);
1103
1108
  return () => {
1104
1109
  current.removeEventListener("_sort", sortListener);
1110
+ current.removeEventListener("_multisort", multiSortListener);
1105
1111
  };
1106
- }, [ref, onSort]);
1112
+ }, [ref, onSort, onMultiSort]);
1107
1113
  return /* @__PURE__ */ jsxRuntime.jsx(
1108
1114
  "goa-table",
1109
1115
  {
1110
1116
  ref,
1111
1117
  width: props.width,
1112
1118
  variant: props.variant,
1119
+ "sort-mode": sortMode,
1113
1120
  striped: props.striped ? "true" : void 0,
1114
1121
  testid: props.testId,
1115
1122
  mt: props.mt,
@@ -1122,11 +1129,13 @@ function GoabxTable({ onSort, version = "2", ...props }) {
1122
1129
  );
1123
1130
  }
1124
1131
  function GoabxTableSortHeader({
1132
+ name,
1133
+ direction = "none",
1134
+ sortOrder,
1125
1135
  children,
1126
1136
  ...rest
1127
1137
  }) {
1128
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1129
- return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { ..._props, children });
1138
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { name, direction, "sort-order": sortOrder, ...rest, children });
1130
1139
  }
1131
1140
  function GoabxTab({ heading, disabled, slug, children }) {
1132
1141
  return /* @__PURE__ */ jsxRuntime.jsxs(