@autoguru/overdrive 4.26.0 → 4.26.2

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,9 +1,7 @@
1
1
  import { IconType } from '@autoguru/icons';
2
- import * as React from 'react';
3
- import { ComponentProps, ReactNode } from 'react';
2
+ import { ComponentProps, FunctionComponent, ReactNode } from 'react';
4
3
  import { Button } from '../Button';
5
4
  import { Flyout } from '../Flyout';
6
- import { EPositionerAlignment } from '../Positioner';
7
5
  type ButtonProps = Omit<ComponentProps<typeof Button>, 'is' | 'children' | 'onClick'>;
8
6
  type FlyoutProps = Pick<ComponentProps<typeof Flyout>, 'alignment'>;
9
7
  export interface Props extends ButtonProps, FlyoutProps {
@@ -13,14 +11,6 @@ export interface Props extends ButtonProps, FlyoutProps {
13
11
  isOpen?: boolean;
14
12
  onClick?: ComponentProps<typeof Button>['onClick'];
15
13
  }
16
- export declare const DropDown: ({ children: options, label, icon, alignment, isOpen: incomingIsOpen, onClick: incomingOnClick, ...buttonProps }: {
17
- [x: string]: any;
18
- children: any;
19
- label: any;
20
- icon?: React.ReactElement<React.SVGAttributes<SVGElement>, "svg"> | undefined;
21
- alignment?: EPositionerAlignment | undefined;
22
- isOpen: any;
23
- onClick: any;
24
- }) => JSX.Element;
14
+ export declare const DropDown: FunctionComponent<Props>;
25
15
  export default DropDown;
26
16
  //# sourceMappingURL=DropDown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DropDown.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EAEd,SAAS,EAIT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAA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,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAsC7C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -23,7 +23,7 @@ export const DropDown = _ref => {
23
23
  label,
24
24
  icon = ChevronDownIcon,
25
25
  alignment = EPositionerAlignment.BOTTOM_LEFT,
26
- isOpen: incomingIsOpen,
26
+ isOpen: incomingIsOpen = false,
27
27
  onClick: incomingOnClick
28
28
  } = _ref,
29
29
  buttonProps = _objectWithoutProperties(_ref, _excluded);
@@ -83,6 +83,7 @@ const Template = _ref => {
83
83
  const sharedProps = {
84
84
  disabled: false,
85
85
  name: 'number',
86
+ value: '',
86
87
  placeholder: defaultPlaceholder,
87
88
  isValid: false,
88
89
  isTouched: false,
@@ -1,4 +1,5 @@
1
1
  export declare const root: string;
2
+ export declare const notchGapPlaceholder: string;
2
3
  export declare const borders: {
3
4
  root: {
4
5
  default: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"NotchedBase.css.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAEf,CAAC;AAeH,eAAO,MAAM,OAAO;;;;;;;;;CAuCnB,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AACF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AAEF,eAAO,MAAM,WAAW,gDAWtB,CAAC;AA2BH,eAAO,MAAM,oBAAoB,KAiDhC,CAAC"}
1
+ {"version":3,"file":"NotchedBase.css.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,QAEf,CAAC;AAeH,eAAO,MAAM,mBAAmB,QAG9B,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;CAuCnB,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AACF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AAEF,eAAO,MAAM,WAAW,gDAWtB,CAAC;AAyBH,eAAO,MAAM,oBAAoB,KAiDhC,CAAC"}
@@ -4,6 +4,7 @@ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
4
  __vanilla_filescope__.setFileScope("lib/components/private/InputBase/NotchedBase.css.ts", "@autoguru/overdrive");
5
5
  import { style, styleVariants } from '@vanilla-extract/css';
6
6
  import { themeContractVars as vars } from "../../../themes/theme.css.js";
7
+ const active_scaling_factor = 0.7777;
7
8
  export const root = style({
8
9
  transition: "fill 0.2s ".concat(vars.animation.easing.decelerate, " 0s")
9
10
  }, "root");
@@ -18,6 +19,10 @@ const borderVisualDefaults = style({
18
19
  borderRadius: vars.border.radius['1'],
19
20
  boxShadow: vars.elevation['2']
20
21
  }, "borderVisualDefaults");
22
+ export const notchGapPlaceholder = style({
23
+ visibility: 'hidden',
24
+ fontSize: "calc(".concat(vars.typography.size['4'].fontSize, " * ").concat(active_scaling_factor, ")")
25
+ }, "notchGapPlaceholder");
21
26
  export const borders = {
22
27
  root: {
23
28
  default: [borderVisualDefaults, style({
@@ -132,7 +137,6 @@ export const placeholder = styleVariants({
132
137
  color: vars.typography.colour.muted
133
138
  }
134
139
  }, "placeholder");
135
- const active_scaling_factor = 0.7777;
136
140
  const calcPlaceholderTranslate = (notched, prefixed, size) => {
137
141
  if (notched) {
138
142
  return "calc(".concat(vars.space['2'], " + ").concat(vars.space['2'], "), calc(-0.5 * ").concat(active_scaling_factor, " * ").concat(vars.typography.size['4'].fontSize, ")");
@@ -1 +1 @@
1
- {"version":3,"file":"NotchedBase.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.tsx"],"names":[],"mappings":"AAEA,OAAO,EACN,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AAC;IAC9B,0BAA0B,EAAE,MAAM,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,OAAO,MAAM,CAAC,oBAAoB,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,KAAK,CA0LhD,CAAC"}
@@ -2,15 +2,12 @@
2
2
 
3
3
  import clsx from 'clsx';
4
4
  import * as React from 'react';
5
- import { useEffect, useRef, useState } from 'react';
5
+ import { useRef } from 'react';
6
6
  import { Box } from "../../Box/index.js";
7
7
  import { useTextStyles } from "../../Text/index.js";
8
8
  import * as styles from "./NotchedBase.css.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
- const ACTIVE_SCALING_FACTOR = 0.7777;
12
- const ACTIVE_PADDING_ADDED = 16;
13
- const ROUGH_WIDTH_PER_CHARACTER = 10.2;
14
11
  export const NotchedBase = _ref => {
15
12
  let {
16
13
  id,
@@ -34,14 +31,7 @@ export const NotchedBase = _ref => {
34
31
  size: '4'
35
32
  });
36
33
  const labelRef = useRef(null);
37
- const [labelWidth, setLabelWidth] = useState(getNotchedComputedWidthForWidth(placeholder.length * ROUGH_WIDTH_PER_CHARACTER));
38
34
  const shouldMerge = !isFocused && !isHovered;
39
- useEffect(() => {
40
- if (labelRef.current) {
41
- setLabelWidth(labelRef.current.offsetWidth);
42
- }
43
- }, [placeholder]);
44
- const notchedWidth = getNotchedComputedWidthForWidth(labelWidth);
45
35
  return _jsxs(Box, {
46
36
  position: "relative",
47
37
  width: "full",
@@ -79,12 +69,14 @@ export const NotchedBase = _ref => {
79
69
  [styles.bordersAttach.flatCorners.TOP_LEFT]: attach === 'LEFT' || attach === 'TOP' || attach === 'ALL',
80
70
  [styles.bordersAttach.flatCorners.BOTTOM_LEFT]: attach === 'LEFT' || attach === 'BOTTOM' || attach === 'ALL'
81
71
  })
82
- }), _jsx("div", {
72
+ }), _jsxs("div", {
83
73
  className: clsx(styles.borders.middle, borderColourClassName),
84
- style: {
85
- width: isEmpty ? 0 : notchedWidth
86
- },
87
- children: _jsx(Box, {
74
+ children: [_jsx(Box, {
75
+ display: isEmpty || placeholder.length === 0 ? 'none' : 'block',
76
+ paddingX: "2",
77
+ className: [labelStyles, styles.notchGapPlaceholder],
78
+ children: placeholder
79
+ }), _jsx(Box, {
88
80
  ref: labelRef,
89
81
  is: "label",
90
82
  pointerEvents: "none",
@@ -103,7 +95,7 @@ export const NotchedBase = _ref => {
103
95
  [styles.placeholderPlacement[size].shifted]: !isEmpty
104
96
  }),
105
97
  children: placeholder
106
- })
98
+ })]
107
99
  }), _jsx("div", {
108
100
  className: clsx(styles.borders.trailing, borderColourClassName, borderColourClassName, {
109
101
  [styles.bordersMerged.complete.RIGHT]: shouldMerge && borderMerged === 'RIGHT',
@@ -116,7 +108,4 @@ export const NotchedBase = _ref => {
116
108
  })]
117
109
  })]
118
110
  });
119
- };
120
- function getNotchedComputedWidthForWidth(width) {
121
- return Math.round((width * ACTIVE_SCALING_FACTOR + ACTIVE_PADDING_ADDED) * 100) / 100;
122
- }
111
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.26.0",
3
+ "version": "4.26.2",
4
4
  "description": "Overdrive is a product component library, and design system for AutoGuru.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",