@autoguru/overdrive 4.4.4 → 4.4.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../lib/components/Tabs/Tab.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGN,WAAW,EAGX,YAAY,EACZ,SAAS,EAET,MAAM,OAAO,CAAC;AAUf,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../lib/components/Tabs/Tab.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGN,WAAW,EAGX,YAAY,EACZ,SAAS,EAET,MAAM,OAAO,CAAC;AAUf,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,GAAG,8EAqFf,CAAC"}
|
|
@@ -21,7 +21,6 @@ export const Tab = forwardRef(({ children, id: incomingId = null, indication = n
|
|
|
21
21
|
const controlsId = typeof incomingId === 'string'
|
|
22
22
|
? incomingId
|
|
23
23
|
: `${tabsContext.id}-${tabListContext}-tab`;
|
|
24
|
-
invariant(typeof children === 'string' || typeof children === 'number', 'Tab children have to be text.');
|
|
25
24
|
const props = {
|
|
26
25
|
className: clsx(useBoxStyles({
|
|
27
26
|
is: typeof Component === 'string' ? Component : 'button',
|
|
@@ -6,12 +6,18 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
|
|
7
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
8
|
|
|
9
|
+
import { AlertIcon, OttoIcon } from '@autoguru/icons';
|
|
9
10
|
import { action } from '@storybook/addon-actions';
|
|
10
11
|
import isChromatic from 'chromatic/isChromatic';
|
|
11
12
|
import * as React from 'react';
|
|
12
13
|
import { useEffect, useState } from 'react';
|
|
14
|
+
import { Box } from "../Box/index.js";
|
|
15
|
+
import { Icon } from "../Icon/index.js";
|
|
16
|
+
import { Inline } from "../Inline/index.js";
|
|
17
|
+
import { EAlignment } from "../Positioner/alignment.js";
|
|
13
18
|
import { Stack } from "../Stack/index.js";
|
|
14
19
|
import { StarRating } from "../StarRating/index.js";
|
|
20
|
+
import { Tooltip } from "../Tooltip/index.js";
|
|
15
21
|
import { Tab, TabList, TabPane, TabPanes, Tabs } from "./index.js";
|
|
16
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -112,6 +118,50 @@ const withIndicationProps = {
|
|
|
112
118
|
};
|
|
113
119
|
export const withIndication = Template.bind(withIndicationProps);
|
|
114
120
|
withIndication.args = withIndicationProps;
|
|
121
|
+
const withComplexTabProps = {
|
|
122
|
+
active: 0,
|
|
123
|
+
onChange: action('onChange'),
|
|
124
|
+
children: _jsxs(_Fragment, {
|
|
125
|
+
children: [_jsxs(TabList, {
|
|
126
|
+
children: [_jsx(Tab, {
|
|
127
|
+
indication: 2,
|
|
128
|
+
children: _jsxs(Inline, {
|
|
129
|
+
alignY: "center",
|
|
130
|
+
children: ["Tab 1", _jsx(Tooltip, {
|
|
131
|
+
alignment: EAlignment.BOTTOM,
|
|
132
|
+
label: "This tab is a winner",
|
|
133
|
+
children: _jsx(Box, {
|
|
134
|
+
children: _jsx(Icon, {
|
|
135
|
+
icon: OttoIcon
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
})]
|
|
139
|
+
})
|
|
140
|
+
}), _jsx(Tab, {
|
|
141
|
+
children: _jsxs(Inline, {
|
|
142
|
+
alignY: "center",
|
|
143
|
+
children: ["Tab 2", _jsx(Tooltip, {
|
|
144
|
+
alignment: EAlignment.BOTTOM,
|
|
145
|
+
label: "This tab is less awesome",
|
|
146
|
+
children: _jsx(Box, {
|
|
147
|
+
children: _jsx(Icon, {
|
|
148
|
+
icon: AlertIcon
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
})]
|
|
152
|
+
})
|
|
153
|
+
})]
|
|
154
|
+
}), _jsxs(TabPanes, {
|
|
155
|
+
children: [_jsx(TabPane, {
|
|
156
|
+
children: "Content A"
|
|
157
|
+
}), _jsx(TabPane, {
|
|
158
|
+
children: "Content B"
|
|
159
|
+
})]
|
|
160
|
+
})]
|
|
161
|
+
})
|
|
162
|
+
};
|
|
163
|
+
export const withComplexTab = Template.bind(withComplexTabProps);
|
|
164
|
+
withComplexTab.args = withComplexTabProps;
|
|
115
165
|
const tabsWithoutPanesProps = {
|
|
116
166
|
active: 0,
|
|
117
167
|
onChange: action('onChange'),
|