@syscore/ui-library 1.10.0 → 1.10.1
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/client/components/ui/accordion.tsx +39 -9
- package/client/ui/Accordion.stories.tsx +187 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +31 -8
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -315,20 +315,40 @@ const AccordionHeaderRow = React.forwardRef(({ title, className }, ref) => {
|
|
|
315
315
|
});
|
|
316
316
|
AccordionHeaderRow.displayName = "AccordionHeaderRow";
|
|
317
317
|
const AccordionItem = React.forwardRef(
|
|
318
|
-
({ value, children, className, ...props }, ref) => {
|
|
318
|
+
({ value, children, className, noBorderOnOpen, ...props }, ref) => {
|
|
319
319
|
const { isExpanded: isExpandedFn } = useAccordion();
|
|
320
320
|
const isExpanded = isExpandedFn(value);
|
|
321
321
|
const itemContextValue = React.useMemo(
|
|
322
|
-
() => ({ value, isExpanded }),
|
|
323
|
-
[value, isExpanded]
|
|
322
|
+
() => ({ value, isExpanded, noBorderOnOpen }),
|
|
323
|
+
[value, isExpanded, noBorderOnOpen]
|
|
324
324
|
);
|
|
325
|
-
return /* @__PURE__ */ jsx(AccordionItemContext.Provider, { value: itemContextValue, children: /* @__PURE__ */ jsx(
|
|
325
|
+
return /* @__PURE__ */ jsx(AccordionItemContext.Provider, { value: itemContextValue, children: /* @__PURE__ */ jsx(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
ref,
|
|
329
|
+
className: cn(className),
|
|
330
|
+
style: noBorderOnOpen && isExpanded ? { borderBottom: "none" } : void 0,
|
|
331
|
+
...props,
|
|
332
|
+
children
|
|
333
|
+
}
|
|
334
|
+
) });
|
|
326
335
|
}
|
|
327
336
|
);
|
|
328
337
|
AccordionItem.displayName = "AccordionItem";
|
|
329
338
|
const AccordionHeader = React.forwardRef(
|
|
330
|
-
({ children, className, onClick, ...props }, ref) => {
|
|
331
|
-
|
|
339
|
+
({ children, className, onClick, transparentOnOpen, ...props }, ref) => {
|
|
340
|
+
const { isExpanded } = useAccordionItem();
|
|
341
|
+
return /* @__PURE__ */ jsx(
|
|
342
|
+
"div",
|
|
343
|
+
{
|
|
344
|
+
ref,
|
|
345
|
+
onClick,
|
|
346
|
+
className: cn(className),
|
|
347
|
+
style: transparentOnOpen && isExpanded ? { backgroundColor: "transparent" } : void 0,
|
|
348
|
+
...props,
|
|
349
|
+
children
|
|
350
|
+
}
|
|
351
|
+
);
|
|
332
352
|
}
|
|
333
353
|
);
|
|
334
354
|
AccordionHeader.displayName = "AccordionHeader";
|
|
@@ -367,7 +387,7 @@ const AccordionTrigger = React.forwardRef(({ className, onClick, ...props }, ref
|
|
|
367
387
|
AccordionTrigger.displayName = "AccordionTrigger";
|
|
368
388
|
const AccordionContent = React.forwardRef(
|
|
369
389
|
({ children, className, ...props }, ref) => {
|
|
370
|
-
const { isExpanded } = useAccordionItem();
|
|
390
|
+
const { isExpanded, noBorderOnOpen } = useAccordionItem();
|
|
371
391
|
return /* @__PURE__ */ jsx(AnimatePresence, { initial: false, children: isExpanded && /* @__PURE__ */ jsx(
|
|
372
392
|
motion.div,
|
|
373
393
|
{
|
|
@@ -376,7 +396,10 @@ const AccordionContent = React.forwardRef(
|
|
|
376
396
|
exit: { height: 0, opacity: 0 },
|
|
377
397
|
transition: { duration: 0.3, ease: [0.25, 0.46, 0.45, 0.94] },
|
|
378
398
|
className: cn(className),
|
|
379
|
-
style: {
|
|
399
|
+
style: {
|
|
400
|
+
willChange: "opacity",
|
|
401
|
+
...noBorderOnOpen ? { borderTop: "none" } : {}
|
|
402
|
+
},
|
|
380
403
|
children: /* @__PURE__ */ jsx("div", { ref, ...props, children })
|
|
381
404
|
}
|
|
382
405
|
) });
|