Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@interop-ui/react-accordion

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interop-ui/react-accordion - npm Package Compare versions

Comparing version 0.0.1-13 to 0.0.1-14

45

dist/index.d.ts

@@ -1,35 +0,9 @@

import React from "react";
import { CollapsibleProps, CollapsibleButtonProps, CollapsibleContentProps } from "@interop-ui/react-collapsible";
declare const ITEM_DEFAULT_TAG = "div";
type AccordionItemDOMProps = React.ComponentPropsWithoutRef<typeof ITEM_DEFAULT_TAG>;
type AccordionItemOwnProps = {
value: string;
};
export type AccordionItemProps = CollapsibleProps & AccordionItemDOMProps & AccordionItemOwnProps;
declare const AccordionItem: import("@interop-ui/react-utils").ForwardRefExoticComponentWithAs<"div", AccordionItemProps> & {
displayName: string;
};
declare const HEADER_DEFAULT_TAG = "h3";
type AccordionHeaderDOMProps = React.ComponentPropsWithoutRef<typeof HEADER_DEFAULT_TAG>;
export const AccordionItem: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@interop-ui/react-polymorphic").MergeProps<import("@interop-ui/react-collapsible").CollapsibleOwnProps, AccordionItemOwnProps>>;
type AccordionHeaderOwnProps = {};
export type AccordionHeaderProps = AccordionHeaderDOMProps & AccordionHeaderOwnProps;
declare const AccordionHeader: import("@interop-ui/react-utils").ForwardRefExoticComponentWithAs<"h3", Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">> & {
displayName: string;
};
declare const BUTTON_DEFAULT_TAG = "button";
type AccordionButtonDOMProps = React.ComponentPropsWithoutRef<typeof BUTTON_DEFAULT_TAG>;
type AccordionButtonOwnProps = {};
export type AccordionButtonProps = CollapsibleButtonProps & AccordionButtonDOMProps & AccordionButtonOwnProps;
declare const AccordionButton: import("@interop-ui/react-utils").ForwardRefExoticComponentWithAs<"button", Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "form" | "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "disabled" | "value" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type">> & {
displayName: string;
};
declare const PANEL_DEFAULT_TAG = "div";
type AccordionPanelDOMProps = React.ComponentPropsWithoutRef<typeof PANEL_DEFAULT_TAG>;
type AccordionPanelOwnProps = {};
export type AccordionPanelProps = CollapsibleContentProps & AccordionPanelDOMProps & AccordionPanelOwnProps;
declare const AccordionPanel: import("@interop-ui/react-utils").ForwardRefExoticComponentWithAs<"div", Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "slot" | "style" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">> & {
displayName: string;
};
declare const ACCORDION_DEFAULT_TAG = "div";
type AccordionDOMProps = Omit<React.ComponentPropsWithoutRef<typeof ACCORDION_DEFAULT_TAG>, 'defaultValue' | 'onChange'>;
export const AccordionHeader: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"h3", AccordionHeaderOwnProps>;
export const AccordionButton: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", Pick<{}, never>>;
export const AccordionPanel: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", Pick<{}, never>>;
type AccordionOwnProps = {

@@ -41,13 +15,4 @@ value?: string;

};
export type AccordionProps = AccordionDOMProps & AccordionOwnProps;
export const Accordion: AccordionStaticProps & import("@interop-ui/react-utils").ForwardRefExoticComponentWithAs<"div", AccordionProps> & {
displayName: string;
};
interface AccordionStaticProps {
Item: typeof AccordionItem;
Header: typeof AccordionHeader;
Button: typeof AccordionButton;
Panel: typeof AccordionPanel;
}
export const Accordion: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", AccordionOwnProps>;
//# sourceMappingURL=index.d.ts.map

2

dist/index.js

@@ -1,2 +0,2 @@

var e,r=require("@interop-ui/react-collapsible").Collapsible,t=require("@interop-ui/react-utils"),n=t.composeEventHandlers,o=t.createContext,a=t.forwardRef,i=t.useComposedRefs,u=t.useControlledState,c=t.useId,l=require("@interop-ui/utils").getPartDataAttrObj,d=(e=require("react"))&&e.__esModule?e.default:e;function s(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(){return(f=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function p(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function b(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return t}(e,r)||v(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,r){if(e){if("string"==typeof e)return y(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?y(e,r):void 0}}function y(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var m=b(o("AccordionContext","Accordion"),2),A=m[0],g=m[1],h=b(o("AccordionItemContext","Accordion.Item"),2),O=h[0],w=h[1],I=a((function(e,t){var n,o=e.value,a=(e.isOpen,e.defaultIsOpen,e.children),i=(e.onToggle,p(e,["value","isOpen","defaultIsOpen","children","onToggle"])),u=g("Accordion.Item"),s="accordion-button-".concat(c()),b=e.id||s,v=o&&o===u.value||!1,y=null!==(n=u.isDisabled)&&void 0!==n?n:e.disabled,m=d.useMemo((function(){return{isOpen:v,buttonId:b}}),[v,b]);return d.createElement(r,f({},i,l("Accordion.Item"),{ref:t,"data-state":v?"open":"closed","data-disabled":y||void 0,disabled:y,isOpen:v,onToggle:function(){return u.setValue(o)}}),d.createElement(O.Provider,{value:m},a))})),E=a((function(e,r){var t=e.as,n=void 0===t?"h3":t,o=p(e,["as"]);return d.createElement(n,f({ref:r},o,l("Accordion.Header")))})),S=a((function(e,t){var n=Object.assign({},e),o=g("Accordion.Button").buttonNodesRef,a=w("Accordion.Button"),u=d.useRef(null),c=i(u,t);return d.useEffect((function(){var e=o.current,r=u.current;if(r)return e.add(r),function(){e.delete(r)}}),[o]),d.createElement(r.Button,f({},n,l("Accordion.Button"),{ref:c,"aria-disabled":a.isOpen||void 0,id:a.buttonId}))})),j=a((function(e,t){var n=w("Accordion.Panel");return d.createElement(r.Content,f({},e,l("Accordion.Panel"),{ref:t,role:"region","aria-labelledby":n.buttonId}))})),P=["Home","End","ArrowDown","ArrowUp"],C=a((function(e,r){var t=e.as,o=void 0===t?"div":t,a=e.value,c=e.defaultValue,v=e.children,y=e.disabled,m=e.onChange,g=void 0===m?function(){}:m,h=p(e,["as","value","defaultValue","children","disabled","onChange"]),O=d.useRef(new Set),w=d.useRef(null),I=i(w,r),E=b(u({prop:a,defaultProp:c,onChange:function(e){function r(r){return e.apply(this,arguments)}return r.toString=function(){return e.toString()},r}((function(e){return e&&g(e)}))}),2),S=E[0],j=E[1],C=n(e.onKeyDown,(function(e){var r,t=e.target;if(P.includes(e.key)&&t instanceof HTMLButtonElement){var n=s(O.current).filter((function(e){return!(e&&e.disabled)})),o=n.length,a=n.indexOf(t);if(-1!==a){e.preventDefault();var i=a;switch(e.key){case"Home":i=0;break;case"End":i=o-1;break;case"ArrowDown":i=a+1;break;case"ArrowUp":(i=a-1)<0&&(i=o-1)}null===(r=n[i%o])||void 0===r||r.focus()}}})),x=d.useMemo((function(){return{isDisabled:y,buttonNodesRef:O,value:S,setValue:j}}),[y,S,j]);return d.createElement(o,f({},h,l("Accordion"),{ref:I,onKeyDown:y?void 0:C}),d.createElement(A.Provider,{value:x},v))}));exports.Accordion=C,C.Item=I,C.Header=E,C.Button=S,C.Panel=j,C.displayName="Accordion",C.Item.displayName="Accordion.Item",C.Header.displayName="Accordion.Header",C.Button.displayName="Accordion.Button",C.Panel.displayName="Accordion.Panel";
var e,r=require("@interop-ui/react-collapsible"),t=r.Collapsible,n=r.CollapsibleButton,o=r.CollapsibleContent,i=require("@interop-ui/react-polymorphic").forwardRefWithAs,a=require("@interop-ui/react-utils"),u=a.composeEventHandlers,c=a.createContext,l=a.useComposedRefs,d=a.useControlledState,s=a.useId,f=require("@interop-ui/utils").getPartDataAttrObj,p=(e=require("react"))&&e.__esModule?e.default:e;function b(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(){return(v=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function y(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function m(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return t}(e,r)||A(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,r){if(e){if("string"==typeof e)return h(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,r):void 0}}function h(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var g=m(c("AccordionContext","Accordion"),2),O=g[0],w=g[1],I=m(c("AccordionItemContext","AccordionItem"),2),E=I[0],S=I[1],j=i((function(e,r){var n,o=e.value,i=(e.isOpen,e.defaultIsOpen,e.children),a=(e.onToggle,y(e,["value","isOpen","defaultIsOpen","children","onToggle"])),u=w("AccordionItem"),c="accordion-button-".concat(s()),l=e.id||c,d=o&&o===u.value||!1,b=null!==(n=u.isDisabled)&&void 0!==n?n:e.disabled,m=p.useMemo((function(){return{isOpen:d,buttonId:l}}),[d,l]);return p.createElement(t,v({},a,f("AccordionItem"),{ref:r,"data-state":d?"open":"closed","data-disabled":b||void 0,disabled:b,isOpen:d,onToggle:function(){return u.setValue(o)}}),p.createElement(E.Provider,{value:m},i))}));exports.AccordionItem=j,j.displayName="AccordionItem";var C=i((function(e,r){var t=e.as,n=void 0===t?"h3":t,o=y(e,["as"]);return p.createElement(n,v({ref:r},o,f("AccordionHeader")))}));exports.AccordionHeader=C,C.displayName="AccordionHeader";var x=i((function(e,r){var t=Object.assign({},e),o=w("AccordionButton").buttonNodesRef,i=S("AccordionButton"),a=p.useRef(null),u=l(a,r);return p.useEffect((function(){var e=o.current,r=a.current;if(r)return e.add(r),function(){e.delete(r)}}),[o]),p.createElement(n,v({},t,f("AccordionButton"),{ref:u,"aria-disabled":i.isOpen||void 0,id:i.buttonId}))}));exports.AccordionButton=x,x.displayName="AccordionButton";var P=i((function(e,r){var t=S("AccordionPanel");return p.createElement(o,v({},e,f("AccordionPanel"),{ref:r,role:"region","aria-labelledby":t.buttonId}))}));exports.AccordionPanel=P,P.displayName="AccordionPanel";var D=["Home","End","ArrowDown","ArrowUp"],B=i((function(e,r){var t=e.as,n=void 0===t?"div":t,o=e.value,i=e.defaultValue,a=e.children,c=e.disabled,s=e.onChange,A=void 0===s?function(){}:s,h=y(e,["as","value","defaultValue","children","disabled","onChange"]),g=p.useRef(new Set),w=p.useRef(null),I=l(w,r),E=m(d({prop:o,defaultProp:i,onChange:function(e){function r(r){return e.apply(this,arguments)}return r.toString=function(){return e.toString()},r}((function(e){return e&&A(e)}))}),2),S=E[0],j=E[1],C=u(e.onKeyDown,(function(e){var r,t=e.target;if(D.includes(e.key)&&t instanceof HTMLButtonElement){var n=b(g.current).filter((function(e){return!(e&&e.disabled)})),o=n.length,i=n.indexOf(t);if(-1!==i){e.preventDefault();var a=i;switch(e.key){case"Home":a=0;break;case"End":a=o-1;break;case"ArrowDown":a=i+1;break;case"ArrowUp":(a=i-1)<0&&(a=o-1)}null===(r=n[a%o])||void 0===r||r.focus()}}})),x=p.useMemo((function(){return{isDisabled:c,buttonNodesRef:g,value:S,setValue:j}}),[c,S,j]);return p.createElement(n,v({},h,f("Accordion"),{ref:I,onKeyDown:c?void 0:C}),p.createElement(O.Provider,{value:x},a))}));exports.Accordion=B,B.displayName="Accordion";
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{Collapsible as e}from"@interop-ui/react-collapsible";import{composeEventHandlers as n,createContext as o,forwardRef as t,useComposedRefs as r,useControlledState as c,useId as i}from"@interop-ui/react-utils";import{getPartDataAttrObj as a}from"@interop-ui/utils";import d from"react";function l(){return(l=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function u(e,n){if(null==e)return{};var o,t,r=function(e,n){if(null==e)return{};var o,t,r={},c=Object.keys(e);for(t=0;t<c.length;t++)o=c[t],n.indexOf(o)>=0||(r[o]=e[o]);return r}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(t=0;t<c.length;t++)o=c[t],n.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}const[s,f]=o("AccordionContext","Accordion"),[p,m]=o("AccordionItemContext","Accordion.Item"),A=t((function(n,o){var t;const{value:r,isOpen:c,defaultIsOpen:s,children:m,onToggle:A}=n,b=u(n,["value","isOpen","defaultIsOpen","children","onToggle"]),v=f("Accordion.Item"),g="accordion-button-".concat(i()),y=n.id||g,O=r&&r===v.value||!1,h=null!==(t=v.isDisabled)&&void 0!==t?t:n.disabled,w=d.useMemo((()=>({isOpen:O,buttonId:y})),[O,y]);return d.createElement(e,l({},b,a("Accordion.Item"),{ref:o,"data-state":O?"open":"closed","data-disabled":h||void 0,disabled:h,isOpen:O,onToggle:()=>v.setValue(r)}),d.createElement(p.Provider,{value:w},m))})),b="h3",v=t((function(e,n){const{as:o=b}=e,t=u(e,["as"]);return d.createElement(o,l({ref:n},t,a("Accordion.Header")))})),g=t((function(n,o){const t=Object.assign({},n),{buttonNodesRef:c}=f("Accordion.Button"),i=m("Accordion.Button"),u=d.useRef(null),s=r(u,o);return d.useEffect((()=>{const e=c.current,n=u.current;if(n)return e.add(n),()=>{e.delete(n)}}),[c]),d.createElement(e.Button,l({},t,a("Accordion.Button"),{ref:s,"aria-disabled":i.isOpen||void 0,id:i.buttonId}))})),y=t((function(n,o){const t=m("Accordion.Panel");return d.createElement(e.Content,l({},n,a("Accordion.Panel"),{ref:o,role:"region","aria-labelledby":t.buttonId}))})),O="div",h=["Home","End","ArrowDown","ArrowUp"];export const Accordion=t((function(e,o){const{as:t=O,value:i,defaultValue:f,children:p,disabled:m,onChange:A=(()=>{})}=e,b=u(e,["as","value","defaultValue","children","disabled","onChange"]),v=d.useRef(new Set),g=d.useRef(null),y=r(g,o),[w,I]=c({prop:i,defaultProp:f,onChange:function(e){function n(n){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((e=>e&&A(e)))}),E=n(e.onKeyDown,(e=>{var n;const o=e.target;if(!(h.includes(e.key)&&(t=o,t instanceof HTMLButtonElement)))return;var t;const r=[...v.current].filter((e=>!(e&&e.disabled))),c=r.length,i=r.indexOf(o);if(-1===i)return;e.preventDefault();let a=i;switch(e.key){case"Home":a=0;break;case"End":a=c-1;break;case"ArrowDown":a=i+1;break;case"ArrowUp":a=i-1,a<0&&(a=c-1)}null===(n=r[a%c])||void 0===n||n.focus()})),P=d.useMemo((()=>({isDisabled:m,buttonNodesRef:v,value:w,setValue:I})),[m,w,I]);return d.createElement(t,l({},b,a("Accordion"),{ref:y,onKeyDown:m?void 0:E}),d.createElement(s.Provider,{value:P},p))}));Accordion.Item=A,Accordion.Header=v,Accordion.Button=g,Accordion.Panel=y,Accordion.displayName="Accordion",Accordion.Item.displayName="Accordion.Item",Accordion.Header.displayName="Accordion.Header",Accordion.Button.displayName="Accordion.Button",Accordion.Panel.displayName="Accordion.Panel";
import{Collapsible as e,CollapsibleButton as o,CollapsibleContent as n}from"@interop-ui/react-collapsible";import{forwardRefWithAs as t}from"@interop-ui/react-polymorphic";import{composeEventHandlers as r,createContext as c,useComposedRefs as i,useControlledState as a,useId as l}from"@interop-ui/react-utils";import{getPartDataAttrObj as d}from"@interop-ui/utils";import u from"react";function s(){return(s=Object.assign||function(e){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function p(e,o){if(null==e)return{};var n,t,r=function(e,o){if(null==e)return{};var n,t,r={},c=Object.keys(e);for(t=0;t<c.length;t++)n=c[t],o.indexOf(n)>=0||(r[n]=e[n]);return r}(e,o);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(t=0;t<c.length;t++)n=c[t],o.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}const[f,m]=c("AccordionContext","Accordion"),[A,b]=c("AccordionItemContext","AccordionItem");export const AccordionItem=t(((o,n)=>{var t;const{value:r,isOpen:c,defaultIsOpen:i,children:a,onToggle:f}=o,b=p(o,["value","isOpen","defaultIsOpen","children","onToggle"]),v=m("AccordionItem"),y="accordion-button-".concat(l()),g=o.id||y,O=r&&r===v.value||!1,h=null!==(t=v.isDisabled)&&void 0!==t?t:o.disabled,w=u.useMemo((()=>({isOpen:O,buttonId:g})),[O,g]);return u.createElement(e,s({},b,d("AccordionItem"),{ref:n,"data-state":O?"open":"closed","data-disabled":h||void 0,disabled:h,isOpen:O,onToggle:()=>v.setValue(r)}),u.createElement(A.Provider,{value:w},a))}));AccordionItem.displayName="AccordionItem";const v="h3";export const AccordionHeader=t(((e,o)=>{const{as:n=v}=e,t=p(e,["as"]);return u.createElement(n,s({ref:o},t,d("AccordionHeader")))}));AccordionHeader.displayName="AccordionHeader";export const AccordionButton=t(((e,n)=>{const t=Object.assign({},e),{buttonNodesRef:r}=m("AccordionButton"),c=b("AccordionButton"),a=u.useRef(null),l=i(a,n);return u.useEffect((()=>{const e=r.current,o=a.current;if(o)return e.add(o),()=>{e.delete(o)}}),[r]),u.createElement(o,s({},t,d("AccordionButton"),{ref:l,"aria-disabled":c.isOpen||void 0,id:c.buttonId}))}));AccordionButton.displayName="AccordionButton";export const AccordionPanel=t(((e,o)=>{const t=b("AccordionPanel");return u.createElement(n,s({},e,d("AccordionPanel"),{ref:o,role:"region","aria-labelledby":t.buttonId}))}));AccordionPanel.displayName="AccordionPanel";const y="div",g=["Home","End","ArrowDown","ArrowUp"];export const Accordion=t(((e,o)=>{const{as:n=y,value:t,defaultValue:c,children:l,disabled:m,onChange:A=(()=>{})}=e,b=p(e,["as","value","defaultValue","children","disabled","onChange"]),v=u.useRef(new Set),O=u.useRef(null),h=i(O,o),[w,I]=a({prop:t,defaultProp:c,onChange:function(e){function o(o){return e.apply(this,arguments)}return o.toString=function(){return e.toString()},o}((e=>e&&A(e)))}),E=r(e.onKeyDown,(e=>{var o;const n=e.target;if(!(g.includes(e.key)&&(t=n,t instanceof HTMLButtonElement)))return;var t;const r=[...v.current].filter((e=>!(e&&e.disabled))),c=r.length,i=r.indexOf(n);if(-1===i)return;e.preventDefault();let a=i;switch(e.key){case"Home":a=0;break;case"End":a=c-1;break;case"ArrowDown":a=i+1;break;case"ArrowUp":a=i-1,a<0&&(a=c-1)}null===(o=r[a%c])||void 0===o||o.focus()})),P=u.useMemo((()=>({isDisabled:m,buttonNodesRef:v,value:w,setValue:I})),[m,w,I]);return u.createElement(n,s({},b,d("Accordion"),{ref:h,onKeyDown:m?void 0:E}),u.createElement(f.Provider,{value:P},l))}));Accordion.displayName="Accordion";
//# sourceMappingURL=index.module.js.map
{
"name": "@interop-ui/react-accordion",
"version": "0.0.1-13",
"version": "0.0.1-14",
"license": "MIT",

@@ -20,5 +20,6 @@ "source": "src/index.ts",

"dependencies": {
"@interop-ui/react-collapsible": "0.0.1-12",
"@interop-ui/react-utils": "0.0.1-12",
"@interop-ui/utils": "0.0.1-4"
"@interop-ui/react-collapsible": "0.0.1-13",
"@interop-ui/react-polymorphic": "0.0.1-0",
"@interop-ui/react-utils": "0.0.1-13",
"@interop-ui/utils": "0.0.1-5"
},

@@ -25,0 +26,0 @@ "devDependencies": {

@@ -15,3 +15,9 @@ # `react-accordion`

import * as React from 'react';
import { Accordion } from '@interop-ui/react-accordion';
import {
Accordion,
AccordionItem,
AccordionHeader,
AccordionButton,
AccordionPanel,
} from '@interop-ui/react-accordion';

@@ -23,15 +29,15 @@ function MyComponent() {

<Accordion.Item value="one">
<Accordion.Header>
<Accordion.Button>One</Accordion.Button>
</Accordion.Header>
<Accordion.Panel>Content for item 1</Accordion.Panel>
</Accordion.Item>
<AccordionItem value="one">
<AccordionHeader>
<AccordionButton>One</AccordionButton>
</AccordionHeader>
<AccordionPanel>Content for item 1</AccordionPanel>
</AccordionItem>
<Accordion.Item value="two">
<Accordion.Header>
<Accordion.Button>Two</Accordion.Button>
</Accordion.Header>
<Accordion.Panel>Content for item 2</Accordion.Panel>
</Accordion.Item>
<AccordionItem value="two">
<AccordionHeader>
<AccordionButton>Two</AccordionButton>
</AccordionHeader>
<AccordionPanel>Content for item 2</AccordionPanel>
</AccordionItem>

@@ -38,0 +44,0 @@ {/* end items */}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc