@algolia/recommend-vdom
Advanced tools
Comparing version 1.8.1 to 1.8.2
/** @jsx createElement */ | ||
import { cx } from './utils'; | ||
export function createDefaultChildrenComponent(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createDefaultChildrenComponent({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function DefaultChildren(props) { | ||
@@ -10,3 +12,2 @@ if (props.recommendations.length === 0 && props.status === 'idle') { | ||
} | ||
return createElement("section", { | ||
@@ -13,0 +14,0 @@ className: cx('auc-Recommend', props.classNames.root) |
/** @jsx createElement */ | ||
export function createDefaultFallbackComponent() { | ||
@@ -3,0 +4,0 @@ return function DefaultFallback() { |
/** @jsx createElement */ | ||
import { cx } from './utils'; | ||
export function createDefaultHeaderComponent(_ref) { | ||
var createElement = _ref.createElement; | ||
export function createDefaultHeaderComponent({ | ||
createElement | ||
}) { | ||
return function DefaultHeader(props) { | ||
@@ -9,7 +11,5 @@ if (!props.recommendations || props.recommendations.length < 1) { | ||
} | ||
if (!props.translations.title) { | ||
return null; | ||
} | ||
return createElement("h3", { | ||
@@ -16,0 +16,0 @@ className: cx('auc-Recommend-title', props.classNames.title) |
/** @jsx createElement */ | ||
import { cx } from './utils'; | ||
export function createFacetsView(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createFacetsView({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function FacetsView(props) { | ||
@@ -11,13 +13,11 @@ return createElement("div", { | ||
className: cx('auc-Recommend-list', props.classNames.list) | ||
}, props.items.map(function (item) { | ||
return createElement("li", { | ||
key: item.facetValue, | ||
className: cx('auc-Recommend-item', props.classNames.item) | ||
}, createElement(props.itemComponent, { | ||
createElement: createElement, | ||
Fragment: Fragment, | ||
item: item | ||
})); | ||
}))); | ||
}, props.items.map(item => createElement("li", { | ||
key: item.facetValue, | ||
className: cx('auc-Recommend-item', props.classNames.item) | ||
}, createElement(props.itemComponent, { | ||
createElement: createElement, | ||
Fragment: Fragment, | ||
item: item | ||
}))))); | ||
}; | ||
} |
import { RecommendComponentProps, Renderer } from './types'; | ||
export declare type FrequentlyBoughtTogetherProps<TObject, TComponentProps extends Record<string, unknown> = {}> = RecommendComponentProps<TObject, TComponentProps>; | ||
export type FrequentlyBoughtTogetherProps<TObject, TComponentProps extends Record<string, unknown> = {}> = RecommendComponentProps<TObject, TComponentProps>; | ||
export declare function createFrequentlyBoughtTogetherComponent({ createElement, Fragment, }: Renderer): <TObject>(props: FrequentlyBoughtTogetherProps<TObject, {}>) => JSX.Element; |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/** @jsx createElement */ | ||
@@ -13,57 +7,48 @@ import { createDefaultChildrenComponent } from './DefaultChildren'; | ||
import { createListViewComponent } from './ListView'; | ||
export function createFrequentlyBoughtTogetherComponent(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createFrequentlyBoughtTogetherComponent({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function FrequentlyBoughtTogether(props) { | ||
var _props$classNames, _props$children, _props$fallbackCompon, _props$headerComponen, _props$view; | ||
var translations = _objectSpread({ | ||
const translations = { | ||
title: 'Frequently bought together', | ||
sliderLabel: 'Frequently bought together products' | ||
}, props.translations); | ||
var classNames = (_props$classNames = props.classNames) !== null && _props$classNames !== void 0 ? _props$classNames : {}; | ||
var children = (_props$children = props.children) !== null && _props$children !== void 0 ? _props$children : createDefaultChildrenComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
}); | ||
var FallbackComponent = (_props$fallbackCompon = props.fallbackComponent) !== null && _props$fallbackCompon !== void 0 ? _props$fallbackCompon : createDefaultFallbackComponent(); | ||
var Fallback = function Fallback() { | ||
return createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
sliderLabel: 'Frequently bought together products', | ||
...props.translations | ||
}; | ||
var Header = (_props$headerComponen = props.headerComponent) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : createDefaultHeaderComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const classNames = props.classNames ?? {}; | ||
const children = props.children ?? createDefaultChildrenComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
var ViewComponent = (_props$view = props.view) !== null && _props$view !== void 0 ? _props$view : createListViewComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const FallbackComponent = props.fallbackComponent ?? createDefaultFallbackComponent(); | ||
const Fallback = () => createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
var View = function View(viewProps) { | ||
return createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
}; | ||
const Header = props.headerComponent ?? createDefaultHeaderComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const ViewComponent = props.view ?? createListViewComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const View = viewProps => createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
return children({ | ||
classNames: classNames, | ||
Fallback: Fallback, | ||
Header: Header, | ||
classNames, | ||
Fallback, | ||
Header, | ||
recommendations: props.items, | ||
status: props.status, | ||
translations: translations, | ||
View: View | ||
translations, | ||
View | ||
}); | ||
}; | ||
} |
/** @jsx createElement */ | ||
import { cx } from './utils'; | ||
export function createListViewComponent(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createListViewComponent({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function ListView(props) { | ||
@@ -11,13 +13,11 @@ return createElement("div", { | ||
className: cx('auc-Recommend-list', props.classNames.list) | ||
}, props.items.map(function (item) { | ||
return createElement("li", { | ||
key: item.objectID, | ||
className: cx('auc-Recommend-item', props.classNames.item) | ||
}, createElement(props.itemComponent, { | ||
createElement: createElement, | ||
Fragment: Fragment, | ||
item: item | ||
})); | ||
}))); | ||
}, props.items.map(item => createElement("li", { | ||
key: item.objectID, | ||
className: cx('auc-Recommend-item', props.classNames.item) | ||
}, createElement(props.itemComponent, { | ||
createElement: createElement, | ||
Fragment: Fragment, | ||
item: item | ||
}))))); | ||
}; | ||
} |
import { RecommendComponentProps, Renderer } from './types'; | ||
export declare type RelatedProductsProps<TObject, TComponentProps extends Record<string, unknown> = {}> = RecommendComponentProps<TObject, TComponentProps>; | ||
export type RelatedProductsProps<TObject, TComponentProps extends Record<string, unknown> = {}> = RecommendComponentProps<TObject, TComponentProps>; | ||
export declare function createRelatedProductsComponent({ createElement, Fragment, }: Renderer): <TObject>(props: RelatedProductsProps<TObject, {}>) => JSX.Element; |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/** @jsx createElement */ | ||
@@ -13,57 +7,48 @@ import { createDefaultChildrenComponent } from './DefaultChildren'; | ||
import { createListViewComponent } from './ListView'; | ||
export function createRelatedProductsComponent(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createRelatedProductsComponent({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function RelatedProducts(props) { | ||
var _props$classNames, _props$children, _props$fallbackCompon, _props$headerComponen, _props$view; | ||
var translations = _objectSpread({ | ||
const translations = { | ||
title: 'Related products', | ||
sliderLabel: 'Related products' | ||
}, props.translations); | ||
var classNames = (_props$classNames = props.classNames) !== null && _props$classNames !== void 0 ? _props$classNames : {}; | ||
var children = (_props$children = props.children) !== null && _props$children !== void 0 ? _props$children : createDefaultChildrenComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
}); | ||
var FallbackComponent = (_props$fallbackCompon = props.fallbackComponent) !== null && _props$fallbackCompon !== void 0 ? _props$fallbackCompon : createDefaultFallbackComponent(); | ||
var Fallback = function Fallback() { | ||
return createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
sliderLabel: 'Related products', | ||
...props.translations | ||
}; | ||
var Header = (_props$headerComponen = props.headerComponent) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : createDefaultHeaderComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const classNames = props.classNames ?? {}; | ||
const children = props.children ?? createDefaultChildrenComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
var ViewComponent = (_props$view = props.view) !== null && _props$view !== void 0 ? _props$view : createListViewComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const FallbackComponent = props.fallbackComponent ?? createDefaultFallbackComponent(); | ||
const Fallback = () => createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
var View = function View(viewProps) { | ||
return createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
}; | ||
const Header = props.headerComponent ?? createDefaultHeaderComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const ViewComponent = props.view ?? createListViewComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const View = viewProps => createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
return children({ | ||
classNames: classNames, | ||
Fallback: Fallback, | ||
Header: Header, | ||
classNames, | ||
Fallback, | ||
Header, | ||
recommendations: props.items, | ||
status: props.status, | ||
translations: translations, | ||
View: View | ||
translations, | ||
View | ||
}); | ||
}; | ||
} |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/** @jsx createElement */ | ||
@@ -13,57 +7,48 @@ import { createDefaultChildrenComponent } from './DefaultChildren'; | ||
import { createFacetsView } from './FacetsView'; | ||
export function createTrendingFacetsComponent(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createTrendingFacetsComponent({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function TrendingFacets(props) { | ||
var _props$classNames, _props$children, _props$fallbackCompon, _props$headerComponen, _props$view; | ||
var translations = _objectSpread({ | ||
const translations = { | ||
title: 'Trending facets', | ||
sliderLabel: 'Trending facets' | ||
}, props.translations); | ||
var classNames = (_props$classNames = props.classNames) !== null && _props$classNames !== void 0 ? _props$classNames : {}; | ||
var children = (_props$children = props.children) !== null && _props$children !== void 0 ? _props$children : createDefaultChildrenComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
}); | ||
var FallbackComponent = (_props$fallbackCompon = props.fallbackComponent) !== null && _props$fallbackCompon !== void 0 ? _props$fallbackCompon : createDefaultFallbackComponent(); | ||
var Fallback = function Fallback() { | ||
return createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
sliderLabel: 'Trending facets', | ||
...props.translations | ||
}; | ||
var Header = (_props$headerComponen = props.headerComponent) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : createDefaultHeaderComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const classNames = props.classNames ?? {}; | ||
const children = props.children ?? createDefaultChildrenComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
var ViewComponent = (_props$view = props.view) !== null && _props$view !== void 0 ? _props$view : createFacetsView({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const FallbackComponent = props.fallbackComponent ?? createDefaultFallbackComponent(); | ||
const Fallback = () => createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
var View = function View(viewProps) { | ||
return createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
}; | ||
const Header = props.headerComponent ?? createDefaultHeaderComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const ViewComponent = props.view ?? createFacetsView({ | ||
createElement, | ||
Fragment | ||
}); | ||
const View = viewProps => createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
return children({ | ||
classNames: classNames, | ||
Fallback: Fallback, | ||
Header: Header, | ||
classNames, | ||
Fallback, | ||
Header, | ||
recommendations: props.items, | ||
status: props.status, | ||
translations: translations, | ||
View: View | ||
translations, | ||
View | ||
}); | ||
}; | ||
} |
import { RecommendComponentProps, Renderer } from './types'; | ||
export declare type TrendingItemsProps<TObject, TComponentProps extends Record<string, unknown> = {}> = RecommendComponentProps<TObject, TComponentProps>; | ||
export type TrendingItemsProps<TObject, TComponentProps extends Record<string, unknown> = {}> = RecommendComponentProps<TObject, TComponentProps>; | ||
export declare function createTrendingItemsComponent({ createElement, Fragment, }: Renderer): <TObject>(props: TrendingItemsProps<TObject, {}>) => JSX.Element; |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
/** @jsx createElement */ | ||
@@ -13,57 +7,48 @@ import { createDefaultChildrenComponent } from './DefaultChildren'; | ||
import { createListViewComponent } from './ListView'; | ||
export function createTrendingItemsComponent(_ref) { | ||
var createElement = _ref.createElement, | ||
Fragment = _ref.Fragment; | ||
export function createTrendingItemsComponent({ | ||
createElement, | ||
Fragment | ||
}) { | ||
return function TrendingItems(props) { | ||
var _props$classNames, _props$children, _props$fallbackCompon, _props$headerComponen, _props$view; | ||
var translations = _objectSpread({ | ||
const translations = { | ||
title: 'Trending items', | ||
sliderLabel: 'Trending items' | ||
}, props.translations); | ||
var classNames = (_props$classNames = props.classNames) !== null && _props$classNames !== void 0 ? _props$classNames : {}; | ||
var children = (_props$children = props.children) !== null && _props$children !== void 0 ? _props$children : createDefaultChildrenComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
}); | ||
var FallbackComponent = (_props$fallbackCompon = props.fallbackComponent) !== null && _props$fallbackCompon !== void 0 ? _props$fallbackCompon : createDefaultFallbackComponent(); | ||
var Fallback = function Fallback() { | ||
return createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
sliderLabel: 'Trending items', | ||
...props.translations | ||
}; | ||
var Header = (_props$headerComponen = props.headerComponent) !== null && _props$headerComponen !== void 0 ? _props$headerComponen : createDefaultHeaderComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const classNames = props.classNames ?? {}; | ||
const children = props.children ?? createDefaultChildrenComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
var ViewComponent = (_props$view = props.view) !== null && _props$view !== void 0 ? _props$view : createListViewComponent({ | ||
createElement: createElement, | ||
Fragment: Fragment | ||
const FallbackComponent = props.fallbackComponent ?? createDefaultFallbackComponent(); | ||
const Fallback = () => createElement(FallbackComponent, { | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}); | ||
var View = function View(viewProps) { | ||
return createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
}; | ||
const Header = props.headerComponent ?? createDefaultHeaderComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const ViewComponent = props.view ?? createListViewComponent({ | ||
createElement, | ||
Fragment | ||
}); | ||
const View = viewProps => createElement(ViewComponent, _extends({ | ||
classNames: classNames, | ||
itemComponent: props.itemComponent, | ||
items: props.items, | ||
translations: translations, | ||
Fragment: Fragment, | ||
createElement: createElement | ||
}, viewProps)); | ||
return children({ | ||
classNames: classNames, | ||
Fallback: Fallback, | ||
Header: Header, | ||
classNames, | ||
Fallback, | ||
Header, | ||
recommendations: props.items, | ||
status: props.status, | ||
translations: translations, | ||
View: View | ||
translations, | ||
View | ||
}); | ||
}; | ||
} |
import { FacetEntry } from '@algolia/recommend-core'; | ||
import { Renderer } from './Renderer'; | ||
export declare type FacetsViewProps<TItem extends FacetEntry, TTranslations extends Record<string, string>, TClassNames extends Record<string, string>> = { | ||
export type FacetsViewProps<TItem extends FacetEntry, TTranslations extends Record<string, string>, TClassNames extends Record<string, string>> = { | ||
classNames: TClassNames; | ||
@@ -5,0 +5,0 @@ itemComponent<TComponentProps extends Record<string, unknown> = {}>(props: { |
@@ -1,2 +0,2 @@ | ||
export declare type RecommendClassNames = Partial<{ | ||
export type RecommendClassNames = Partial<{ | ||
root: string; | ||
@@ -3,0 +3,0 @@ title: string; |
@@ -8,7 +8,7 @@ import { FacetEntry, RecordWithObjectID } from '@algolia/recommend-core'; | ||
import { ViewProps } from './ViewProps'; | ||
export declare type ItemComponentProps<TObject> = { | ||
export type ItemComponentProps<TObject> = { | ||
item: TObject; | ||
} & Renderer; | ||
export declare type HeaderComponentProps<TObject> = Renderer & ComponentProps<TObject>; | ||
export declare type ComponentProps<TObject> = { | ||
export type HeaderComponentProps<TObject> = Renderer & ComponentProps<TObject>; | ||
export type ComponentProps<TObject> = { | ||
classNames: RecommendClassNames; | ||
@@ -18,3 +18,3 @@ recommendations: TObject[]; | ||
}; | ||
export declare type ChildrenProps<TObject> = ComponentProps<TObject> & { | ||
export type ChildrenProps<TObject> = ComponentProps<TObject> & { | ||
Fallback(): JSX.Element | null; | ||
@@ -25,3 +25,3 @@ Header(props: HeaderComponentProps<TObject>): JSX.Element | null; | ||
}; | ||
export declare type RecommendComponentProps<TObject, TComponentProps extends Record<string, unknown> = {}> = { | ||
export type RecommendComponentProps<TObject, TComponentProps extends Record<string, unknown> = {}> = { | ||
itemComponent(props: ItemComponentProps<RecordWithObjectID<TObject>> & TComponentProps): JSX.Element; | ||
@@ -37,3 +37,3 @@ items: Array<RecordWithObjectID<TObject>>; | ||
}; | ||
export declare type TrendingComponentProps<TObject, TComponentProps extends Record<string, unknown> = {}> = { | ||
export type TrendingComponentProps<TObject, TComponentProps extends Record<string, unknown> = {}> = { | ||
itemComponent(props: ItemComponentProps<FacetEntry<TObject>> & TComponentProps): JSX.Element; | ||
@@ -40,0 +40,0 @@ items: Array<FacetEntry<TObject>>; |
@@ -1,1 +0,1 @@ | ||
export declare type RecommendStatus = 'loading' | 'stalled' | 'idle'; | ||
export type RecommendStatus = 'loading' | 'stalled' | 'idle'; |
@@ -1,4 +0,4 @@ | ||
export declare type RecommendTranslations = Partial<{ | ||
export type RecommendTranslations = Partial<{ | ||
title: string; | ||
sliderLabel: string; | ||
}>; |
@@ -1,6 +0,6 @@ | ||
export declare type Pragma = (type: any, props: Record<string, any> | null, ...children: ComponentChildren[]) => JSX.Element; | ||
export declare type PragmaFrag = any; | ||
declare type ComponentChild = VNode<any> | object | string | number | boolean | null | undefined; | ||
declare type ComponentChildren = ComponentChild[] | ComponentChild; | ||
export declare type VNode<TProps = any> = { | ||
export type Pragma = (type: any, props: Record<string, any> | null, ...children: ComponentChildren[]) => JSX.Element; | ||
export type PragmaFrag = any; | ||
type ComponentChild = VNode<any> | object | string | number | boolean | null | undefined; | ||
type ComponentChildren = ComponentChild[] | ComponentChild; | ||
export type VNode<TProps = any> = { | ||
type: any; | ||
@@ -13,3 +13,3 @@ key: string | number | any; | ||
}; | ||
export declare type Renderer = { | ||
export type Renderer = { | ||
/** | ||
@@ -16,0 +16,0 @@ * The function to create virtual nodes. |
import { RecordWithObjectID } from '@algolia/recommend-core'; | ||
import { Renderer } from './Renderer'; | ||
export declare type ViewProps<TItem extends RecordWithObjectID, TTranslations extends Record<string, string>, TClassNames extends Record<string, string>> = { | ||
export type ViewProps<TItem extends RecordWithObjectID, TTranslations extends Record<string, string>, TClassNames extends Record<string, string>> = { | ||
classNames: TClassNames; | ||
@@ -5,0 +5,0 @@ itemComponent<TComponentProps extends Record<string, unknown> = {}>(props: { |
@@ -1,7 +0,3 @@ | ||
export function cx() { | ||
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) { | ||
classNames[_key] = arguments[_key]; | ||
} | ||
export function cx(...classNames) { | ||
return classNames.filter(Boolean).join(' '); | ||
} |
@@ -1,1 +0,1 @@ | ||
export declare const version = "1.8.1"; | ||
export declare const version = "1.8.2"; |
@@ -1,1 +0,1 @@ | ||
export var version = '1.8.1'; | ||
export const version = '1.8.2'; |
@@ -1,3 +0,3 @@ | ||
/*! @algolia/recommend-vdom 1.8.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend-vdom"]={})}(this,(function(e){"use strict";function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}function a(e){var t=e.createElement,n=e.Fragment;return function(e){return 0===e.recommendations.length&&"idle"===e.status?t(e.Fallback,null):t("section",{className:r("auc-Recommend",e.classNames.root)},t(e.Header,{classNames:e.classNames,recommendations:e.recommendations,translations:e.translations,createElement:t,Fragment:n}),t(e.View,null))}}function o(e){var t=e.createElement;return function(e){return!e.recommendations||e.recommendations.length<1?null:e.translations.title?t("h3",{className:r("auc-Recommend-title",e.classNames.title)},e.translations.title):null}}function c(e){var t=e.createElement,n=e.Fragment;return function(e){return t("div",{className:r("auc-Recommend-container",e.classNames.container)},t("ol",{className:r("auc-Recommend-list",e.classNames.list)},e.items.map((function(a){return t("li",{key:a.objectID,className:r("auc-Recommend-item",e.classNames.item)},t(e.itemComponent,{createElement:t,Fragment:n,item:a}))}))))}}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}e.createFrequentlyBoughtTogetherComponent=function(e){var r=e.createElement,i=e.Fragment;return function(e){var s,m,u,f,p,d=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Frequently bought together",sliderLabel:"Frequently bought together products"},e.translations),b=null!==(s=e.classNames)&&void 0!==s?s:{},g=null!==(m=e.children)&&void 0!==m?m:a({createElement:r,Fragment:i}),O=null!==(u=e.fallbackComponent)&&void 0!==u?u:function(){return null},v=null!==(f=e.headerComponent)&&void 0!==f?f:o({createElement:r,Fragment:i}),y=null!==(p=e.view)&&void 0!==p?p:c({createElement:r,Fragment:i});return g({classNames:b,Fallback:function(){return r(O,{Fragment:i,createElement:r})},Header:v,recommendations:e.items,status:e.status,translations:d,View:function(n){return r(y,t({classNames:b,itemComponent:e.itemComponent,items:e.items,translations:d,Fragment:i,createElement:r},n))}})}},e.createRelatedProductsComponent=function(e){var r=e.createElement,l=e.Fragment;return function(e){var s,m,u,f,p,d=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Related products",sliderLabel:"Related products"},e.translations),b=null!==(s=e.classNames)&&void 0!==s?s:{},g=null!==(m=e.children)&&void 0!==m?m:a({createElement:r,Fragment:l}),O=null!==(u=e.fallbackComponent)&&void 0!==u?u:function(){return null},v=null!==(f=e.headerComponent)&&void 0!==f?f:o({createElement:r,Fragment:l}),y=null!==(p=e.view)&&void 0!==p?p:c({createElement:r,Fragment:l});return g({classNames:b,Fallback:function(){return r(O,{Fragment:l,createElement:r})},Header:v,recommendations:e.items,status:e.status,translations:d,View:function(n){return r(y,t({classNames:b,itemComponent:e.itemComponent,items:e.items,translations:d,Fragment:l,createElement:r},n))}})}},e.createTrendingFacetsComponent=function(e){var c=e.createElement,l=e.Fragment;return function(e){var i,m,u,f,p,d=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Trending facets",sliderLabel:"Trending facets"},e.translations),b=null!==(i=e.classNames)&&void 0!==i?i:{},g=null!==(m=e.children)&&void 0!==m?m:a({createElement:c,Fragment:l}),O=null!==(u=e.fallbackComponent)&&void 0!==u?u:function(){return null},v=null!==(f=e.headerComponent)&&void 0!==f?f:o({createElement:c,Fragment:l}),y=null!==(p=e.view)&&void 0!==p?p:function(e){var t=e.createElement,n=e.Fragment;return function(e){return t("div",{className:r("auc-Recommend-container",e.classNames.container)},t("ol",{className:r("auc-Recommend-list",e.classNames.list)},e.items.map((function(a){return t("li",{key:a.facetValue,className:r("auc-Recommend-item",e.classNames.item)},t(e.itemComponent,{createElement:t,Fragment:n,item:a}))}))))}}({createElement:c,Fragment:l});return g({classNames:b,Fallback:function(){return c(O,{Fragment:l,createElement:c})},Header:v,recommendations:e.items,status:e.status,translations:d,View:function(n){return c(y,t({classNames:b,itemComponent:e.itemComponent,items:e.items,translations:d,Fragment:l,createElement:c},n))}})}},e.createTrendingItemsComponent=function(e){var r=e.createElement,l=e.Fragment;return function(e){var i,s,u,f,p,d=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({title:"Trending items",sliderLabel:"Trending items"},e.translations),b=null!==(i=e.classNames)&&void 0!==i?i:{},g=null!==(s=e.children)&&void 0!==s?s:a({createElement:r,Fragment:l}),O=null!==(u=e.fallbackComponent)&&void 0!==u?u:function(){return null},v=null!==(f=e.headerComponent)&&void 0!==f?f:o({createElement:r,Fragment:l}),y=null!==(p=e.view)&&void 0!==p?p:c({createElement:r,Fragment:l});return g({classNames:b,Fallback:function(){return r(O,{Fragment:l,createElement:r})},Header:v,recommendations:e.items,status:e.status,translations:d,View:function(n){return r(y,t({classNames:b,itemComponent:e.itemComponent,items:e.items,translations:d,Fragment:l,createElement:r},n))}})}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
/*! @algolia/recommend-vdom 1.8.2 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/recommend */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/recommend-vdom"]={})}(this,(function(e){"use strict";function t(){return t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},t.apply(this,arguments)}function n(...e){return e.filter(Boolean).join(" ")}function a({createElement:e,Fragment:t}){return function(a){return 0===a.recommendations.length&&"idle"===a.status?e(a.Fallback,null):e("section",{className:n("auc-Recommend",a.classNames.root)},e(a.Header,{classNames:a.classNames,recommendations:a.recommendations,translations:a.translations,createElement:e,Fragment:t}),e(a.View,null))}}function s({createElement:e}){return function(t){return!t.recommendations||t.recommendations.length<1?null:t.translations.title?e("h3",{className:n("auc-Recommend-title",t.classNames.title)},t.translations.title):null}}function r({createElement:e,Fragment:t}){return function(a){return e("div",{className:n("auc-Recommend-container",a.classNames.container)},e("ol",{className:n("auc-Recommend-list",a.classNames.list)},a.items.map((s=>e("li",{key:s.objectID,className:n("auc-Recommend-item",a.classNames.item)},e(a.itemComponent,{createElement:e,Fragment:t,item:s}))))))}}e.createFrequentlyBoughtTogetherComponent=function({createElement:e,Fragment:n}){return function(m){const l={title:"Frequently bought together",sliderLabel:"Frequently bought together products",...m.translations},o=m.classNames??{},c=m.children??a({createElement:e,Fragment:n}),i=m.fallbackComponent??function(){return null},u=m.headerComponent??s({createElement:e,Fragment:n}),d=m.view??r({createElement:e,Fragment:n});return c({classNames:o,Fallback:()=>e(i,{Fragment:n,createElement:e}),Header:u,recommendations:m.items,status:m.status,translations:l,View:a=>e(d,t({classNames:o,itemComponent:m.itemComponent,items:m.items,translations:l,Fragment:n,createElement:e},a))})}},e.createRelatedProductsComponent=function({createElement:e,Fragment:n}){return function(m){const l={title:"Related products",sliderLabel:"Related products",...m.translations},o=m.classNames??{},c=m.children??a({createElement:e,Fragment:n}),i=m.fallbackComponent??function(){return null},u=m.headerComponent??s({createElement:e,Fragment:n}),d=m.view??r({createElement:e,Fragment:n});return c({classNames:o,Fallback:()=>e(i,{Fragment:n,createElement:e}),Header:u,recommendations:m.items,status:m.status,translations:l,View:a=>e(d,t({classNames:o,itemComponent:m.itemComponent,items:m.items,translations:l,Fragment:n,createElement:e},a))})}},e.createTrendingFacetsComponent=function({createElement:e,Fragment:r}){return function(m){const l={title:"Trending facets",sliderLabel:"Trending facets",...m.translations},o=m.classNames??{},c=m.children??a({createElement:e,Fragment:r}),i=m.fallbackComponent??function(){return null},u=m.headerComponent??s({createElement:e,Fragment:r}),d=m.view??function({createElement:e,Fragment:t}){return function(a){return e("div",{className:n("auc-Recommend-container",a.classNames.container)},e("ol",{className:n("auc-Recommend-list",a.classNames.list)},a.items.map((s=>e("li",{key:s.facetValue,className:n("auc-Recommend-item",a.classNames.item)},e(a.itemComponent,{createElement:e,Fragment:t,item:s}))))))}}({createElement:e,Fragment:r});return c({classNames:o,Fallback:()=>e(i,{Fragment:r,createElement:e}),Header:u,recommendations:m.items,status:m.status,translations:l,View:n=>e(d,t({classNames:o,itemComponent:m.itemComponent,items:m.items,translations:l,Fragment:r,createElement:e},n))})}},e.createTrendingItemsComponent=function({createElement:e,Fragment:n}){return function(m){const l={title:"Trending items",sliderLabel:"Trending items",...m.translations},o=m.classNames??{},c=m.children??a({createElement:e,Fragment:n}),i=m.fallbackComponent??function(){return null},u=m.headerComponent??s({createElement:e,Fragment:n}),d=m.view??r({createElement:e,Fragment:n});return c({classNames:o,Fallback:()=>e(i,{Fragment:n,createElement:e}),Header:u,recommendations:m.items,status:m.status,translations:l,View:a=>e(d,t({classNames:o,itemComponent:m.itemComponent,items:m.items,translations:l,Fragment:n,createElement:e},a))})}}})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@algolia/recommend-vdom", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "homepage": "https://github.com/algolia/recommend", | ||
"build:types": "tsc -p ./tsconfig.declaration.json --outDir ./dist/esm", | ||
"build:umd": "rollup --config", | ||
"build:umd": "rollup --config --bundleConfigAsCjs", | ||
"build": "yarn build:clean && yarn build:esm && yarn build:umd && yarn build:types", | ||
@@ -32,4 +32,4 @@ "prepare": "yarn build:esm && yarn build:types" | ||
"devDependencies": { | ||
"@algolia/recommend-core": "1.8.1" | ||
"@algolia/recommend-core": "1.8.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40756
486