@autoguru/overdrive 4.62.0 → 4.64.0
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 +4 -1
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +11 -5
- package/dist/components/Button/Button.css.d.ts +13 -1
- package/dist/components/Button/Button.css.d.ts.map +1 -1
- package/dist/components/Button/Button.css.js +35 -0
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +5 -1
- package/dist/components/CheckBox/CheckBox.css.d.ts.map +1 -1
- package/dist/components/CheckBox/CheckBox.css.js +5 -2
- package/dist/components/FilterChip/FilterChip.css.d.ts +64 -0
- package/dist/components/FilterChip/FilterChip.css.d.ts.map +1 -0
- package/dist/components/FilterChip/FilterChip.css.js +243 -0
- package/dist/components/FilterChip/FilterChip.d.ts +112 -0
- package/dist/components/FilterChip/FilterChip.d.ts.map +1 -0
- package/dist/components/FilterChip/FilterChip.js +152 -0
- package/dist/components/FilterChip/default.d.ts +2 -0
- package/dist/components/FilterChip/default.d.ts.map +1 -0
- package/dist/components/FilterChip/default.js +1 -0
- package/dist/components/FilterChip/index.d.ts +3 -0
- package/dist/components/FilterChip/index.d.ts.map +1 -0
- package/dist/components/FilterChip/index.js +1 -0
- package/dist/components/MinimalModal/MinimalModal.css.js +4 -4
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts +13 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.js +6 -1
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts +3 -2
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/useColorOverrides.js +158 -22
- package/dist/components/OverdriveProvider/useColorOverrides.spec.d.ts +2 -0
- package/dist/components/OverdriveProvider/useColorOverrides.spec.d.ts.map +1 -0
- package/dist/components/OverdriveProvider/useColorOverrides.spec.js +226 -0
- package/dist/components/Radio/Radio.css.d.ts.map +1 -1
- package/dist/components/Radio/Radio.css.js +3 -2
- package/dist/components/StandardModal/StandardModal.css.js +2 -2
- package/dist/components/StandardModal/StandardModal.js +3 -2
- package/dist/components/Switch/Switch.css.d.ts.map +1 -1
- package/dist/components/Switch/Switch.css.js +3 -1
- package/dist/components/Tabs/Tab.css.d.ts +40 -0
- package/dist/components/Tabs/Tab.css.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.css.js +69 -8
- package/dist/components/Tabs/Tab.js +1 -1
- package/dist/components/Tabs/TabList.css.d.ts +1 -0
- package/dist/components/Tabs/TabList.css.d.ts.map +1 -1
- package/dist/components/Tabs/TabList.css.js +2 -1
- package/dist/components/Tabs/TabList.d.ts.map +1 -1
- package/dist/components/Tabs/TabList.js +5 -2
- package/dist/components/Tabs/TabPane.js +2 -1
- package/dist/components/Tabs/TabPanes.js +2 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +4 -1
- package/dist/components/Tabs/index.d.ts +4 -3
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/intentColorset.css.d.ts +3 -3
- package/dist/styles/sprinkles.css.d.ts +12 -12
- package/dist/styles/typography.css.d.ts +1 -1
- package/dist/themes/base/contrastGuide.spec.js +11 -2
- package/dist/themes/base/index.d.ts +8 -0
- package/dist/themes/base/index.d.ts.map +1 -1
- package/dist/themes/base/tokens.d.ts +17 -0
- package/dist/themes/base/tokens.d.ts.map +1 -1
- package/dist/themes/base/tokens.js +18 -0
- package/dist/themes/flat_red/index.d.ts +13 -0
- package/dist/themes/flat_red/index.d.ts.map +1 -1
- package/dist/themes/flat_red/tokens.d.ts +9 -0
- package/dist/themes/flat_red/tokens.d.ts.map +1 -1
- package/dist/themes/flat_red/tokens.js +10 -0
- package/dist/themes/index.d.ts +8 -0
- package/dist/themes/index.d.ts.map +1 -1
- package/dist/themes/makeTheme.d.ts +4 -0
- package/dist/themes/makeTheme.d.ts.map +1 -1
- package/dist/themes/neutral/index.d.ts +13 -0
- package/dist/themes/neutral/index.d.ts.map +1 -1
- package/dist/themes/neutral/tokens.d.ts +9 -0
- package/dist/themes/neutral/tokens.d.ts.map +1 -1
- package/dist/themes/neutral/tokens.js +11 -0
- package/dist/themes/theme.css.d.ts +4 -0
- package/dist/themes/theme.css.d.ts.map +1 -1
- package/dist/themes/theme.css.js +16 -0
- package/package.json +1 -1
|
@@ -9,6 +9,9 @@ export interface AlertProps extends IntentStripeProps {
|
|
|
9
9
|
dismissible?: boolean;
|
|
10
10
|
onRequestClose?: ComponentProps<typeof Button>['onClick'];
|
|
11
11
|
}
|
|
12
|
-
export declare const Alert:
|
|
12
|
+
export declare const Alert: {
|
|
13
|
+
({ children, className, intent, inline, onRequestClose, dismissible, }: AlertProps): React.JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
13
16
|
export default Alert;
|
|
14
17
|
//# sourceMappingURL=Alert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../lib/components/Alert/Alert.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../lib/components/Alert/Alert.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAG7D,MAAM,WAAW,UAAW,SAAQ,iBAAiB;IACpD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,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;AAmBD,eAAO,MAAM,KAAK;4EAOf,UAAU;;CAiEZ,CAAC;AAIF,eAAe,KAAK,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { AlertCircleIcon, WarningIcon, CheckCircleIcon, InformationIcon, XIcon }
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { sprinkles } from "../../styles/index.js";
|
|
5
|
-
import { sprinklesLegacyText } from "../../styles/typography.css.js";
|
|
6
5
|
import { Box } from "../Box/Box.js";
|
|
7
6
|
import { Button } from "../Button/Button.js";
|
|
8
7
|
import { Icon } from "../Icon/Icon.js";
|
|
@@ -16,6 +15,12 @@ const iconMapForIntent = {
|
|
|
16
15
|
success: CheckCircleIcon,
|
|
17
16
|
warning: WarningIcon
|
|
18
17
|
};
|
|
18
|
+
const textColorForIntent = {
|
|
19
|
+
danger: 'alertForeground',
|
|
20
|
+
information: 'infoForeground',
|
|
21
|
+
success: 'successForeground',
|
|
22
|
+
warning: 'warningForeground'
|
|
23
|
+
};
|
|
19
24
|
export const Alert = ({
|
|
20
25
|
children,
|
|
21
26
|
className = '',
|
|
@@ -25,8 +30,8 @@ export const Alert = ({
|
|
|
25
30
|
dismissible = typeof onRequestClose === 'function'
|
|
26
31
|
}) => {
|
|
27
32
|
return /*#__PURE__*/_jsxs(Box, {
|
|
28
|
-
className: clsx(className,
|
|
29
|
-
color: intent
|
|
33
|
+
className: clsx(className, sprinkles({
|
|
34
|
+
color: textColorForIntent[intent]
|
|
30
35
|
}), {
|
|
31
36
|
[styles.contained]: !inline
|
|
32
37
|
}),
|
|
@@ -36,8 +41,8 @@ export const Alert = ({
|
|
|
36
41
|
backgroundColor: "white",
|
|
37
42
|
borderWidth: "1",
|
|
38
43
|
borderColor: "default",
|
|
39
|
-
borderRadius: "
|
|
40
|
-
boxShadow: inline ? 'none' : '
|
|
44
|
+
borderRadius: "xsmall",
|
|
45
|
+
boxShadow: inline ? 'none' : 'z4',
|
|
41
46
|
padding: "2",
|
|
42
47
|
odComponent: "alert",
|
|
43
48
|
children: [/*#__PURE__*/_jsx(IntentStripe, {
|
|
@@ -85,4 +90,5 @@ export const Alert = ({
|
|
|
85
90
|
})]
|
|
86
91
|
});
|
|
87
92
|
};
|
|
93
|
+
Alert.displayName = 'Alert';
|
|
88
94
|
export default Alert;
|
|
@@ -148,6 +148,10 @@ export declare const button: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
|
148
148
|
isLoading: {
|
|
149
149
|
true: {};
|
|
150
150
|
};
|
|
151
|
+
/** Empty here; the appearance lives in the `intent: 'primary'` compound. */
|
|
152
|
+
outlined: {
|
|
153
|
+
true: {};
|
|
154
|
+
};
|
|
151
155
|
}>;
|
|
152
156
|
type ButtonRecipeProps = NonNullable<Required<RecipeVariants<typeof button>>>;
|
|
153
157
|
export type ButtonSize = ButtonRecipeProps['size'];
|
|
@@ -156,6 +160,7 @@ export type ButtonIntent = ButtonRecipeProps['intent'];
|
|
|
156
160
|
export type ButtonIsFullWidth = ButtonRecipeProps['isFullWidth'];
|
|
157
161
|
export type ButtonIsLoading = ButtonRecipeProps['isLoading'];
|
|
158
162
|
export type ButtonMinimal = ButtonRecipeProps['minimal'];
|
|
163
|
+
export type ButtonOutlined = ButtonRecipeProps['outlined'];
|
|
159
164
|
export type ButtonRounded = ButtonRecipeProps['rounded'];
|
|
160
165
|
export interface StyledButtonProps {
|
|
161
166
|
/**
|
|
@@ -174,8 +179,15 @@ export interface StyledButtonProps {
|
|
|
174
179
|
* Present a borderless minimal appearance
|
|
175
180
|
*/
|
|
176
181
|
minimal?: ButtonMinimal;
|
|
182
|
+
/**
|
|
183
|
+
* Transparent fill with a brand-coloured border and label.
|
|
184
|
+
*
|
|
185
|
+
* Currently applies to `variant="primary"` only, and ignored when `minimal`
|
|
186
|
+
* is set — the two are opposites.
|
|
187
|
+
*/
|
|
188
|
+
outlined?: ButtonOutlined;
|
|
177
189
|
isFullWidth?: ButtonIsFullWidth;
|
|
178
|
-
isLoading?:
|
|
190
|
+
isLoading?: ButtonIsLoading;
|
|
179
191
|
}
|
|
180
192
|
export {};
|
|
181
193
|
//# sourceMappingURL=Button.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAe,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAYzE,eAAO,MAAM,aAAa,QAAkC,CAAC;AAC7D,eAAO,MAAM,cAAc,QAKzB,CAAC;AACH,eAAO,MAAM,OAAO,QAA4B,CAAC;AAGjD,eAAO,MAAM,MAAM;;;;gBA+Cd,CAAC,iBAAiB,CAAC;;;;kBAIlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;kBAGlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;kBAIlB;;;;;;;;;gBAUD,CAAC,iBAAiB,CAAC;;kBAElB;;;;;;;gBAQD,CAAC,iBAAiB,CAAC;;;;;;;kBASlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAOlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;;;;;kBAalB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;;kBAQlB;;;;;gBAKD,CAAC,iBAA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AM,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnD,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACvD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAC7D,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACzD,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,eAAe,CAAC;CAC5B"}
|
|
@@ -212,6 +212,10 @@ export const button = recipe({
|
|
|
212
212
|
},
|
|
213
213
|
isLoading: {
|
|
214
214
|
true: {}
|
|
215
|
+
},
|
|
216
|
+
/** Empty here; the appearance lives in the `intent: 'primary'` compound. */
|
|
217
|
+
outlined: {
|
|
218
|
+
true: {}
|
|
215
219
|
}
|
|
216
220
|
},
|
|
217
221
|
compoundVariants: [
|
|
@@ -409,6 +413,37 @@ export const button = recipe({
|
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
415
|
}
|
|
416
|
+
},
|
|
417
|
+
// Compound class names are index-based — append, never insert.
|
|
418
|
+
{
|
|
419
|
+
variants: {
|
|
420
|
+
intent: 'primary',
|
|
421
|
+
outlined: true
|
|
422
|
+
},
|
|
423
|
+
style: {
|
|
424
|
+
'@layer': {
|
|
425
|
+
[cssLayerComponent]: {
|
|
426
|
+
// intent primary sets this too, at equal specificity.
|
|
427
|
+
backgroundColor: 'transparent',
|
|
428
|
+
border: `1px solid ${vars.color.button.primary.outlined.border}`,
|
|
429
|
+
color: vars.color.button.primary.outlined.text,
|
|
430
|
+
selectors: {
|
|
431
|
+
'&:focus-visible, &:not(:disabled):hover': {
|
|
432
|
+
backgroundColor: vars.color.button.primary.outlined.hover,
|
|
433
|
+
borderColor: vars.color.button.primary.outlined.border,
|
|
434
|
+
color: vars.color.button.primary.outlined.text
|
|
435
|
+
},
|
|
436
|
+
'&:active:not(:disabled, [data-loading])': {
|
|
437
|
+
backgroundColor: vars.color.button.primary.outlined.pressed,
|
|
438
|
+
// Restated: intent primary's nested `:active`
|
|
439
|
+
// (0,3,0) beats this variant's `:focus-visible`.
|
|
440
|
+
borderColor: vars.color.button.primary.outlined.border,
|
|
441
|
+
color: vars.color.button.primary.outlined.text
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
412
447
|
}],
|
|
413
448
|
defaultVariants: {
|
|
414
449
|
size: 'medium',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EASb,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAIhB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEtD,KAAK,eAAe,GAAG,cAAc,CAAC,QAAQ,CAAC,CAA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,CAAC,CAAC;AAOhD,QAAA,MAAM,mBAAmB;;CAEf,CAAC;AAEX,KAAK,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,MAAM,WAAW,WAChB,SAAQ,IAAI,CACV,eAAe,EACb,UAAU,GACV,IAAI,GACJ,QAAQ,GACR,SAAS,GACT,SAAS,GACT,WAAW,GACX,cAAc,GACd,cAAc,GACd,MAAM,GACN,WAAW,CACb,EACD,IAAI,CACH,cAAc,EACZ,YAAY,GACZ,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,eAAe,CACjB,EACD,iBAAiB,EACjB,UAAU;IACX;;OAEG;IACH,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;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB;AAcD,eAAO,MAAM,YAAY,GAAI,MAAM,WAAW,CAAC,MAAM,CAAC,uBACnB,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,MAAM,uFA4IlB,CAAC"}
|
|
@@ -65,6 +65,7 @@ export const Button = /*#__PURE__*/forwardRef(({
|
|
|
65
65
|
isFullWidth = false,
|
|
66
66
|
localeText,
|
|
67
67
|
minimal = false,
|
|
68
|
+
outlined = false,
|
|
68
69
|
rounded = false,
|
|
69
70
|
size = 'medium',
|
|
70
71
|
testId,
|
|
@@ -84,7 +85,9 @@ export const Button = /*#__PURE__*/forwardRef(({
|
|
|
84
85
|
}, ref) => {
|
|
85
86
|
const [functionallyDisabled, setFunctionallyDisabled] = useState(false);
|
|
86
87
|
const language = _objectSpread(_objectSpread({}, LOCALE_TEXT_DEFAULT), localeText);
|
|
87
|
-
|
|
88
|
+
// `minimal` wins; primary-only because only it has outlined tokens.
|
|
89
|
+
const isOutlined = outlined && !minimal && variant === 'primary';
|
|
90
|
+
const isInverse = minimal || isOutlined || variant === 'secondary';
|
|
88
91
|
const isSingleIconChild = useMemo(() => /*#__PURE__*/isValidElement(children) && children.type === Icon && typeof children.type !== 'string', [children]);
|
|
89
92
|
const shape = isSingleIconChild && 'iconOnly' || rounded && 'rounded' || 'default';
|
|
90
93
|
const onClick = useCallback(event => {
|
|
@@ -105,6 +108,7 @@ export const Button = /*#__PURE__*/forwardRef(({
|
|
|
105
108
|
isFullWidth,
|
|
106
109
|
isLoading,
|
|
107
110
|
minimal,
|
|
111
|
+
outlined: isOutlined,
|
|
108
112
|
rounded,
|
|
109
113
|
shape,
|
|
110
114
|
size
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBox.css.d.ts","sourceRoot":"","sources":["../../../lib/components/CheckBox/CheckBox.css.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"CheckBox.css.d.ts","sourceRoot":"","sources":["../../../lib/components/CheckBox/CheckBox.css.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ,wCA6BnB,CAAC;AAEH,eAAO,MAAM,IAAI,QAOf,CAAC"}
|
|
@@ -3,7 +3,7 @@ __vanilla_filescope__.setFileScope("lib/components/CheckBox/CheckBox.css.ts", "@
|
|
|
3
3
|
import { style, styleVariants } from '@vanilla-extract/css';
|
|
4
4
|
import { overdriveTokens as vars } from "../../themes/theme.css.js";
|
|
5
5
|
import { nativeInput, checkable } from "../private/CheckableBase/CheckableBase.css.js";
|
|
6
|
-
const colorAccent = vars.color.
|
|
6
|
+
const colorAccent = vars.color.brand.solid;
|
|
7
7
|
const colorContrast = vars.color.background.default;
|
|
8
8
|
const colorMid = vars.colours.background.neutral;
|
|
9
9
|
const size = vars.space['6'];
|
|
@@ -33,7 +33,10 @@ export const checkbox = styleVariants({
|
|
|
33
33
|
},
|
|
34
34
|
selected: {
|
|
35
35
|
backgroundColor: colorAccent,
|
|
36
|
-
borderColor: colorAccent
|
|
36
|
+
borderColor: colorAccent,
|
|
37
|
+
// On `selected` only — the Icon always renders, hidden by matching
|
|
38
|
+
// the page background.
|
|
39
|
+
color: vars.color.brand.onSolid
|
|
37
40
|
}
|
|
38
41
|
}, "checkbox");
|
|
39
42
|
export const icon = style({
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
|
+
import { cssLayerComponent } from '../../styles/layers.css';
|
|
3
|
+
export declare const chip: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
4
|
+
variant: {
|
|
5
|
+
filter: {
|
|
6
|
+
'@layer': {
|
|
7
|
+
[cssLayerComponent]: {
|
|
8
|
+
backgroundColor: `var(--${string})`;
|
|
9
|
+
borderColor: `var(--${string})`;
|
|
10
|
+
color: `var(--${string})`;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
add: {
|
|
15
|
+
'@layer': {
|
|
16
|
+
[cssLayerComponent]: {
|
|
17
|
+
backgroundColor: "transparent";
|
|
18
|
+
borderColor: `var(--${string})`;
|
|
19
|
+
borderStyle: "dashed";
|
|
20
|
+
color: `var(--${string})`;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
selected: {
|
|
26
|
+
true: {};
|
|
27
|
+
false: {};
|
|
28
|
+
};
|
|
29
|
+
interactive: {
|
|
30
|
+
true: {};
|
|
31
|
+
false: {};
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
export type StyledFilterChipProps = NonNullable<RecipeVariants<typeof chip>>;
|
|
35
|
+
export declare const chipBody: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
36
|
+
withRemove: {
|
|
37
|
+
true: {
|
|
38
|
+
'@layer': {
|
|
39
|
+
[cssLayerComponent]: {
|
|
40
|
+
paddingInlineEnd: `var(--${string})`;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
false: {};
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
export declare const buttonFont: string;
|
|
48
|
+
export declare const innerButtonText: string;
|
|
49
|
+
export declare const removeButton: string;
|
|
50
|
+
export declare const labelText: string;
|
|
51
|
+
export declare const valueText: string;
|
|
52
|
+
export declare const categoryLabel: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
53
|
+
selected: {
|
|
54
|
+
true: {
|
|
55
|
+
'@layer': {
|
|
56
|
+
[cssLayerComponent]: {
|
|
57
|
+
color: `var(--${string})`;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
false: {};
|
|
62
|
+
};
|
|
63
|
+
}>;
|
|
64
|
+
//# sourceMappingURL=FilterChip.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterChip.css.d.ts","sourceRoot":"","sources":["../../../lib/components/FilterChip/FilterChip.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAe,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAczE,eAAO,MAAM,IAAI;;;;gBAsCZ,CAAC,iBAAiB,CAAC;;;;kBAIlB;;;;;gBAKD,CAAC,iBAAiB,CAAC;;;;;kBAKlB;;;;;;;;;;;;EA6EJ,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;AAE7E,eAAO,MAAM,QAAQ;;;;gBAmBhB,CAAC,iBAAiB,CAAC;;kBAElB;;;;;EAUJ,CAAC;AAEH,eAAO,MAAM,UAAU,QAOrB,CAAC;AAEH,eAAO,MAAM,eAAe,QAQ1B,CAAC;AAEH,eAAO,MAAM,YAAY,QAavB,CAAC;AAEH,eAAO,MAAM,SAAS,QAOpB,CAAC;AAEH,eAAO,MAAM,SAAS,QAQpB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;gBAYrB,CAAC,iBAAiB,CAAC;;kBAElB;;;;;EASJ,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
2
|
+
__vanilla_filescope__.setFileScope("lib/components/FilterChip/FilterChip.css.ts", "@autoguru/overdrive");
|
|
3
|
+
import { globalLayer, style } from '@vanilla-extract/css';
|
|
4
|
+
import { recipe } from '@vanilla-extract/recipes';
|
|
5
|
+
import { LAYER_ORDER, cssLayerComponent } from "../../styles/layers.css.js";
|
|
6
|
+
import { selectors } from "../../styles/selectors.js";
|
|
7
|
+
import { overdriveTokens as vars } from "../../themes/theme.css.js";
|
|
8
|
+
globalLayer(LAYER_ORDER);
|
|
9
|
+
const TRANSITION_DURATION = '150ms';
|
|
10
|
+
const FOCUS_RING_WIDTH = vars.border.width['2'];
|
|
11
|
+
const FOCUS_COLOUR = vars.color.info.foreground;
|
|
12
|
+
const chipHover = '&:is(button):hover, &:has(button:hover)';
|
|
13
|
+
export const chip = recipe({
|
|
14
|
+
base: {
|
|
15
|
+
'@layer': {
|
|
16
|
+
[cssLayerComponent]: {
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
borderRadius: vars.border.radius.pill,
|
|
19
|
+
borderStyle: 'solid',
|
|
20
|
+
borderWidth: vars.border.width['1'],
|
|
21
|
+
display: 'inline-flex',
|
|
22
|
+
fontSize: vars.typography.size['4'].fontSize,
|
|
23
|
+
lineHeight: vars.typography.size['4'].lineHeight,
|
|
24
|
+
maxWidth: '100%',
|
|
25
|
+
minWidth: 0,
|
|
26
|
+
position: 'relative',
|
|
27
|
+
transitionDuration: TRANSITION_DURATION,
|
|
28
|
+
transitionProperty: 'background-color, border-color, color',
|
|
29
|
+
transitionTimingFunction: vars.animation.easing.standard,
|
|
30
|
+
selectors: {
|
|
31
|
+
[`&:focus-visible, &[data-focus-visible], &:has(:focus-visible), &:has([data-focus-visible])`]: {
|
|
32
|
+
borderColor: FOCUS_COLOUR,
|
|
33
|
+
outline: `solid ${FOCUS_RING_WIDTH} ${FOCUS_COLOUR}`,
|
|
34
|
+
outlineOffset: FOCUS_RING_WIDTH
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
'@media': {
|
|
38
|
+
'(prefers-reduced-motion: reduce)': {
|
|
39
|
+
transitionDuration: '0s'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
filter: {
|
|
48
|
+
'@layer': {
|
|
49
|
+
[cssLayerComponent]: {
|
|
50
|
+
backgroundColor: vars.color.background.emphasisInactive,
|
|
51
|
+
borderColor: vars.color.border.default,
|
|
52
|
+
color: vars.color.foreground.primary
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
add: {
|
|
57
|
+
'@layer': {
|
|
58
|
+
[cssLayerComponent]: {
|
|
59
|
+
backgroundColor: 'transparent',
|
|
60
|
+
borderColor: vars.color.border.default,
|
|
61
|
+
borderStyle: 'dashed',
|
|
62
|
+
color: vars.color.foreground.secondary
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
selected: {
|
|
68
|
+
true: {},
|
|
69
|
+
false: {}
|
|
70
|
+
},
|
|
71
|
+
interactive: {
|
|
72
|
+
true: {},
|
|
73
|
+
false: {}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
compoundVariants: [{
|
|
77
|
+
variants: {
|
|
78
|
+
variant: 'filter',
|
|
79
|
+
interactive: true
|
|
80
|
+
},
|
|
81
|
+
style: {
|
|
82
|
+
'@layer': {
|
|
83
|
+
[cssLayerComponent]: {
|
|
84
|
+
selectors: {
|
|
85
|
+
[chipHover]: {
|
|
86
|
+
backgroundColor: vars.color.background.emphasisLight,
|
|
87
|
+
borderColor: vars.color.border.emphasis
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
variants: {
|
|
95
|
+
variant: 'add',
|
|
96
|
+
interactive: true
|
|
97
|
+
},
|
|
98
|
+
style: {
|
|
99
|
+
'@layer': {
|
|
100
|
+
[cssLayerComponent]: {
|
|
101
|
+
selectors: {
|
|
102
|
+
[chipHover]: {
|
|
103
|
+
borderColor: vars.color.border.selected,
|
|
104
|
+
color: vars.color.foreground.primary
|
|
105
|
+
},
|
|
106
|
+
[selectors.focusVisible]: {
|
|
107
|
+
borderColor: FOCUS_COLOUR,
|
|
108
|
+
color: vars.color.foreground.primary
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
variants: {
|
|
116
|
+
variant: 'filter',
|
|
117
|
+
selected: true
|
|
118
|
+
},
|
|
119
|
+
style: {
|
|
120
|
+
'@layer': {
|
|
121
|
+
[cssLayerComponent]: {
|
|
122
|
+
backgroundColor: vars.color.brand.solid,
|
|
123
|
+
borderColor: vars.color.brand.solid,
|
|
124
|
+
color: vars.color.brand.onSolid,
|
|
125
|
+
selectors: {
|
|
126
|
+
[chipHover]: {
|
|
127
|
+
backgroundColor: vars.color.brand.solid,
|
|
128
|
+
borderColor: vars.color.brand.solid
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}],
|
|
135
|
+
defaultVariants: {
|
|
136
|
+
variant: 'filter',
|
|
137
|
+
selected: false,
|
|
138
|
+
interactive: false
|
|
139
|
+
}
|
|
140
|
+
}, "chip");
|
|
141
|
+
export const chipBody = recipe({
|
|
142
|
+
base: {
|
|
143
|
+
'@layer': {
|
|
144
|
+
[cssLayerComponent]: {
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
display: 'inline-flex',
|
|
147
|
+
gap: vars.space['1'],
|
|
148
|
+
minWidth: 0,
|
|
149
|
+
paddingBlock: vars.space['2'],
|
|
150
|
+
paddingInlineEnd: vars.space['3'],
|
|
151
|
+
paddingInlineStart: vars.space['3']
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
variants: {
|
|
156
|
+
withRemove: {
|
|
157
|
+
true: {
|
|
158
|
+
'@layer': {
|
|
159
|
+
[cssLayerComponent]: {
|
|
160
|
+
paddingInlineEnd: vars.space['1']
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
false: {}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
defaultVariants: {
|
|
168
|
+
withRemove: false
|
|
169
|
+
}
|
|
170
|
+
}, "chipBody");
|
|
171
|
+
export const buttonFont = style({
|
|
172
|
+
'@layer': {
|
|
173
|
+
[cssLayerComponent]: {
|
|
174
|
+
fontFamily: 'inherit',
|
|
175
|
+
fontWeight: 'inherit'
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, "buttonFont");
|
|
179
|
+
export const innerButtonText = style({
|
|
180
|
+
'@layer': {
|
|
181
|
+
[cssLayerComponent]: {
|
|
182
|
+
color: 'inherit',
|
|
183
|
+
fontSize: 'inherit',
|
|
184
|
+
lineHeight: 'inherit'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, "innerButtonText");
|
|
188
|
+
export const removeButton = style({
|
|
189
|
+
'@layer': {
|
|
190
|
+
[cssLayerComponent]: {
|
|
191
|
+
alignItems: 'center',
|
|
192
|
+
alignSelf: 'stretch',
|
|
193
|
+
display: 'inline-flex',
|
|
194
|
+
flexShrink: 0,
|
|
195
|
+
justifyContent: 'center',
|
|
196
|
+
paddingBlock: vars.space['2'],
|
|
197
|
+
paddingInlineEnd: vars.space['3'],
|
|
198
|
+
paddingInlineStart: 0
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}, "removeButton");
|
|
202
|
+
export const labelText = style({
|
|
203
|
+
'@layer': {
|
|
204
|
+
[cssLayerComponent]: {
|
|
205
|
+
flexShrink: 0,
|
|
206
|
+
whiteSpace: 'nowrap'
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}, "labelText");
|
|
210
|
+
export const valueText = style({
|
|
211
|
+
'@layer': {
|
|
212
|
+
[cssLayerComponent]: {
|
|
213
|
+
overflow: 'hidden',
|
|
214
|
+
textOverflow: 'ellipsis',
|
|
215
|
+
whiteSpace: 'nowrap'
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, "valueText");
|
|
219
|
+
export const categoryLabel = recipe({
|
|
220
|
+
base: {
|
|
221
|
+
'@layer': {
|
|
222
|
+
[cssLayerComponent]: {
|
|
223
|
+
color: vars.color.foreground.secondary
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
variants: {
|
|
228
|
+
selected: {
|
|
229
|
+
true: {
|
|
230
|
+
'@layer': {
|
|
231
|
+
[cssLayerComponent]: {
|
|
232
|
+
color: vars.color.brand.onSolid
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
false: {}
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
defaultVariants: {
|
|
240
|
+
selected: false
|
|
241
|
+
}
|
|
242
|
+
}, "categoryLabel");
|
|
243
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { type HTMLAttributes, type MouseEventHandler } from 'react';
|
|
2
|
+
import type { TestIdProp } from '../../types';
|
|
3
|
+
/** Attributes forwarded to the chip body. */
|
|
4
|
+
type FilterChipBodyAttributes = Pick<HTMLAttributes<HTMLElement>, 'aria-controls' | 'aria-describedby' | 'aria-haspopup' | 'aria-label' | 'aria-labelledby' | 'id' | 'onBlur' | 'onFocus' | 'onKeyDown' | 'onMouseEnter' | 'onMouseLeave'>;
|
|
5
|
+
interface FilterChipBaseProps extends FilterChipBodyAttributes, TestIdProp {
|
|
6
|
+
/** The category name, or the chip's only text for `simple` and `add`. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Override class name with additional styles */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** The props every chip except `add` shares. */
|
|
12
|
+
interface FilterChipStateProps {
|
|
13
|
+
/**
|
|
14
|
+
* Reflects the persistent chosen state as an inverted surface. Purely
|
|
15
|
+
* visual — the chip's own text is what tells a screen reader which filter is
|
|
16
|
+
* applied. Use `pressed` if the chip is a toggle.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
selected?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Marks the chip as an on/off toggle and reports `aria-pressed`. Only set
|
|
22
|
+
* this when clicking the chip applies and unapplies the filter in place; a
|
|
23
|
+
* chip whose body opens an editor is not a toggle and must leave it unset.
|
|
24
|
+
*/
|
|
25
|
+
pressed?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the popover or dropdown this chip controls is open. When
|
|
28
|
+
* supplied the chip is exposed as a disclosure rather than a toggle, and
|
|
29
|
+
* `aria-haspopup` is set unless you specify it yourself. Pair it with
|
|
30
|
+
* `aria-controls` and the forwarded `ref`, which `Popover` needs to anchor
|
|
31
|
+
* itself to the chip.
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/** Activates the chip body. Omit to render the chip non-interactively. */
|
|
35
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
36
|
+
/**
|
|
37
|
+
* Removes the filter. Supplying this renders the trailing `×` button.
|
|
38
|
+
*/
|
|
39
|
+
onRemove?: MouseEventHandler<HTMLButtonElement>;
|
|
40
|
+
/**
|
|
41
|
+
* Accessible name for the `×` button. Defaults to naming the filter and its
|
|
42
|
+
* value — `Remove State QLD filter` — so that two chips from the same
|
|
43
|
+
* category are distinguishable. Any trailing colon is stripped.
|
|
44
|
+
*/
|
|
45
|
+
removeLabel?: string;
|
|
46
|
+
}
|
|
47
|
+
/** A category and its chosen value, e.g. `Vehicle type: Truck`. */
|
|
48
|
+
interface SelectChipProps extends FilterChipBaseProps, FilterChipStateProps {
|
|
49
|
+
type?: 'select';
|
|
50
|
+
/** The chosen value. */
|
|
51
|
+
value?: string;
|
|
52
|
+
operator?: never;
|
|
53
|
+
}
|
|
54
|
+
/** A category, a comparison operator and a value, e.g. `Usage (km): over 100,000 km`. */
|
|
55
|
+
interface NumericChipProps extends FilterChipBaseProps, FilterChipStateProps {
|
|
56
|
+
type: 'numeric';
|
|
57
|
+
/** The chosen value. */
|
|
58
|
+
value?: string;
|
|
59
|
+
/** The comparison word, e.g. `over`. */
|
|
60
|
+
operator?: string;
|
|
61
|
+
}
|
|
62
|
+
/** A bare label with no value, e.g. `Serviced`. */
|
|
63
|
+
interface SimpleChipProps extends FilterChipBaseProps, FilterChipStateProps {
|
|
64
|
+
type: 'simple';
|
|
65
|
+
value?: never;
|
|
66
|
+
operator?: never;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The dashed "Add Filter" affordance that opens a filter picker. It holds no
|
|
70
|
+
* filter, so it takes no value, no state and nothing to remove, and `onClick` is
|
|
71
|
+
* required.
|
|
72
|
+
*/
|
|
73
|
+
interface AddChipProps extends FilterChipBaseProps {
|
|
74
|
+
type: 'add';
|
|
75
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
76
|
+
value?: never;
|
|
77
|
+
operator?: never;
|
|
78
|
+
selected?: never;
|
|
79
|
+
pressed?: never;
|
|
80
|
+
expanded?: never;
|
|
81
|
+
onRemove?: never;
|
|
82
|
+
removeLabel?: never;
|
|
83
|
+
}
|
|
84
|
+
/** All FilterChip props, discriminated on `type`. */
|
|
85
|
+
export type FilterChipProps = SelectChipProps | NumericChipProps | SimpleChipProps | AddChipProps;
|
|
86
|
+
/**
|
|
87
|
+
* The four filter chip shapes.
|
|
88
|
+
*
|
|
89
|
+
* - `select` — a category and its chosen value, e.g. `Vehicle type: Truck`
|
|
90
|
+
* - `numeric` — a category, a comparison operator and a value, e.g. `Usage (km): over 100,000 km`
|
|
91
|
+
* - `simple` — a bare label with no value
|
|
92
|
+
* - `add` — the dashed "Add Filter" affordance that opens a filter picker
|
|
93
|
+
*/
|
|
94
|
+
export type FilterChipType = NonNullable<FilterChipProps['type']>;
|
|
95
|
+
/**
|
|
96
|
+
* A filter chip represents one active filter in a filter bar. The body opens an
|
|
97
|
+
* editor for the filter's value and the trailing `×` clears it.
|
|
98
|
+
*
|
|
99
|
+
* Distinct from `Badge`, which is a static, non-interactive label.
|
|
100
|
+
*
|
|
101
|
+
* The forwarded `ref` lands on the chip body, which is what a `Popover` anchors
|
|
102
|
+
* to. It is attached only when the body is a button — that is, when `onClick` is
|
|
103
|
+
* supplied. A chip without one has an inert `<span>` body and receives no ref,
|
|
104
|
+
* whether or not it has a `×`.
|
|
105
|
+
*
|
|
106
|
+
* Removal is by the `×` button only — the WAI-ARIA APG chip pattern also removes
|
|
107
|
+
* a focused chip on `Backspace`/`Delete`, which this component does not
|
|
108
|
+
* implement.
|
|
109
|
+
*/
|
|
110
|
+
export declare const FilterChip: React.ForwardRefExoticComponent<FilterChipProps & React.RefAttributes<HTMLButtonElement>>;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=FilterChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterChip.d.ts","sourceRoot":"","sources":["../../../lib/components/FilterChip/FilterChip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAEb,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEtB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9C,6CAA6C;AAC7C,KAAK,wBAAwB,GAAG,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