@jobber/components 4.77.2-fixdatali.1 → 4.77.2

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.
@@ -31,13 +31,13 @@ export interface DataListObject {
31
31
  export type DataListHeader<T extends DataListObject> = {
32
32
  readonly [K in keyof T]?: string;
33
33
  };
34
- export interface DataListSorting extends SortableOptions {
34
+ export interface DataListSorting extends Partial<SortableOptions> {
35
35
  readonly key: string;
36
36
  }
37
37
  export interface SortableOptions {
38
- readonly id?: string;
39
- readonly label?: string;
40
- readonly order?: "asc" | "desc";
38
+ readonly id: string;
39
+ readonly label: string;
40
+ readonly order: "asc" | "desc";
41
41
  }
42
42
  export interface DataListProps<T extends DataListObject> {
43
43
  /**
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
- import { SortableOptions } from "../../../DataList.types";
2
+ import { DataListSorting, SortableOptions } from "../../../DataList.types";
3
3
  interface DataListSortingOptionsProps {
4
4
  readonly options: SortableOptions[];
5
- readonly selectedOption: SortableOptions | null;
5
+ readonly selectedOption: DataListSorting | null;
6
6
  readonly onSelectChange: (selectedOption: SortableOptions) => void;
7
7
  readonly onClose: () => void;
8
8
  readonly optionsListRef: React.RefObject<HTMLUListElement>;
@@ -339,12 +339,11 @@ function DataListHeaderTile({ headers, headerKey, visible = false, }) {
339
339
  const isSortable = Boolean(sortableItem);
340
340
  const sortingState = sorting === null || sorting === void 0 ? void 0 : sorting.state;
341
341
  const Tag = isSortable ? "button" : "div";
342
- const selectedOption = (sorting === null || sorting === void 0 ? void 0 : sorting.state) || null;
343
342
  return (React__default["default"].createElement(Tag, { className: classnames__default["default"](styles$a.headerLabel, {
344
343
  [styles$a.sortable]: isSortable,
345
344
  }), onClick: handleOnClick, ref: dataListHeaderTileRef },
346
345
  React__default["default"].createElement(Text.Text, { maxLines: "single" }, headers[headerKey]),
347
- isSortable && (sortableItem === null || sortableItem === void 0 ? void 0 : sortableItem.options) && isDropDownOpen && (React__default["default"].createElement(DataListSortingOptions, { options: sortableItem.options, selectedOption: selectedOption, onSelectChange: handleSelectChange, onClose: () => setIsDropDownOpen(false), optionsListRef: optionsListRef, dataListHeaderTileRef: dataListHeaderTileRef })),
346
+ isSortable && (sortableItem === null || sortableItem === void 0 ? void 0 : sortableItem.options) && isDropDownOpen && (React__default["default"].createElement(DataListSortingOptions, { options: sortableItem.options, selectedOption: (sorting === null || sorting === void 0 ? void 0 : sorting.state) || null, onSelectChange: handleSelectChange, onClose: () => setIsDropDownOpen(false), optionsListRef: optionsListRef, dataListHeaderTileRef: dataListHeaderTileRef })),
348
347
  (sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) === headerKey ? (React__default["default"].createElement(DataListSortingArrows, { order: sortingState.order })) : (sortingState === null || sortingState === void 0 ? void 0 : sortingState.key) !== headerKey && isSortable ? (React__default["default"].createElement(DataListSortingArrows, { order: "none" })) : null));
349
348
  function toggleSorting(sortingKey, id, label, order) {
350
349
  const isSameKey = (sortingState === null || sortingState === void 0 ? void 0 : sortingState.label) === label && sortingKey === (sortingState === null || sortingState === void 0 ? void 0 : sortingState.key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.77.2-fixdatali.1+f6f79546",
3
+ "version": "4.77.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "dependencies": {
22
22
  "@jobber/design": "^0.53.0",
23
- "@jobber/formatters": "^0.2.2",
23
+ "@jobber/formatters": "*",
24
24
  "@jobber/hooks": "^2.8.1",
25
25
  "@popperjs/core": "^2.0.6",
26
26
  "@std-proposal/temporal": "0.0.1",
@@ -84,5 +84,5 @@
84
84
  "> 1%",
85
85
  "IE 10"
86
86
  ],
87
- "gitHead": "f6f795462fdda0164727e5c9491f0da40fad04f1"
87
+ "gitHead": "b1e06d1334c34d9a11b4106fceafb869a7e34079"
88
88
  }