@radix-ui/react-accordion 1.2.18-rc.1784603841447 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -18
- package/dist/index.d.ts +4 -18
- package/dist/index.js +7 -25
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +7 -25
- package/dist/index.mjs.map +2 -2
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -3,27 +3,13 @@ import * as React from 'react';
|
|
|
3
3
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
4
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
readonly Single: "single";
|
|
8
|
-
readonly Multiple: "multiple";
|
|
9
|
-
};
|
|
10
|
-
type AccordionType = (typeof AccordionType)[keyof typeof AccordionType];
|
|
11
|
-
declare const Orientation: {
|
|
12
|
-
readonly Vertical: "vertical";
|
|
13
|
-
readonly Horizontal: "horizontal";
|
|
14
|
-
};
|
|
15
|
-
type Orientation = (typeof Orientation)[keyof typeof Orientation];
|
|
16
|
-
declare const Direction: {
|
|
17
|
-
readonly LTR: "ltr";
|
|
18
|
-
readonly RTL: "rtl";
|
|
19
|
-
};
|
|
20
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
6
|
+
type Direction = 'ltr' | 'rtl';
|
|
21
7
|
declare const createAccordionScope: _radix_ui_react_context.CreateScope;
|
|
22
8
|
interface AccordionSingleProps extends AccordionImplSingleProps {
|
|
23
|
-
type:
|
|
9
|
+
type: 'single';
|
|
24
10
|
}
|
|
25
11
|
interface AccordionMultipleProps extends AccordionImplMultipleProps {
|
|
26
|
-
type:
|
|
12
|
+
type: 'multiple';
|
|
27
13
|
}
|
|
28
14
|
declare const Accordion: React.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
29
15
|
interface AccordionImplSingleProps extends AccordionImplProps {
|
|
@@ -73,7 +59,7 @@ interface AccordionImplProps extends PrimitiveDivProps {
|
|
|
73
59
|
* The layout in which the Accordion operates.
|
|
74
60
|
* @default vertical
|
|
75
61
|
*/
|
|
76
|
-
orientation?:
|
|
62
|
+
orientation?: React.AriaAttributes['aria-orientation'];
|
|
77
63
|
/**
|
|
78
64
|
* The language read direction.
|
|
79
65
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -3,27 +3,13 @@ import * as React from 'react';
|
|
|
3
3
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
4
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
readonly Single: "single";
|
|
8
|
-
readonly Multiple: "multiple";
|
|
9
|
-
};
|
|
10
|
-
type AccordionType = (typeof AccordionType)[keyof typeof AccordionType];
|
|
11
|
-
declare const Orientation: {
|
|
12
|
-
readonly Vertical: "vertical";
|
|
13
|
-
readonly Horizontal: "horizontal";
|
|
14
|
-
};
|
|
15
|
-
type Orientation = (typeof Orientation)[keyof typeof Orientation];
|
|
16
|
-
declare const Direction: {
|
|
17
|
-
readonly LTR: "ltr";
|
|
18
|
-
readonly RTL: "rtl";
|
|
19
|
-
};
|
|
20
|
-
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
6
|
+
type Direction = 'ltr' | 'rtl';
|
|
21
7
|
declare const createAccordionScope: _radix_ui_react_context.CreateScope;
|
|
22
8
|
interface AccordionSingleProps extends AccordionImplSingleProps {
|
|
23
|
-
type:
|
|
9
|
+
type: 'single';
|
|
24
10
|
}
|
|
25
11
|
interface AccordionMultipleProps extends AccordionImplMultipleProps {
|
|
26
|
-
type:
|
|
12
|
+
type: 'multiple';
|
|
27
13
|
}
|
|
28
14
|
declare const Accordion: React.ForwardRefExoticComponent<(AccordionSingleProps | AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
29
15
|
interface AccordionImplSingleProps extends AccordionImplProps {
|
|
@@ -73,7 +59,7 @@ interface AccordionImplProps extends PrimitiveDivProps {
|
|
|
73
59
|
* The layout in which the Accordion operates.
|
|
74
60
|
* @default vertical
|
|
75
61
|
*/
|
|
76
|
-
orientation?:
|
|
62
|
+
orientation?: React.AriaAttributes['aria-orientation'];
|
|
77
63
|
/**
|
|
78
64
|
* The language read direction.
|
|
79
65
|
*/
|
package/dist/index.js
CHANGED
|
@@ -59,18 +59,6 @@ var import_react_collapsible = require("@radix-ui/react-collapsible");
|
|
|
59
59
|
var import_react_id = require("@radix-ui/react-id");
|
|
60
60
|
var import_react_direction = require("@radix-ui/react-direction");
|
|
61
61
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
62
|
-
var AccordionType = {
|
|
63
|
-
Single: "single",
|
|
64
|
-
Multiple: "multiple"
|
|
65
|
-
};
|
|
66
|
-
var Orientation = {
|
|
67
|
-
Vertical: "vertical",
|
|
68
|
-
Horizontal: "horizontal"
|
|
69
|
-
};
|
|
70
|
-
var Direction = {
|
|
71
|
-
LTR: "ltr",
|
|
72
|
-
RTL: "rtl"
|
|
73
|
-
};
|
|
74
62
|
var ACCORDION_NAME = "Accordion";
|
|
75
63
|
var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
|
|
76
64
|
var [Collection, useCollection, createCollectionScope] = (0, import_react_collection.createCollection)(ACCORDION_NAME);
|
|
@@ -85,7 +73,7 @@ var Accordion = /* @__PURE__ */ React.forwardRef(
|
|
|
85
73
|
const { type, ...accordionProps } = props;
|
|
86
74
|
const singleProps = accordionProps;
|
|
87
75
|
const multipleProps = accordionProps;
|
|
88
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeAccordion, children: type ===
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { scope: props.__scopeAccordion, children: type === "multiple" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplMultiple, { ...multipleProps, ref: forwardedRef }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccordionImplSingle, { ...singleProps, ref: forwardedRef }) });
|
|
89
77
|
}, "Accordion")
|
|
90
78
|
);
|
|
91
79
|
var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
|
|
@@ -158,18 +146,12 @@ var AccordionImplMultiple = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __n
|
|
|
158
146
|
var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
|
|
159
147
|
var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
160
148
|
/* @__PURE__ */ __name(function AccordionImpl2(props, forwardedRef) {
|
|
161
|
-
const {
|
|
162
|
-
__scopeAccordion,
|
|
163
|
-
disabled,
|
|
164
|
-
dir,
|
|
165
|
-
orientation = Orientation.Vertical,
|
|
166
|
-
...accordionProps
|
|
167
|
-
} = props;
|
|
149
|
+
const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
|
|
168
150
|
const accordionRef = React.useRef(null);
|
|
169
151
|
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(accordionRef, forwardedRef);
|
|
170
152
|
const getItems = useCollection(__scopeAccordion);
|
|
171
153
|
const direction = (0, import_react_direction.useDirection)(dir);
|
|
172
|
-
const isDirectionLTR = direction ===
|
|
154
|
+
const isDirectionLTR = direction === "ltr";
|
|
173
155
|
const handleKeyDown = (0, import_primitive.composeEventHandlers)(props.onKeyDown, (event) => {
|
|
174
156
|
if (!ACCORDION_KEYS.includes(event.key)) return;
|
|
175
157
|
const target = event.target;
|
|
@@ -201,7 +183,7 @@ var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
201
183
|
nextIndex = endIndex;
|
|
202
184
|
break;
|
|
203
185
|
case "ArrowRight":
|
|
204
|
-
if (orientation ===
|
|
186
|
+
if (orientation === "horizontal") {
|
|
205
187
|
if (isDirectionLTR) {
|
|
206
188
|
moveNext();
|
|
207
189
|
} else {
|
|
@@ -210,12 +192,12 @@ var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
210
192
|
}
|
|
211
193
|
break;
|
|
212
194
|
case "ArrowDown":
|
|
213
|
-
if (orientation ===
|
|
195
|
+
if (orientation === "vertical") {
|
|
214
196
|
moveNext();
|
|
215
197
|
}
|
|
216
198
|
break;
|
|
217
199
|
case "ArrowLeft":
|
|
218
|
-
if (orientation ===
|
|
200
|
+
if (orientation === "horizontal") {
|
|
219
201
|
if (isDirectionLTR) {
|
|
220
202
|
movePrev();
|
|
221
203
|
} else {
|
|
@@ -224,7 +206,7 @@ var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
224
206
|
}
|
|
225
207
|
break;
|
|
226
208
|
case "ArrowUp":
|
|
227
|
-
if (orientation ===
|
|
209
|
+
if (orientation === "vertical") {
|
|
228
210
|
movePrev();
|
|
229
211
|
}
|
|
230
212
|
break;
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/accordion.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\nexport {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Root,\n Item,\n Header,\n Trigger,\n Content,\n} from './accordion';\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n} from './accordion';\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport { createCollapsibleScope } from '@radix-ui/react-collapsible';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\n\nconst AccordionType = {\n Single: 'single',\n Multiple: 'multiple',\n} as const;\n\nconst Orientation = {\n Vertical: 'vertical',\n Horizontal: 'horizontal',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype AccordionType = (typeof AccordionType)[keyof typeof AccordionType];\ntype Orientation = (typeof Orientation)[keyof typeof Orientation];\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\n/* -------------------------------------------------------------------------------------------------\n * Accordion\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACCORDION_NAME = 'Accordion';\nconst ACCORDION_KEYS = ['Home', 'End', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'];\n\nconst [Collection, useCollection, createCollectionScope] =\n createCollection<AccordionTriggerElement>(ACCORDION_NAME);\n\ntype ScopedProps<P> = P & { __scopeAccordion?: Scope };\nconst [createAccordionContext, createAccordionScope] = createContextScope(ACCORDION_NAME, [\n createCollectionScope,\n createCollapsibleScope,\n]);\nconst useCollapsibleScope = createCollapsibleScope();\n\ntype AccordionElement = AccordionImplMultipleElement | AccordionImplSingleElement;\ninterface AccordionSingleProps extends AccordionImplSingleProps {\n type: typeof AccordionType.Single;\n}\ninterface AccordionMultipleProps extends AccordionImplMultipleProps {\n type: typeof AccordionType.Multiple;\n}\n\nconst Accordion = /* @__PURE__ */ React.forwardRef<\n AccordionElement,\n AccordionSingleProps | AccordionMultipleProps\n>(\n // blank line to reduce diff noise\n function Accordion(\n props: ScopedProps<AccordionSingleProps | AccordionMultipleProps>,\n forwardedRef,\n ) {\n const { type, ...accordionProps } = props;\n const singleProps = accordionProps as AccordionImplSingleProps;\n const multipleProps = accordionProps as AccordionImplMultipleProps;\n return (\n <Collection.Provider scope={props.__scopeAccordion}>\n {type === AccordionType.Multiple ? (\n <AccordionImplMultiple {...multipleProps} ref={forwardedRef} />\n ) : (\n <AccordionImplSingle {...singleProps} ref={forwardedRef} />\n )}\n </Collection.Provider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionValueContextValue = {\n value: string[];\n onItemOpen(value: string): void;\n onItemClose(value: string): void;\n};\n\nconst [AccordionValueProvider, useAccordionValueContext] =\n createAccordionContext<AccordionValueContextValue>(ACCORDION_NAME);\n\nconst [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(\n ACCORDION_NAME,\n { collapsible: false },\n);\n\ntype AccordionImplSingleElement = AccordionImplElement;\ninterface AccordionImplSingleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion item whose content is expanded.\n */\n value?: string;\n /**\n * The value of the item whose content is expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string;\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string): void;\n /**\n * Whether an accordion item can be collapsed after it has been opened.\n * @default false\n */\n collapsible?: boolean;\n}\n\nconst AccordionImplSingle = /* @__PURE__ */ React.forwardRef<\n AccordionImplSingleElement,\n AccordionImplSingleProps\n>(\n // blank line to reduce diff noise\n function AccordionImplSingle(props: ScopedProps<AccordionImplSingleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n collapsible = false,\n ...accordionSingleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? '',\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={React.useMemo(() => (value ? [value] : []), [value])}\n onItemOpen={setValue}\n onItemClose={React.useCallback(() => collapsible && setValue(''), [collapsible, setValue])}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={collapsible}>\n <AccordionImpl {...accordionSingleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplMultipleElement = AccordionImplElement;\ninterface AccordionImplMultipleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion items whose contents are expanded.\n */\n value?: string[];\n /**\n * The value of the items whose contents are expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string[];\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string[]): void;\n}\n\nconst AccordionImplMultiple = /* @__PURE__ */ React.forwardRef<\n AccordionImplMultipleElement,\n AccordionImplMultipleProps\n>(function AccordionImplMultiple(props: ScopedProps<AccordionImplMultipleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n ...accordionMultipleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? [],\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n const handleItemOpen = React.useCallback(\n (itemValue: string) => setValue((prevValue = []) => [...prevValue, itemValue]),\n [setValue],\n );\n\n const handleItemClose = React.useCallback(\n (itemValue: string) =>\n setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)),\n [setValue],\n );\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={value}\n onItemOpen={handleItemOpen}\n onItemClose={handleItemClose}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={true}>\n <AccordionImpl {...accordionMultipleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplContextValue = {\n disabled?: boolean;\n direction: AccordionImplProps['dir'];\n orientation: AccordionImplProps['orientation'];\n};\n\nconst [AccordionImplProvider, useAccordionContext] =\n createAccordionContext<AccordionImplContextValue>(ACCORDION_NAME);\n\ntype AccordionImplElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AccordionImplProps extends PrimitiveDivProps {\n /**\n * Whether or not an accordion is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * The layout in which the Accordion operates.\n * @default vertical\n */\n orientation?: Orientation;\n /**\n * The language read direction.\n */\n dir?: Direction;\n}\n\nconst AccordionImpl = /* @__PURE__ */ React.forwardRef<AccordionImplElement, AccordionImplProps>(\n function AccordionImpl(props: ScopedProps<AccordionImplProps>, forwardedRef) {\n const {\n __scopeAccordion,\n disabled,\n dir,\n orientation = Orientation.Vertical,\n ...accordionProps\n } = props;\n const accordionRef = React.useRef<AccordionImplElement>(null);\n const composedRefs = useComposedRefs(accordionRef, forwardedRef);\n const getItems = useCollection(__scopeAccordion);\n const direction = useDirection(dir);\n const isDirectionLTR = direction === Direction.LTR;\n\n const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {\n if (!ACCORDION_KEYS.includes(event.key)) return;\n const target = event.target as HTMLElement;\n const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);\n const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);\n const triggerCount = triggerCollection.length;\n\n if (triggerIndex === -1) return;\n\n // Prevents page scroll while user is navigating\n event.preventDefault();\n\n let nextIndex = triggerIndex;\n const homeIndex = 0;\n const endIndex = triggerCount - 1;\n\n const moveNext = () => {\n nextIndex = triggerIndex + 1;\n if (nextIndex > endIndex) {\n nextIndex = homeIndex;\n }\n };\n\n const movePrev = () => {\n nextIndex = triggerIndex - 1;\n if (nextIndex < homeIndex) {\n nextIndex = endIndex;\n }\n };\n\n switch (event.key) {\n case 'Home':\n nextIndex = homeIndex;\n break;\n case 'End':\n nextIndex = endIndex;\n break;\n case 'ArrowRight':\n if (orientation === Orientation.Horizontal) {\n if (isDirectionLTR) {\n moveNext();\n } else {\n movePrev();\n }\n }\n break;\n case 'ArrowDown':\n if (orientation === Orientation.Vertical) {\n moveNext();\n }\n break;\n case 'ArrowLeft':\n if (orientation === Orientation.Horizontal) {\n if (isDirectionLTR) {\n movePrev();\n } else {\n moveNext();\n }\n }\n break;\n case 'ArrowUp':\n if (orientation === Orientation.Vertical) {\n movePrev();\n }\n break;\n }\n\n const clampedIndex = nextIndex % triggerCount;\n triggerCollection[clampedIndex]!.ref.current?.focus();\n });\n\n return (\n <AccordionImplProvider\n scope={__scopeAccordion}\n disabled={disabled}\n direction={dir}\n orientation={orientation}\n >\n <Collection.Slot scope={__scopeAccordion}>\n <Primitive.div\n {...accordionProps}\n data-orientation={orientation}\n ref={composedRefs}\n onKeyDown={disabled ? undefined : handleKeyDown}\n />\n </Collection.Slot>\n </AccordionImplProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'AccordionItem';\n\ntype AccordionItemContextValue = { open?: boolean; disabled?: boolean; triggerId: string };\nconst [AccordionItemProvider, useAccordionItemContext] =\n createAccordionContext<AccordionItemContextValue>(ITEM_NAME);\n\ntype AccordionItemElement = React.ComponentRef<typeof CollapsiblePrimitive.Root>;\ntype CollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\ninterface AccordionItemProps extends Omit<\n CollapsibleProps,\n 'open' | 'defaultOpen' | 'onOpenChange'\n> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string;\n}\n\n/**\n * `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.\n */\nconst AccordionItem = /* @__PURE__ */ React.forwardRef<AccordionItemElement, AccordionItemProps>(\n function AccordionItem(props: ScopedProps<AccordionItemProps>, forwardedRef) {\n const { __scopeAccordion, value, ...accordionItemProps } = props;\n const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);\n const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n const triggerId = useId();\n const open = (value && valueContext.value.includes(value)) || false;\n const disabled = accordionContext.disabled || props.disabled;\n\n return (\n <AccordionItemProvider\n scope={__scopeAccordion}\n open={open}\n disabled={disabled}\n triggerId={triggerId}\n >\n <CollapsiblePrimitive.Root\n data-orientation={accordionContext.orientation}\n data-state={getState(open)}\n {...collapsibleScope}\n {...accordionItemProps}\n ref={forwardedRef}\n disabled={disabled}\n open={open}\n onOpenChange={(open) => {\n if (open) {\n valueContext.onItemOpen(value);\n } else {\n valueContext.onItemClose(value);\n }\n }}\n />\n </AccordionItemProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionHeader\n * -----------------------------------------------------------------------------------------------*/\n\nconst HEADER_NAME = 'AccordionHeader';\n\ntype AccordionHeaderElement = React.ComponentRef<typeof Primitive.h3>;\ntype PrimitiveHeading3Props = React.ComponentPropsWithoutRef<typeof Primitive.h3>;\ninterface AccordionHeaderProps extends PrimitiveHeading3Props {}\n\n/**\n * `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible\n * whether or not its content is collapsed.\n */\nconst AccordionHeader = /* @__PURE__ */ React.forwardRef<\n AccordionHeaderElement,\n AccordionHeaderProps\n>(\n // blank line to reduce diff noise\n function AccordionHeader(props: ScopedProps<AccordionHeaderProps>, forwardedRef) {\n const { __scopeAccordion, ...headerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);\n return (\n <Primitive.h3\n data-orientation={accordionContext.orientation}\n data-state={getState(itemContext.open)}\n data-disabled={itemContext.disabled ? '' : undefined}\n {...headerProps}\n ref={forwardedRef}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AccordionTrigger';\n\ntype AccordionTriggerElement = React.ComponentRef<typeof CollapsiblePrimitive.Trigger>;\ntype CollapsibleTriggerProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;\ninterface AccordionTriggerProps extends CollapsibleTriggerProps {}\n\n/**\n * `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It\n * should always be nested inside of an `AccordionHeader`.\n */\nconst AccordionTrigger = /* @__PURE__ */ React.forwardRef<\n AccordionTriggerElement,\n AccordionTriggerProps\n>(\n // blank line to reduce diff noise\n function AccordionTrigger(props: ScopedProps<AccordionTriggerProps>, forwardedRef) {\n const { __scopeAccordion, ...triggerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <Collection.ItemSlot scope={__scopeAccordion}>\n <CollapsiblePrimitive.Trigger\n aria-disabled={(itemContext.open && !collapsibleContext.collapsible) || undefined}\n data-orientation={accordionContext.orientation}\n id={itemContext.triggerId}\n {...collapsibleScope}\n {...triggerProps}\n ref={forwardedRef}\n />\n </Collection.ItemSlot>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AccordionContent';\n\ntype AccordionContentElement = React.ComponentRef<typeof CollapsiblePrimitive.Content>;\ntype CollapsibleContentProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;\ninterface AccordionContentProps extends CollapsibleContentProps {}\n\n/**\n * `AccordionContent` contains the collapsible content for an `AccordionItem`.\n */\nconst AccordionContent = /* @__PURE__ */ React.forwardRef<\n AccordionContentElement,\n AccordionContentProps\n>(\n // blank line to reduce diff noise\n function AccordionContent(props: ScopedProps<AccordionContentProps>, forwardedRef) {\n const { __scopeAccordion, ...contentProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <CollapsiblePrimitive.Content\n role=\"region\"\n aria-labelledby={itemContext.triggerId}\n data-orientation={accordionContext.orientation}\n {...collapsibleScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n ...props.style,\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open?: boolean) {\n return open ? 'open' : 'closed';\n}\n\nexport {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Accordion as Root,\n AccordionItem as Item,\n AccordionHeader as Header,\n AccordionTrigger as Trigger,\n AccordionContent as Content,\n};\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,2BAAmC;AACnC,8BAAiC;AACjC,gCAAgC;AAChC,uBAAqC;AACrC,0CAAqC;AACrC,6BAA0B;AAC1B,2BAAsC;AACtC,+BAAuC;AACvC,sBAAsB;AAGtB,6BAA6B;
|
|
4
|
+
"sourcesContent": ["'use client';\nexport {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Root,\n Item,\n Header,\n Trigger,\n Content,\n} from './accordion';\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n} from './accordion';\n", "import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport { createCollapsibleScope } from '@radix-ui/react-collapsible';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\n\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * Accordion\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACCORDION_NAME = 'Accordion';\nconst ACCORDION_KEYS = ['Home', 'End', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'];\n\nconst [Collection, useCollection, createCollectionScope] =\n createCollection<AccordionTriggerElement>(ACCORDION_NAME);\n\ntype ScopedProps<P> = P & { __scopeAccordion?: Scope };\nconst [createAccordionContext, createAccordionScope] = createContextScope(ACCORDION_NAME, [\n createCollectionScope,\n createCollapsibleScope,\n]);\nconst useCollapsibleScope = createCollapsibleScope();\n\ntype AccordionElement = AccordionImplMultipleElement | AccordionImplSingleElement;\ninterface AccordionSingleProps extends AccordionImplSingleProps {\n type: 'single';\n}\ninterface AccordionMultipleProps extends AccordionImplMultipleProps {\n type: 'multiple';\n}\n\nconst Accordion = /* @__PURE__ */ React.forwardRef<\n AccordionElement,\n AccordionSingleProps | AccordionMultipleProps\n>(\n // blank line to reduce diff noise\n function Accordion(\n props: ScopedProps<AccordionSingleProps | AccordionMultipleProps>,\n forwardedRef,\n ) {\n const { type, ...accordionProps } = props;\n const singleProps = accordionProps as AccordionImplSingleProps;\n const multipleProps = accordionProps as AccordionImplMultipleProps;\n return (\n <Collection.Provider scope={props.__scopeAccordion}>\n {type === 'multiple' ? (\n <AccordionImplMultiple {...multipleProps} ref={forwardedRef} />\n ) : (\n <AccordionImplSingle {...singleProps} ref={forwardedRef} />\n )}\n </Collection.Provider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionValueContextValue = {\n value: string[];\n onItemOpen(value: string): void;\n onItemClose(value: string): void;\n};\n\nconst [AccordionValueProvider, useAccordionValueContext] =\n createAccordionContext<AccordionValueContextValue>(ACCORDION_NAME);\n\nconst [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(\n ACCORDION_NAME,\n { collapsible: false },\n);\n\ntype AccordionImplSingleElement = AccordionImplElement;\ninterface AccordionImplSingleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion item whose content is expanded.\n */\n value?: string;\n /**\n * The value of the item whose content is expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string;\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string): void;\n /**\n * Whether an accordion item can be collapsed after it has been opened.\n * @default false\n */\n collapsible?: boolean;\n}\n\nconst AccordionImplSingle = /* @__PURE__ */ React.forwardRef<\n AccordionImplSingleElement,\n AccordionImplSingleProps\n>(\n // blank line to reduce diff noise\n function AccordionImplSingle(props: ScopedProps<AccordionImplSingleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n collapsible = false,\n ...accordionSingleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? '',\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={React.useMemo(() => (value ? [value] : []), [value])}\n onItemOpen={setValue}\n onItemClose={React.useCallback(() => collapsible && setValue(''), [collapsible, setValue])}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={collapsible}>\n <AccordionImpl {...accordionSingleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplMultipleElement = AccordionImplElement;\ninterface AccordionImplMultipleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion items whose contents are expanded.\n */\n value?: string[];\n /**\n * The value of the items whose contents are expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string[];\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string[]): void;\n}\n\nconst AccordionImplMultiple = /* @__PURE__ */ React.forwardRef<\n AccordionImplMultipleElement,\n AccordionImplMultipleProps\n>(function AccordionImplMultiple(props: ScopedProps<AccordionImplMultipleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n ...accordionMultipleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? [],\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n const handleItemOpen = React.useCallback(\n (itemValue: string) => setValue((prevValue = []) => [...prevValue, itemValue]),\n [setValue],\n );\n\n const handleItemClose = React.useCallback(\n (itemValue: string) =>\n setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)),\n [setValue],\n );\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={value}\n onItemOpen={handleItemOpen}\n onItemClose={handleItemClose}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={true}>\n <AccordionImpl {...accordionMultipleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplContextValue = {\n disabled?: boolean;\n direction: AccordionImplProps['dir'];\n orientation: AccordionImplProps['orientation'];\n};\n\nconst [AccordionImplProvider, useAccordionContext] =\n createAccordionContext<AccordionImplContextValue>(ACCORDION_NAME);\n\ntype AccordionImplElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AccordionImplProps extends PrimitiveDivProps {\n /**\n * Whether or not an accordion is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * The layout in which the Accordion operates.\n * @default vertical\n */\n orientation?: React.AriaAttributes['aria-orientation'];\n /**\n * The language read direction.\n */\n dir?: Direction;\n}\n\nconst AccordionImpl = /* @__PURE__ */ React.forwardRef<AccordionImplElement, AccordionImplProps>(\n function AccordionImpl(props: ScopedProps<AccordionImplProps>, forwardedRef) {\n const { __scopeAccordion, disabled, dir, orientation = 'vertical', ...accordionProps } = props;\n const accordionRef = React.useRef<AccordionImplElement>(null);\n const composedRefs = useComposedRefs(accordionRef, forwardedRef);\n const getItems = useCollection(__scopeAccordion);\n const direction = useDirection(dir);\n const isDirectionLTR = direction === 'ltr';\n\n const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {\n if (!ACCORDION_KEYS.includes(event.key)) return;\n const target = event.target as HTMLElement;\n const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);\n const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);\n const triggerCount = triggerCollection.length;\n\n if (triggerIndex === -1) return;\n\n // Prevents page scroll while user is navigating\n event.preventDefault();\n\n let nextIndex = triggerIndex;\n const homeIndex = 0;\n const endIndex = triggerCount - 1;\n\n const moveNext = () => {\n nextIndex = triggerIndex + 1;\n if (nextIndex > endIndex) {\n nextIndex = homeIndex;\n }\n };\n\n const movePrev = () => {\n nextIndex = triggerIndex - 1;\n if (nextIndex < homeIndex) {\n nextIndex = endIndex;\n }\n };\n\n switch (event.key) {\n case 'Home':\n nextIndex = homeIndex;\n break;\n case 'End':\n nextIndex = endIndex;\n break;\n case 'ArrowRight':\n if (orientation === 'horizontal') {\n if (isDirectionLTR) {\n moveNext();\n } else {\n movePrev();\n }\n }\n break;\n case 'ArrowDown':\n if (orientation === 'vertical') {\n moveNext();\n }\n break;\n case 'ArrowLeft':\n if (orientation === 'horizontal') {\n if (isDirectionLTR) {\n movePrev();\n } else {\n moveNext();\n }\n }\n break;\n case 'ArrowUp':\n if (orientation === 'vertical') {\n movePrev();\n }\n break;\n }\n\n const clampedIndex = nextIndex % triggerCount;\n triggerCollection[clampedIndex]!.ref.current?.focus();\n });\n\n return (\n <AccordionImplProvider\n scope={__scopeAccordion}\n disabled={disabled}\n direction={dir}\n orientation={orientation}\n >\n <Collection.Slot scope={__scopeAccordion}>\n <Primitive.div\n {...accordionProps}\n data-orientation={orientation}\n ref={composedRefs}\n onKeyDown={disabled ? undefined : handleKeyDown}\n />\n </Collection.Slot>\n </AccordionImplProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'AccordionItem';\n\ntype AccordionItemContextValue = { open?: boolean; disabled?: boolean; triggerId: string };\nconst [AccordionItemProvider, useAccordionItemContext] =\n createAccordionContext<AccordionItemContextValue>(ITEM_NAME);\n\ntype AccordionItemElement = React.ComponentRef<typeof CollapsiblePrimitive.Root>;\ntype CollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\ninterface AccordionItemProps extends Omit<\n CollapsibleProps,\n 'open' | 'defaultOpen' | 'onOpenChange'\n> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string;\n}\n\n/**\n * `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.\n */\nconst AccordionItem = /* @__PURE__ */ React.forwardRef<AccordionItemElement, AccordionItemProps>(\n function AccordionItem(props: ScopedProps<AccordionItemProps>, forwardedRef) {\n const { __scopeAccordion, value, ...accordionItemProps } = props;\n const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);\n const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n const triggerId = useId();\n const open = (value && valueContext.value.includes(value)) || false;\n const disabled = accordionContext.disabled || props.disabled;\n\n return (\n <AccordionItemProvider\n scope={__scopeAccordion}\n open={open}\n disabled={disabled}\n triggerId={triggerId}\n >\n <CollapsiblePrimitive.Root\n data-orientation={accordionContext.orientation}\n data-state={getState(open)}\n {...collapsibleScope}\n {...accordionItemProps}\n ref={forwardedRef}\n disabled={disabled}\n open={open}\n onOpenChange={(open) => {\n if (open) {\n valueContext.onItemOpen(value);\n } else {\n valueContext.onItemClose(value);\n }\n }}\n />\n </AccordionItemProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionHeader\n * -----------------------------------------------------------------------------------------------*/\n\nconst HEADER_NAME = 'AccordionHeader';\n\ntype AccordionHeaderElement = React.ComponentRef<typeof Primitive.h3>;\ntype PrimitiveHeading3Props = React.ComponentPropsWithoutRef<typeof Primitive.h3>;\ninterface AccordionHeaderProps extends PrimitiveHeading3Props {}\n\n/**\n * `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible\n * whether or not its content is collapsed.\n */\nconst AccordionHeader = /* @__PURE__ */ React.forwardRef<\n AccordionHeaderElement,\n AccordionHeaderProps\n>(\n // blank line to reduce diff noise\n function AccordionHeader(props: ScopedProps<AccordionHeaderProps>, forwardedRef) {\n const { __scopeAccordion, ...headerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);\n return (\n <Primitive.h3\n data-orientation={accordionContext.orientation}\n data-state={getState(itemContext.open)}\n data-disabled={itemContext.disabled ? '' : undefined}\n {...headerProps}\n ref={forwardedRef}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AccordionTrigger';\n\ntype AccordionTriggerElement = React.ComponentRef<typeof CollapsiblePrimitive.Trigger>;\ntype CollapsibleTriggerProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;\ninterface AccordionTriggerProps extends CollapsibleTriggerProps {}\n\n/**\n * `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It\n * should always be nested inside of an `AccordionHeader`.\n */\nconst AccordionTrigger = /* @__PURE__ */ React.forwardRef<\n AccordionTriggerElement,\n AccordionTriggerProps\n>(\n // blank line to reduce diff noise\n function AccordionTrigger(props: ScopedProps<AccordionTriggerProps>, forwardedRef) {\n const { __scopeAccordion, ...triggerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <Collection.ItemSlot scope={__scopeAccordion}>\n <CollapsiblePrimitive.Trigger\n aria-disabled={(itemContext.open && !collapsibleContext.collapsible) || undefined}\n data-orientation={accordionContext.orientation}\n id={itemContext.triggerId}\n {...collapsibleScope}\n {...triggerProps}\n ref={forwardedRef}\n />\n </Collection.ItemSlot>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AccordionContent';\n\ntype AccordionContentElement = React.ComponentRef<typeof CollapsiblePrimitive.Content>;\ntype CollapsibleContentProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;\ninterface AccordionContentProps extends CollapsibleContentProps {}\n\n/**\n * `AccordionContent` contains the collapsible content for an `AccordionItem`.\n */\nconst AccordionContent = /* @__PURE__ */ React.forwardRef<\n AccordionContentElement,\n AccordionContentProps\n>(\n // blank line to reduce diff noise\n function AccordionContent(props: ScopedProps<AccordionContentProps>, forwardedRef) {\n const { __scopeAccordion, ...contentProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <CollapsiblePrimitive.Content\n role=\"region\"\n aria-labelledby={itemContext.triggerId}\n data-orientation={accordionContext.orientation}\n {...collapsibleScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n ...props.style,\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open?: boolean) {\n return open ? 'open' : 'closed';\n}\n\nexport {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Accordion as Root,\n AccordionItem as Item,\n AccordionHeader as Header,\n AccordionTrigger as Trigger,\n AccordionContent as Content,\n};\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,2BAAmC;AACnC,8BAAiC;AACjC,gCAAgC;AAChC,uBAAqC;AACrC,0CAAqC;AACrC,6BAA0B;AAC1B,2BAAsC;AACtC,+BAAuC;AACvC,sBAAsB;AAGtB,6BAA6B;AA4CnB;AApCV,IAAM,iBAAiB;AACvB,IAAM,iBAAiB,CAAC,QAAQ,OAAO,aAAa,WAAW,aAAa,YAAY;AAExF,IAAM,CAAC,YAAY,eAAe,qBAAqB,QACrD,0CAA0C,cAAc;AAG1D,IAAM,CAAC,wBAAwB,oBAAoB,QAAI,yCAAmB,gBAAgB;AAAA,EACxF;AAAA,EACA;AACF,CAAC;AACD,IAAM,0BAAs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,gBAAgB;AAC7E,UAAM,cAAc,wBAAwB,cAAc,gBAAgB;AAC1E,UAAM,mBAAmB,oBAAoB,gBAAgB;AAC7D,WACE;AAAA,MAAsB;AAAA,MAArB;AAAA,QACC,MAAK;AAAA,QACL,mBAAiB,YAAY;AAAA,QAC7B,oBAAkB,iBAAiB;AAAA,QAClC,GAAG;AAAA,QACH,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,OAAO;AAAA,UACL,oCAAoC;AAAA,UACpC,mCAAmC;AAAA,UACnC,GAAG,MAAM;AAAA,QACX;AAAA;AAAA,IACF;AAAA,EAEJ,GApBA;AAqBF;AAIA,SAAS,SAAS,MAAgB;AAChC,SAAO,OAAO,SAAS;AACzB;AAFS;",
|
|
6
6
|
"names": ["Accordion", "AccordionImplSingle", "AccordionImplMultiple", "value", "AccordionImpl", "AccordionItem", "open", "AccordionHeader", "AccordionTrigger", "AccordionContent"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -15,18 +15,6 @@ import { createCollapsibleScope } from "@radix-ui/react-collapsible";
|
|
|
15
15
|
import { useId } from "@radix-ui/react-id";
|
|
16
16
|
import { useDirection } from "@radix-ui/react-direction";
|
|
17
17
|
import { jsx } from "react/jsx-runtime";
|
|
18
|
-
var AccordionType = {
|
|
19
|
-
Single: "single",
|
|
20
|
-
Multiple: "multiple"
|
|
21
|
-
};
|
|
22
|
-
var Orientation = {
|
|
23
|
-
Vertical: "vertical",
|
|
24
|
-
Horizontal: "horizontal"
|
|
25
|
-
};
|
|
26
|
-
var Direction = {
|
|
27
|
-
LTR: "ltr",
|
|
28
|
-
RTL: "rtl"
|
|
29
|
-
};
|
|
30
18
|
var ACCORDION_NAME = "Accordion";
|
|
31
19
|
var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
|
|
32
20
|
var [Collection, useCollection, createCollectionScope] = createCollection(ACCORDION_NAME);
|
|
@@ -41,7 +29,7 @@ var Accordion = /* @__PURE__ */ React.forwardRef(
|
|
|
41
29
|
const { type, ...accordionProps } = props;
|
|
42
30
|
const singleProps = accordionProps;
|
|
43
31
|
const multipleProps = accordionProps;
|
|
44
|
-
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeAccordion, children: type ===
|
|
32
|
+
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeAccordion, children: type === "multiple" ? /* @__PURE__ */ jsx(AccordionImplMultiple, { ...multipleProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(AccordionImplSingle, { ...singleProps, ref: forwardedRef }) });
|
|
45
33
|
}, "Accordion")
|
|
46
34
|
);
|
|
47
35
|
var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
|
|
@@ -114,18 +102,12 @@ var AccordionImplMultiple = /* @__PURE__ */ React.forwardRef(/* @__PURE__ */ __n
|
|
|
114
102
|
var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
|
|
115
103
|
var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
116
104
|
/* @__PURE__ */ __name(function AccordionImpl2(props, forwardedRef) {
|
|
117
|
-
const {
|
|
118
|
-
__scopeAccordion,
|
|
119
|
-
disabled,
|
|
120
|
-
dir,
|
|
121
|
-
orientation = Orientation.Vertical,
|
|
122
|
-
...accordionProps
|
|
123
|
-
} = props;
|
|
105
|
+
const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
|
|
124
106
|
const accordionRef = React.useRef(null);
|
|
125
107
|
const composedRefs = useComposedRefs(accordionRef, forwardedRef);
|
|
126
108
|
const getItems = useCollection(__scopeAccordion);
|
|
127
109
|
const direction = useDirection(dir);
|
|
128
|
-
const isDirectionLTR = direction ===
|
|
110
|
+
const isDirectionLTR = direction === "ltr";
|
|
129
111
|
const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {
|
|
130
112
|
if (!ACCORDION_KEYS.includes(event.key)) return;
|
|
131
113
|
const target = event.target;
|
|
@@ -157,7 +139,7 @@ var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
157
139
|
nextIndex = endIndex;
|
|
158
140
|
break;
|
|
159
141
|
case "ArrowRight":
|
|
160
|
-
if (orientation ===
|
|
142
|
+
if (orientation === "horizontal") {
|
|
161
143
|
if (isDirectionLTR) {
|
|
162
144
|
moveNext();
|
|
163
145
|
} else {
|
|
@@ -166,12 +148,12 @@ var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
166
148
|
}
|
|
167
149
|
break;
|
|
168
150
|
case "ArrowDown":
|
|
169
|
-
if (orientation ===
|
|
151
|
+
if (orientation === "vertical") {
|
|
170
152
|
moveNext();
|
|
171
153
|
}
|
|
172
154
|
break;
|
|
173
155
|
case "ArrowLeft":
|
|
174
|
-
if (orientation ===
|
|
156
|
+
if (orientation === "horizontal") {
|
|
175
157
|
if (isDirectionLTR) {
|
|
176
158
|
movePrev();
|
|
177
159
|
} else {
|
|
@@ -180,7 +162,7 @@ var AccordionImpl = /* @__PURE__ */ React.forwardRef(
|
|
|
180
162
|
}
|
|
181
163
|
break;
|
|
182
164
|
case "ArrowUp":
|
|
183
|
-
if (orientation ===
|
|
165
|
+
if (orientation === "vertical") {
|
|
184
166
|
movePrev();
|
|
185
167
|
}
|
|
186
168
|
break;
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/accordion.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport { createCollapsibleScope } from '@radix-ui/react-collapsible';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\n\nconst AccordionType = {\n Single: 'single',\n Multiple: 'multiple',\n} as const;\n\nconst Orientation = {\n Vertical: 'vertical',\n Horizontal: 'horizontal',\n} as const;\n\nconst Direction = {\n LTR: 'ltr',\n RTL: 'rtl',\n} as const;\n\ntype AccordionType = (typeof AccordionType)[keyof typeof AccordionType];\ntype Orientation = (typeof Orientation)[keyof typeof Orientation];\ntype Direction = (typeof Direction)[keyof typeof Direction];\n\n/* -------------------------------------------------------------------------------------------------\n * Accordion\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACCORDION_NAME = 'Accordion';\nconst ACCORDION_KEYS = ['Home', 'End', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'];\n\nconst [Collection, useCollection, createCollectionScope] =\n createCollection<AccordionTriggerElement>(ACCORDION_NAME);\n\ntype ScopedProps<P> = P & { __scopeAccordion?: Scope };\nconst [createAccordionContext, createAccordionScope] = createContextScope(ACCORDION_NAME, [\n createCollectionScope,\n createCollapsibleScope,\n]);\nconst useCollapsibleScope = createCollapsibleScope();\n\ntype AccordionElement = AccordionImplMultipleElement | AccordionImplSingleElement;\ninterface AccordionSingleProps extends AccordionImplSingleProps {\n type: typeof AccordionType.Single;\n}\ninterface AccordionMultipleProps extends AccordionImplMultipleProps {\n type: typeof AccordionType.Multiple;\n}\n\nconst Accordion = /* @__PURE__ */ React.forwardRef<\n AccordionElement,\n AccordionSingleProps | AccordionMultipleProps\n>(\n // blank line to reduce diff noise\n function Accordion(\n props: ScopedProps<AccordionSingleProps | AccordionMultipleProps>,\n forwardedRef,\n ) {\n const { type, ...accordionProps } = props;\n const singleProps = accordionProps as AccordionImplSingleProps;\n const multipleProps = accordionProps as AccordionImplMultipleProps;\n return (\n <Collection.Provider scope={props.__scopeAccordion}>\n {type === AccordionType.Multiple ? (\n <AccordionImplMultiple {...multipleProps} ref={forwardedRef} />\n ) : (\n <AccordionImplSingle {...singleProps} ref={forwardedRef} />\n )}\n </Collection.Provider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionValueContextValue = {\n value: string[];\n onItemOpen(value: string): void;\n onItemClose(value: string): void;\n};\n\nconst [AccordionValueProvider, useAccordionValueContext] =\n createAccordionContext<AccordionValueContextValue>(ACCORDION_NAME);\n\nconst [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(\n ACCORDION_NAME,\n { collapsible: false },\n);\n\ntype AccordionImplSingleElement = AccordionImplElement;\ninterface AccordionImplSingleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion item whose content is expanded.\n */\n value?: string;\n /**\n * The value of the item whose content is expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string;\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string): void;\n /**\n * Whether an accordion item can be collapsed after it has been opened.\n * @default false\n */\n collapsible?: boolean;\n}\n\nconst AccordionImplSingle = /* @__PURE__ */ React.forwardRef<\n AccordionImplSingleElement,\n AccordionImplSingleProps\n>(\n // blank line to reduce diff noise\n function AccordionImplSingle(props: ScopedProps<AccordionImplSingleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n collapsible = false,\n ...accordionSingleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? '',\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={React.useMemo(() => (value ? [value] : []), [value])}\n onItemOpen={setValue}\n onItemClose={React.useCallback(() => collapsible && setValue(''), [collapsible, setValue])}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={collapsible}>\n <AccordionImpl {...accordionSingleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplMultipleElement = AccordionImplElement;\ninterface AccordionImplMultipleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion items whose contents are expanded.\n */\n value?: string[];\n /**\n * The value of the items whose contents are expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string[];\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string[]): void;\n}\n\nconst AccordionImplMultiple = /* @__PURE__ */ React.forwardRef<\n AccordionImplMultipleElement,\n AccordionImplMultipleProps\n>(function AccordionImplMultiple(props: ScopedProps<AccordionImplMultipleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n ...accordionMultipleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? [],\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n const handleItemOpen = React.useCallback(\n (itemValue: string) => setValue((prevValue = []) => [...prevValue, itemValue]),\n [setValue],\n );\n\n const handleItemClose = React.useCallback(\n (itemValue: string) =>\n setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)),\n [setValue],\n );\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={value}\n onItemOpen={handleItemOpen}\n onItemClose={handleItemClose}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={true}>\n <AccordionImpl {...accordionMultipleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplContextValue = {\n disabled?: boolean;\n direction: AccordionImplProps['dir'];\n orientation: AccordionImplProps['orientation'];\n};\n\nconst [AccordionImplProvider, useAccordionContext] =\n createAccordionContext<AccordionImplContextValue>(ACCORDION_NAME);\n\ntype AccordionImplElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AccordionImplProps extends PrimitiveDivProps {\n /**\n * Whether or not an accordion is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * The layout in which the Accordion operates.\n * @default vertical\n */\n orientation?: Orientation;\n /**\n * The language read direction.\n */\n dir?: Direction;\n}\n\nconst AccordionImpl = /* @__PURE__ */ React.forwardRef<AccordionImplElement, AccordionImplProps>(\n function AccordionImpl(props: ScopedProps<AccordionImplProps>, forwardedRef) {\n const {\n __scopeAccordion,\n disabled,\n dir,\n orientation = Orientation.Vertical,\n ...accordionProps\n } = props;\n const accordionRef = React.useRef<AccordionImplElement>(null);\n const composedRefs = useComposedRefs(accordionRef, forwardedRef);\n const getItems = useCollection(__scopeAccordion);\n const direction = useDirection(dir);\n const isDirectionLTR = direction === Direction.LTR;\n\n const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {\n if (!ACCORDION_KEYS.includes(event.key)) return;\n const target = event.target as HTMLElement;\n const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);\n const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);\n const triggerCount = triggerCollection.length;\n\n if (triggerIndex === -1) return;\n\n // Prevents page scroll while user is navigating\n event.preventDefault();\n\n let nextIndex = triggerIndex;\n const homeIndex = 0;\n const endIndex = triggerCount - 1;\n\n const moveNext = () => {\n nextIndex = triggerIndex + 1;\n if (nextIndex > endIndex) {\n nextIndex = homeIndex;\n }\n };\n\n const movePrev = () => {\n nextIndex = triggerIndex - 1;\n if (nextIndex < homeIndex) {\n nextIndex = endIndex;\n }\n };\n\n switch (event.key) {\n case 'Home':\n nextIndex = homeIndex;\n break;\n case 'End':\n nextIndex = endIndex;\n break;\n case 'ArrowRight':\n if (orientation === Orientation.Horizontal) {\n if (isDirectionLTR) {\n moveNext();\n } else {\n movePrev();\n }\n }\n break;\n case 'ArrowDown':\n if (orientation === Orientation.Vertical) {\n moveNext();\n }\n break;\n case 'ArrowLeft':\n if (orientation === Orientation.Horizontal) {\n if (isDirectionLTR) {\n movePrev();\n } else {\n moveNext();\n }\n }\n break;\n case 'ArrowUp':\n if (orientation === Orientation.Vertical) {\n movePrev();\n }\n break;\n }\n\n const clampedIndex = nextIndex % triggerCount;\n triggerCollection[clampedIndex]!.ref.current?.focus();\n });\n\n return (\n <AccordionImplProvider\n scope={__scopeAccordion}\n disabled={disabled}\n direction={dir}\n orientation={orientation}\n >\n <Collection.Slot scope={__scopeAccordion}>\n <Primitive.div\n {...accordionProps}\n data-orientation={orientation}\n ref={composedRefs}\n onKeyDown={disabled ? undefined : handleKeyDown}\n />\n </Collection.Slot>\n </AccordionImplProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'AccordionItem';\n\ntype AccordionItemContextValue = { open?: boolean; disabled?: boolean; triggerId: string };\nconst [AccordionItemProvider, useAccordionItemContext] =\n createAccordionContext<AccordionItemContextValue>(ITEM_NAME);\n\ntype AccordionItemElement = React.ComponentRef<typeof CollapsiblePrimitive.Root>;\ntype CollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\ninterface AccordionItemProps extends Omit<\n CollapsibleProps,\n 'open' | 'defaultOpen' | 'onOpenChange'\n> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string;\n}\n\n/**\n * `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.\n */\nconst AccordionItem = /* @__PURE__ */ React.forwardRef<AccordionItemElement, AccordionItemProps>(\n function AccordionItem(props: ScopedProps<AccordionItemProps>, forwardedRef) {\n const { __scopeAccordion, value, ...accordionItemProps } = props;\n const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);\n const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n const triggerId = useId();\n const open = (value && valueContext.value.includes(value)) || false;\n const disabled = accordionContext.disabled || props.disabled;\n\n return (\n <AccordionItemProvider\n scope={__scopeAccordion}\n open={open}\n disabled={disabled}\n triggerId={triggerId}\n >\n <CollapsiblePrimitive.Root\n data-orientation={accordionContext.orientation}\n data-state={getState(open)}\n {...collapsibleScope}\n {...accordionItemProps}\n ref={forwardedRef}\n disabled={disabled}\n open={open}\n onOpenChange={(open) => {\n if (open) {\n valueContext.onItemOpen(value);\n } else {\n valueContext.onItemClose(value);\n }\n }}\n />\n </AccordionItemProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionHeader\n * -----------------------------------------------------------------------------------------------*/\n\nconst HEADER_NAME = 'AccordionHeader';\n\ntype AccordionHeaderElement = React.ComponentRef<typeof Primitive.h3>;\ntype PrimitiveHeading3Props = React.ComponentPropsWithoutRef<typeof Primitive.h3>;\ninterface AccordionHeaderProps extends PrimitiveHeading3Props {}\n\n/**\n * `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible\n * whether or not its content is collapsed.\n */\nconst AccordionHeader = /* @__PURE__ */ React.forwardRef<\n AccordionHeaderElement,\n AccordionHeaderProps\n>(\n // blank line to reduce diff noise\n function AccordionHeader(props: ScopedProps<AccordionHeaderProps>, forwardedRef) {\n const { __scopeAccordion, ...headerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);\n return (\n <Primitive.h3\n data-orientation={accordionContext.orientation}\n data-state={getState(itemContext.open)}\n data-disabled={itemContext.disabled ? '' : undefined}\n {...headerProps}\n ref={forwardedRef}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AccordionTrigger';\n\ntype AccordionTriggerElement = React.ComponentRef<typeof CollapsiblePrimitive.Trigger>;\ntype CollapsibleTriggerProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;\ninterface AccordionTriggerProps extends CollapsibleTriggerProps {}\n\n/**\n * `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It\n * should always be nested inside of an `AccordionHeader`.\n */\nconst AccordionTrigger = /* @__PURE__ */ React.forwardRef<\n AccordionTriggerElement,\n AccordionTriggerProps\n>(\n // blank line to reduce diff noise\n function AccordionTrigger(props: ScopedProps<AccordionTriggerProps>, forwardedRef) {\n const { __scopeAccordion, ...triggerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <Collection.ItemSlot scope={__scopeAccordion}>\n <CollapsiblePrimitive.Trigger\n aria-disabled={(itemContext.open && !collapsibleContext.collapsible) || undefined}\n data-orientation={accordionContext.orientation}\n id={itemContext.triggerId}\n {...collapsibleScope}\n {...triggerProps}\n ref={forwardedRef}\n />\n </Collection.ItemSlot>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AccordionContent';\n\ntype AccordionContentElement = React.ComponentRef<typeof CollapsiblePrimitive.Content>;\ntype CollapsibleContentProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;\ninterface AccordionContentProps extends CollapsibleContentProps {}\n\n/**\n * `AccordionContent` contains the collapsible content for an `AccordionItem`.\n */\nconst AccordionContent = /* @__PURE__ */ React.forwardRef<\n AccordionContentElement,\n AccordionContentProps\n>(\n // blank line to reduce diff noise\n function AccordionContent(props: ScopedProps<AccordionContentProps>, forwardedRef) {\n const { __scopeAccordion, ...contentProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <CollapsiblePrimitive.Content\n role=\"region\"\n aria-labelledby={itemContext.triggerId}\n data-orientation={accordionContext.orientation}\n {...collapsibleScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n ...props.style,\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open?: boolean) {\n return open ? 'open' : 'closed';\n}\n\nexport {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Accordion as Root,\n AccordionItem as Item,\n AccordionHeader as Header,\n AccordionTrigger as Trigger,\n AccordionContent as Content,\n};\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n};\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,YAAY,0BAA0B;AACtC,SAAS,8BAA8B;AACvC,SAAS,aAAa;AAGtB,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport { createCollapsibleScope } from '@radix-ui/react-collapsible';\nimport { useId } from '@radix-ui/react-id';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\n\ntype Direction = 'ltr' | 'rtl';\n\n/* -------------------------------------------------------------------------------------------------\n * Accordion\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACCORDION_NAME = 'Accordion';\nconst ACCORDION_KEYS = ['Home', 'End', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'];\n\nconst [Collection, useCollection, createCollectionScope] =\n createCollection<AccordionTriggerElement>(ACCORDION_NAME);\n\ntype ScopedProps<P> = P & { __scopeAccordion?: Scope };\nconst [createAccordionContext, createAccordionScope] = createContextScope(ACCORDION_NAME, [\n createCollectionScope,\n createCollapsibleScope,\n]);\nconst useCollapsibleScope = createCollapsibleScope();\n\ntype AccordionElement = AccordionImplMultipleElement | AccordionImplSingleElement;\ninterface AccordionSingleProps extends AccordionImplSingleProps {\n type: 'single';\n}\ninterface AccordionMultipleProps extends AccordionImplMultipleProps {\n type: 'multiple';\n}\n\nconst Accordion = /* @__PURE__ */ React.forwardRef<\n AccordionElement,\n AccordionSingleProps | AccordionMultipleProps\n>(\n // blank line to reduce diff noise\n function Accordion(\n props: ScopedProps<AccordionSingleProps | AccordionMultipleProps>,\n forwardedRef,\n ) {\n const { type, ...accordionProps } = props;\n const singleProps = accordionProps as AccordionImplSingleProps;\n const multipleProps = accordionProps as AccordionImplMultipleProps;\n return (\n <Collection.Provider scope={props.__scopeAccordion}>\n {type === 'multiple' ? (\n <AccordionImplMultiple {...multipleProps} ref={forwardedRef} />\n ) : (\n <AccordionImplSingle {...singleProps} ref={forwardedRef} />\n )}\n </Collection.Provider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionValueContextValue = {\n value: string[];\n onItemOpen(value: string): void;\n onItemClose(value: string): void;\n};\n\nconst [AccordionValueProvider, useAccordionValueContext] =\n createAccordionContext<AccordionValueContextValue>(ACCORDION_NAME);\n\nconst [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(\n ACCORDION_NAME,\n { collapsible: false },\n);\n\ntype AccordionImplSingleElement = AccordionImplElement;\ninterface AccordionImplSingleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion item whose content is expanded.\n */\n value?: string;\n /**\n * The value of the item whose content is expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string;\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string): void;\n /**\n * Whether an accordion item can be collapsed after it has been opened.\n * @default false\n */\n collapsible?: boolean;\n}\n\nconst AccordionImplSingle = /* @__PURE__ */ React.forwardRef<\n AccordionImplSingleElement,\n AccordionImplSingleProps\n>(\n // blank line to reduce diff noise\n function AccordionImplSingle(props: ScopedProps<AccordionImplSingleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n collapsible = false,\n ...accordionSingleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? '',\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={React.useMemo(() => (value ? [value] : []), [value])}\n onItemOpen={setValue}\n onItemClose={React.useCallback(() => collapsible && setValue(''), [collapsible, setValue])}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={collapsible}>\n <AccordionImpl {...accordionSingleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplMultipleElement = AccordionImplElement;\ninterface AccordionImplMultipleProps extends AccordionImplProps {\n /**\n * The controlled stateful value of the accordion items whose contents are expanded.\n */\n value?: string[];\n /**\n * The value of the items whose contents are expanded when the accordion is initially rendered. Use\n * `defaultValue` if you do not need to control the state of an accordion.\n */\n defaultValue?: string[];\n /**\n * The callback that fires when the state of the accordion changes.\n */\n onValueChange?(value: string[]): void;\n}\n\nconst AccordionImplMultiple = /* @__PURE__ */ React.forwardRef<\n AccordionImplMultipleElement,\n AccordionImplMultipleProps\n>(function AccordionImplMultiple(props: ScopedProps<AccordionImplMultipleProps>, forwardedRef) {\n const {\n value: valueProp,\n defaultValue,\n onValueChange = () => {},\n ...accordionMultipleProps\n } = props;\n\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? [],\n onChange: onValueChange,\n caller: ACCORDION_NAME,\n });\n\n const handleItemOpen = React.useCallback(\n (itemValue: string) => setValue((prevValue = []) => [...prevValue, itemValue]),\n [setValue],\n );\n\n const handleItemClose = React.useCallback(\n (itemValue: string) =>\n setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)),\n [setValue],\n );\n\n return (\n <AccordionValueProvider\n scope={props.__scopeAccordion}\n value={value}\n onItemOpen={handleItemOpen}\n onItemClose={handleItemClose}\n >\n <AccordionCollapsibleProvider scope={props.__scopeAccordion} collapsible={true}>\n <AccordionImpl {...accordionMultipleProps} ref={forwardedRef} />\n </AccordionCollapsibleProvider>\n </AccordionValueProvider>\n );\n});\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype AccordionImplContextValue = {\n disabled?: boolean;\n direction: AccordionImplProps['dir'];\n orientation: AccordionImplProps['orientation'];\n};\n\nconst [AccordionImplProvider, useAccordionContext] =\n createAccordionContext<AccordionImplContextValue>(ACCORDION_NAME);\n\ntype AccordionImplElement = React.ComponentRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AccordionImplProps extends PrimitiveDivProps {\n /**\n * Whether or not an accordion is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * The layout in which the Accordion operates.\n * @default vertical\n */\n orientation?: React.AriaAttributes['aria-orientation'];\n /**\n * The language read direction.\n */\n dir?: Direction;\n}\n\nconst AccordionImpl = /* @__PURE__ */ React.forwardRef<AccordionImplElement, AccordionImplProps>(\n function AccordionImpl(props: ScopedProps<AccordionImplProps>, forwardedRef) {\n const { __scopeAccordion, disabled, dir, orientation = 'vertical', ...accordionProps } = props;\n const accordionRef = React.useRef<AccordionImplElement>(null);\n const composedRefs = useComposedRefs(accordionRef, forwardedRef);\n const getItems = useCollection(__scopeAccordion);\n const direction = useDirection(dir);\n const isDirectionLTR = direction === 'ltr';\n\n const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {\n if (!ACCORDION_KEYS.includes(event.key)) return;\n const target = event.target as HTMLElement;\n const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);\n const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);\n const triggerCount = triggerCollection.length;\n\n if (triggerIndex === -1) return;\n\n // Prevents page scroll while user is navigating\n event.preventDefault();\n\n let nextIndex = triggerIndex;\n const homeIndex = 0;\n const endIndex = triggerCount - 1;\n\n const moveNext = () => {\n nextIndex = triggerIndex + 1;\n if (nextIndex > endIndex) {\n nextIndex = homeIndex;\n }\n };\n\n const movePrev = () => {\n nextIndex = triggerIndex - 1;\n if (nextIndex < homeIndex) {\n nextIndex = endIndex;\n }\n };\n\n switch (event.key) {\n case 'Home':\n nextIndex = homeIndex;\n break;\n case 'End':\n nextIndex = endIndex;\n break;\n case 'ArrowRight':\n if (orientation === 'horizontal') {\n if (isDirectionLTR) {\n moveNext();\n } else {\n movePrev();\n }\n }\n break;\n case 'ArrowDown':\n if (orientation === 'vertical') {\n moveNext();\n }\n break;\n case 'ArrowLeft':\n if (orientation === 'horizontal') {\n if (isDirectionLTR) {\n movePrev();\n } else {\n moveNext();\n }\n }\n break;\n case 'ArrowUp':\n if (orientation === 'vertical') {\n movePrev();\n }\n break;\n }\n\n const clampedIndex = nextIndex % triggerCount;\n triggerCollection[clampedIndex]!.ref.current?.focus();\n });\n\n return (\n <AccordionImplProvider\n scope={__scopeAccordion}\n disabled={disabled}\n direction={dir}\n orientation={orientation}\n >\n <Collection.Slot scope={__scopeAccordion}>\n <Primitive.div\n {...accordionProps}\n data-orientation={orientation}\n ref={composedRefs}\n onKeyDown={disabled ? undefined : handleKeyDown}\n />\n </Collection.Slot>\n </AccordionImplProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'AccordionItem';\n\ntype AccordionItemContextValue = { open?: boolean; disabled?: boolean; triggerId: string };\nconst [AccordionItemProvider, useAccordionItemContext] =\n createAccordionContext<AccordionItemContextValue>(ITEM_NAME);\n\ntype AccordionItemElement = React.ComponentRef<typeof CollapsiblePrimitive.Root>;\ntype CollapsibleProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Root>;\ninterface AccordionItemProps extends Omit<\n CollapsibleProps,\n 'open' | 'defaultOpen' | 'onOpenChange'\n> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n *\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string;\n}\n\n/**\n * `AccordionItem` contains all of the parts of a collapsible section inside of an `Accordion`.\n */\nconst AccordionItem = /* @__PURE__ */ React.forwardRef<AccordionItemElement, AccordionItemProps>(\n function AccordionItem(props: ScopedProps<AccordionItemProps>, forwardedRef) {\n const { __scopeAccordion, value, ...accordionItemProps } = props;\n const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);\n const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n const triggerId = useId();\n const open = (value && valueContext.value.includes(value)) || false;\n const disabled = accordionContext.disabled || props.disabled;\n\n return (\n <AccordionItemProvider\n scope={__scopeAccordion}\n open={open}\n disabled={disabled}\n triggerId={triggerId}\n >\n <CollapsiblePrimitive.Root\n data-orientation={accordionContext.orientation}\n data-state={getState(open)}\n {...collapsibleScope}\n {...accordionItemProps}\n ref={forwardedRef}\n disabled={disabled}\n open={open}\n onOpenChange={(open) => {\n if (open) {\n valueContext.onItemOpen(value);\n } else {\n valueContext.onItemClose(value);\n }\n }}\n />\n </AccordionItemProvider>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionHeader\n * -----------------------------------------------------------------------------------------------*/\n\nconst HEADER_NAME = 'AccordionHeader';\n\ntype AccordionHeaderElement = React.ComponentRef<typeof Primitive.h3>;\ntype PrimitiveHeading3Props = React.ComponentPropsWithoutRef<typeof Primitive.h3>;\ninterface AccordionHeaderProps extends PrimitiveHeading3Props {}\n\n/**\n * `AccordionHeader` contains the content for the parts of an `AccordionItem` that will be visible\n * whether or not its content is collapsed.\n */\nconst AccordionHeader = /* @__PURE__ */ React.forwardRef<\n AccordionHeaderElement,\n AccordionHeaderProps\n>(\n // blank line to reduce diff noise\n function AccordionHeader(props: ScopedProps<AccordionHeaderProps>, forwardedRef) {\n const { __scopeAccordion, ...headerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);\n return (\n <Primitive.h3\n data-orientation={accordionContext.orientation}\n data-state={getState(itemContext.open)}\n data-disabled={itemContext.disabled ? '' : undefined}\n {...headerProps}\n ref={forwardedRef}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AccordionTrigger';\n\ntype AccordionTriggerElement = React.ComponentRef<typeof CollapsiblePrimitive.Trigger>;\ntype CollapsibleTriggerProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Trigger>;\ninterface AccordionTriggerProps extends CollapsibleTriggerProps {}\n\n/**\n * `AccordionTrigger` is the trigger that toggles the collapsed state of an `AccordionItem`. It\n * should always be nested inside of an `AccordionHeader`.\n */\nconst AccordionTrigger = /* @__PURE__ */ React.forwardRef<\n AccordionTriggerElement,\n AccordionTriggerProps\n>(\n // blank line to reduce diff noise\n function AccordionTrigger(props: ScopedProps<AccordionTriggerProps>, forwardedRef) {\n const { __scopeAccordion, ...triggerProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <Collection.ItemSlot scope={__scopeAccordion}>\n <CollapsiblePrimitive.Trigger\n aria-disabled={(itemContext.open && !collapsibleContext.collapsible) || undefined}\n data-orientation={accordionContext.orientation}\n id={itemContext.triggerId}\n {...collapsibleScope}\n {...triggerProps}\n ref={forwardedRef}\n />\n </Collection.ItemSlot>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * AccordionContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AccordionContent';\n\ntype AccordionContentElement = React.ComponentRef<typeof CollapsiblePrimitive.Content>;\ntype CollapsibleContentProps = React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.Content>;\ninterface AccordionContentProps extends CollapsibleContentProps {}\n\n/**\n * `AccordionContent` contains the collapsible content for an `AccordionItem`.\n */\nconst AccordionContent = /* @__PURE__ */ React.forwardRef<\n AccordionContentElement,\n AccordionContentProps\n>(\n // blank line to reduce diff noise\n function AccordionContent(props: ScopedProps<AccordionContentProps>, forwardedRef) {\n const { __scopeAccordion, ...contentProps } = props;\n const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);\n const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);\n const collapsibleScope = useCollapsibleScope(__scopeAccordion);\n return (\n <CollapsiblePrimitive.Content\n role=\"region\"\n aria-labelledby={itemContext.triggerId}\n data-orientation={accordionContext.orientation}\n {...collapsibleScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n ...props.style,\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open?: boolean) {\n return open ? 'open' : 'closed';\n}\n\nexport {\n createAccordionScope,\n //\n Accordion,\n AccordionItem,\n AccordionHeader,\n AccordionTrigger,\n AccordionContent,\n //\n Accordion as Root,\n AccordionItem as Item,\n AccordionHeader as Header,\n AccordionTrigger as Trigger,\n AccordionContent as Content,\n};\nexport type {\n AccordionSingleProps,\n AccordionMultipleProps,\n AccordionItemProps,\n AccordionHeaderProps,\n AccordionTriggerProps,\n AccordionContentProps,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,iBAAiB;AAC1B,YAAY,0BAA0B;AACtC,SAAS,8BAA8B;AACvC,SAAS,aAAa;AAGtB,SAAS,oBAAoB;AA4CnB;AApCV,IAAM,iBAAiB;AACvB,IAAM,iBAAiB,CAAC,QAAQ,OAAO,aAAa,WAAW,aAAa,YAAY;AAExF,IAAM,CAAC,YAAY,eAAe,qBAAqB,IACrD,iBAA0C,cAAc;AAG1D,IAAM,CAAC,wBAAwB,oBAAoB,IAAI,mBAAmB,gBAAgB;AAAA,EACxF;AAAA,EACA;AACF,CAAC;AACD,IAAM,sBAAsB,uBAAuB;AAUnD,IAAM,YAA4B,gBAAM;AAAA;AAAA,EAKtC,gCAASA,WACP,OACA,cACA;AACA,UAAM,EAAE,MAAM,GAAG,eAAe,IAAI;AACpC,UAAM,cAAc;AACpB,UAAM,gBAAgB;AACtB,WACE,oBAAC,WAAW,UAAX,EAAoB,OAAO,MAAM,kBAC/B,mBAAS,aACR,oBAAC,yBAAuB,GAAG,eAAe,KAAK,cAAc,IAE7D,oBAAC,uBAAqB,GAAG,aAAa,KAAK,cAAc,GAE7D;AAAA,EAEJ,GAhBA;AAiBF;AAUA,IAAM,CAAC,wBAAwB,wBAAwB,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SAAS,SAAS,MAAgB;AAChC,SAAO,OAAO,SAAS;AACzB;AAFS;",
|
|
6
6
|
"names": ["Accordion", "AccordionImplSingle", "AccordionImplMultiple", "value", "AccordionImpl", "AccordionItem", "open", "AccordionHeader", "AccordionTrigger", "AccordionContent"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-accordion",
|
|
3
|
-
"version": "1.2.18
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
],
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@radix-ui/primitive": "1.1.
|
|
15
|
-
"@radix-ui/react-
|
|
16
|
-
"@radix-ui/react-
|
|
17
|
-
"@radix-ui/react-
|
|
18
|
-
"@radix-ui/react-
|
|
19
|
-
"@radix-ui/react-
|
|
20
|
-
"@radix-ui/react-
|
|
21
|
-
"@radix-ui/react-
|
|
22
|
-
"@radix-ui/react-
|
|
14
|
+
"@radix-ui/primitive": "1.1.7",
|
|
15
|
+
"@radix-ui/react-collapsible": "1.1.18",
|
|
16
|
+
"@radix-ui/react-collection": "1.1.13",
|
|
17
|
+
"@radix-ui/react-compose-refs": "1.1.4",
|
|
18
|
+
"@radix-ui/react-context": "1.2.1",
|
|
19
|
+
"@radix-ui/react-direction": "1.1.3",
|
|
20
|
+
"@radix-ui/react-id": "1.1.3",
|
|
21
|
+
"@radix-ui/react-primitive": "2.1.8",
|
|
22
|
+
"@radix-ui/react-use-controllable-state": "1.2.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/react": "^19.2.17",
|