@seeqdev/qomponents 0.0.54 → 0.0.55

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.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { AccordionProps } from './Accordion.types';
3
+ declare const Accordion: React.FunctionComponent<AccordionProps>;
4
+ export default Accordion;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ title: string;
3
+ };
4
+ export default _default;
5
+ export declare const AllAccordionVariants: () => JSX.Element;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ export interface AccordionProps {
3
+ extraClassNames?: string;
4
+ defaultValue?: string;
5
+ value: string;
6
+ disabled?: boolean;
7
+ accordionItems: AccordionItem[];
8
+ testId?: string;
9
+ onItemSelect: (key: string) => void;
10
+ }
11
+ interface AccordionItem {
12
+ value: string;
13
+ trigger: React.ReactNode;
14
+ content: React.ReactNode;
15
+ itemTestId?: string;
16
+ id?: string;
17
+ disabled?: boolean;
18
+ contentClassNames?: string;
19
+ }
20
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './Accordion';
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import Icon from './Icon';
8
8
  import Select from './Select';
9
9
  import Modal from './Modal';
10
10
  import Tabs from './Tabs';
11
+ import Accordion from './Accordion';
11
12
  export { Tabs };
12
13
  export { Button };
13
14
  export { ToolbarButton };
@@ -19,3 +20,4 @@ export { Icon };
19
20
  export { Select };
20
21
  export { QTip };
21
22
  export { Modal };
23
+ export { Accordion };
package/dist/index.esm.js CHANGED
@@ -14517,5 +14517,402 @@ const Tabs = ({ tabs, defaultActiveTab, activeTab, onTabSelect, extraClassNames,
14517
14517
  tabs.map((tab, index) => (React__default.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2, { className: `tw-bg-sq-white dark:tw-bg-sq-dark-background tw-overflow-y-auto -tw-mt-[1px] tw-border-t-[1px] tw-z-[500] tw-flex tw-flex-col tw-flex-grow ${tab.tabContentExtraClassNames || ''}`, key: `${tab.label}_${index}_content`, value: tab.id }, tab.content)))));
14518
14518
  };
14519
14519
 
14520
- export { Button, Checkbox, Icon, Modal, QTip, Select, Tabs, TextArea, TextField, ToolbarButton, Tooltip };
14520
+ /* -------------------------------------------------------------------------------------------------
14521
+ * Collapsible
14522
+ * -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$COLLAPSIBLE_NAME = 'Collapsible';
14523
+ const [$409067139f391064$var$createCollapsibleContext, $409067139f391064$export$952b32dcbe73087a] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($409067139f391064$var$COLLAPSIBLE_NAME);
14524
+ const [$409067139f391064$var$CollapsibleProvider, $409067139f391064$var$useCollapsibleContext] = $409067139f391064$var$createCollapsibleContext($409067139f391064$var$COLLAPSIBLE_NAME);
14525
+ const $409067139f391064$export$6eb0f7ddcda6131f = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
14526
+ const { __scopeCollapsible: __scopeCollapsible , open: openProp , defaultOpen: defaultOpen , disabled: disabled , onOpenChange: onOpenChange , ...collapsibleProps } = props;
14527
+ const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
14528
+ prop: openProp,
14529
+ defaultProp: defaultOpen,
14530
+ onChange: onOpenChange
14531
+ });
14532
+ return /*#__PURE__*/ createElement($409067139f391064$var$CollapsibleProvider, {
14533
+ scope: __scopeCollapsible,
14534
+ disabled: disabled,
14535
+ contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
14536
+ open: open,
14537
+ onOpenToggle: useCallback(()=>setOpen((prevOpen)=>!prevOpen
14538
+ )
14539
+ , [
14540
+ setOpen
14541
+ ])
14542
+ }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
14543
+ "data-state": $409067139f391064$var$getState(open),
14544
+ "data-disabled": disabled ? '' : undefined
14545
+ }, collapsibleProps, {
14546
+ ref: forwardedRef
14547
+ })));
14548
+ });
14549
+ /* -------------------------------------------------------------------------------------------------
14550
+ * CollapsibleTrigger
14551
+ * -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$TRIGGER_NAME = 'CollapsibleTrigger';
14552
+ const $409067139f391064$export$c135dce7b15bbbdc = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
14553
+ const { __scopeCollapsible: __scopeCollapsible , ...triggerProps } = props;
14554
+ const context = $409067139f391064$var$useCollapsibleContext($409067139f391064$var$TRIGGER_NAME, __scopeCollapsible);
14555
+ return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
14556
+ type: "button",
14557
+ "aria-controls": context.contentId,
14558
+ "aria-expanded": context.open || false,
14559
+ "data-state": $409067139f391064$var$getState(context.open),
14560
+ "data-disabled": context.disabled ? '' : undefined,
14561
+ disabled: context.disabled
14562
+ }, triggerProps, {
14563
+ ref: forwardedRef,
14564
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onOpenToggle)
14565
+ }));
14566
+ });
14567
+ /* -------------------------------------------------------------------------------------------------
14568
+ * CollapsibleContent
14569
+ * -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$CONTENT_NAME = 'CollapsibleContent';
14570
+ const $409067139f391064$export$aadde00976f34151 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
14571
+ const { forceMount: forceMount , ...contentProps } = props;
14572
+ const context = $409067139f391064$var$useCollapsibleContext($409067139f391064$var$CONTENT_NAME, props.__scopeCollapsible);
14573
+ return /*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
14574
+ present: forceMount || context.open
14575
+ }, ({ present: present })=>/*#__PURE__*/ createElement($409067139f391064$var$CollapsibleContentImpl, _extends({}, contentProps, {
14576
+ ref: forwardedRef,
14577
+ present: present
14578
+ }))
14579
+ );
14580
+ });
14581
+ /* -----------------------------------------------------------------------------------------------*/ const $409067139f391064$var$CollapsibleContentImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
14582
+ const { __scopeCollapsible: __scopeCollapsible , present: present , children: children , ...contentProps } = props;
14583
+ const context = $409067139f391064$var$useCollapsibleContext($409067139f391064$var$CONTENT_NAME, __scopeCollapsible);
14584
+ const [isPresent, setIsPresent] = useState(present);
14585
+ const ref = useRef(null);
14586
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
14587
+ const heightRef = useRef(0);
14588
+ const height = heightRef.current;
14589
+ const widthRef = useRef(0);
14590
+ const width = widthRef.current; // when opening we want it to immediately open to retrieve dimensions
14591
+ // when closing we delay `present` to retrieve dimensions before closing
14592
+ const isOpen = context.open || isPresent;
14593
+ const isMountAnimationPreventedRef = useRef(isOpen);
14594
+ const originalStylesRef = useRef();
14595
+ useEffect(()=>{
14596
+ const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
14597
+ );
14598
+ return ()=>cancelAnimationFrame(rAF)
14599
+ ;
14600
+ }, []);
14601
+ $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
14602
+ const node = ref.current;
14603
+ if (node) {
14604
+ originalStylesRef.current = originalStylesRef.current || {
14605
+ transitionDuration: node.style.transitionDuration,
14606
+ animationName: node.style.animationName
14607
+ }; // block any animations/transitions so the element renders at its full dimensions
14608
+ node.style.transitionDuration = '0s';
14609
+ node.style.animationName = 'none'; // get width and height from full dimensions
14610
+ const rect = node.getBoundingClientRect();
14611
+ heightRef.current = rect.height;
14612
+ widthRef.current = rect.width; // kick off any animations/transitions that were originally set up if it isn't the initial mount
14613
+ if (!isMountAnimationPreventedRef.current) {
14614
+ node.style.transitionDuration = originalStylesRef.current.transitionDuration;
14615
+ node.style.animationName = originalStylesRef.current.animationName;
14616
+ }
14617
+ setIsPresent(present);
14618
+ }
14619
+ /**
14620
+ * depends on `context.open` because it will change to `false`
14621
+ * when a close is triggered but `present` will be `false` on
14622
+ * animation end (so when close finishes). This allows us to
14623
+ * retrieve the dimensions *before* closing.
14624
+ */ }, [
14625
+ context.open,
14626
+ present
14627
+ ]);
14628
+ return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
14629
+ "data-state": $409067139f391064$var$getState(context.open),
14630
+ "data-disabled": context.disabled ? '' : undefined,
14631
+ id: context.contentId,
14632
+ hidden: !isOpen
14633
+ }, contentProps, {
14634
+ ref: composedRefs,
14635
+ style: {
14636
+ [`--radix-collapsible-content-height`]: height ? `${height}px` : undefined,
14637
+ [`--radix-collapsible-content-width`]: width ? `${width}px` : undefined,
14638
+ ...props.style
14639
+ }
14640
+ }), isOpen && children);
14641
+ });
14642
+ /* -----------------------------------------------------------------------------------------------*/ function $409067139f391064$var$getState(open) {
14643
+ return open ? 'open' : 'closed';
14644
+ }
14645
+ const $409067139f391064$export$be92b6f5f03c0fe9 = $409067139f391064$export$6eb0f7ddcda6131f;
14646
+ const $409067139f391064$export$41fb9f06171c75f4 = $409067139f391064$export$c135dce7b15bbbdc;
14647
+ const $409067139f391064$export$7c6e2c02157bb7d2 = $409067139f391064$export$aadde00976f34151;
14648
+
14649
+ /* -------------------------------------------------------------------------------------------------
14650
+ * Accordion
14651
+ * -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$ACCORDION_NAME = 'Accordion';
14652
+ const $1bf158f521e1b1b4$var$ACCORDION_KEYS = [
14653
+ 'Home',
14654
+ 'End',
14655
+ 'ArrowDown',
14656
+ 'ArrowUp',
14657
+ 'ArrowLeft',
14658
+ 'ArrowRight'
14659
+ ];
14660
+ const [$1bf158f521e1b1b4$var$Collection, $1bf158f521e1b1b4$var$useCollection, $1bf158f521e1b1b4$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($1bf158f521e1b1b4$var$ACCORDION_NAME);
14661
+ const [$1bf158f521e1b1b4$var$createAccordionContext, $1bf158f521e1b1b4$export$9748edc328a73be1] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($1bf158f521e1b1b4$var$ACCORDION_NAME, [
14662
+ $1bf158f521e1b1b4$var$createCollectionScope,
14663
+ $409067139f391064$export$952b32dcbe73087a
14664
+ ]);
14665
+ const $1bf158f521e1b1b4$var$useCollapsibleScope = $409067139f391064$export$952b32dcbe73087a();
14666
+ const $1bf158f521e1b1b4$export$a766cd26d0d69044 = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14667
+ const { type: type , ...accordionProps } = props;
14668
+ const singleProps = accordionProps;
14669
+ const multipleProps = accordionProps;
14670
+ return /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$Collection.Provider, {
14671
+ scope: props.__scopeAccordion
14672
+ }, type === 'multiple' ? /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionImplMultiple, _extends({}, multipleProps, {
14673
+ ref: forwardedRef
14674
+ })) : /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionImplSingle, _extends({}, singleProps, {
14675
+ ref: forwardedRef
14676
+ })));
14677
+ });
14678
+ $1bf158f521e1b1b4$export$a766cd26d0d69044.propTypes = {
14679
+ type (props) {
14680
+ const value = props.value || props.defaultValue;
14681
+ if (props.type && ![
14682
+ 'single',
14683
+ 'multiple'
14684
+ ].includes(props.type)) return new Error('Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`.');
14685
+ if (props.type === 'multiple' && typeof value === 'string') return new Error('Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`.');
14686
+ if (props.type === 'single' && Array.isArray(value)) return new Error('Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`.');
14687
+ return null;
14688
+ }
14689
+ };
14690
+ /* -----------------------------------------------------------------------------------------------*/ const [$1bf158f521e1b1b4$var$AccordionValueProvider, $1bf158f521e1b1b4$var$useAccordionValueContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME);
14691
+ const [$1bf158f521e1b1b4$var$AccordionCollapsibleProvider, $1bf158f521e1b1b4$var$useAccordionCollapsibleContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, {
14692
+ collapsible: false
14693
+ });
14694
+ const $1bf158f521e1b1b4$var$AccordionImplSingle = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14695
+ const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , collapsible: collapsible = false , ...accordionSingleProps } = props;
14696
+ const [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
14697
+ prop: valueProp,
14698
+ defaultProp: defaultValue,
14699
+ onChange: onValueChange
14700
+ });
14701
+ return /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionValueProvider, {
14702
+ scope: props.__scopeAccordion,
14703
+ value: value ? [
14704
+ value
14705
+ ] : [],
14706
+ onItemOpen: setValue,
14707
+ onItemClose: React__default.useCallback(()=>collapsible && setValue('')
14708
+ , [
14709
+ collapsible,
14710
+ setValue
14711
+ ])
14712
+ }, /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionCollapsibleProvider, {
14713
+ scope: props.__scopeAccordion,
14714
+ collapsible: collapsible
14715
+ }, /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionImpl, _extends({}, accordionSingleProps, {
14716
+ ref: forwardedRef
14717
+ }))));
14718
+ });
14719
+ /* -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$AccordionImplMultiple = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14720
+ const { value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange = ()=>{} , ...accordionMultipleProps } = props;
14721
+ const [value1 = [], setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
14722
+ prop: valueProp,
14723
+ defaultProp: defaultValue,
14724
+ onChange: onValueChange
14725
+ });
14726
+ const handleItemOpen = React__default.useCallback((itemValue)=>setValue((prevValue = [])=>[
14727
+ ...prevValue,
14728
+ itemValue
14729
+ ]
14730
+ )
14731
+ , [
14732
+ setValue
14733
+ ]);
14734
+ const handleItemClose = React__default.useCallback((itemValue)=>setValue((prevValue = [])=>prevValue.filter((value)=>value !== itemValue
14735
+ )
14736
+ )
14737
+ , [
14738
+ setValue
14739
+ ]);
14740
+ return /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionValueProvider, {
14741
+ scope: props.__scopeAccordion,
14742
+ value: value1,
14743
+ onItemOpen: handleItemOpen,
14744
+ onItemClose: handleItemClose
14745
+ }, /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionCollapsibleProvider, {
14746
+ scope: props.__scopeAccordion,
14747
+ collapsible: true
14748
+ }, /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionImpl, _extends({}, accordionMultipleProps, {
14749
+ ref: forwardedRef
14750
+ }))));
14751
+ });
14752
+ /* -----------------------------------------------------------------------------------------------*/ const [$1bf158f521e1b1b4$var$AccordionImplProvider, $1bf158f521e1b1b4$var$useAccordionContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME);
14753
+ const $1bf158f521e1b1b4$var$AccordionImpl = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14754
+ const { __scopeAccordion: __scopeAccordion , disabled: disabled , dir: dir , orientation: orientation = 'vertical' , ...accordionProps } = props;
14755
+ const accordionRef = React__default.useRef(null);
14756
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(accordionRef, forwardedRef);
14757
+ const getItems = $1bf158f521e1b1b4$var$useCollection(__scopeAccordion);
14758
+ const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
14759
+ const isDirectionLTR = direction === 'ltr';
14760
+ const handleKeyDown = $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
14761
+ var _triggerCollection$cl;
14762
+ if (!$1bf158f521e1b1b4$var$ACCORDION_KEYS.includes(event.key)) return;
14763
+ const target = event.target;
14764
+ const triggerCollection = getItems().filter((item)=>{
14765
+ var _item$ref$current;
14766
+ return !((_item$ref$current = item.ref.current) !== null && _item$ref$current !== void 0 && _item$ref$current.disabled);
14767
+ });
14768
+ const triggerIndex = triggerCollection.findIndex((item)=>item.ref.current === target
14769
+ );
14770
+ const triggerCount = triggerCollection.length;
14771
+ if (triggerIndex === -1) return; // Prevents page scroll while user is navigating
14772
+ event.preventDefault();
14773
+ let nextIndex = triggerIndex;
14774
+ const homeIndex = 0;
14775
+ const endIndex = triggerCount - 1;
14776
+ const moveNext = ()=>{
14777
+ nextIndex = triggerIndex + 1;
14778
+ if (nextIndex > endIndex) nextIndex = homeIndex;
14779
+ };
14780
+ const movePrev = ()=>{
14781
+ nextIndex = triggerIndex - 1;
14782
+ if (nextIndex < homeIndex) nextIndex = endIndex;
14783
+ };
14784
+ switch(event.key){
14785
+ case 'Home':
14786
+ nextIndex = homeIndex;
14787
+ break;
14788
+ case 'End':
14789
+ nextIndex = endIndex;
14790
+ break;
14791
+ case 'ArrowRight':
14792
+ if (orientation === 'horizontal') {
14793
+ if (isDirectionLTR) moveNext();
14794
+ else movePrev();
14795
+ }
14796
+ break;
14797
+ case 'ArrowDown':
14798
+ if (orientation === 'vertical') moveNext();
14799
+ break;
14800
+ case 'ArrowLeft':
14801
+ if (orientation === 'horizontal') {
14802
+ if (isDirectionLTR) movePrev();
14803
+ else moveNext();
14804
+ }
14805
+ break;
14806
+ case 'ArrowUp':
14807
+ if (orientation === 'vertical') movePrev();
14808
+ break;
14809
+ }
14810
+ const clampedIndex = nextIndex % triggerCount;
14811
+ (_triggerCollection$cl = triggerCollection[clampedIndex].ref.current) === null || _triggerCollection$cl === void 0 || _triggerCollection$cl.focus();
14812
+ });
14813
+ return /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionImplProvider, {
14814
+ scope: __scopeAccordion,
14815
+ disabled: disabled,
14816
+ direction: dir,
14817
+ orientation: orientation
14818
+ }, /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$Collection.Slot, {
14819
+ scope: __scopeAccordion
14820
+ }, /*#__PURE__*/ React__default.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, accordionProps, {
14821
+ "data-orientation": orientation,
14822
+ ref: composedRefs,
14823
+ onKeyDown: disabled ? undefined : handleKeyDown
14824
+ }))));
14825
+ });
14826
+ /* -------------------------------------------------------------------------------------------------
14827
+ * AccordionItem
14828
+ * -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$ITEM_NAME = 'AccordionItem';
14829
+ const [$1bf158f521e1b1b4$var$AccordionItemProvider, $1bf158f521e1b1b4$var$useAccordionItemContext] = $1bf158f521e1b1b4$var$createAccordionContext($1bf158f521e1b1b4$var$ITEM_NAME);
14830
+ /**
14831
+ * `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.
14832
+ */ const $1bf158f521e1b1b4$export$d99097c13d4dac9f = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14833
+ const { __scopeAccordion: __scopeAccordion , value: value , ...accordionItemProps } = props;
14834
+ const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ITEM_NAME, __scopeAccordion);
14835
+ const valueContext = $1bf158f521e1b1b4$var$useAccordionValueContext($1bf158f521e1b1b4$var$ITEM_NAME, __scopeAccordion);
14836
+ const collapsibleScope = $1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);
14837
+ const triggerId = $1746a345f3d73bb7$export$f680877a34711e37();
14838
+ const open1 = value && valueContext.value.includes(value) || false;
14839
+ const disabled = accordionContext.disabled || props.disabled;
14840
+ return /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$AccordionItemProvider, {
14841
+ scope: __scopeAccordion,
14842
+ open: open1,
14843
+ disabled: disabled,
14844
+ triggerId: triggerId
14845
+ }, /*#__PURE__*/ React__default.createElement($409067139f391064$export$be92b6f5f03c0fe9, _extends({
14846
+ "data-orientation": accordionContext.orientation,
14847
+ "data-state": $1bf158f521e1b1b4$var$getState(open1)
14848
+ }, collapsibleScope, accordionItemProps, {
14849
+ ref: forwardedRef,
14850
+ disabled: disabled,
14851
+ open: open1,
14852
+ onOpenChange: (open)=>{
14853
+ if (open) valueContext.onItemOpen(value);
14854
+ else valueContext.onItemClose(value);
14855
+ }
14856
+ })));
14857
+ });
14858
+ /* -------------------------------------------------------------------------------------------------
14859
+ * AccordionTrigger
14860
+ * -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$TRIGGER_NAME = 'AccordionTrigger';
14861
+ /**
14862
+ * `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It
14863
+ * should always be nested inside of an `AccordionHeader`.
14864
+ */ const $1bf158f521e1b1b4$export$94e939b1f85bdd73 = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14865
+ const { __scopeAccordion: __scopeAccordion , ...triggerProps } = props;
14866
+ const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, __scopeAccordion);
14867
+ const itemContext = $1bf158f521e1b1b4$var$useAccordionItemContext($1bf158f521e1b1b4$var$TRIGGER_NAME, __scopeAccordion);
14868
+ const collapsibleContext = $1bf158f521e1b1b4$var$useAccordionCollapsibleContext($1bf158f521e1b1b4$var$TRIGGER_NAME, __scopeAccordion);
14869
+ const collapsibleScope = $1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);
14870
+ return /*#__PURE__*/ React__default.createElement($1bf158f521e1b1b4$var$Collection.ItemSlot, {
14871
+ scope: __scopeAccordion
14872
+ }, /*#__PURE__*/ React__default.createElement($409067139f391064$export$41fb9f06171c75f4, _extends({
14873
+ "aria-disabled": itemContext.open && !collapsibleContext.collapsible || undefined,
14874
+ "data-orientation": accordionContext.orientation,
14875
+ id: itemContext.triggerId
14876
+ }, collapsibleScope, triggerProps, {
14877
+ ref: forwardedRef
14878
+ })));
14879
+ });
14880
+ /* -------------------------------------------------------------------------------------------------
14881
+ * AccordionContent
14882
+ * -----------------------------------------------------------------------------------------------*/ const $1bf158f521e1b1b4$var$CONTENT_NAME = 'AccordionContent';
14883
+ /**
14884
+ * `AccordionContent` contains the collapsible content for an `AccordionItem`.
14885
+ */ const $1bf158f521e1b1b4$export$985b9a77379b54a0 = /*#__PURE__*/ React__default.forwardRef((props, forwardedRef)=>{
14886
+ const { __scopeAccordion: __scopeAccordion , ...contentProps } = props;
14887
+ const accordionContext = $1bf158f521e1b1b4$var$useAccordionContext($1bf158f521e1b1b4$var$ACCORDION_NAME, __scopeAccordion);
14888
+ const itemContext = $1bf158f521e1b1b4$var$useAccordionItemContext($1bf158f521e1b1b4$var$CONTENT_NAME, __scopeAccordion);
14889
+ const collapsibleScope = $1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);
14890
+ return /*#__PURE__*/ React__default.createElement($409067139f391064$export$7c6e2c02157bb7d2, _extends({
14891
+ role: "region",
14892
+ "aria-labelledby": itemContext.triggerId,
14893
+ "data-orientation": accordionContext.orientation
14894
+ }, collapsibleScope, contentProps, {
14895
+ ref: forwardedRef,
14896
+ style: {
14897
+ ['--radix-accordion-content-height']: 'var(--radix-collapsible-content-height)',
14898
+ ['--radix-accordion-content-width']: 'var(--radix-collapsible-content-width)',
14899
+ ...props.style
14900
+ }
14901
+ }));
14902
+ });
14903
+ /* -----------------------------------------------------------------------------------------------*/ function $1bf158f521e1b1b4$var$getState(open) {
14904
+ return open ? 'open' : 'closed';
14905
+ }
14906
+ const $1bf158f521e1b1b4$export$be92b6f5f03c0fe9 = $1bf158f521e1b1b4$export$a766cd26d0d69044;
14907
+ const $1bf158f521e1b1b4$export$6d08773d2e66f8f2 = $1bf158f521e1b1b4$export$d99097c13d4dac9f;
14908
+ const $1bf158f521e1b1b4$export$41fb9f06171c75f4 = $1bf158f521e1b1b4$export$94e939b1f85bdd73;
14909
+ const $1bf158f521e1b1b4$export$7c6e2c02157bb7d2 = $1bf158f521e1b1b4$export$985b9a77379b54a0;
14910
+
14911
+ const Accordion = ({ accordionItems, defaultValue, value, onItemSelect, disabled, extraClassNames, testId, }) => {
14912
+ return (React__default.createElement($1bf158f521e1b1b4$export$be92b6f5f03c0fe9, { className: "rounded-md w-full", type: "single", defaultValue: defaultValue, value: value, collapsible: true, "data-testid": testId, onValueChange: (_value) => onItemSelect(_value) }, accordionItems.map((item) => (React__default.createElement($1bf158f521e1b1b4$export$6d08773d2e66f8f2, { className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-w-full ${extraClassNames || ''}`, key: item.value, disabled: disabled, value: item.value },
14913
+ React__default.createElement($1bf158f521e1b1b4$export$41fb9f06171c75f4, { disabled: disabled, className: `tw-w-full tw-cursor-default` }, item.trigger),
14914
+ React__default.createElement($1bf158f521e1b1b4$export$7c6e2c02157bb7d2, { className: `data-[state=open]:tw-animate-slideDown data-[state=closed]:tw-animate-slideUp tw-overflow-hidden ${item.contentClassNames || ''}` }, item.content))))));
14915
+ };
14916
+
14917
+ export { Accordion, Button, Checkbox, Icon, Modal, QTip, Select, Tabs, TextArea, TextField, ToolbarButton, Tooltip };
14521
14918
  //# sourceMappingURL=index.esm.js.map