@duffel/components 3.7.4 → 3.7.5--canary-1
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/components/DuffelNGSView/AirlineSelector.d.ts +8 -0
- package/components/DuffelNGSView/DuffelNGSView.d.ts +1 -1
- package/components/DuffelNGSView/FilterControl.d.ts +16 -0
- package/components/DuffelNGSView/FilterControls.d.ts +12 -0
- package/components/DuffelNGSView/StopsSelector.d.ts +8 -0
- package/components/DuffelNGSView/TimeRangeSelector.d.ts +9 -0
- package/components/DuffelNGSView/lib/filter-results.d.ts +14 -0
- package/components/DuffelNGSView/lib/get-initial-filter-values.d.ts +4 -0
- package/components/DuffelNGSView/lib/getAirlines.d.ts +4 -0
- package/components/DuffelNGSView/lib/sort-ngs-rows-by-duration.d.ts +5 -0
- package/components/DuffelNGSView/lib/{sort-ngs-rows.d.ts → sort-ngs-rows-by-shelf-price.d.ts} +1 -1
- package/package.json +3 -2
- package/stories/AirlineSelector.stories.d.ts +3 -0
- package/tests/lib/getAirlines.test.d.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/custom-elements.js +0 -69
- package/custom-elements.js.map +0 -7
- package/index.js +0 -40
- package/index.js.map +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Filters } from "./lib/filter-results";
|
|
3
|
+
export interface AirlineSelectorProps {
|
|
4
|
+
options: Filters["airlines"];
|
|
5
|
+
selected: Filters["airlines"];
|
|
6
|
+
onChange: (airlines: Filters["airlines"]) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const AirlineSelector: React.FC<AirlineSelectorProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface FilterControlProps {
|
|
3
|
+
target: React.ReactNode;
|
|
4
|
+
children: (closePopover: () => void) => React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const FilterControl: React.FC<FilterControlProps>;
|
|
7
|
+
interface FilterControlOptionProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
isSelected: boolean;
|
|
11
|
+
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
12
|
+
onKeyDown: React.KeyboardEventHandler<HTMLButtonElement>;
|
|
13
|
+
onDoubleClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
14
|
+
}
|
|
15
|
+
export declare const FilterControlOption: React.FC<FilterControlOptionProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Filters } from "./lib/filter-results";
|
|
2
|
+
interface FilterControlsProps {
|
|
3
|
+
airlines: Filters["airlines"];
|
|
4
|
+
airlinesFilter: Filters["airlines"];
|
|
5
|
+
setAirlinesFilter: (airlines: Filters["airlines"]) => void;
|
|
6
|
+
timesFilter: Filters["times"];
|
|
7
|
+
setTimesFilter: (times: Filters["times"]) => void;
|
|
8
|
+
stopsFilter: Filters["stops"];
|
|
9
|
+
setStopsFilter: (stops: Filters["stops"]) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const FilterControls: React.FC<FilterControlsProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Filters } from "./lib/filter-results";
|
|
3
|
+
interface StopsSelectorProps {
|
|
4
|
+
selected: Filters["stops"];
|
|
5
|
+
onChange: (stopFilter: Filters["stops"]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const StopsSelector: React.FC<StopsSelectorProps>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "rc-slider/assets/index.css";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Filters } from "./lib/filter-results";
|
|
4
|
+
interface TimeRangeSelectorProps {
|
|
5
|
+
selected: Filters["times"];
|
|
6
|
+
onChange: (stopFilter: Filters["times"]) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const TimeRangeSelector: React.FC<TimeRangeSelectorProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="@duffel/api" />
|
|
2
|
+
import { NGSTableProps } from "../NGSTable";
|
|
3
|
+
export interface Filters {
|
|
4
|
+
airlines: Array<{
|
|
5
|
+
iata_code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
}>;
|
|
8
|
+
stops: "direct-only" | "1-stop-at-most" | "2-stops-at-most" | "any";
|
|
9
|
+
times: {
|
|
10
|
+
departure: [number, number];
|
|
11
|
+
arrival: [number, number];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare function filterResults(offers: NGSTableProps["offers"], currentSliceIndex: number, filters: Filters): Omit<import("@duffel/api/types").Offer, "available_services">[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NGSOfferRow } from "./group-offers-for-ngs-view";
|
|
2
|
+
type DurationSortDirection = "asc" | "desc";
|
|
3
|
+
export type DurationSort = DurationSortDirection | null;
|
|
4
|
+
export declare const sortNGSRowsByDuration: (rows: NGSOfferRow[], sortDuration: DurationSortDirection) => NGSOfferRow[];
|
|
5
|
+
export {};
|
package/components/DuffelNGSView/lib/{sort-ngs-rows.d.ts → sort-ngs-rows-by-shelf-price.d.ts}
RENAMED
|
@@ -3,4 +3,4 @@ import { NGSShelf } from ".";
|
|
|
3
3
|
import { NGSOfferRow } from "./group-offers-for-ngs-view";
|
|
4
4
|
export type SortDirection = "asc" | "desc";
|
|
5
5
|
export declare const getCheapestOfferAmount: (offers: OfferRequest["offers"] | null) => number | null;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const sortNGSRowsByShelfPrice: (rows: NGSOfferRow[], sortShelf: NGSShelf, sortDirection: SortDirection) => NGSOfferRow[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duffel/components",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.5--canary-1",
|
|
4
4
|
"description": "Component library to build your travel product with Duffel.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Duffel",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"dev": "node config/esbuild.dev.config.js",
|
|
39
39
|
"generate-fixture": "esbuild ./scripts/generate-fixture.ts --outfile=dist/scripts/generate-fixture.cjs --format=cjs --platform=node --bundle --tsconfig=scripts.tsconfig.json && node dist/scripts/generate-fixture.cjs",
|
|
40
40
|
"lint": "eslint . --ext .ts,.tsx,.mjs,.js --max-warnings=0",
|
|
41
|
-
"prettier": "prettier --write --loglevel=warn .",
|
|
42
41
|
"prettier-check": "prettier --check .",
|
|
43
42
|
"storybook": "storybook dev -p 6006",
|
|
44
43
|
"test": "LANG='en_US' TZ=UTC yarn jest",
|
|
@@ -54,8 +53,10 @@
|
|
|
54
53
|
"@stripe/react-stripe-js": "2.1.0",
|
|
55
54
|
"@stripe/stripe-js": "1.54.2",
|
|
56
55
|
"classnames": "2.3.2",
|
|
56
|
+
"duration-fns": "^3.0.2",
|
|
57
57
|
"fuse.js": "6.6.2",
|
|
58
58
|
"lodash": "4.17.21",
|
|
59
|
+
"rc-slider": "^10.6.2",
|
|
59
60
|
"react": "18.2.0",
|
|
60
61
|
"react-dom": "18.2.0"
|
|
61
62
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|