@autoguru/overdrive 4.13.1 → 4.14.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/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/AutoSuggest/AutoSuggest.d.ts +2 -2
- package/dist/components/AutoSuggest/AutoSuggest.d.ts.map +1 -1
- package/dist/components/BulletList/context.d.ts +1 -1
- package/dist/components/BulletList/context.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Columns/Column.d.ts +1 -1
- package/dist/components/Columns/Column.d.ts.map +1 -1
- package/dist/components/Columns/Columns.d.ts +1 -1
- package/dist/components/Columns/Columns.d.ts.map +1 -1
- package/dist/components/Flyout/stories.js +2 -1
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.css.d.ts +7 -0
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.css.d.ts.map +1 -0
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.css.js +36 -0
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.d.ts +15 -0
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.d.ts.map +1 -0
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.js +167 -0
- package/dist/components/HorizontalAutoScroller/index.d.ts +3 -0
- package/dist/components/HorizontalAutoScroller/index.d.ts.map +1 -0
- package/dist/components/HorizontalAutoScroller/index.js +4 -0
- package/dist/components/HorizontalAutoScroller/stories.js +88 -0
- package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.d.ts +23 -0
- package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.d.ts.map +1 -0
- package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.js +159 -0
- package/dist/components/Image/types.d.ts +1 -1
- package/dist/components/Image/types.d.ts.map +1 -1
- package/dist/components/OrderedList/OrderedList.d.ts +1 -1
- package/dist/components/OrderedList/OrderedList.d.ts.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/components/SimplePagination/SimplePagination.d.ts +1 -1
- package/dist/components/SimplePagination/SimplePagination.d.ts.map +1 -1
- package/dist/components/SliderProgress/ProgressStep.d.ts.map +1 -1
- package/dist/components/SliderProgress/SliderProgress.d.ts +2 -3
- package/dist/components/SliderProgress/SliderProgress.d.ts.map +1 -1
- package/dist/components/StandardModal/StandardModal.d.ts +1 -1
- package/dist/components/StandardModal/StandardModal.d.ts.map +1 -1
- package/dist/components/Table/TableHeadCell.d.ts +1 -1
- package/dist/components/Table/TableHeadCell.d.ts.map +1 -1
- package/dist/components/TextLink/TextLink.d.ts +2 -2
- package/dist/components/TextLink/TextLink.d.ts.map +1 -1
- package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.d.ts +1 -1
- package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.d.ts.map +1 -1
- package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.d.ts +1 -1
- package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.d.ts.map +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +2 -2
- package/dist/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/components/Toaster/Toast.d.ts +2 -2
- package/dist/components/Toaster/Toast.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/private/InputBase/withEnhancedInput.d.ts +2 -2
- package/dist/components/private/InputBase/withEnhancedInput.d.ts.map +1 -1
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.d.ts +2 -2
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.d.ts.map +1 -1
- package/dist/themes/helpers.d.ts +3 -3
- package/dist/themes/helpers.d.ts.map +1 -1
- package/dist/themes/makeTheme.d.ts +1 -1
- package/dist/themes/makeTheme.d.ts.map +1 -1
- package/dist/themes/tokens.d.ts +17 -17
- package/dist/themes/tokens.d.ts.map +1 -1
- package/dist/utils/index.d.ts +4 -4
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/mapTokenToProperty.d.ts +2 -2
- package/dist/utils/mapTokenToProperty.d.ts.map +1 -1
- package/dist/utils/resolveResponsiveProps.d.ts +2 -2
- package/dist/utils/resolveResponsiveProps.d.ts.map +1 -1
- package/dist/utils/responsiveProps.css.d.ts +1 -1
- package/dist/utils/responsiveProps.css.d.ts.map +1 -1
- package/package.json +12 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { backgroundColours } from '../Box/useBoxStyles.css';
|
|
3
3
|
import { Button } from '../Button';
|
|
4
|
-
|
|
4
|
+
type Intent = keyof Pick<typeof backgroundColours, 'danger' | 'information' | 'success' | 'warning'>;
|
|
5
5
|
export interface Props {
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../lib/components/Alert/Alert.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOnC,
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../lib/components/Alert/Alert.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOnC,KAAK,MAAM,GAAG,MAAM,IAAI,CACvB,OAAO,iBAAiB,EACxB,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,CAChD,CAAC;AAEF,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,cAAc,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;CAC1D;AASD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAwE1C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -7,12 +7,12 @@ export interface AutoSuggestValue<PayloadType> {
|
|
|
7
7
|
payload: PayloadType | null | undefined;
|
|
8
8
|
skip?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type AutoSuggestItemRenderer<PayloadType> = (props: {
|
|
11
11
|
value: AutoSuggestValue<PayloadType>;
|
|
12
12
|
highlight: boolean;
|
|
13
13
|
suggestions: Array<AutoSuggestValue<PayloadType>>;
|
|
14
14
|
}) => ReactElement;
|
|
15
|
-
|
|
15
|
+
type Suggestions<PayloadType> = Array<AutoSuggestValue<PayloadType>>;
|
|
16
16
|
export interface Props<PayloadType> extends Omit<ComponentPropsWithoutRef<typeof TextInput>, 'onChange' | 'value' | 'type' | 'suffixIcon'> {
|
|
17
17
|
autoFocus?: boolean;
|
|
18
18
|
autoWidth?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSuggest.d.ts","sourceRoot":"","sources":["../../../lib/components/AutoSuggest/AutoSuggest.tsx"],"names":[],"mappings":"AAAA,OA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W,CACjC,SAAQ,IAAI,CACX,wBAAwB,CAAC,OAAO,SAAS,CAAC,EAC1C,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAC5C;IACD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAC5C,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC,YAAY,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAEpD,QAAQ,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAEtD,OAAO,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;CACrD;AAwGD,eAAO,MAAM,WAAW;;MA8FnB,YAAY,CAAC;AAuhBlB,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type BulletType = 'circle' | 'square' | 'disc';
|
|
3
3
|
export declare const bulletMap: BulletType[];
|
|
4
4
|
export declare const BulletListContext: Context<number>;
|
|
5
5
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletList/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,OAAO,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletList/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,OAAO,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtD,eAAO,MAAM,SAAS,EAAE,UAAU,EAAiC,CAAC;AAEpE,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAqB,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { IconType } from '@autoguru/icons';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { AriaAttributes, ButtonHTMLAttributes, ElementType, ReactElement } from 'react';
|
|
4
4
|
import * as styles from './Button.css';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type ButtonPrimitive = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
6
|
+
type AllowedChildren = string | IconType;
|
|
7
7
|
export interface Props extends Pick<ButtonPrimitive, 'id' | 'onClick' | 'type' | 'className'>, Pick<AriaAttributes, 'aria-label'> {
|
|
8
8
|
children: AllowedChildren | AllowedChildren[];
|
|
9
9
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,oBAAoB,EAIpB,WAAW,EAIX,YAAY,EAKZ,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,oBAAoB,EAIpB,WAAW,EAIX,YAAY,EAKZ,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,KAAK,eAAe,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE/D,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,CAAC;AAIzC,MAAM,WAAW,KAChB,SAAQ,IAAI,CAAC,eAAe,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC,EACrE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC;IACnC,QAAQ,EAAE,eAAe,GAAG,eAAe,EAAE,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,OAAO,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAqBD,eAAO,MAAM,MAAM,iFAgLlB,CAAC;AAqCF,eAAe,MAAM,CAAC"}
|
|
@@ -11,6 +11,6 @@ export interface Props extends Omit<ComponentProps<typeof Box>, 'width' | 'css'>
|
|
|
11
11
|
className?: string;
|
|
12
12
|
children: ReactNode | ReactNode[];
|
|
13
13
|
}
|
|
14
|
-
export declare const Column: React.ForwardRefExoticComponent<
|
|
14
|
+
export declare const Column: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
15
15
|
export default Column;
|
|
16
16
|
//# sourceMappingURL=Column.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cA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,OAAO,MAAM,CAAC,KAAK,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CAClC;AAED,eAAO,MAAM,MAAM,wFAmDlB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -21,6 +21,6 @@ interface ColumnContextValue {
|
|
|
21
21
|
isList: boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare const ColumnContext: React.Context<ColumnContextValue | null>;
|
|
24
|
-
export declare const Columns: React.ForwardRefExoticComponent<
|
|
24
|
+
export declare const Columns: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
25
25
|
export default Columns;
|
|
26
26
|
//# sourceMappingURL=Columns.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Columns.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EAGd,SAAS,EAET,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,KAAM,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,EAAE,KAAK,CAAC;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,cAAc,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC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AAC,MAAM,CAAC,CAAC;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,QAAQ,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC3B,SAAS,MAAC;IACV,SAAS,MAAC;IACV,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,0CAAiD,CAAC;AAE5E,eAAO,MAAM,OAAO,wFAmEnB,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
4
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
7
|
import * as React from 'react';
|
|
@@ -41,7 +42,7 @@ const sharedProps = {
|
|
|
41
42
|
triggerOffset: 12
|
|
42
43
|
};
|
|
43
44
|
const Template = _ref => {
|
|
44
|
-
let args = Object.assign({}, _ref);
|
|
45
|
+
let args = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
45
46
|
const triggerRef = useRef(null);
|
|
46
47
|
return _jsxs(Box, {
|
|
47
48
|
style: {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const controllerBtn: string;
|
|
2
|
+
export declare const controllerCol: string;
|
|
3
|
+
export declare const prevBtn: string;
|
|
4
|
+
export declare const nextBtn: string;
|
|
5
|
+
export declare const item: string;
|
|
6
|
+
export declare const active: string;
|
|
7
|
+
//# sourceMappingURL=HorizontalAutoScroller.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalAutoScroller.css.d.ts","sourceRoot":"","sources":["../../../lib/components/HorizontalAutoScroller/HorizontalAutoScroller.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,QAKxB,CAAC;AACH,eAAO,MAAM,aAAa,QAExB,CAAC;AAEH,eAAO,MAAM,OAAO,QAIlB,CAAC;AAEH,eAAO,MAAM,OAAO,QAIlB,CAAC;AAEH,eAAO,MAAM,IAAI,QAMf,CAAC;AACH,eAAO,MAAM,MAAM,QAGjB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
__vanilla_filescope__.setFileScope("lib/components/HorizontalAutoScroller/HorizontalAutoScroller.css.ts", "@autoguru/overdrive");
|
|
5
|
+
import { style } from '@vanilla-extract/css';
|
|
6
|
+
import { themeContractVars as vars } from "../../themes/theme.css.js";
|
|
7
|
+
const actionWidth = 50;
|
|
8
|
+
export const controllerBtn = style({
|
|
9
|
+
top: 0,
|
|
10
|
+
height: '100%',
|
|
11
|
+
width: actionWidth,
|
|
12
|
+
zIndex: 9
|
|
13
|
+
}, "controllerBtn");
|
|
14
|
+
export const controllerCol = style({
|
|
15
|
+
width: actionWidth
|
|
16
|
+
}, "controllerCol");
|
|
17
|
+
export const prevBtn = style({
|
|
18
|
+
left: 0,
|
|
19
|
+
background: 'linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.6769301470588236) 70%, rgba(255,255,255,0) 100%)'
|
|
20
|
+
}, "prevBtn");
|
|
21
|
+
export const nextBtn = style({
|
|
22
|
+
right: 0,
|
|
23
|
+
background: 'linear-gradient(-90deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.6769301470588236) 70%, rgba(255,255,255,0) 100%)'
|
|
24
|
+
}, "nextBtn");
|
|
25
|
+
export const item = style({
|
|
26
|
+
userSelect: 'none',
|
|
27
|
+
willChange: 'transform',
|
|
28
|
+
transition: "opacity 0.3s ".concat(vars.animation.easing.standard, " 0s, transform 0.3s ").concat(vars.animation.easing.standard, " 0s"),
|
|
29
|
+
transform: 'scale(0.9)',
|
|
30
|
+
opacity: 0.6
|
|
31
|
+
}, "item");
|
|
32
|
+
export const active = style({
|
|
33
|
+
transform: 'scale(1)',
|
|
34
|
+
opacity: 1
|
|
35
|
+
}, "active");
|
|
36
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentProps, FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import { SliderProgress } from '..';
|
|
3
|
+
import { Column, Columns } from '../Columns';
|
|
4
|
+
import { UseHorizontalAutoScrollerProps } from './useHorizontalAutoScroller';
|
|
5
|
+
export interface Props extends Pick<ComponentProps<typeof Columns>, 'space'>, Omit<UseHorizontalAutoScrollerProps, 'itemsRef'> {
|
|
6
|
+
durationSeconds?: number;
|
|
7
|
+
className?: string;
|
|
8
|
+
columnWidth?: ComponentProps<typeof Column>['width'];
|
|
9
|
+
sliderProgressColour?: ComponentProps<typeof SliderProgress>['backgroundColour'];
|
|
10
|
+
noControls?: boolean;
|
|
11
|
+
children: ReactNode | ReactNode[];
|
|
12
|
+
}
|
|
13
|
+
export declare const HorizontalAutoScroller: FunctionComponent<Props>;
|
|
14
|
+
export default HorizontalAutoScroller;
|
|
15
|
+
//# sourceMappingURL=HorizontalAutoScroller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalAutoScroller.d.ts","sourceRoot":"","sources":["../../../lib/components/HorizontalAutoScroller/HorizontalAutoScroller.tsx"],"names":[],"mappings":"AAGA,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,SAAS,EAGT,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAM7C,OAAO,EAEN,8BAA8B,EAC9B,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,KAChB,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,EAAE,OAAO,CAAC,EACpD,IAAI,CAAC,8BAA8B,EAAE,UAAU,CAAC;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;IACrD,oBAAoB,CAAC,EAAE,cAAc,CACpC,OAAO,cAAc,CACrB,CAAC,kBAAkB,CAAC,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CAClC;AAED,eAAO,MAAM,sBAAsB,EAAE,iBAAiB,CAAC,KAAK,CAiK3D,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@autoguru/icons';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { useMemo, useState } from 'react';
|
|
10
|
+
import flattenChildren from 'react-keyed-flatten-children';
|
|
11
|
+
import { useSwipeable } from 'react-swipeable';
|
|
12
|
+
import { SliderProgress } from "../index.js";
|
|
13
|
+
import { Box } from "../Box/index.js";
|
|
14
|
+
import { Button } from "../Button/index.js";
|
|
15
|
+
import { Column, Columns } from "../Columns/index.js";
|
|
16
|
+
import { Icon } from "../Icon/index.js";
|
|
17
|
+
import Section from "../Section/Section.js";
|
|
18
|
+
import { Stack } from "../Stack/index.js";
|
|
19
|
+
import * as styles from "./HorizontalAutoScroller.css.js";
|
|
20
|
+
import { useHorizontalAutoScroller } from "./useHorizontalAutoScroller.js";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
export const HorizontalAutoScroller = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
sliderProgressColour = 'primary',
|
|
27
|
+
noControls = false,
|
|
28
|
+
space = '5',
|
|
29
|
+
durationSeconds = 10,
|
|
30
|
+
children,
|
|
31
|
+
itemsPerPage: incomingItemsPerPage,
|
|
32
|
+
paused: incomingIsPaused,
|
|
33
|
+
activePage: incomingActivePage,
|
|
34
|
+
columnWidth = '1/2',
|
|
35
|
+
className
|
|
36
|
+
} = _ref;
|
|
37
|
+
const incomingItems = useMemo(() => flattenChildren(children), [children]);
|
|
38
|
+
const [activeIndex, setActiveIndex] = useState(incomingActivePage);
|
|
39
|
+
const [itemsRef, setItemsRef] = useState();
|
|
40
|
+
const items = useMemo(() => {
|
|
41
|
+
const itemsRef = [];
|
|
42
|
+
const list = incomingItems.map((item, index) => _jsx(Column, {
|
|
43
|
+
ref: el => {
|
|
44
|
+
if (el) itemsRef.push(el);
|
|
45
|
+
},
|
|
46
|
+
noShrink: true,
|
|
47
|
+
width: columnWidth,
|
|
48
|
+
justifyContent: "stretch",
|
|
49
|
+
alignSelf: "stretch",
|
|
50
|
+
children: _jsx(Box, {
|
|
51
|
+
width: "full",
|
|
52
|
+
className: clsx(styles.item, {
|
|
53
|
+
[styles.active]: index === activeIndex
|
|
54
|
+
}),
|
|
55
|
+
children: item
|
|
56
|
+
})
|
|
57
|
+
}, index));
|
|
58
|
+
setItemsRef(itemsRef);
|
|
59
|
+
return list;
|
|
60
|
+
}, [incomingItems, activeIndex, columnWidth]);
|
|
61
|
+
const {
|
|
62
|
+
containerRef,
|
|
63
|
+
pageCount,
|
|
64
|
+
activePage,
|
|
65
|
+
paused,
|
|
66
|
+
next,
|
|
67
|
+
prev,
|
|
68
|
+
onClick,
|
|
69
|
+
pause,
|
|
70
|
+
resume
|
|
71
|
+
} = useHorizontalAutoScroller({
|
|
72
|
+
itemsRef,
|
|
73
|
+
itemsPerPage: incomingItemsPerPage,
|
|
74
|
+
paused: incomingIsPaused,
|
|
75
|
+
activePage: incomingActivePage,
|
|
76
|
+
onChange: setActiveIndex
|
|
77
|
+
});
|
|
78
|
+
const handlers = useSwipeable({
|
|
79
|
+
onSwiped: eventData => {
|
|
80
|
+
eventData.dir === 'Left' ? next() : prev();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
if (items.length < 2) {
|
|
84
|
+
return _jsx(_Fragment, {
|
|
85
|
+
children: items
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return _jsxs(Stack, {
|
|
89
|
+
className: className,
|
|
90
|
+
space: "5",
|
|
91
|
+
children: [_jsxs(Box, _objectSpread(_objectSpread({
|
|
92
|
+
overflow: "hidden",
|
|
93
|
+
position: "relative"
|
|
94
|
+
}, handlers), {}, {
|
|
95
|
+
onContextMenu: event => {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
},
|
|
99
|
+
onTouchStart: pause,
|
|
100
|
+
onTouchEnd: resume,
|
|
101
|
+
onClick: onClick,
|
|
102
|
+
children: [noControls ? null : _jsx(Box, {
|
|
103
|
+
className: [styles.controllerBtn, styles.prevBtn],
|
|
104
|
+
display: "flex",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
justifyContent: "flexStart",
|
|
107
|
+
position: "absolute",
|
|
108
|
+
children: _jsx(Button, {
|
|
109
|
+
rounded: true,
|
|
110
|
+
onClick: event => {
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
prev();
|
|
114
|
+
},
|
|
115
|
+
variant: "secondary",
|
|
116
|
+
children: _jsx(Icon, {
|
|
117
|
+
icon: ChevronLeftIcon
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
}), _jsxs(Columns, {
|
|
121
|
+
ref: containerRef,
|
|
122
|
+
overflow: "hidden",
|
|
123
|
+
noWrap: true,
|
|
124
|
+
width: "full",
|
|
125
|
+
space: space,
|
|
126
|
+
children: [noControls ? null : _jsx(Column, {
|
|
127
|
+
noShrink: true,
|
|
128
|
+
className: styles.controllerCol,
|
|
129
|
+
children: _jsx("span", {})
|
|
130
|
+
}), items, noControls ? null : _jsx(Column, {
|
|
131
|
+
noShrink: true,
|
|
132
|
+
className: styles.controllerCol,
|
|
133
|
+
children: _jsx("span", {})
|
|
134
|
+
})]
|
|
135
|
+
}), noControls ? null : _jsx(Box, {
|
|
136
|
+
className: [styles.controllerBtn, styles.nextBtn],
|
|
137
|
+
display: "flex",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
justifyContent: "flexEnd",
|
|
140
|
+
position: "absolute",
|
|
141
|
+
children: _jsx(Button, {
|
|
142
|
+
rounded: true,
|
|
143
|
+
onClick: event => {
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
next();
|
|
147
|
+
},
|
|
148
|
+
variant: "secondary",
|
|
149
|
+
children: _jsx(Icon, {
|
|
150
|
+
icon: ChevronRightIcon
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
})]
|
|
154
|
+
})), _jsx(Section, {
|
|
155
|
+
width: "small",
|
|
156
|
+
children: _jsx(SliderProgress, {
|
|
157
|
+
backgroundColour: sliderProgressColour,
|
|
158
|
+
duration: "".concat(durationSeconds, "s"),
|
|
159
|
+
paused: paused,
|
|
160
|
+
onRequestNext: next,
|
|
161
|
+
totalCount: pageCount,
|
|
162
|
+
activeIndex: activePage || 0
|
|
163
|
+
})
|
|
164
|
+
})]
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
export default HorizontalAutoScroller;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/HorizontalAutoScroller/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
const _excluded = ["childrenNum"];
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Box } from "../Box/index.js";
|
|
10
|
+
import { boxArgTypes, scaleOptions } from "../Box/argTypes.js";
|
|
11
|
+
import { HorizontalAutoScroller } from "./index.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Components/HorizontalAutoScroller',
|
|
15
|
+
component: HorizontalAutoScroller,
|
|
16
|
+
argTypes: {
|
|
17
|
+
sliderProgressColour: boxArgTypes.backgroundColour,
|
|
18
|
+
space: {
|
|
19
|
+
options: scaleOptions,
|
|
20
|
+
control: {
|
|
21
|
+
type: 'select'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
paused: {
|
|
25
|
+
control: {
|
|
26
|
+
type: 'boolean'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
noControls: {
|
|
30
|
+
control: {
|
|
31
|
+
type: 'boolean'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const template = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
childrenNum
|
|
39
|
+
} = _ref,
|
|
40
|
+
args = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
return _jsx(HorizontalAutoScroller, _objectSpread(_objectSpread({}, args), {}, {
|
|
42
|
+
children: Array.from({
|
|
43
|
+
length: childrenNum
|
|
44
|
+
}).map((_, index) => _jsx(Box, {
|
|
45
|
+
backgroundColour: "gray200",
|
|
46
|
+
padding: "3",
|
|
47
|
+
display: "flex",
|
|
48
|
+
width: "full",
|
|
49
|
+
height: "full",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
children: _jsx(Box, {
|
|
53
|
+
style: {
|
|
54
|
+
width: '100%',
|
|
55
|
+
height: 20 + Math.ceil(Math.random() * 300)
|
|
56
|
+
},
|
|
57
|
+
backgroundColour: "gray900"
|
|
58
|
+
})
|
|
59
|
+
}, index))
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
const standardProps = {
|
|
63
|
+
paused: false,
|
|
64
|
+
activePage: 0,
|
|
65
|
+
childrenNum: 9
|
|
66
|
+
};
|
|
67
|
+
export const standard = template.bind(standardProps);
|
|
68
|
+
standard.args = standardProps;
|
|
69
|
+
const widthStartPageProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
70
|
+
activePage: 3
|
|
71
|
+
});
|
|
72
|
+
export const widthStartPage = template.bind(widthStartPageProps);
|
|
73
|
+
widthStartPage.args = widthStartPageProps;
|
|
74
|
+
const withCustomDurationProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
75
|
+
durationSeconds: 1
|
|
76
|
+
});
|
|
77
|
+
export const withCustomDuration = template.bind(withCustomDurationProps);
|
|
78
|
+
withCustomDuration.args = withCustomDurationProps;
|
|
79
|
+
const withProgressColourProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
80
|
+
sliderProgressColour: 'yellow500'
|
|
81
|
+
});
|
|
82
|
+
export const withProgressColour = template.bind(withProgressColourProps);
|
|
83
|
+
withProgressColour.args = withProgressColourProps;
|
|
84
|
+
const withManySlidesProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
85
|
+
childrenNum: 50
|
|
86
|
+
});
|
|
87
|
+
export const withManySlides = template.bind(withManySlidesProps);
|
|
88
|
+
withManySlides.args = withManySlidesProps;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useInView } from 'react-intersection-observer';
|
|
2
|
+
interface State {
|
|
3
|
+
pageCount: number;
|
|
4
|
+
activePage?: number | null;
|
|
5
|
+
paused: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface UseHorizontalAutoScrollerProps extends Partial<Omit<State, 'pageCount'>> {
|
|
8
|
+
itemsRef?: Array<HTMLElement>;
|
|
9
|
+
itemsPerPage?: number;
|
|
10
|
+
onChange?(page: number): void;
|
|
11
|
+
}
|
|
12
|
+
interface Returns extends State {
|
|
13
|
+
containerRef: ReturnType<typeof useInView>[0];
|
|
14
|
+
next(): void;
|
|
15
|
+
prev(): void;
|
|
16
|
+
pause(): void;
|
|
17
|
+
resume(): void;
|
|
18
|
+
onClick(): void;
|
|
19
|
+
goToPage(page: number): void;
|
|
20
|
+
}
|
|
21
|
+
export declare const useHorizontalAutoScroller: ({ itemsRef, itemsPerPage, paused: incomingIsPaused, activePage: incomingActivePage, onChange, }: UseHorizontalAutoScrollerProps) => Returns;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=useHorizontalAutoScroller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHorizontalAutoScroller.d.ts","sourceRoot":"","sources":["../../../lib/components/HorizontalAutoScroller/useHorizontalAutoScroller.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,UAAU,KAAK;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,8BAChB,SAAQ,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,UAAU,OAAQ,SAAQ,KAAK;IAC9B,YAAY,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9C,IAAI,IAAI,IAAI,CAAC;IAEb,IAAI,IAAI,IAAI,CAAC;IAEb,KAAK,IAAI,IAAI,CAAC;IAEd,MAAM,IAAI,IAAI,CAAC;IAEf,OAAO,IAAI,IAAI,CAAC;IAEhB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAmGD,eAAO,MAAM,yBAAyB,oGAMnC,8BAA8B,KAAG,OA8FnC,CAAC"}
|