@spark-ui/components 10.9.0 → 10.10.0

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.
@@ -1,6 +1,3 @@
1
- import {
2
- Collapsible
3
- } from "../chunk-3LEFXZNI.mjs";
4
1
  import {
5
2
  Icon
6
3
  } from "../chunk-UMUMFMFB.mjs";
@@ -10,48 +7,44 @@ import {
10
7
  } from "../chunk-6QCEPQ3U.mjs";
11
8
 
12
9
  // src/accordion/Accordion.tsx
13
- import * as accordion from "@zag-js/accordion";
14
- import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
10
+ import { Accordion as BaseAccordion } from "@base-ui-components/react/accordion";
15
11
  import { cx } from "class-variance-authority";
16
- import { createContext, useContext, useId } from "react";
12
+ import { createContext, useContext } from "react";
13
+
14
+ // src/accordion/useRenderSlot.tsx
17
15
  import { jsx } from "react/jsx-runtime";
16
+ function useRenderSlot(asChild, defaultTag) {
17
+ const Component = asChild ? Slot : defaultTag;
18
+ return asChild ? ({ ...props }) => /* @__PURE__ */ jsx(Component, { ...props }) : void 0;
19
+ }
20
+
21
+ // src/accordion/Accordion.tsx
22
+ import { jsx as jsx2 } from "react/jsx-runtime";
18
23
  var AccordionContext = createContext(null);
19
24
  var Accordion = ({
20
25
  asChild = false,
21
26
  children,
22
- collapsible = true,
23
- className,
24
- defaultValue,
25
27
  design = "outlined",
26
- disabled = false,
28
+ hiddenUntilFound = true,
27
29
  multiple = false,
28
- value,
29
- onValueChange,
30
+ className,
30
31
  ref,
31
32
  ...props
32
33
  }) => {
33
- const [machineProps, localProps] = accordion.splitProps({
34
- children,
35
- multiple,
36
- collapsible,
37
- value,
38
- disabled,
39
- className: cx("bg-surface rounded-lg h-fit", className),
40
- ...props
41
- });
42
- const service = useMachine(accordion.machine, {
43
- ...machineProps,
44
- defaultValue,
45
- value,
46
- id: useId(),
47
- onValueChange(details) {
48
- onValueChange?.(details.value);
34
+ const renderSlot = useRenderSlot(asChild, "div");
35
+ return /* @__PURE__ */ jsx2(AccordionContext.Provider, { value: { design }, children: /* @__PURE__ */ jsx2(
36
+ BaseAccordion.Root,
37
+ {
38
+ "data-spark-component": "accordion",
39
+ ref,
40
+ openMultiple: multiple,
41
+ hiddenUntilFound,
42
+ className: cx("bg-surface h-fit rounded-lg", className),
43
+ render: renderSlot,
44
+ ...props,
45
+ children
49
46
  }
50
- });
51
- const Component = asChild ? Slot : "div";
52
- const api = accordion.connect(service, normalizeProps);
53
- const mergedProps = mergeProps(api.getRootProps(), localProps);
54
- return /* @__PURE__ */ jsx(AccordionContext.Provider, { value: { ...api, design }, children: /* @__PURE__ */ jsx(Component, { "data-spark-component": "accordion", ref, ...mergedProps, children }) });
47
+ ) });
55
48
  };
56
49
  Accordion.displayName = "Accordion";
57
50
  var useAccordionContext = () => {
@@ -63,80 +56,41 @@ var useAccordionContext = () => {
63
56
  };
64
57
 
65
58
  // src/accordion/AccordionItem.tsx
66
- import { mergeProps as mergeProps2 } from "@zag-js/react";
59
+ import { Accordion as BaseAccordion2 } from "@base-ui-components/react/accordion";
67
60
  import { cx as cx2 } from "class-variance-authority";
68
-
69
- // src/accordion/AccordionItemContext.tsx
70
- import {
71
- createContext as createContext2,
72
- useContext as useContext2,
73
- useState
74
- } from "react";
75
- import { jsx as jsx2 } from "react/jsx-runtime";
76
- var AccordionItemContext = createContext2(null);
77
- var AccordionItemProvider = ({
78
- value: valueProp,
79
- disabled: disabledProp = false,
80
- children
81
- }) => {
82
- const [value, setValue] = useState(valueProp);
83
- const [disabled, setDisabled] = useState(disabledProp);
84
- return /* @__PURE__ */ jsx2(AccordionItemContext.Provider, { value: { value, setValue, disabled, setDisabled }, children });
85
- };
86
- var useAccordionItemContext = () => {
87
- const context = useContext2(AccordionItemContext);
88
- if (!context) {
89
- throw Error("useAccordionItemContext must be used within a AccordionItem provider");
90
- }
91
- return context;
92
- };
93
-
94
- // src/accordion/AccordionItem.tsx
95
61
  import { jsx as jsx3 } from "react/jsx-runtime";
96
62
  var Item = ({
97
63
  asChild = false,
98
64
  className,
99
65
  children,
100
- disabled = false,
101
- value,
102
66
  ref,
103
67
  ...props
104
68
  }) => {
105
- const accordion2 = useAccordionContext();
106
- const localProps = {
107
- className: cx2(
108
- "relative first:rounded-t-lg last:rounded-b-lg",
109
- "not-last:border-b-0",
110
- { "border-sm border-outline": accordion2.design === "outlined" },
111
- className
112
- ),
113
- asChild,
114
- ...props
115
- };
116
- const itemProps = accordion2.getItemProps({ value, ...disabled && { disabled } });
117
- const mergedProps = mergeProps2(itemProps, localProps);
118
- const item = accordion2.getItemState({ value });
119
- const itemContentProps = accordion2.getItemContentProps({ value });
120
- return /* @__PURE__ */ jsx3(AccordionItemProvider, { value, disabled, children: /* @__PURE__ */ jsx3(
121
- Collapsible,
69
+ const accordion = useAccordionContext();
70
+ const renderSlot = useRenderSlot(asChild, "div");
71
+ return /* @__PURE__ */ jsx3(
72
+ BaseAccordion2.Item,
122
73
  {
123
74
  ref,
124
- open: item.expanded,
125
75
  "data-spark-component": "accordion-item",
126
- ids: { content: itemContentProps.id },
127
- ...mergedProps,
76
+ render: renderSlot,
77
+ className: cx2(
78
+ "relative first:rounded-t-lg last:rounded-b-lg",
79
+ "not-last:border-b-0",
80
+ { "border-sm border-outline": accordion.design === "outlined" },
81
+ className
82
+ ),
83
+ ...props,
128
84
  children
129
85
  }
130
- ) });
86
+ );
131
87
  };
132
88
  Item.displayName = "Accordion.Item";
133
89
 
134
90
  // src/accordion/AccordionItemContent.tsx
135
- import { createSplitProps } from "@spark-ui/internal-utils";
136
- import { mergeProps as mergeProps3 } from "@zag-js/react";
91
+ import { Accordion as BaseAccordion3 } from "@base-ui-components/react/accordion";
137
92
  import { cx as cx3 } from "class-variance-authority";
138
93
  import { jsx as jsx4 } from "react/jsx-runtime";
139
- var splitVisibilityProps = createSplitProps();
140
94
  var ItemContent = ({
141
95
  asChild = false,
142
96
  className,
@@ -144,20 +98,23 @@ var ItemContent = ({
144
98
  ref,
145
99
  ...props
146
100
  }) => {
147
- const accordion2 = useAccordionContext();
148
- const accordionItem = useAccordionItemContext();
149
- const localProps = {
150
- className: cx3("[&>:first-child]:p-lg", "text-body-1 text-on-surface", className),
151
- asChild,
152
- ...props
153
- };
154
- const contentProps = accordion2.getItemContentProps({
155
- value: accordionItem.value,
156
- ...accordionItem.disabled && { disabled: accordionItem.disabled }
157
- });
158
- const [, itemContentProps] = splitVisibilityProps(contentProps, ["hidden", "data-state"]);
159
- const mergedProps = mergeProps3(itemContentProps, localProps);
160
- return /* @__PURE__ */ jsx4(Collapsible.Content, { ref, "data-spark-component": "accordion-item-content", ...mergedProps, children });
101
+ const renderSlot = useRenderSlot(asChild, "div");
102
+ return /* @__PURE__ */ jsx4(
103
+ BaseAccordion3.Panel,
104
+ {
105
+ ref,
106
+ "data-spark-component": "accordion-item-content",
107
+ className: cx3(
108
+ "[&>:first-child]:p-lg overflow-hidden",
109
+ "h-[var(--accordion-panel-height)] transition-all duration-200 data-[ending-style]:h-0 data-[starting-style]:h-0",
110
+ "text-body-1 text-on-surface",
111
+ className
112
+ ),
113
+ render: renderSlot,
114
+ ...props,
115
+ children
116
+ }
117
+ );
161
118
  };
162
119
  ItemContent.displayName = "Accordion.ItemContent";
163
120
 
@@ -184,8 +141,8 @@ var ItemHeader = ({
184
141
  ItemHeader.displayName = "Accordion.ItemHeader";
185
142
 
186
143
  // src/accordion/AccordionItemTrigger.tsx
144
+ import { Accordion as BaseAccordion4 } from "@base-ui-components/react/accordion";
187
145
  import { ArrowHorizontalDown } from "@spark-ui/icons/ArrowHorizontalDown";
188
- import { mergeProps as mergeProps4 } from "@zag-js/react";
189
146
  import { cx as cx5 } from "class-variance-authority";
190
147
  import { jsx as jsx6, jsxs } from "react/jsx-runtime";
191
148
  var ItemTrigger = ({
@@ -195,39 +152,40 @@ var ItemTrigger = ({
195
152
  ref,
196
153
  ...props
197
154
  }) => {
198
- const { getItemTriggerProps } = useAccordionContext();
199
- const { value, disabled } = useAccordionItemContext();
200
- const Component = asChild ? Slot : "button";
201
- const localProps = {
202
- ...props,
203
- className: cx5(
204
- "relative flex gap-lg justify-between items-center min-h-sz-48",
205
- "w-full px-lg py-md text-left text-headline-2 text-on-surface rounded-[inherit] data-[state=open]:rounded-b-0",
206
- "hover:enabled:bg-surface-hovered focus:bg-surface-hovered",
207
- "focus-visible:u-outline focus-visible:outline-hidden focus-visible:z-raised",
208
- "disabled:opacity-dim-3 cursor-pointer disabled:cursor-not-allowed",
209
- className
210
- )
211
- };
212
- const mergedProps = mergeProps4(
213
- getItemTriggerProps({ value, ...disabled && { disabled } }),
214
- localProps
155
+ const renderSlot = useRenderSlot(asChild, "button");
156
+ return /* @__PURE__ */ jsxs(
157
+ BaseAccordion4.Trigger,
158
+ {
159
+ ref,
160
+ "data-spark-component": "accordion-item-trigger",
161
+ render: renderSlot,
162
+ className: cx5(
163
+ "group",
164
+ "gap-lg min-h-sz-48 relative flex items-center justify-between",
165
+ "px-lg py-md text-headline-2 text-on-surface data-[panel-open]:rounded-b-0 w-full rounded-[inherit] text-left",
166
+ "hover:enabled:bg-surface-hovered focus:bg-surface-hovered",
167
+ "focus-visible:u-outline focus-visible:z-raised focus-visible:outline-hidden",
168
+ "disabled:opacity-dim-3 cursor-pointer disabled:cursor-not-allowed",
169
+ className
170
+ ),
171
+ ...props,
172
+ children: [
173
+ /* @__PURE__ */ jsx6("div", { className: "gap-lg flex grow items-center", children }),
174
+ /* @__PURE__ */ jsx6(
175
+ Icon,
176
+ {
177
+ intent: "neutral",
178
+ className: cx5(
179
+ "shrink-0 rotate-0 duration-100 ease-in motion-reduce:transition-none",
180
+ "group-data-[panel-open]:rotate-180"
181
+ ),
182
+ size: "sm",
183
+ children: /* @__PURE__ */ jsx6(ArrowHorizontalDown, {})
184
+ }
185
+ )
186
+ ]
187
+ }
215
188
  );
216
- const isOpen = !!mergedProps["aria-expanded"];
217
- return /* @__PURE__ */ jsxs(Component, { ref, "data-spark-component": "accordion-item-trigger", ...mergedProps, children: [
218
- /* @__PURE__ */ jsx6("div", { className: "gap-lg flex grow items-center", children }),
219
- /* @__PURE__ */ jsx6(
220
- Icon,
221
- {
222
- intent: "neutral",
223
- className: cx5("shrink-0 rotate-0 duration-100 ease-in motion-reduce:transition-none", {
224
- "rotate-180": isOpen
225
- }),
226
- size: "sm",
227
- children: /* @__PURE__ */ jsx6(ArrowHorizontalDown, {})
228
- }
229
- )
230
- ] });
231
189
  };
232
190
  ItemTrigger.displayName = "Accordion.ItemTrigger";
233
191
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/accordion/Accordion.tsx","../../src/accordion/AccordionItem.tsx","../../src/accordion/AccordionItemContext.tsx","../../src/accordion/AccordionItemContent.tsx","../../src/accordion/AccordionItemHeader.tsx","../../src/accordion/AccordionItemTrigger.tsx","../../src/accordion/index.ts"],"sourcesContent":["import * as accordion from '@zag-js/accordion'\nimport { mergeProps, normalizeProps, type PropTypes, useMachine } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, createContext, Ref, useContext, useId } from 'react'\n\nimport { Slot } from '../slot'\n\ntype ExtentedZagInterface = Omit<\n accordion.Props,\n 'id' | 'ids' | 'orientation' | 'getRootNode' | 'onValueChange'\n> &\n Omit<ComponentPropsWithoutRef<'div'>, 'defaultChecked'>\n\nexport interface AccordionProps extends ExtentedZagInterface {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n /**\n * Whether an accordion item can be closed after it has been expanded.\n */\n collapsible?: boolean\n defaultValue?: accordion.Props['value']\n /**\n * Whether the accordion items are disabled\n */\n disabled?: boolean\n /**\n * Whether multiple accordion items can be expanded at the same time.\n */\n multiple?: boolean\n /**\n * The `value` of the accordion items that are currently being expanded.\n */\n value?: string[]\n /**\n * The callback fired when the state of expanded/collapsed accordion items changes.\n */\n onValueChange?: (value: string[]) => void\n design?: 'filled' | 'outlined'\n ref?: Ref<HTMLDivElement>\n}\n\nconst AccordionContext = createContext<\n | (accordion.Api<PropTypes> & {\n design: 'filled' | 'outlined'\n })\n | null\n>(null)\n\nexport const Accordion = ({\n asChild = false,\n children,\n collapsible = true,\n className,\n defaultValue,\n design = 'outlined',\n disabled = false,\n multiple = false,\n value,\n onValueChange,\n ref,\n ...props\n}: AccordionProps) => {\n const [machineProps, localProps] = accordion.splitProps({\n children,\n multiple,\n collapsible,\n value,\n disabled,\n className: cx('bg-surface rounded-lg h-fit', className),\n ...props,\n })\n\n const service = useMachine(accordion.machine, {\n ...machineProps,\n defaultValue,\n value,\n id: useId(),\n onValueChange(details) {\n onValueChange?.(details.value)\n },\n })\n\n const Component = asChild ? Slot : 'div'\n const api = accordion.connect(service, normalizeProps)\n\n const mergedProps = mergeProps(api.getRootProps(), localProps)\n\n return (\n <AccordionContext.Provider value={{ ...api, design }}>\n <Component data-spark-component=\"accordion\" ref={ref} {...mergedProps}>\n {children}\n </Component>\n </AccordionContext.Provider>\n )\n}\n\nAccordion.displayName = 'Accordion'\n\nexport const useAccordionContext = () => {\n const context = useContext(AccordionContext)\n\n if (!context) {\n throw Error('useAccordionContext must be used within a Accordion provider')\n }\n\n return context\n}\n","import { mergeProps } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Collapsible } from '../collapsible'\nimport { useAccordionContext } from './Accordion'\nimport { AccordionItemProvider } from './AccordionItemContext'\n\nexport interface AccordionItemProps extends ComponentPropsWithoutRef<'div'> {\n value: string\n asChild?: boolean\n disabled?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Item = ({\n asChild = false,\n className,\n children,\n disabled = false,\n value,\n ref,\n ...props\n}: AccordionItemProps) => {\n const accordion = useAccordionContext()\n\n const localProps = {\n className: cx(\n 'relative first:rounded-t-lg last:rounded-b-lg',\n 'not-last:border-b-0',\n { 'border-sm border-outline': accordion.design === 'outlined' },\n className\n ),\n asChild,\n ...props,\n }\n\n const itemProps = accordion.getItemProps({ value, ...(disabled && { disabled }) })\n const mergedProps = mergeProps(itemProps, localProps)\n\n const item = accordion.getItemState({ value })\n const itemContentProps = accordion.getItemContentProps({ value })\n\n return (\n <AccordionItemProvider value={value} disabled={disabled}>\n <Collapsible\n ref={ref}\n open={item.expanded}\n data-spark-component=\"accordion-item\"\n ids={{ content: itemContentProps.id }}\n {...mergedProps}\n >\n {children}\n </Collapsible>\n </AccordionItemProvider>\n )\n}\n\nItem.displayName = 'Accordion.Item'\n","import {\n createContext,\n Dispatch,\n type PropsWithChildren,\n SetStateAction,\n useContext,\n useState,\n} from 'react'\n\ninterface AccordionItemContextState {\n value: string\n setValue: Dispatch<SetStateAction<string>>\n disabled: boolean\n setDisabled: Dispatch<SetStateAction<boolean>>\n}\n\nconst AccordionItemContext = createContext<AccordionItemContextState | null>(null)\n\nexport const AccordionItemProvider = ({\n value: valueProp,\n disabled: disabledProp = false,\n children,\n}: PropsWithChildren<{ value: string; disabled?: boolean }>) => {\n const [value, setValue] = useState<string>(valueProp)\n const [disabled, setDisabled] = useState<boolean>(disabledProp)\n\n return (\n <AccordionItemContext.Provider value={{ value, setValue, disabled, setDisabled }}>\n {children}\n </AccordionItemContext.Provider>\n )\n}\n\nexport const useAccordionItemContext = () => {\n const context = useContext(AccordionItemContext)\n\n if (!context) {\n throw Error('useAccordionItemContext must be used within a AccordionItem provider')\n }\n\n return context\n}\n","import { createSplitProps } from '@spark-ui/internal-utils'\nimport { mergeProps } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Collapsible } from '../collapsible'\nimport { useAccordionContext } from './Accordion'\nimport { useAccordionItemContext } from './AccordionItemContext'\n\nexport interface AccordionItemContentProps extends ComponentPropsWithoutRef<'div'> {\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nconst splitVisibilityProps = createSplitProps<{\n hidden?: boolean\n 'data-state'?: string\n}>()\n\nexport const ItemContent = ({\n asChild = false,\n className,\n children,\n ref,\n ...props\n}: AccordionItemContentProps) => {\n const accordion = useAccordionContext()\n const accordionItem = useAccordionItemContext()\n\n const localProps = {\n className: cx('[&>:first-child]:p-lg', 'text-body-1 text-on-surface', className),\n asChild,\n ...props,\n }\n const contentProps = accordion.getItemContentProps({\n value: accordionItem.value,\n ...(accordionItem.disabled && { disabled: accordionItem.disabled }),\n })\n\n const [, itemContentProps] = splitVisibilityProps(contentProps, ['hidden', 'data-state'])\n\n const mergedProps = mergeProps(itemContentProps, localProps)\n\n return (\n <Collapsible.Content ref={ref} data-spark-component=\"accordion-item-content\" {...mergedProps}>\n {children}\n </Collapsible.Content>\n )\n}\n\nItemContent.displayName = 'Accordion.ItemContent'\n","import { cx } from 'class-variance-authority'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface AccordionItemHeaderProps extends ComponentProps<'h3'> {\n asChild?: boolean\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const ItemHeader = ({\n asChild = false,\n children,\n className,\n ref,\n}: AccordionItemHeaderProps) => {\n const Component = asChild ? Slot : 'h3'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"accordion-item-header\"\n className={cx('rounded-[inherit]', className)}\n >\n {children}\n </Component>\n )\n}\n\nItemHeader.displayName = 'Accordion.ItemHeader'\n","import { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { mergeProps } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { Slot } from '../slot'\nimport { useAccordionContext } from './Accordion'\nimport { useAccordionItemContext } from './AccordionItemContext'\n\nexport interface AccordionItemTriggerProps extends ComponentPropsWithoutRef<'button'> {\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const ItemTrigger = ({\n asChild = false,\n children,\n className,\n ref,\n ...props\n}: AccordionItemTriggerProps) => {\n const { getItemTriggerProps } = useAccordionContext()\n const { value, disabled } = useAccordionItemContext()\n\n const Component = asChild ? Slot : 'button'\n\n const localProps = {\n ...props,\n className: cx(\n 'relative flex gap-lg justify-between items-center min-h-sz-48',\n 'w-full px-lg py-md text-left text-headline-2 text-on-surface rounded-[inherit] data-[state=open]:rounded-b-0',\n 'hover:enabled:bg-surface-hovered focus:bg-surface-hovered',\n 'focus-visible:u-outline focus-visible:outline-hidden focus-visible:z-raised',\n 'disabled:opacity-dim-3 cursor-pointer disabled:cursor-not-allowed',\n className\n ),\n }\n\n const mergedProps = mergeProps(\n getItemTriggerProps({ value, ...(disabled && { disabled }) }),\n localProps\n )\n\n const isOpen = !!mergedProps['aria-expanded']\n\n return (\n <Component ref={ref} data-spark-component=\"accordion-item-trigger\" {...mergedProps}>\n <div className=\"gap-lg flex grow items-center\">{children}</div>\n <Icon\n intent=\"neutral\"\n className={cx('shrink-0 rotate-0 duration-100 ease-in motion-reduce:transition-none', {\n 'rotate-180': isOpen,\n })}\n size=\"sm\"\n >\n <ArrowHorizontalDown />\n </Icon>\n </Component>\n )\n}\n\nItemTrigger.displayName = 'Accordion.ItemTrigger'\n","import { Accordion as Root } from './Accordion'\nimport { Item } from './AccordionItem'\nimport { ItemContent } from './AccordionItemContent'\nimport { ItemHeader } from './AccordionItemHeader'\nimport { ItemTrigger } from './AccordionItemTrigger'\n\nexport const Accordion: typeof Root & {\n Item: typeof Item\n ItemHeader: typeof ItemHeader\n ItemTrigger: typeof ItemTrigger\n ItemContent: typeof ItemContent\n} = Object.assign(Root, {\n Item,\n ItemHeader,\n ItemTrigger,\n ItemContent,\n})\n\nAccordion.displayName = 'Accordion'\nItem.displayName = 'Item'\nItemHeader.displayName = 'ItemHeader'\nItemTrigger.displayName = 'Accordion.Trigger'\nItemContent.displayName = 'Accordion.Content'\n\nexport { type AccordionProps } from './Accordion'\nexport { type AccordionItemHeaderProps } from './AccordionItemHeader'\nexport { type AccordionItemContentProps } from './AccordionItemContent'\nexport { type AccordionItemTriggerProps } from './AccordionItemTrigger'\n"],"mappings":";;;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AAS,cAAAC,mBAAkB;AAC3B,SAAS,MAAAC,WAAU;AA6Cf,SACE,OAAAC,MADF;AAhCG,IAAM,cAAc,CAAC;AAAA,EAC1B,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAiC;AAC/B,QAAM,EAAE,oBAAoB,IAAI,oBAAoB;AACpD,QAAM,EAAE,OAAO,SAAS,IAAI,wBAAwB;AAEpD,QAAM,YAAY,UAAU,OAAO;AAEnC,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,WAAWC;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAcC;AAAA,IAClB,oBAAoB,EAAE,OAAO,GAAI,YAAY,EAAE,SAAS,EAAG,CAAC;AAAA,IAC5D;AAAA,EACF;AAEA,QAAM,SAAS,CAAC,CAAC,YAAY,eAAe;AAE5C,SACE,qBAAC,aAAU,KAAU,wBAAqB,0BAA0B,GAAG,aACrE;AAAA,oBAAAF,KAAC,SAAI,WAAU,iCAAiC,UAAS;AAAA,IACzD,gBAAAA;AAAA,MAAC;AAAA;AAAA,QACC,QAAO;AAAA,QACP,WAAWC,IAAG,wEAAwE;AAAA,UACpF,cAAc;AAAA,QAChB,CAAC;AAAA,QACD,MAAK;AAAA,QAEL,0BAAAD,KAAC,uBAAoB;AAAA;AAAA,IACvB;AAAA,KACF;AAEJ;AAEA,YAAY,cAAc;;;ACxDnB,IAAMG,aAKT,OAAO,OAAO,WAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDA,WAAU,cAAc;AACxB,KAAK,cAAc;AACnB,WAAW,cAAc;AACzB,YAAY,cAAc;AAC1B,YAAY,cAAc;","names":["mergeProps","cx","createContext","useContext","jsx","jsx","accordion","cx","mergeProps","mergeProps","cx","jsx","accordion","cx","mergeProps","cx","jsx","cx","mergeProps","cx","jsx","cx","mergeProps","Accordion"]}
1
+ {"version":3,"sources":["../../src/accordion/Accordion.tsx","../../src/accordion/useRenderSlot.tsx","../../src/accordion/AccordionItem.tsx","../../src/accordion/AccordionItemContent.tsx","../../src/accordion/AccordionItemHeader.tsx","../../src/accordion/AccordionItemTrigger.tsx","../../src/accordion/index.ts"],"sourcesContent":["import { Accordion as BaseAccordion } from '@base-ui-components/react/accordion'\nimport { cx } from 'class-variance-authority'\nimport { ComponentProps, createContext, Ref, useContext } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\ntype ExtentedZagInterface = Omit<\n ComponentProps<typeof BaseAccordion.Root>,\n 'openMultiple' | 'render'\n>\n\nexport interface AccordionProps extends ExtentedZagInterface {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n /**\n * Whether the accordion items are disabled\n */\n disabled?: boolean\n /**\n * Whether multiple items can be open at the same time.\n */\n multiple?: boolean\n design?: 'filled' | 'outlined'\n ref?: Ref<HTMLDivElement>\n}\n\nconst AccordionContext = createContext<{\n design: 'filled' | 'outlined'\n} | null>(null)\n\nexport const Accordion = ({\n asChild = false,\n children,\n design = 'outlined',\n hiddenUntilFound = true,\n multiple = false,\n className,\n ref,\n ...props\n}: AccordionProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <AccordionContext.Provider value={{ design }}>\n <BaseAccordion.Root\n data-spark-component=\"accordion\"\n ref={ref}\n openMultiple={multiple}\n hiddenUntilFound={hiddenUntilFound}\n className={cx('bg-surface h-fit rounded-lg', className)}\n render={renderSlot}\n {...props}\n >\n {children}\n </BaseAccordion.Root>\n </AccordionContext.Provider>\n )\n}\n\nAccordion.displayName = 'Accordion'\n\nexport const useAccordionContext = () => {\n const context = useContext(AccordionContext)\n\n if (!context) {\n throw Error('useAccordionContext must be used within a Accordion provider')\n }\n\n return context\n}\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n","import { Accordion as BaseAccordion } from '@base-ui-components/react/accordion'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { useAccordionContext } from './Accordion'\nimport { useRenderSlot } from './useRenderSlot'\n\ntype ExtentedZagInterface = Omit<ComponentProps<typeof BaseAccordion.Item>, 'render'>\n\nexport interface AccordionItemProps extends ExtentedZagInterface {\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Item = ({\n asChild = false,\n className,\n children,\n ref,\n ...props\n}: AccordionItemProps) => {\n const accordion = useAccordionContext()\n\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <BaseAccordion.Item\n ref={ref}\n data-spark-component=\"accordion-item\"\n render={renderSlot}\n className={cx(\n 'relative first:rounded-t-lg last:rounded-b-lg',\n 'not-last:border-b-0',\n { 'border-sm border-outline': accordion.design === 'outlined' },\n className\n )}\n {...props}\n >\n {children}\n </BaseAccordion.Item>\n )\n}\n\nItem.displayName = 'Accordion.Item'\n","import { Accordion as BaseAccordion } from '@base-ui-components/react/accordion'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\ntype ExtentedZagInterface = Omit<ComponentProps<typeof BaseAccordion.Panel>, 'render'>\n\nexport interface AccordionItemContentProps extends ExtentedZagInterface {\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const ItemContent = ({\n asChild = false,\n className,\n children,\n ref,\n ...props\n}: AccordionItemContentProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <BaseAccordion.Panel\n ref={ref}\n data-spark-component=\"accordion-item-content\"\n className={cx(\n '[&>:first-child]:p-lg overflow-hidden',\n 'h-[var(--accordion-panel-height)] transition-all duration-200 data-[ending-style]:h-0 data-[starting-style]:h-0',\n 'text-body-1 text-on-surface',\n className\n )}\n render={renderSlot}\n {...props}\n >\n {children}\n </BaseAccordion.Panel>\n )\n}\n\nItemContent.displayName = 'Accordion.ItemContent'\n","import { cx } from 'class-variance-authority'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface AccordionItemHeaderProps extends ComponentProps<'h3'> {\n asChild?: boolean\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const ItemHeader = ({\n asChild = false,\n children,\n className,\n ref,\n}: AccordionItemHeaderProps) => {\n const Component = asChild ? Slot : 'h3'\n\n return (\n <Component\n ref={ref}\n data-spark-component=\"accordion-item-header\"\n className={cx('rounded-[inherit]', className)}\n >\n {children}\n </Component>\n )\n}\n\nItemHeader.displayName = 'Accordion.ItemHeader'\n","import { Accordion as BaseAccordion } from '@base-ui-components/react/accordion'\nimport { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { useRenderSlot } from './useRenderSlot'\n\ntype ExtentedZagInterface = Omit<ComponentProps<typeof BaseAccordion.Trigger>, 'render'>\n\nexport interface AccordionItemTriggerProps extends ExtentedZagInterface {\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const ItemTrigger = ({\n asChild = false,\n children,\n className,\n ref,\n ...props\n}: AccordionItemTriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return (\n <BaseAccordion.Trigger\n ref={ref}\n data-spark-component=\"accordion-item-trigger\"\n render={renderSlot}\n className={cx(\n 'group',\n 'gap-lg min-h-sz-48 relative flex items-center justify-between',\n 'px-lg py-md text-headline-2 text-on-surface data-[panel-open]:rounded-b-0 w-full rounded-[inherit] text-left',\n 'hover:enabled:bg-surface-hovered focus:bg-surface-hovered',\n 'focus-visible:u-outline focus-visible:z-raised focus-visible:outline-hidden',\n 'disabled:opacity-dim-3 cursor-pointer disabled:cursor-not-allowed',\n className\n )}\n {...props}\n >\n <div className=\"gap-lg flex grow items-center\">{children}</div>\n <Icon\n intent=\"neutral\"\n className={cx(\n 'shrink-0 rotate-0 duration-100 ease-in motion-reduce:transition-none',\n 'group-data-[panel-open]:rotate-180'\n )}\n size=\"sm\"\n >\n <ArrowHorizontalDown />\n </Icon>\n </BaseAccordion.Trigger>\n )\n}\n\nItemTrigger.displayName = 'Accordion.ItemTrigger'\n","import { Accordion as Root } from './Accordion'\nimport { Item } from './AccordionItem'\nimport { ItemContent } from './AccordionItemContent'\nimport { ItemHeader } from './AccordionItemHeader'\nimport { ItemTrigger } from './AccordionItemTrigger'\n\nexport const Accordion: typeof Root & {\n Item: typeof Item\n ItemHeader: typeof ItemHeader\n ItemTrigger: typeof ItemTrigger\n ItemContent: typeof ItemContent\n} = Object.assign(Root, {\n Item,\n ItemHeader,\n ItemTrigger,\n ItemContent,\n})\n\nAccordion.displayName = 'Accordion'\nItem.displayName = 'Item'\nItemHeader.displayName = 'ItemHeader'\nItemTrigger.displayName = 'Accordion.Trigger'\nItemContent.displayName = 'Accordion.Content'\n\nexport { type AccordionProps } from './Accordion'\nexport { type AccordionItemHeaderProps } from './AccordionItemHeader'\nexport { type AccordionItemContentProps } from './AccordionItemContent'\nexport { type AccordionItemTriggerProps } from './AccordionItemTrigger'\n"],"mappings":";;;;;;;;;AAAA,SAAS,aAAa,qBAAqB;AAC3C,SAAS,UAAU;AACnB,SAAyB,eAAoB,kBAAkB;;;ACG1B;AAH9B,SAAS,cAAc,SAAkB,YAAoB;AAClE,QAAM,YAAY,UAAU,OAAO;AAEnC,SAAO,UAAU,CAAC,EAAE,GAAG,MAAM,MAAM,oBAAC,aAAW,GAAG,OAAO,IAAK;AAChE;;;ADwCM,gBAAAA,YAAA;AAlBN,IAAM,mBAAmB,cAEf,IAAI;AAEP,IAAM,YAAY,CAAC;AAAA,EACxB,UAAU;AAAA,EACV;AAAA,EACA,SAAS;AAAA,EACT,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,GAAG;AACL,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L,0BAAAF,KAAC,uBAAoB;AAAA;AAAA,QACvB;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,YAAY,cAAc;;;ACjDnB,IAAMG,aAKT,OAAO,OAAO,WAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDA,WAAU,cAAc;AACxB,KAAK,cAAc;AACnB,WAAW,cAAc;AACzB,YAAY,cAAc;AAC1B,YAAY,cAAc;","names":["jsx","BaseAccordion","cx","jsx","BaseAccordion","cx","BaseAccordion","cx","jsx","BaseAccordion","cx","cx","jsx","cx","BaseAccordion","cx","jsx","BaseAccordion","cx","Accordion"]}
@@ -1,60 +1,43 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as collapsible from '@zag-js/collapsible';
3
- import { ComponentProps, Ref, ComponentPropsWithoutRef } from 'react';
2
+ import { Collapsible as Collapsible$1 } from '@base-ui-components/react/collapsible';
3
+ import { ComponentProps } from 'react';
4
4
 
5
- interface CollapsibleProps extends ComponentProps<'div'> {
5
+ interface ContentProps extends ComponentProps<typeof Collapsible$1.Panel> {
6
6
  /**
7
7
  * Change the default rendered element for the one passed as a child, merging their props and behavior.
8
8
  */
9
9
  asChild?: boolean;
10
- /**
11
- * The open state of the collapsible when it is initially rendered. Use when you do not need to control its open state.
12
- */
13
- defaultOpen?: boolean;
14
- /**
15
- * When `true`, prevents the user from interacting with the collapsible.
16
- */
17
- disabled?: boolean;
18
- /**
19
- * Event handler called when the open state of the collapsible changes.
20
- */
21
- onOpenChange?: (open: boolean) => void;
22
- /**
23
- * The controlled open state of the collapsible. Must be used in conjunction with `onOpenChange`.
24
- */
25
- open?: boolean;
26
- /**
27
- * The ids of the elements in the collapsible. Useful for composition
28
- */
29
- ids?: collapsible.Props['ids'];
30
- ref?: Ref<HTMLDivElement>;
31
10
  }
32
- declare const Collapsible$1: {
33
- ({ asChild, children, defaultOpen, disabled, onOpenChange, open, ids, ref, ...props }: CollapsibleProps): react_jsx_runtime.JSX.Element;
11
+ declare const Content: {
12
+ ({ asChild, className, children, hiddenUntilFound, ...props }: ContentProps): react_jsx_runtime.JSX.Element;
34
13
  displayName: string;
35
14
  };
36
15
 
37
- interface CollapsibleContentProps extends ComponentPropsWithoutRef<'div'> {
16
+ interface RootProps extends ComponentProps<typeof Collapsible$1.Root> {
17
+ /**
18
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
19
+ */
38
20
  asChild?: boolean;
39
- ref?: Ref<HTMLDivElement>;
40
21
  }
41
- declare const Content: {
42
- ({ asChild, className, children, ref, ...props }: CollapsibleContentProps): react_jsx_runtime.JSX.Element;
22
+ declare const Root: {
23
+ ({ asChild, children, ...props }: RootProps): react_jsx_runtime.JSX.Element;
43
24
  displayName: string;
44
25
  };
45
26
 
46
- interface CollapsibleTriggerProps extends ComponentPropsWithoutRef<'button'> {
27
+ interface TriggerProps extends ComponentProps<'button'> {
28
+ /**
29
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
30
+ */
47
31
  asChild?: boolean;
48
- ref?: Ref<HTMLButtonElement>;
49
32
  }
50
33
  declare const Trigger: {
51
- ({ asChild, children, ref, ...props }: CollapsibleTriggerProps): react_jsx_runtime.JSX.Element;
34
+ ({ asChild, children, ...props }: TriggerProps): react_jsx_runtime.JSX.Element;
52
35
  displayName: string;
53
36
  };
54
37
 
55
- declare const Collapsible: typeof Collapsible$1 & {
38
+ declare const Collapsible: typeof Root & {
56
39
  Trigger: typeof Trigger;
57
40
  Content: typeof Content;
58
41
  };
59
42
 
60
- export { Collapsible, type CollapsibleContentProps, type CollapsibleProps, type CollapsibleTriggerProps };
43
+ export { Collapsible };
@@ -1,60 +1,43 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as collapsible from '@zag-js/collapsible';
3
- import { ComponentProps, Ref, ComponentPropsWithoutRef } from 'react';
2
+ import { Collapsible as Collapsible$1 } from '@base-ui-components/react/collapsible';
3
+ import { ComponentProps } from 'react';
4
4
 
5
- interface CollapsibleProps extends ComponentProps<'div'> {
5
+ interface ContentProps extends ComponentProps<typeof Collapsible$1.Panel> {
6
6
  /**
7
7
  * Change the default rendered element for the one passed as a child, merging their props and behavior.
8
8
  */
9
9
  asChild?: boolean;
10
- /**
11
- * The open state of the collapsible when it is initially rendered. Use when you do not need to control its open state.
12
- */
13
- defaultOpen?: boolean;
14
- /**
15
- * When `true`, prevents the user from interacting with the collapsible.
16
- */
17
- disabled?: boolean;
18
- /**
19
- * Event handler called when the open state of the collapsible changes.
20
- */
21
- onOpenChange?: (open: boolean) => void;
22
- /**
23
- * The controlled open state of the collapsible. Must be used in conjunction with `onOpenChange`.
24
- */
25
- open?: boolean;
26
- /**
27
- * The ids of the elements in the collapsible. Useful for composition
28
- */
29
- ids?: collapsible.Props['ids'];
30
- ref?: Ref<HTMLDivElement>;
31
10
  }
32
- declare const Collapsible$1: {
33
- ({ asChild, children, defaultOpen, disabled, onOpenChange, open, ids, ref, ...props }: CollapsibleProps): react_jsx_runtime.JSX.Element;
11
+ declare const Content: {
12
+ ({ asChild, className, children, hiddenUntilFound, ...props }: ContentProps): react_jsx_runtime.JSX.Element;
34
13
  displayName: string;
35
14
  };
36
15
 
37
- interface CollapsibleContentProps extends ComponentPropsWithoutRef<'div'> {
16
+ interface RootProps extends ComponentProps<typeof Collapsible$1.Root> {
17
+ /**
18
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
19
+ */
38
20
  asChild?: boolean;
39
- ref?: Ref<HTMLDivElement>;
40
21
  }
41
- declare const Content: {
42
- ({ asChild, className, children, ref, ...props }: CollapsibleContentProps): react_jsx_runtime.JSX.Element;
22
+ declare const Root: {
23
+ ({ asChild, children, ...props }: RootProps): react_jsx_runtime.JSX.Element;
43
24
  displayName: string;
44
25
  };
45
26
 
46
- interface CollapsibleTriggerProps extends ComponentPropsWithoutRef<'button'> {
27
+ interface TriggerProps extends ComponentProps<'button'> {
28
+ /**
29
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
30
+ */
47
31
  asChild?: boolean;
48
- ref?: Ref<HTMLButtonElement>;
49
32
  }
50
33
  declare const Trigger: {
51
- ({ asChild, children, ref, ...props }: CollapsibleTriggerProps): react_jsx_runtime.JSX.Element;
34
+ ({ asChild, children, ...props }: TriggerProps): react_jsx_runtime.JSX.Element;
52
35
  displayName: string;
53
36
  };
54
37
 
55
- declare const Collapsible: typeof Collapsible$1 & {
38
+ declare const Collapsible: typeof Root & {
56
39
  Trigger: typeof Trigger;
57
40
  Content: typeof Content;
58
41
  };
59
42
 
60
- export { Collapsible, type CollapsibleContentProps, type CollapsibleProps, type CollapsibleTriggerProps };
43
+ export { Collapsible };