@lolmath/ui 2.2.0 → 2.3.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/dist/index.cjs +41 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -486,25 +486,50 @@ function ProgressBar({
|
|
|
486
486
|
}
|
|
487
487
|
|
|
488
488
|
// src/components/accordion.tsx
|
|
489
|
-
var
|
|
489
|
+
var import_react3 = require("react");
|
|
490
490
|
var import_tailwind_merge7 = require("tailwind-merge");
|
|
491
|
+
|
|
492
|
+
// src/utilities/css-id.tsx
|
|
493
|
+
var import_react2 = require("react");
|
|
494
|
+
function useCssId() {
|
|
495
|
+
return (0, import_react2.useId)().replaceAll(":", "");
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// src/utilities/view-transition.tsx
|
|
499
|
+
var import_react_dom = require("react-dom");
|
|
500
|
+
function startViewTransition(callback) {
|
|
501
|
+
if (document.startViewTransition) {
|
|
502
|
+
document.startViewTransition(() => {
|
|
503
|
+
(0, import_react_dom.flushSync)(callback);
|
|
504
|
+
});
|
|
505
|
+
} else {
|
|
506
|
+
callback();
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// src/components/accordion.tsx
|
|
491
511
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
492
512
|
function Accordion({ children, className }) {
|
|
493
|
-
const [activeItem, setActiveItem] = (0,
|
|
513
|
+
const [activeItem, setActiveItem] = (0, import_react3.useState)("");
|
|
514
|
+
const id = useCssId();
|
|
494
515
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
495
516
|
AccordionContext.Provider,
|
|
496
517
|
{
|
|
497
518
|
value: {
|
|
498
519
|
activeItem,
|
|
499
|
-
setActiveItem
|
|
520
|
+
setActiveItem,
|
|
521
|
+
id
|
|
500
522
|
},
|
|
501
523
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
502
524
|
"div",
|
|
503
525
|
{
|
|
504
526
|
className: (0, import_tailwind_merge7.twMerge)(
|
|
505
|
-
"bg-lol-blue-950 border-lol-gold-500 overflow-hidden
|
|
527
|
+
"bg-lol-blue-950 border-lol-gold-500 rounded border overflow-hidden",
|
|
506
528
|
className
|
|
507
529
|
),
|
|
530
|
+
style: {
|
|
531
|
+
viewTransitionName: `${id}`
|
|
532
|
+
},
|
|
508
533
|
children
|
|
509
534
|
}
|
|
510
535
|
)
|
|
@@ -515,8 +540,8 @@ function AccordionTrigger({
|
|
|
515
540
|
children,
|
|
516
541
|
className
|
|
517
542
|
}) {
|
|
518
|
-
const { setActiveItem, activeItem } = (0,
|
|
519
|
-
const { item } = (0,
|
|
543
|
+
const { setActiveItem, activeItem, id } = (0, import_react3.useContext)(AccordionContext);
|
|
544
|
+
const { item } = (0, import_react3.useContext)(AccordionItemContext);
|
|
520
545
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
521
546
|
"button",
|
|
522
547
|
{
|
|
@@ -525,7 +550,12 @@ function AccordionTrigger({
|
|
|
525
550
|
className
|
|
526
551
|
),
|
|
527
552
|
onClick: () => {
|
|
528
|
-
|
|
553
|
+
startViewTransition(() => {
|
|
554
|
+
setActiveItem((currentItem) => currentItem === item ? "" : item);
|
|
555
|
+
});
|
|
556
|
+
},
|
|
557
|
+
style: {
|
|
558
|
+
viewTransitionName: `${id}-${item}`
|
|
529
559
|
},
|
|
530
560
|
children: [
|
|
531
561
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -555,15 +585,15 @@ function AccordionItem({ children, value }) {
|
|
|
555
585
|
);
|
|
556
586
|
}
|
|
557
587
|
function AccordionContent({ children }) {
|
|
558
|
-
const { activeItem } = (0,
|
|
559
|
-
const { item } = (0,
|
|
588
|
+
const { activeItem } = (0, import_react3.useContext)(AccordionContext);
|
|
589
|
+
const { item } = (0, import_react3.useContext)(AccordionItemContext);
|
|
560
590
|
if (activeItem !== item) {
|
|
561
591
|
return null;
|
|
562
592
|
}
|
|
563
593
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-lol-blue-900 border-lol-gold-500 font-spiegel text-lol-blue-100 border-t px-5 py-2", children });
|
|
564
594
|
}
|
|
565
|
-
var AccordionContext = (0,
|
|
566
|
-
var AccordionItemContext = (0,
|
|
595
|
+
var AccordionContext = (0, import_react3.createContext)(void 0);
|
|
596
|
+
var AccordionItemContext = (0, import_react3.createContext)(void 0);
|
|
567
597
|
|
|
568
598
|
// src/components/text-field.tsx
|
|
569
599
|
var import_react_aria_components7 = require("react-aria-components");
|