@react-spectrum/listbox 3.14.0 → 3.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/listbox",
3
- "version": "3.14.0",
3
+ "version": "3.14.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,23 +36,23 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/focus": "^3.19.0",
40
- "@react-aria/i18n": "^3.12.4",
41
- "@react-aria/interactions": "^3.22.5",
42
- "@react-aria/listbox": "^3.13.6",
43
- "@react-aria/utils": "^3.26.0",
44
- "@react-aria/virtualizer": "^4.1.0",
45
- "@react-spectrum/layout": "^3.6.10",
46
- "@react-spectrum/progress": "^3.7.11",
47
- "@react-spectrum/text": "^3.5.10",
48
- "@react-spectrum/utils": "^3.12.0",
49
- "@react-stately/collections": "^3.12.0",
50
- "@react-stately/layout": "^4.1.0",
51
- "@react-stately/list": "^3.11.1",
52
- "@react-stately/virtualizer": "^4.2.0",
53
- "@react-types/listbox": "^3.5.3",
54
- "@react-types/shared": "^3.26.0",
55
- "@spectrum-icons/ui": "^3.6.11",
39
+ "@react-aria/focus": "^3.20.0",
40
+ "@react-aria/i18n": "^3.12.6",
41
+ "@react-aria/interactions": "^3.24.0",
42
+ "@react-aria/listbox": "^3.14.1",
43
+ "@react-aria/utils": "^3.28.0",
44
+ "@react-aria/virtualizer": "^4.1.2",
45
+ "@react-spectrum/layout": "^3.6.12",
46
+ "@react-spectrum/progress": "^3.7.13",
47
+ "@react-spectrum/text": "^3.5.12",
48
+ "@react-spectrum/utils": "^3.12.2",
49
+ "@react-stately/collections": "^3.12.2",
50
+ "@react-stately/layout": "^4.2.0",
51
+ "@react-stately/list": "^3.12.0",
52
+ "@react-stately/virtualizer": "^4.3.0",
53
+ "@react-types/listbox": "^3.5.5",
54
+ "@react-types/shared": "^3.28.0",
55
+ "@spectrum-icons/ui": "^3.6.13",
56
56
  "@swc/helpers": "^0.5.0"
57
57
  },
58
58
  "devDependencies": {
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
69
+ "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
70
70
  }
package/src/ListBox.tsx CHANGED
@@ -17,7 +17,14 @@ import {SpectrumListBoxProps} from '@react-types/listbox';
17
17
  import {useDOMRef} from '@react-spectrum/utils';
18
18
  import {useListState} from '@react-stately/list';
19
19
 
20
- function ListBox<T extends object>(props: SpectrumListBoxProps<T>, ref: DOMRef<HTMLDivElement>) {
20
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
21
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
22
+
23
+
24
+ /**
25
+ * A list of options that can allow selection of one or more.
26
+ */
27
+ export const ListBox = React.forwardRef(function ListBox<T extends object>(props: SpectrumListBoxProps<T>, ref: DOMRef<HTMLDivElement>) {
21
28
  let state = useListState(props);
22
29
  let layout = useListBoxLayout();
23
30
  let domRef = useDOMRef(ref);
@@ -29,14 +36,4 @@ function ListBox<T extends object>(props: SpectrumListBoxProps<T>, ref: DOMRef<H
29
36
  state={state}
30
37
  layout={layout} />
31
38
  );
32
- }
33
-
34
- // forwardRef doesn't support generic parameters, so cast the result to the correct type
35
- // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
36
-
37
-
38
- /**
39
- * A list of options that can allow selection of one or more.
40
- */
41
- const _ListBox = React.forwardRef(ListBox) as <T>(props: SpectrumListBoxProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
42
- export {_ListBox as ListBox};
39
+ }) as <T>(props: SpectrumListBoxProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
@@ -54,7 +54,7 @@ export function useListBoxLayout<T>(): ListBoxLayout<T> {
54
54
  new ListBoxLayout<T>({
55
55
  estimatedRowHeight: scale === 'large' ? 48 : 32,
56
56
  estimatedHeadingHeight: scale === 'large' ? 33 : 26,
57
- padding: scale === 'large' ? 5 : 4, // TODO: get from DNA
57
+ paddingY: scale === 'large' ? 5 : 4, // TODO: get from DNA
58
58
  placeholderHeight: scale === 'large' ? 48 : 32
59
59
  })
60
60
  , [scale]);
@@ -62,8 +62,10 @@ export function useListBoxLayout<T>(): ListBoxLayout<T> {
62
62
  return layout;
63
63
  }
64
64
 
65
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
66
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
65
67
  /** @private */
66
- function ListBoxBase<T extends object>(props: ListBoxBaseProps<T>, ref: ForwardedRef<HTMLDivElement | null>) {
68
+ export const ListBoxBase = React.forwardRef(function ListBoxBase<T extends object>(props: ListBoxBaseProps<T>, ref: ForwardedRef<HTMLDivElement | null>) {
67
69
  let {layout, state, shouldFocusOnHover = false, shouldUseVirtualFocus = false, domProps = {}, isLoading, showLoadingSpinner = isLoading, onScroll, renderEmptyState} = props;
68
70
  let objectRef = useObjectRef(ref);
69
71
  let {listBoxProps} = useListBox({
@@ -145,12 +147,7 @@ function ListBoxBase<T extends object>(props: ListBoxBaseProps<T>, ref: Forwarde
145
147
  </FocusScope>
146
148
  </ListBoxContext.Provider>
147
149
  );
148
- }
149
-
150
- // forwardRef doesn't support generic parameters, so cast the result to the correct type
151
- // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
152
- const _ListBoxBase = React.forwardRef(ListBoxBase) as <T>(props: ListBoxBaseProps<T> & {ref?: RefObject<HTMLDivElement | null>}) => ReactElement;
153
- export {_ListBoxBase as ListBoxBase};
150
+ }) as <T>(props: ListBoxBaseProps<T> & {ref?: RefObject<HTMLDivElement | null>}) => ReactElement;
154
151
 
155
152
  function LoadingState() {
156
153
  let {state} = useContext(ListBoxContext)!;
@@ -2,24 +2,24 @@ import {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer'
2
2
  import {LayoutNode, ListLayout, ListLayoutOptions} from '@react-stately/layout';
3
3
  import {Node} from '@react-types/shared';
4
4
 
5
- interface ListBoxLayoutProps {
5
+ interface ListBoxLayoutProps extends ListLayoutOptions {
6
6
  isLoading?: boolean
7
7
  }
8
8
 
9
9
  interface ListBoxLayoutOptions extends ListLayoutOptions {
10
10
  placeholderHeight: number,
11
- padding: number
11
+ paddingY: number
12
12
  }
13
13
 
14
14
  export class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {
15
15
  private isLoading: boolean = false;
16
16
  private placeholderHeight: number;
17
- private padding: number;
17
+ private paddingY: number;
18
18
 
19
19
  constructor(opts: ListBoxLayoutOptions) {
20
20
  super(opts);
21
21
  this.placeholderHeight = opts.placeholderHeight;
22
- this.padding = opts.padding;
22
+ this.paddingY = opts.paddingY;
23
23
  }
24
24
 
25
25
  update(invalidationContext: InvalidationContext<ListBoxLayoutProps>): void {
@@ -28,7 +28,7 @@ export class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {
28
28
  }
29
29
 
30
30
  protected buildCollection(): LayoutNode[] {
31
- let nodes = super.buildCollection(this.padding);
31
+ let nodes = super.buildCollection(this.paddingY);
32
32
  let y = this.contentSize.height;
33
33
 
34
34
  if (this.isLoading) {
@@ -55,7 +55,7 @@ export class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {
55
55
  y = placeholder.rect.maxY;
56
56
  }
57
57
 
58
- this.contentSize.height = y + this.padding;
58
+ this.contentSize.height = y + this.paddingY;
59
59
  return nodes;
60
60
  }
61
61
 
@@ -1 +0,0 @@
1
- {"mappings":"AA4DA;;;;;AAIE;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAIA;;;;AAQA;;;;AAIA;;;;AAKF;;;;;;;;AAOE;;;;;;;;;;;AAqBE;;;;;AAQF;;;;AAKE;;;;;AAOJ;EACE;;;;EAIE;;;;;AAMJ;;;;;;;;;;AAWA;;;;AAIA;;;;AAIA;;;;;;;;;;;;;AAmBE;;;;;AAMA;;;;AAKF;;;;;;;AAWA;;;;;;;;;;;;;AAgBE;;;;AAIA;;;;AAIA;;;;AAKE;;;;AAKF;;;;AAMF;;;;;;AAMA;;;;;;AAMA;;;;;;AAOA;;;;;;;;;AAaA;;;;;;;;;;;;AAcE;;;;AAGA;;;;AAKF;;;;;AAMA;;;;;;;;;;AAgBE;;;;AAOF;;;;;;AAOA;;;;;;AAOA;;;;;;AAOA;;;;;;AAMA;;;;;;;;AAUA;;;;;;;;AASA;;;;AAGE;;;;;;AAKE;;;;AAKF;;;;;;;;AAOE;;;;;;;;AAQA;;;;;AAIE;;;;;;;;;;AAyBN;;;;;;;AAWA;;;;;AAKA;;;;AAIA;;;;;AAIE;;;;;;AAOA;;;;;AASE;;;;AAKF;;;;AAKA;;;;;;;AACE;;;;AAUJ;;;;AAIA;;;;AAIA;;;;AAIA;;;;;;AAQA;;;;AAIA;;;;;;;;;;AASA;;;;;;;;;;AASA;;;;;;;;;;AASA;;;;;;;;;;AASA;;;;;;;AAKE;;;;AAAA;;;;AAKF;;;;;;;AAKE;;;;AAAA;;;;AAKF;EACE;;;;;EAIA;;;;;;;;;;;;;;;;;;;EAkBE;;;;EAGA;;;;;EAOI;;;;EAIF;;;;;EAXF;;;;;EAOI;;;;EAIF;;;;;EAXF;;;;;EAOI;;;;EAIF;;;;;EAXF;;;;;EAOI;;;;EAIF;;;;;EAXF;;;;;EAOI;;;;EAIF;;;;;EAXF;;;;;EAOI;;;;EAIF","sources":["packages/@adobe/spectrum-css-temp/components/menu/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"vars.487ba452.css.map"}