@react-stately/tabs 3.2.3 → 3.2.4

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/main.js CHANGED
@@ -6,15 +6,35 @@ function $parcel$export(e, n, v, s) {
6
6
  }
7
7
 
8
8
  $parcel$export(module.exports, "useTabListState", () => $817f925d289daf81$export$4ba071daf4e486);
9
-
9
+ /*
10
+ * Copyright 2020 Adobe. All rights reserved.
11
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ * you may not use this file except in compliance with the License. You may obtain a copy
13
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software distributed under
16
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ * OF ANY KIND, either express or implied. See the License for the specific language
18
+ * governing permissions and limitations under the License.
19
+ */ /*
20
+ * Copyright 2020 Adobe. All rights reserved.
21
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
22
+ * you may not use this file except in compliance with the License. You may obtain a copy
23
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software distributed under
26
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
27
+ * OF ANY KIND, either express or implied. See the License for the specific language
28
+ * governing permissions and limitations under the License.
29
+ */
10
30
 
11
31
  function $817f925d289daf81$export$4ba071daf4e486(props) {
12
- let state = $7iSyh$reactstatelylist.useSingleSelectListState({
32
+ let state = (0, $7iSyh$reactstatelylist.useSingleSelectListState)({
13
33
  ...props,
14
34
  suppressTextValueWarning: true
15
35
  });
16
36
  let { selectionManager: selectionManager , collection: collection , selectedKey: currentSelectedKey } = state;
17
- let lastSelectedKey = $7iSyh$react.useRef(currentSelectedKey);
37
+ let lastSelectedKey = (0, $7iSyh$react.useRef)(currentSelectedKey);
18
38
  // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)
19
39
  let selectedKey = currentSelectedKey;
20
40
  if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;SC0BgB,uCAAe,CAAmB,KAAsB,EAAmB,CAAC;IAC1F,GAAG,CAAC,KAAK,GAAG,gDAAwB,CAAI,CAAC;WACpC,KAAK;QACR,wBAAwB,EAAE,IAAI;IAChC,CAAC;IAED,GAAG,CAAC,CAAC,mBACH,gBAAgB,eAChB,UAAU,GACV,WAAW,EAAE,kBAAkB,EACjC,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,eAAe,GAAG,mBAAM,CAAC,kBAAkB;IAC/C,EAA0H,AAA1H,wHAA0H;IAC1H,GAAG,CAAC,WAAW,GAAG,kBAAkB;IACpC,EAAE,EAAE,gBAAgB,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;QACjE,WAAW,GAAG,UAAU,CAAC,WAAW;QACpC,EAAuE,AAAvE,qEAAuE;cAChE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,KAAK,WAAW,KAAK,UAAU,CAAC,UAAU,GACjF,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,WAAW;QAElD,EAAoH,AAApH,kHAAoH;QACpH,EAAE,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,KAAK,WAAW,KAAK,UAAU,CAAC,UAAU,IAC9E,WAAW,GAAG,UAAU,CAAC,WAAW;QAEtC,EAAuF,AAAvF,qFAAuF;QACvF,gBAAgB,CAAC,eAAe,CAAC,CAAC;YAAA,WAAW;QAAA,CAAC;IAChD,CAAC;IAED,EAA2J,AAA3J,yJAA2J;IAC3J,EAAE,EAAE,gBAAgB,CAAC,UAAU,IAAI,IAAI,KAAM,gBAAgB,CAAC,SAAS,IAAI,WAAW,KAAK,eAAe,CAAC,OAAO,EAChH,gBAAgB,CAAC,aAAa,CAAC,WAAW;IAE5C,eAAe,CAAC,OAAO,GAAG,WAAW;IAErC,MAAM,CAAC,CAAC;WACH,KAAK;QACR,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;IACvC,CAAC;AACH,CAAC","sources":["packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/useTabListState.ts"],"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\nexport {useTabListState} from './useTabListState';\n\nexport type {TabListProps} from '@react-types/tabs';\nexport type {TabListState} from './useTabListState';\n","/*\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\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useRef} from 'react';\n\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (state.disabledKeys.has(selectedKey) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key than the last\n if (state.disabledKeys.has(selectedKey) && selectedKey === collection.getLastKey()) {\n selectedKey = collection.getFirstKey();\n }\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAcO,SAAS,wCAAkC,KAAsB,EAAmB;IACzF,IAAI,QAAQ,CAAA,GAAA,gDAAuB,EAAK;QACtC,GAAG,KAAK;QACR,0BAA0B,IAAI;IAChC;IAEA,IAAI,oBACF,iBAAgB,cAChB,WAAU,EACV,aAAa,mBAAkB,EAChC,GAAG;IAEJ,IAAI,kBAAkB,CAAA,GAAA,mBAAK,EAAE;IAC7B,0HAA0H;IAC1H,IAAI,cAAc;IAClB,IAAI,iBAAiB,OAAO,IAAI,CAAC,WAAW,OAAO,CAAC,cAAc;QAChE,cAAc,WAAW,WAAW;QACpC,uEAAuE;QACvE,MAAO,MAAM,YAAY,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,WAAW,UAAU,GACjF,cAAc,WAAW,WAAW,CAAC;QAEvC,oHAAoH;QACpH,IAAI,MAAM,YAAY,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,WAAW,UAAU,IAC9E,cAAc,WAAW,WAAW;QAEtC,uFAAuF;QACvF,iBAAiB,eAAe,CAAC;YAAC;SAAY;IAChD,CAAC;IAED,2JAA2J;IAC3J,IAAI,iBAAiB,UAAU,IAAI,IAAI,IAAK,CAAC,iBAAiB,SAAS,IAAI,gBAAgB,gBAAgB,OAAO,EAChH,iBAAiB,aAAa,CAAC;IAEjC,gBAAgB,OAAO,GAAG;IAE1B,OAAO;QACL,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI,KAAK;IACvC;AACF;;CDvDC,GAED","sources":["packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/useTabListState.ts"],"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\nexport {useTabListState} from './useTabListState';\n\nexport type {TabListProps} from '@react-types/tabs';\nexport type {TabListState} from './useTabListState';\n","/*\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\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useRef} from 'react';\n\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (state.disabledKeys.has(selectedKey) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key than the last\n if (state.disabledKeys.has(selectedKey) && selectedKey === collection.getLastKey()) {\n selectedKey = collection.getFirstKey();\n }\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,15 +1,35 @@
1
1
  import {useSingleSelectListState as $ijHKZ$useSingleSelectListState} from "@react-stately/list";
2
2
  import {useRef as $ijHKZ$useRef} from "react";
3
3
 
4
-
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */
5
25
 
6
26
  function $76f919a04c5a7d14$export$4ba071daf4e486(props) {
7
- let state = $ijHKZ$useSingleSelectListState({
27
+ let state = (0, $ijHKZ$useSingleSelectListState)({
8
28
  ...props,
9
29
  suppressTextValueWarning: true
10
30
  });
11
31
  let { selectionManager: selectionManager , collection: collection , selectedKey: currentSelectedKey } = state;
12
- let lastSelectedKey = $ijHKZ$useRef(currentSelectedKey);
32
+ let lastSelectedKey = (0, $ijHKZ$useRef)(currentSelectedKey);
13
33
  // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)
14
34
  let selectedKey = currentSelectedKey;
15
35
  if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {
@@ -1 +1 @@
1
- {"mappings":";;;;;SC0BgB,uCAAe,CAAmB,KAAsB,EAAmB,CAAC;IAC1F,GAAG,CAAC,KAAK,GAAG,+BAAwB,CAAI,CAAC;WACpC,KAAK;QACR,wBAAwB,EAAE,IAAI;IAChC,CAAC;IAED,GAAG,CAAC,CAAC,mBACH,gBAAgB,eAChB,UAAU,GACV,WAAW,EAAE,kBAAkB,EACjC,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,eAAe,GAAG,aAAM,CAAC,kBAAkB;IAC/C,EAA0H,AAA1H,wHAA0H;IAC1H,GAAG,CAAC,WAAW,GAAG,kBAAkB;IACpC,EAAE,EAAE,gBAAgB,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;QACjE,WAAW,GAAG,UAAU,CAAC,WAAW;QACpC,EAAuE,AAAvE,qEAAuE;cAChE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,KAAK,WAAW,KAAK,UAAU,CAAC,UAAU,GACjF,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,WAAW;QAElD,EAAoH,AAApH,kHAAoH;QACpH,EAAE,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,KAAK,WAAW,KAAK,UAAU,CAAC,UAAU,IAC9E,WAAW,GAAG,UAAU,CAAC,WAAW;QAEtC,EAAuF,AAAvF,qFAAuF;QACvF,gBAAgB,CAAC,eAAe,CAAC,CAAC;YAAA,WAAW;QAAA,CAAC;IAChD,CAAC;IAED,EAA2J,AAA3J,yJAA2J;IAC3J,EAAE,EAAE,gBAAgB,CAAC,UAAU,IAAI,IAAI,KAAM,gBAAgB,CAAC,SAAS,IAAI,WAAW,KAAK,eAAe,CAAC,OAAO,EAChH,gBAAgB,CAAC,aAAa,CAAC,WAAW;IAE5C,eAAe,CAAC,OAAO,GAAG,WAAW;IAErC,MAAM,CAAC,CAAC;WACH,KAAK;QACR,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK;IACvC,CAAC;AACH,CAAC","sources":["packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/useTabListState.ts"],"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\nexport {useTabListState} from './useTabListState';\n\nexport type {TabListProps} from '@react-types/tabs';\nexport type {TabListState} from './useTabListState';\n","/*\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\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useRef} from 'react';\n\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (state.disabledKeys.has(selectedKey) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key than the last\n if (state.disabledKeys.has(selectedKey) && selectedKey === collection.getLastKey()) {\n selectedKey = collection.getFirstKey();\n }\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;AAcO,SAAS,wCAAkC,KAAsB,EAAmB;IACzF,IAAI,QAAQ,CAAA,GAAA,+BAAuB,EAAK;QACtC,GAAG,KAAK;QACR,0BAA0B,IAAI;IAChC;IAEA,IAAI,oBACF,iBAAgB,cAChB,WAAU,EACV,aAAa,mBAAkB,EAChC,GAAG;IAEJ,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAE;IAC7B,0HAA0H;IAC1H,IAAI,cAAc;IAClB,IAAI,iBAAiB,OAAO,IAAI,CAAC,WAAW,OAAO,CAAC,cAAc;QAChE,cAAc,WAAW,WAAW;QACpC,uEAAuE;QACvE,MAAO,MAAM,YAAY,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,WAAW,UAAU,GACjF,cAAc,WAAW,WAAW,CAAC;QAEvC,oHAAoH;QACpH,IAAI,MAAM,YAAY,CAAC,GAAG,CAAC,gBAAgB,gBAAgB,WAAW,UAAU,IAC9E,cAAc,WAAW,WAAW;QAEtC,uFAAuF;QACvF,iBAAiB,eAAe,CAAC;YAAC;SAAY;IAChD,CAAC;IAED,2JAA2J;IAC3J,IAAI,iBAAiB,UAAU,IAAI,IAAI,IAAK,CAAC,iBAAiB,SAAS,IAAI,gBAAgB,gBAAgB,OAAO,EAChH,iBAAiB,aAAa,CAAC;IAEjC,gBAAgB,OAAO,GAAG;IAE1B,OAAO;QACL,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI,KAAK;IACvC;AACF;;CDvDC,GAED","sources":["packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/useTabListState.ts"],"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\nexport {useTabListState} from './useTabListState';\n\nexport type {TabListProps} from '@react-types/tabs';\nexport type {TabListState} from './useTabListState';\n","/*\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\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useRef} from 'react';\n\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (selectionManager.isEmpty || !collection.getItem(selectedKey)) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (state.disabledKeys.has(selectedKey) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key than the last\n if (state.disabledKeys.has(selectedKey) && selectedKey === collection.getLastKey()) {\n selectedKey = collection.getFirstKey();\n }\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/tabs",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -17,10 +17,10 @@
17
17
  "url": "https://github.com/adobe/react-spectrum"
18
18
  },
19
19
  "dependencies": {
20
- "@babel/runtime": "^7.6.2",
21
- "@react-stately/list": "^3.6.0",
22
- "@react-stately/utils": "^3.5.1",
23
- "@react-types/tabs": "^3.1.5"
20
+ "@react-stately/list": "^3.6.1",
21
+ "@react-stately/utils": "^3.5.2",
22
+ "@react-types/tabs": "^3.1.5",
23
+ "@swc/helpers": "^0.4.14"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "2954307ddbefe149241685440c81f80ece6b2c83"
31
+ "gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
32
32
  }