@seeqdev/qomponents 0.0.41 → 0.0.42
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/README.md +135 -135
- package/dist/Tabs/Tabs.d.ts +4 -0
- package/dist/Tabs/Tabs.stories.d.ts +5 -0
- package/dist/Tabs/Tabs.test.d.ts +1 -0
- package/dist/Tabs/Tabs.types.d.ts +18 -0
- package/dist/Tabs/index.d.ts +1 -0
- package/dist/example/.eslintrc.cjs +14 -14
- package/dist/example/README.md +33 -33
- package/dist/example/index.html +13 -13
- package/dist/example/package.json +30 -30
- package/dist/example/src/ComplexSelectExample.tsx +81 -81
- package/dist/example/src/Example.tsx +167 -167
- package/dist/example/src/index.css +102 -102
- package/dist/example/src/main.tsx +10 -10
- package/dist/example/src/vite-env.d.ts +1 -1
- package/dist/example/tsconfig.json +33 -33
- package/dist/example/tsconfig.node.json +12 -12
- package/dist/example/vite.config.ts +12 -12
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +486 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +486 -6
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2726 -2644
- package/package.json +80 -79
- package/dist/Button/Button.js +0 -87
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.js +0 -77
- package/dist/Button/Button.stories.js.map +0 -1
- package/dist/Button/Button.test.js +0 -49
- package/dist/Button/Button.test.js.map +0 -1
- package/dist/Button/Button.types.js +0 -4
- package/dist/Button/Button.types.js.map +0 -1
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +0 -1
- package/dist/Checkbox/Checkbox.js +0 -24
- package/dist/Checkbox/Checkbox.js.map +0 -1
- package/dist/Checkbox/Checkbox.stories.js +0 -32
- package/dist/Checkbox/Checkbox.stories.js.map +0 -1
- package/dist/Checkbox/Checkbox.test.js +0 -94
- package/dist/Checkbox/Checkbox.test.js.map +0 -1
- package/dist/Checkbox/Checkbox.types.js +0 -2
- package/dist/Checkbox/Checkbox.types.js.map +0 -1
- package/dist/Checkbox/index.js +0 -2
- package/dist/Checkbox/index.js.map +0 -1
- package/dist/Icon/Icon.js +0 -63
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.js +0 -40
- package/dist/Icon/Icon.stories.js.map +0 -1
- package/dist/Icon/Icon.test.js +0 -55
- package/dist/Icon/Icon.test.js.map +0 -1
- package/dist/Icon/Icon.types.js +0 -16
- package/dist/Icon/Icon.types.js.map +0 -1
- package/dist/Icon/index.js +0 -2
- package/dist/Icon/index.js.map +0 -1
- package/dist/Select/Select.js +0 -168
- package/dist/Select/Select.js.map +0 -1
- package/dist/Select/Select.stories.js +0 -72
- package/dist/Select/Select.stories.js.map +0 -1
- package/dist/Select/Select.test.js +0 -161
- package/dist/Select/Select.test.js.map +0 -1
- package/dist/Select/Select.types.js +0 -2
- package/dist/Select/Select.types.js.map +0 -1
- package/dist/Select/index.js +0 -2
- package/dist/Select/index.js.map +0 -1
- package/dist/TextArea/TextArea.js +0 -23
- package/dist/TextArea/TextArea.js.map +0 -1
- package/dist/TextArea/TextArea.stories.js +0 -39
- package/dist/TextArea/TextArea.stories.js.map +0 -1
- package/dist/TextArea/TextArea.test.js +0 -68
- package/dist/TextArea/TextArea.test.js.map +0 -1
- package/dist/TextArea/TextArea.types.js +0 -2
- package/dist/TextArea/TextArea.types.js.map +0 -1
- package/dist/TextArea/index.js +0 -2
- package/dist/TextArea/index.js.map +0 -1
- package/dist/TextField/TextField.js +0 -64
- package/dist/TextField/TextField.js.map +0 -1
- package/dist/TextField/TextField.stories.js +0 -41
- package/dist/TextField/TextField.stories.js.map +0 -1
- package/dist/TextField/TextField.test.js +0 -35
- package/dist/TextField/TextField.test.js.map +0 -1
- package/dist/TextField/TextField.types.js +0 -2
- package/dist/TextField/TextField.types.js.map +0 -1
- package/dist/TextField/index.js +0 -2
- package/dist/TextField/index.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.js +0 -74
- package/dist/ToolbarButton/ToolbarButton.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js +0 -79
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.test.js +0 -93
- package/dist/ToolbarButton/ToolbarButton.test.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.types.js +0 -2
- package/dist/ToolbarButton/ToolbarButton.types.js.map +0 -1
- package/dist/ToolbarButton/index.js +0 -2
- package/dist/ToolbarButton/index.js.map +0 -1
- package/dist/Tooltip/QTip.stories.js +0 -40
- package/dist/Tooltip/QTip.stories.js.map +0 -1
- package/dist/Tooltip/QTip.types.js +0 -2
- package/dist/Tooltip/QTip.types.js.map +0 -1
- package/dist/Tooltip/QTipPerformance.stories.js +0 -30
- package/dist/Tooltip/QTipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/Qtip.js +0 -148
- package/dist/Tooltip/Qtip.js.map +0 -1
- package/dist/Tooltip/Tooltip.js +0 -36
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/Tooltip.stories.js +0 -32
- package/dist/Tooltip/Tooltip.stories.js.map +0 -1
- package/dist/Tooltip/Tooltip.types.js +0 -3
- package/dist/Tooltip/Tooltip.types.js.map +0 -1
- package/dist/Tooltip/TooltipPerformance.stories.js +0 -30
- package/dist/Tooltip/TooltipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/index.js +0 -3
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/browserId.js +0 -29
- package/dist/utils/browserId.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import react from '@vitejs/plugin-react';
|
|
3
|
-
|
|
4
|
-
// https://vitejs.dev/config/
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
plugins: [react()],
|
|
7
|
-
css: {
|
|
8
|
-
postcss: {
|
|
9
|
-
plugins: [],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
});
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
|
|
4
|
+
// https://vitejs.dev/config/
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [react()],
|
|
7
|
+
css: {
|
|
8
|
+
postcss: {
|
|
9
|
+
plugins: [],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import TextArea from './TextArea';
|
|
|
6
6
|
import { QTip, Tooltip } from './Tooltip';
|
|
7
7
|
import Icon from './Icon';
|
|
8
8
|
import Select from './Select';
|
|
9
|
+
import Tabs from './Tabs';
|
|
10
|
+
export { Tabs };
|
|
9
11
|
export { Button };
|
|
10
12
|
export { ToolbarButton };
|
|
11
13
|
export { TextField };
|
package/dist/index.esm.js
CHANGED
|
@@ -78,7 +78,7 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
78
78
|
const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
|
|
79
79
|
const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
|
|
80
80
|
const style = type === 'color' && color ? { color } : {};
|
|
81
|
-
const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
81
|
+
const appliedClassNames = `${iconPrefixString} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
82
82
|
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
|
|
83
83
|
const tooltipData = tooltip
|
|
84
84
|
? {
|
|
@@ -4653,13 +4653,13 @@ const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP
|
|
|
4653
4653
|
const arrowBaseClasses = 'before:tw-content-[\'\'] before:tw-absolute before:tw-border-8';
|
|
4654
4654
|
const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';
|
|
4655
4655
|
const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';
|
|
4656
|
-
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
|
|
4656
|
+
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
|
|
4657
4657
|
before:tw-border-l-transparent before:tw-border-r-black`;
|
|
4658
|
-
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
|
|
4658
|
+
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
|
|
4659
4659
|
before:tw-border-l-black before:tw-border-r-transparent`;
|
|
4660
|
-
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
|
|
4660
|
+
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
|
|
4661
4661
|
before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;
|
|
4662
|
-
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
|
|
4662
|
+
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
|
|
4663
4663
|
before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;
|
|
4664
4664
|
const placements = {
|
|
4665
4665
|
top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,
|
|
@@ -4669,7 +4669,7 @@ const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP
|
|
|
4669
4669
|
};
|
|
4670
4670
|
return (React__default.createElement("div", { className: "tw-group tw-relative tw-inline-block" },
|
|
4671
4671
|
children,
|
|
4672
|
-
React__default.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
|
|
4672
|
+
React__default.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
|
|
4673
4673
|
tw-absolute tw-opacity-0 group-hover:tw-opacity-100 tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white ${placements[position]}` }, text)));
|
|
4674
4674
|
};
|
|
4675
4675
|
|
|
@@ -13669,5 +13669,484 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
|
|
|
13669
13669
|
return creatable ? React__default.createElement(CreatableSelect$1, { ...props }) : React__default.createElement(StateManagedSelect$1, { ...props });
|
|
13670
13670
|
};
|
|
13671
13671
|
|
|
13672
|
-
|
|
13672
|
+
// We have resorted to returning slots directly rather than exposing primitives that can then
|
|
13673
|
+
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
|
|
13674
|
+
// This is because we encountered issues with generic types that cannot be statically analysed
|
|
13675
|
+
// due to creating them dynamically via createCollection.
|
|
13676
|
+
function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
13677
|
+
/* -----------------------------------------------------------------------------------------------
|
|
13678
|
+
* CollectionProvider
|
|
13679
|
+
* ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
|
|
13680
|
+
const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
|
|
13681
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
13682
|
+
collectionRef: {
|
|
13683
|
+
current: null
|
|
13684
|
+
},
|
|
13685
|
+
itemMap: new Map()
|
|
13686
|
+
});
|
|
13687
|
+
const CollectionProvider = (props)=>{
|
|
13688
|
+
const { scope: scope , children: children } = props;
|
|
13689
|
+
const ref = React__default.useRef(null);
|
|
13690
|
+
const itemMap = React__default.useRef(new Map()).current;
|
|
13691
|
+
return /*#__PURE__*/ React__default.createElement(CollectionProviderImpl, {
|
|
13692
|
+
scope: scope,
|
|
13693
|
+
itemMap: itemMap,
|
|
13694
|
+
collectionRef: ref
|
|
13695
|
+
}, children);
|
|
13696
|
+
};
|
|
13697
|
+
/* -----------------------------------------------------------------------------------------------
|
|
13698
|
+
* CollectionSlot
|
|
13699
|
+
* ---------------------------------------------------------------------------------------------*/ const COLLECTION_SLOT_NAME = name + 'CollectionSlot';
|
|
13700
|
+
const CollectionSlot = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
|
|
13701
|
+
const { scope: scope , children: children } = props;
|
|
13702
|
+
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
13703
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
13704
|
+
return /*#__PURE__*/ React__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
13705
|
+
ref: composedRefs
|
|
13706
|
+
}, children);
|
|
13707
|
+
});
|
|
13708
|
+
/* -----------------------------------------------------------------------------------------------
|
|
13709
|
+
* CollectionItem
|
|
13710
|
+
* ---------------------------------------------------------------------------------------------*/ const ITEM_SLOT_NAME = name + 'CollectionItemSlot';
|
|
13711
|
+
const ITEM_DATA_ATTR = 'data-radix-collection-item';
|
|
13712
|
+
const CollectionItemSlot = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
|
|
13713
|
+
const { scope: scope , children: children , ...itemData } = props;
|
|
13714
|
+
const ref = React__default.useRef(null);
|
|
13715
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
13716
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
13717
|
+
React__default.useEffect(()=>{
|
|
13718
|
+
context.itemMap.set(ref, {
|
|
13719
|
+
ref: ref,
|
|
13720
|
+
...itemData
|
|
13721
|
+
});
|
|
13722
|
+
return ()=>void context.itemMap.delete(ref)
|
|
13723
|
+
;
|
|
13724
|
+
});
|
|
13725
|
+
return /*#__PURE__*/ React__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
13726
|
+
[ITEM_DATA_ATTR]: '',
|
|
13727
|
+
ref: composedRefs
|
|
13728
|
+
}, children);
|
|
13729
|
+
});
|
|
13730
|
+
/* -----------------------------------------------------------------------------------------------
|
|
13731
|
+
* useCollection
|
|
13732
|
+
* ---------------------------------------------------------------------------------------------*/ function useCollection(scope) {
|
|
13733
|
+
const context = useCollectionContext(name + 'CollectionConsumer', scope);
|
|
13734
|
+
const getItems = React__default.useCallback(()=>{
|
|
13735
|
+
const collectionNode = context.collectionRef.current;
|
|
13736
|
+
if (!collectionNode) return [];
|
|
13737
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
13738
|
+
const items = Array.from(context.itemMap.values());
|
|
13739
|
+
const orderedItems = items.sort((a, b)=>orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
13740
|
+
);
|
|
13741
|
+
return orderedItems;
|
|
13742
|
+
}, [
|
|
13743
|
+
context.collectionRef,
|
|
13744
|
+
context.itemMap
|
|
13745
|
+
]);
|
|
13746
|
+
return getItems;
|
|
13747
|
+
}
|
|
13748
|
+
return [
|
|
13749
|
+
{
|
|
13750
|
+
Provider: CollectionProvider,
|
|
13751
|
+
Slot: CollectionSlot,
|
|
13752
|
+
ItemSlot: CollectionItemSlot
|
|
13753
|
+
},
|
|
13754
|
+
useCollection,
|
|
13755
|
+
createCollectionScope
|
|
13756
|
+
];
|
|
13757
|
+
}
|
|
13758
|
+
|
|
13759
|
+
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ createContext(undefined);
|
|
13760
|
+
/* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
13761
|
+
const globalDir = useContext($f631663db3294ace$var$DirectionContext);
|
|
13762
|
+
return localDir || globalDir || 'ltr';
|
|
13763
|
+
}
|
|
13764
|
+
|
|
13765
|
+
const $d7bdfb9eb0fdf311$var$ENTRY_FOCUS = 'rovingFocusGroup.onEntryFocus';
|
|
13766
|
+
const $d7bdfb9eb0fdf311$var$EVENT_OPTIONS = {
|
|
13767
|
+
bubbles: false,
|
|
13768
|
+
cancelable: true
|
|
13769
|
+
};
|
|
13770
|
+
/* -------------------------------------------------------------------------------------------------
|
|
13771
|
+
* RovingFocusGroup
|
|
13772
|
+
* -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$GROUP_NAME = 'RovingFocusGroup';
|
|
13773
|
+
const [$d7bdfb9eb0fdf311$var$Collection, $d7bdfb9eb0fdf311$var$useCollection, $d7bdfb9eb0fdf311$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($d7bdfb9eb0fdf311$var$GROUP_NAME);
|
|
13774
|
+
const [$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext, $d7bdfb9eb0fdf311$export$c7109489551a4f4] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($d7bdfb9eb0fdf311$var$GROUP_NAME, [
|
|
13775
|
+
$d7bdfb9eb0fdf311$var$createCollectionScope
|
|
13776
|
+
]);
|
|
13777
|
+
const [$d7bdfb9eb0fdf311$var$RovingFocusProvider, $d7bdfb9eb0fdf311$var$useRovingFocusContext] = $d7bdfb9eb0fdf311$var$createRovingFocusGroupContext($d7bdfb9eb0fdf311$var$GROUP_NAME);
|
|
13778
|
+
const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
13779
|
+
return /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$var$Collection.Provider, {
|
|
13780
|
+
scope: props.__scopeRovingFocusGroup
|
|
13781
|
+
}, /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
|
|
13782
|
+
scope: props.__scopeRovingFocusGroup
|
|
13783
|
+
}, /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
|
|
13784
|
+
ref: forwardedRef
|
|
13785
|
+
}))));
|
|
13786
|
+
});
|
|
13787
|
+
/* -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
13788
|
+
const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , orientation: orientation , loop: loop = false , dir: dir , currentTabStopId: currentTabStopIdProp , defaultCurrentTabStopId: defaultCurrentTabStopId , onCurrentTabStopIdChange: onCurrentTabStopIdChange , onEntryFocus: onEntryFocus , ...groupProps } = props;
|
|
13789
|
+
const ref = useRef(null);
|
|
13790
|
+
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
13791
|
+
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
13792
|
+
const [currentTabStopId = null, setCurrentTabStopId] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
13793
|
+
prop: currentTabStopIdProp,
|
|
13794
|
+
defaultProp: defaultCurrentTabStopId,
|
|
13795
|
+
onChange: onCurrentTabStopIdChange
|
|
13796
|
+
});
|
|
13797
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = useState(false);
|
|
13798
|
+
const handleEntryFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEntryFocus);
|
|
13799
|
+
const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
|
|
13800
|
+
const isClickFocusRef = useRef(false);
|
|
13801
|
+
const [focusableItemsCount, setFocusableItemsCount] = useState(0);
|
|
13802
|
+
useEffect(()=>{
|
|
13803
|
+
const node = ref.current;
|
|
13804
|
+
if (node) {
|
|
13805
|
+
node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);
|
|
13806
|
+
return ()=>node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus)
|
|
13807
|
+
;
|
|
13808
|
+
}
|
|
13809
|
+
}, [
|
|
13810
|
+
handleEntryFocus
|
|
13811
|
+
]);
|
|
13812
|
+
return /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider, {
|
|
13813
|
+
scope: __scopeRovingFocusGroup,
|
|
13814
|
+
orientation: orientation,
|
|
13815
|
+
dir: direction,
|
|
13816
|
+
loop: loop,
|
|
13817
|
+
currentTabStopId: currentTabStopId,
|
|
13818
|
+
onItemFocus: useCallback((tabStopId)=>setCurrentTabStopId(tabStopId)
|
|
13819
|
+
, [
|
|
13820
|
+
setCurrentTabStopId
|
|
13821
|
+
]),
|
|
13822
|
+
onItemShiftTab: useCallback(()=>setIsTabbingBackOut(true)
|
|
13823
|
+
, []),
|
|
13824
|
+
onFocusableItemAdd: useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount + 1
|
|
13825
|
+
)
|
|
13826
|
+
, []),
|
|
13827
|
+
onFocusableItemRemove: useCallback(()=>setFocusableItemsCount((prevCount)=>prevCount - 1
|
|
13828
|
+
)
|
|
13829
|
+
, [])
|
|
13830
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
13831
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
13832
|
+
"data-orientation": orientation
|
|
13833
|
+
}, groupProps, {
|
|
13834
|
+
ref: composedRefs,
|
|
13835
|
+
style: {
|
|
13836
|
+
outline: 'none',
|
|
13837
|
+
...props.style
|
|
13838
|
+
},
|
|
13839
|
+
onMouseDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, ()=>{
|
|
13840
|
+
isClickFocusRef.current = true;
|
|
13841
|
+
}),
|
|
13842
|
+
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, (event)=>{
|
|
13843
|
+
// We normally wouldn't need this check, because we already check
|
|
13844
|
+
// that the focus is on the current target and not bubbling to it.
|
|
13845
|
+
// We do this because Safari doesn't focus buttons when clicked, and
|
|
13846
|
+
// instead, the wrapper will get focused and not through a bubbling event.
|
|
13847
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
13848
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
13849
|
+
const entryFocusEvent = new CustomEvent($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, $d7bdfb9eb0fdf311$var$EVENT_OPTIONS);
|
|
13850
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
13851
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
13852
|
+
const items = getItems().filter((item)=>item.focusable
|
|
13853
|
+
);
|
|
13854
|
+
const activeItem = items.find((item)=>item.active
|
|
13855
|
+
);
|
|
13856
|
+
const currentItem = items.find((item)=>item.id === currentTabStopId
|
|
13857
|
+
);
|
|
13858
|
+
const candidateItems = [
|
|
13859
|
+
activeItem,
|
|
13860
|
+
currentItem,
|
|
13861
|
+
...items
|
|
13862
|
+
].filter(Boolean);
|
|
13863
|
+
const candidateNodes = candidateItems.map((item)=>item.ref.current
|
|
13864
|
+
);
|
|
13865
|
+
$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes);
|
|
13866
|
+
}
|
|
13867
|
+
}
|
|
13868
|
+
isClickFocusRef.current = false;
|
|
13869
|
+
}),
|
|
13870
|
+
onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, ()=>setIsTabbingBackOut(false)
|
|
13871
|
+
)
|
|
13872
|
+
})));
|
|
13873
|
+
});
|
|
13874
|
+
/* -------------------------------------------------------------------------------------------------
|
|
13875
|
+
* RovingFocusGroupItem
|
|
13876
|
+
* -----------------------------------------------------------------------------------------------*/ const $d7bdfb9eb0fdf311$var$ITEM_NAME = 'RovingFocusGroupItem';
|
|
13877
|
+
const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
13878
|
+
const { __scopeRovingFocusGroup: __scopeRovingFocusGroup , focusable: focusable = true , active: active = false , tabStopId: tabStopId , ...itemProps } = props;
|
|
13879
|
+
const autoId = $1746a345f3d73bb7$export$f680877a34711e37();
|
|
13880
|
+
const id = tabStopId || autoId;
|
|
13881
|
+
const context = $d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME, __scopeRovingFocusGroup);
|
|
13882
|
+
const isCurrentTabStop = context.currentTabStopId === id;
|
|
13883
|
+
const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
|
|
13884
|
+
const { onFocusableItemAdd: onFocusableItemAdd , onFocusableItemRemove: onFocusableItemRemove } = context;
|
|
13885
|
+
useEffect(()=>{
|
|
13886
|
+
if (focusable) {
|
|
13887
|
+
onFocusableItemAdd();
|
|
13888
|
+
return ()=>onFocusableItemRemove()
|
|
13889
|
+
;
|
|
13890
|
+
}
|
|
13891
|
+
}, [
|
|
13892
|
+
focusable,
|
|
13893
|
+
onFocusableItemAdd,
|
|
13894
|
+
onFocusableItemRemove
|
|
13895
|
+
]);
|
|
13896
|
+
return /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot, {
|
|
13897
|
+
scope: __scopeRovingFocusGroup,
|
|
13898
|
+
id: id,
|
|
13899
|
+
focusable: focusable,
|
|
13900
|
+
active: active
|
|
13901
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({
|
|
13902
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
13903
|
+
"data-orientation": context.orientation
|
|
13904
|
+
}, itemProps, {
|
|
13905
|
+
ref: forwardedRef,
|
|
13906
|
+
onMouseDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, (event)=>{
|
|
13907
|
+
// We prevent focusing non-focusable items on `mousedown`.
|
|
13908
|
+
// Even though the item has tabIndex={-1}, that only means take it out of the tab order.
|
|
13909
|
+
if (!focusable) event.preventDefault(); // Safari doesn't focus a button when clicked so we run our logic on mousedown also
|
|
13910
|
+
else context.onItemFocus(id);
|
|
13911
|
+
}),
|
|
13912
|
+
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, ()=>context.onItemFocus(id)
|
|
13913
|
+
),
|
|
13914
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
|
|
13915
|
+
if (event.key === 'Tab' && event.shiftKey) {
|
|
13916
|
+
context.onItemShiftTab();
|
|
13917
|
+
return;
|
|
13918
|
+
}
|
|
13919
|
+
if (event.target !== event.currentTarget) return;
|
|
13920
|
+
const focusIntent = $d7bdfb9eb0fdf311$var$getFocusIntent(event, context.orientation, context.dir);
|
|
13921
|
+
if (focusIntent !== undefined) {
|
|
13922
|
+
event.preventDefault();
|
|
13923
|
+
const items = getItems().filter((item)=>item.focusable
|
|
13924
|
+
);
|
|
13925
|
+
let candidateNodes = items.map((item)=>item.ref.current
|
|
13926
|
+
);
|
|
13927
|
+
if (focusIntent === 'last') candidateNodes.reverse();
|
|
13928
|
+
else if (focusIntent === 'prev' || focusIntent === 'next') {
|
|
13929
|
+
if (focusIntent === 'prev') candidateNodes.reverse();
|
|
13930
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
13931
|
+
candidateNodes = context.loop ? $d7bdfb9eb0fdf311$var$wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
13932
|
+
}
|
|
13933
|
+
/**
|
|
13934
|
+
* Imperative focus during keydown is risky so we prevent React's batching updates
|
|
13935
|
+
* to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
|
|
13936
|
+
*/ setTimeout(()=>$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes)
|
|
13937
|
+
);
|
|
13938
|
+
}
|
|
13939
|
+
})
|
|
13940
|
+
})));
|
|
13941
|
+
});
|
|
13942
|
+
/* -----------------------------------------------------------------------------------------------*/ // prettier-ignore
|
|
13943
|
+
const $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT = {
|
|
13944
|
+
ArrowLeft: 'prev',
|
|
13945
|
+
ArrowUp: 'prev',
|
|
13946
|
+
ArrowRight: 'next',
|
|
13947
|
+
ArrowDown: 'next',
|
|
13948
|
+
PageUp: 'first',
|
|
13949
|
+
Home: 'first',
|
|
13950
|
+
PageDown: 'last',
|
|
13951
|
+
End: 'last'
|
|
13952
|
+
};
|
|
13953
|
+
function $d7bdfb9eb0fdf311$var$getDirectionAwareKey(key, dir) {
|
|
13954
|
+
if (dir !== 'rtl') return key;
|
|
13955
|
+
return key === 'ArrowLeft' ? 'ArrowRight' : key === 'ArrowRight' ? 'ArrowLeft' : key;
|
|
13956
|
+
}
|
|
13957
|
+
function $d7bdfb9eb0fdf311$var$getFocusIntent(event, orientation, dir) {
|
|
13958
|
+
const key = $d7bdfb9eb0fdf311$var$getDirectionAwareKey(event.key, dir);
|
|
13959
|
+
if (orientation === 'vertical' && [
|
|
13960
|
+
'ArrowLeft',
|
|
13961
|
+
'ArrowRight'
|
|
13962
|
+
].includes(key)) return undefined;
|
|
13963
|
+
if (orientation === 'horizontal' && [
|
|
13964
|
+
'ArrowUp',
|
|
13965
|
+
'ArrowDown'
|
|
13966
|
+
].includes(key)) return undefined;
|
|
13967
|
+
return $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT[key];
|
|
13968
|
+
}
|
|
13969
|
+
function $d7bdfb9eb0fdf311$var$focusFirst(candidates) {
|
|
13970
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
13971
|
+
for (const candidate of candidates){
|
|
13972
|
+
// if focus is already where we want to go, we don't want to keep going through the candidates
|
|
13973
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
13974
|
+
candidate.focus();
|
|
13975
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
13976
|
+
}
|
|
13977
|
+
}
|
|
13978
|
+
/**
|
|
13979
|
+
* Wraps an array around itself at a given start index
|
|
13980
|
+
* Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`
|
|
13981
|
+
*/ function $d7bdfb9eb0fdf311$var$wrapArray(array, startIndex) {
|
|
13982
|
+
return array.map((_, index)=>array[(startIndex + index) % array.length]
|
|
13983
|
+
);
|
|
13984
|
+
}
|
|
13985
|
+
const $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 = $d7bdfb9eb0fdf311$export$8699f7c8af148338;
|
|
13986
|
+
const $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 = $d7bdfb9eb0fdf311$export$ab9df7c53fe8454;
|
|
13987
|
+
|
|
13988
|
+
/* -------------------------------------------------------------------------------------------------
|
|
13989
|
+
* Tabs
|
|
13990
|
+
* -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TABS_NAME = 'Tabs';
|
|
13991
|
+
const [$69cb30bb0017df05$var$createTabsContext, $69cb30bb0017df05$export$355f5bd209d7b13a] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($69cb30bb0017df05$var$TABS_NAME, [
|
|
13992
|
+
$d7bdfb9eb0fdf311$export$c7109489551a4f4
|
|
13993
|
+
]);
|
|
13994
|
+
const $69cb30bb0017df05$var$useRovingFocusGroupScope = $d7bdfb9eb0fdf311$export$c7109489551a4f4();
|
|
13995
|
+
const [$69cb30bb0017df05$var$TabsProvider, $69cb30bb0017df05$var$useTabsContext] = $69cb30bb0017df05$var$createTabsContext($69cb30bb0017df05$var$TABS_NAME);
|
|
13996
|
+
const $69cb30bb0017df05$export$b2539bed5023c21c = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
13997
|
+
const { __scopeTabs: __scopeTabs , value: valueProp , onValueChange: onValueChange , defaultValue: defaultValue , orientation: orientation = 'horizontal' , dir: dir , activationMode: activationMode = 'automatic' , ...tabsProps } = props;
|
|
13998
|
+
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
13999
|
+
const [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
14000
|
+
prop: valueProp,
|
|
14001
|
+
onChange: onValueChange,
|
|
14002
|
+
defaultProp: defaultValue
|
|
14003
|
+
});
|
|
14004
|
+
return /*#__PURE__*/ createElement($69cb30bb0017df05$var$TabsProvider, {
|
|
14005
|
+
scope: __scopeTabs,
|
|
14006
|
+
baseId: $1746a345f3d73bb7$export$f680877a34711e37(),
|
|
14007
|
+
value: value,
|
|
14008
|
+
onValueChange: setValue,
|
|
14009
|
+
orientation: orientation,
|
|
14010
|
+
dir: direction,
|
|
14011
|
+
activationMode: activationMode
|
|
14012
|
+
}, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
14013
|
+
dir: direction,
|
|
14014
|
+
"data-orientation": orientation
|
|
14015
|
+
}, tabsProps, {
|
|
14016
|
+
ref: forwardedRef
|
|
14017
|
+
})));
|
|
14018
|
+
});
|
|
14019
|
+
/* -------------------------------------------------------------------------------------------------
|
|
14020
|
+
* TabsList
|
|
14021
|
+
* -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TAB_LIST_NAME = 'TabsList';
|
|
14022
|
+
const $69cb30bb0017df05$export$9712d22edc0d78c1 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
14023
|
+
const { __scopeTabs: __scopeTabs , loop: loop = true , ...listProps } = props;
|
|
14024
|
+
const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
|
|
14025
|
+
const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
|
|
14026
|
+
return /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
|
|
14027
|
+
asChild: true
|
|
14028
|
+
}, rovingFocusGroupScope, {
|
|
14029
|
+
orientation: context.orientation,
|
|
14030
|
+
dir: context.dir,
|
|
14031
|
+
loop: loop
|
|
14032
|
+
}), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
14033
|
+
role: "tablist",
|
|
14034
|
+
"aria-orientation": context.orientation
|
|
14035
|
+
}, listProps, {
|
|
14036
|
+
ref: forwardedRef
|
|
14037
|
+
})));
|
|
14038
|
+
});
|
|
14039
|
+
/* -------------------------------------------------------------------------------------------------
|
|
14040
|
+
* TabsTrigger
|
|
14041
|
+
* -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$TRIGGER_NAME = 'TabsTrigger';
|
|
14042
|
+
const $69cb30bb0017df05$export$8114b9fdfdf9f3ba = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
14043
|
+
const { __scopeTabs: __scopeTabs , value: value , disabled: disabled = false , ...triggerProps } = props;
|
|
14044
|
+
const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TRIGGER_NAME, __scopeTabs);
|
|
14045
|
+
const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
|
|
14046
|
+
const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
|
|
14047
|
+
const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
|
|
14048
|
+
const isSelected = value === context.value;
|
|
14049
|
+
return /*#__PURE__*/ createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
|
|
14050
|
+
asChild: true
|
|
14051
|
+
}, rovingFocusGroupScope, {
|
|
14052
|
+
focusable: !disabled,
|
|
14053
|
+
active: isSelected
|
|
14054
|
+
}), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
|
|
14055
|
+
type: "button",
|
|
14056
|
+
role: "tab",
|
|
14057
|
+
"aria-selected": isSelected,
|
|
14058
|
+
"aria-controls": contentId,
|
|
14059
|
+
"data-state": isSelected ? 'active' : 'inactive',
|
|
14060
|
+
"data-disabled": disabled ? '' : undefined,
|
|
14061
|
+
disabled: disabled,
|
|
14062
|
+
id: triggerId
|
|
14063
|
+
}, triggerProps, {
|
|
14064
|
+
ref: forwardedRef,
|
|
14065
|
+
onMouseDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, (event)=>{
|
|
14066
|
+
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
|
|
14067
|
+
// but not when the control key is pressed (avoiding MacOS right click)
|
|
14068
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) context.onValueChange(value);
|
|
14069
|
+
else // prevent focus to avoid accidental activation
|
|
14070
|
+
event.preventDefault();
|
|
14071
|
+
}),
|
|
14072
|
+
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
|
|
14073
|
+
if ([
|
|
14074
|
+
' ',
|
|
14075
|
+
'Enter'
|
|
14076
|
+
].includes(event.key)) context.onValueChange(value);
|
|
14077
|
+
}),
|
|
14078
|
+
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, ()=>{
|
|
14079
|
+
// handle "automatic" activation if necessary
|
|
14080
|
+
// ie. activate tab following focus
|
|
14081
|
+
const isAutomaticActivation = context.activationMode !== 'manual';
|
|
14082
|
+
if (!isSelected && !disabled && isAutomaticActivation) context.onValueChange(value);
|
|
14083
|
+
})
|
|
14084
|
+
})));
|
|
14085
|
+
});
|
|
14086
|
+
/* -------------------------------------------------------------------------------------------------
|
|
14087
|
+
* TabsContent
|
|
14088
|
+
* -----------------------------------------------------------------------------------------------*/ const $69cb30bb0017df05$var$CONTENT_NAME = 'TabsContent';
|
|
14089
|
+
const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
14090
|
+
const { __scopeTabs: __scopeTabs , value: value , forceMount: forceMount , children: children , ...contentProps } = props;
|
|
14091
|
+
const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$CONTENT_NAME, __scopeTabs);
|
|
14092
|
+
const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
|
|
14093
|
+
const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
|
|
14094
|
+
const isSelected = value === context.value;
|
|
14095
|
+
const isMountAnimationPreventedRef = useRef(isSelected);
|
|
14096
|
+
useEffect(()=>{
|
|
14097
|
+
const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
|
|
14098
|
+
);
|
|
14099
|
+
return ()=>cancelAnimationFrame(rAF)
|
|
14100
|
+
;
|
|
14101
|
+
}, []);
|
|
14102
|
+
return /*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
|
|
14103
|
+
present: forceMount || isSelected
|
|
14104
|
+
}, ({ present: present })=>/*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
|
|
14105
|
+
"data-state": isSelected ? 'active' : 'inactive',
|
|
14106
|
+
"data-orientation": context.orientation,
|
|
14107
|
+
role: "tabpanel",
|
|
14108
|
+
"aria-labelledby": triggerId,
|
|
14109
|
+
hidden: !present,
|
|
14110
|
+
id: contentId,
|
|
14111
|
+
tabIndex: 0
|
|
14112
|
+
}, contentProps, {
|
|
14113
|
+
ref: forwardedRef,
|
|
14114
|
+
style: {
|
|
14115
|
+
...props.style,
|
|
14116
|
+
animationDuration: isMountAnimationPreventedRef.current ? '0s' : undefined
|
|
14117
|
+
}
|
|
14118
|
+
}), present && children)
|
|
14119
|
+
);
|
|
14120
|
+
});
|
|
14121
|
+
/* ---------------------------------------------------------------------------------------------- */ function $69cb30bb0017df05$var$makeTriggerId(baseId, value) {
|
|
14122
|
+
return `${baseId}-trigger-${value}`;
|
|
14123
|
+
}
|
|
14124
|
+
function $69cb30bb0017df05$var$makeContentId(baseId, value) {
|
|
14125
|
+
return `${baseId}-content-${value}`;
|
|
14126
|
+
}
|
|
14127
|
+
const $69cb30bb0017df05$export$be92b6f5f03c0fe9 = $69cb30bb0017df05$export$b2539bed5023c21c;
|
|
14128
|
+
const $69cb30bb0017df05$export$54c2e3dc7acea9f5 = $69cb30bb0017df05$export$9712d22edc0d78c1;
|
|
14129
|
+
const $69cb30bb0017df05$export$41fb9f06171c75f4 = $69cb30bb0017df05$export$8114b9fdfdf9f3ba;
|
|
14130
|
+
const $69cb30bb0017df05$export$7c6e2c02157bb7d2 = $69cb30bb0017df05$export$bd905d70e8fd2ebb;
|
|
14131
|
+
|
|
14132
|
+
const Tabs = ({ tabs, defaultActiveTab, activeTab, onTabSelect, extraClassNames, testId, id, }) => {
|
|
14133
|
+
const handleTabSelect = (tabId) => {
|
|
14134
|
+
if (activeTab === tabId)
|
|
14135
|
+
return;
|
|
14136
|
+
onTabSelect && onTabSelect(tabId);
|
|
14137
|
+
};
|
|
14138
|
+
return (React__default.createElement($69cb30bb0017df05$export$be92b6f5f03c0fe9, { className: `tw-flex tw-flex-col tw-min-w-[300px] ${extraClassNames || ''}`, defaultValue: defaultActiveTab, "data-testid": testId, id: id, value: activeTab, onValueChange: handleTabSelect },
|
|
14139
|
+
React__default.createElement($69cb30bb0017df05$export$54c2e3dc7acea9f5, { className: `tw-bg-sq-light-gray dark:tw-bg-gray-700 tw-flex tw-flex-row tw-gap-[2px]` }, tabs.map(({ id, icon, label, tabExtraClassNames, testId: tabsTestId, disabled }, index) => (React__default.createElement($69cb30bb0017df05$export$41fb9f06171c75f4, { className: `tw-bg-sq-white dark:tw-bg-sq-dark-background tw-h-[45px] tw-border-solid dark:tw-border-gray-700 tw-flex tw-flex-1 tw-justify-center tw-items-center ${tabExtraClassNames || ''} ${activeTab === id
|
|
14140
|
+
? 'tw-border-b-sq-color-dark dark:tw-border-b-sq-color-dark tw-border-b-[3px]'
|
|
14141
|
+
: 'hover:tw-bg-sq-light-gray tw-border-b-[1px] hover:dark:tw-bg-gray-700'}`, "data-testid": tabsTestId, disabled: disabled, key: `${label}-${id}-${index}`, value: id },
|
|
14142
|
+
React__default.createElement("span", null,
|
|
14143
|
+
icon && React__default.createElement(Icon, { icon: icon, testId: `${id}_tab-icon`, extraClassNames: "tw-text-[15px] tw-mr-[7px]" }),
|
|
14144
|
+
React__default.createElement("span", { className: `tw-text-[14px] tw-font-medium ${activeTab === id
|
|
14145
|
+
? 'dark:tw-text-sq-dark-text tw-text-gray-500'
|
|
14146
|
+
: 'dark:tw-text-sq-color-dark-dark tw-text-sq-color-dark'}` }, label)))))),
|
|
14147
|
+
tabs.map((tab, index) => (React__default.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2, { key: `${tab.label}_${index}_content`, value: tab.id },
|
|
14148
|
+
React__default.createElement("div", { className: "tw-bg-sq-white dark:tw-bg-sq-dark-background tw-p-4" }, tab.content))))));
|
|
14149
|
+
};
|
|
14150
|
+
|
|
14151
|
+
export { Button, Checkbox, Icon, QTip, Select, Tabs, TextArea, TextField, ToolbarButton, Tooltip };
|
|
13673
14152
|
//# sourceMappingURL=index.esm.js.map
|