@khipu/design-system 0.2.0-alpha.81 → 0.2.0-alpha.83
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/beercss/khipu-beercss.css +20 -12
- package/dist/beercss/khipu-beercss.js +4 -0
- package/dist/beercss/khipu-beercss.min.css +1 -1
- package/dist/beercss/khipu-beercss.min.js +1 -1
- package/dist/beercss/khipu-beercss.scoped.css +20 -12
- package/dist/beercss/khipu-beercss.scoped.min.css +1 -1
- package/dist/beercss/metadata.json +5 -5
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +13 -2
- package/dist/index.mjs +14 -3
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khipu/design-system/beercss",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.83",
|
|
4
4
|
"description": "Khipu BeerCSS bundle with Material Design 3 and Khipu customizations",
|
|
5
|
-
"buildDate": "2026-
|
|
5
|
+
"buildDate": "2026-07-01T02:24:52.411Z",
|
|
6
6
|
"includes": {
|
|
7
7
|
"beercss": "4.0.1",
|
|
8
8
|
"khipu-tokens": "latest",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"scopeClass": ".kds-theme-root",
|
|
21
21
|
"cdn": {
|
|
22
|
-
"css": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.
|
|
23
|
-
"cssScoped": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.
|
|
24
|
-
"js": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.
|
|
22
|
+
"css": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.83/dist/beercss/khipu-beercss.min.css",
|
|
23
|
+
"cssScoped": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.83/dist/beercss/khipu-beercss.scoped.min.css",
|
|
24
|
+
"js": "https://cdn.jsdelivr.net/npm/@khipu/design-system@0.2.0-alpha.83/dist/beercss/khipu-beercss.min.js"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -3753,6 +3753,11 @@ interface ExpandPanelProps {
|
|
|
3753
3753
|
id: string;
|
|
3754
3754
|
className: string;
|
|
3755
3755
|
hidden: boolean;
|
|
3756
|
+
/**
|
|
3757
|
+
* Ref the hook uses to drive the panel's `max-height` off its own `scrollHeight`, so the
|
|
3758
|
+
* expand animation fits any content length instead of clipping against a fixed CSS cap.
|
|
3759
|
+
*/
|
|
3760
|
+
ref: (node: HTMLDivElement | null) => void;
|
|
3756
3761
|
}
|
|
3757
3762
|
/**
|
|
3758
3763
|
* Result of {@link useExpandToggle}.
|
|
@@ -3779,9 +3784,9 @@ interface UseExpandToggleResult {
|
|
|
3779
3784
|
*
|
|
3780
3785
|
* It links button and panel via a stable `aria-controls`/`id` pair (`useId`), reflects the
|
|
3781
3786
|
* open state through `aria-expanded` (which drives the caret rotation in CSS) and toggles the
|
|
3782
|
-
* `open` class on the panel
|
|
3783
|
-
* attribute is also set when closed — the DS provides a
|
|
3784
|
-
* keeps the panel `display:block` so the collapse still animates.
|
|
3787
|
+
* `open` class on the panel, sizing its `max-height` to the content's `scrollHeight` so the
|
|
3788
|
+
* animation never clips. The `hidden` attribute is also set when closed — the DS provides a
|
|
3789
|
+
* `.kds-expand-panel[hidden]` rule that keeps the panel `display:block` so the collapse still animates.
|
|
3785
3790
|
*
|
|
3786
3791
|
* Supports controlled (`open` + `onOpenChange`) and uncontrolled (`defaultOpen`) usage. Combine
|
|
3787
3792
|
* with `useStickyInvoiceCollapse({ onCollapseStart: () => setOpen(false) })` to close on scroll.
|
package/dist/index.d.ts
CHANGED
|
@@ -3753,6 +3753,11 @@ interface ExpandPanelProps {
|
|
|
3753
3753
|
id: string;
|
|
3754
3754
|
className: string;
|
|
3755
3755
|
hidden: boolean;
|
|
3756
|
+
/**
|
|
3757
|
+
* Ref the hook uses to drive the panel's `max-height` off its own `scrollHeight`, so the
|
|
3758
|
+
* expand animation fits any content length instead of clipping against a fixed CSS cap.
|
|
3759
|
+
*/
|
|
3760
|
+
ref: (node: HTMLDivElement | null) => void;
|
|
3756
3761
|
}
|
|
3757
3762
|
/**
|
|
3758
3763
|
* Result of {@link useExpandToggle}.
|
|
@@ -3779,9 +3784,9 @@ interface UseExpandToggleResult {
|
|
|
3779
3784
|
*
|
|
3780
3785
|
* It links button and panel via a stable `aria-controls`/`id` pair (`useId`), reflects the
|
|
3781
3786
|
* open state through `aria-expanded` (which drives the caret rotation in CSS) and toggles the
|
|
3782
|
-
* `open` class on the panel
|
|
3783
|
-
* attribute is also set when closed — the DS provides a
|
|
3784
|
-
* keeps the panel `display:block` so the collapse still animates.
|
|
3787
|
+
* `open` class on the panel, sizing its `max-height` to the content's `scrollHeight` so the
|
|
3788
|
+
* animation never clips. The `hidden` attribute is also set when closed — the DS provides a
|
|
3789
|
+
* `.kds-expand-panel[hidden]` rule that keeps the panel `display:block` so the collapse still animates.
|
|
3785
3790
|
*
|
|
3786
3791
|
* Supports controlled (`open` + `onOpenChange`) and uncontrolled (`defaultOpen`) usage. Combine
|
|
3787
3792
|
* with `useStickyInvoiceCollapse({ onCollapseStart: () => setOpen(false) })` to close on scroll.
|
package/dist/index.js
CHANGED
|
@@ -2681,6 +2681,7 @@ function useStickyInvoiceCollapse(options = {}) {
|
|
|
2681
2681
|
const panelId = toggle.getAttribute("aria-controls");
|
|
2682
2682
|
const panel = panelId ? document.getElementById(panelId) : toggle.parentElement?.querySelector("[data-expand-panel], .kds-expand-panel");
|
|
2683
2683
|
panel?.classList.remove("open");
|
|
2684
|
+
if (panel) panel.style.maxHeight = "";
|
|
2684
2685
|
});
|
|
2685
2686
|
};
|
|
2686
2687
|
const apply = () => {
|
|
@@ -2747,6 +2748,15 @@ function useExpandToggle(options = {}) {
|
|
|
2747
2748
|
const isControlled = controlledOpen !== void 0;
|
|
2748
2749
|
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react48.useState)(defaultOpen);
|
|
2749
2750
|
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
2751
|
+
const panelRef = (0, import_react48.useRef)(null);
|
|
2752
|
+
const setPanelRef = (0, import_react48.useCallback)((node) => {
|
|
2753
|
+
panelRef.current = node;
|
|
2754
|
+
}, []);
|
|
2755
|
+
(0, import_react48.useLayoutEffect)(() => {
|
|
2756
|
+
const panel = panelRef.current;
|
|
2757
|
+
if (!panel) return;
|
|
2758
|
+
panel.style.maxHeight = open ? `${panel.scrollHeight}px` : "";
|
|
2759
|
+
}, [open]);
|
|
2750
2760
|
const setOpen = (0, import_react48.useCallback)(
|
|
2751
2761
|
(next) => {
|
|
2752
2762
|
if (!isControlled) {
|
|
@@ -2770,9 +2780,10 @@ function useExpandToggle(options = {}) {
|
|
|
2770
2780
|
(baseClassName = "kds-expand-panel") => ({
|
|
2771
2781
|
id: panelId,
|
|
2772
2782
|
className: open ? `${baseClassName} open` : baseClassName,
|
|
2773
|
-
hidden: !open
|
|
2783
|
+
hidden: !open,
|
|
2784
|
+
ref: setPanelRef
|
|
2774
2785
|
}),
|
|
2775
|
-
[open, panelId]
|
|
2786
|
+
[open, panelId, setPanelRef]
|
|
2776
2787
|
);
|
|
2777
2788
|
return { open, setOpen, toggle, getToggleProps, getPanelProps };
|
|
2778
2789
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2569,6 +2569,7 @@ function useStickyInvoiceCollapse(options = {}) {
|
|
|
2569
2569
|
const panelId = toggle.getAttribute("aria-controls");
|
|
2570
2570
|
const panel = panelId ? document.getElementById(panelId) : toggle.parentElement?.querySelector("[data-expand-panel], .kds-expand-panel");
|
|
2571
2571
|
panel?.classList.remove("open");
|
|
2572
|
+
if (panel) panel.style.maxHeight = "";
|
|
2572
2573
|
});
|
|
2573
2574
|
};
|
|
2574
2575
|
const apply = () => {
|
|
@@ -2627,7 +2628,7 @@ function useStickyInvoiceCollapse(options = {}) {
|
|
|
2627
2628
|
}
|
|
2628
2629
|
|
|
2629
2630
|
// src/components/core/hooks/useExpandToggle.ts
|
|
2630
|
-
import { useCallback as useCallback4, useId, useState as useState9 } from "react";
|
|
2631
|
+
import { useCallback as useCallback4, useId, useLayoutEffect, useRef as useRef5, useState as useState9 } from "react";
|
|
2631
2632
|
function useExpandToggle(options = {}) {
|
|
2632
2633
|
const { defaultOpen = false, open: controlledOpen, onOpenChange, id } = options;
|
|
2633
2634
|
const generatedId = useId();
|
|
@@ -2635,6 +2636,15 @@ function useExpandToggle(options = {}) {
|
|
|
2635
2636
|
const isControlled = controlledOpen !== void 0;
|
|
2636
2637
|
const [uncontrolledOpen, setUncontrolledOpen] = useState9(defaultOpen);
|
|
2637
2638
|
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
2639
|
+
const panelRef = useRef5(null);
|
|
2640
|
+
const setPanelRef = useCallback4((node) => {
|
|
2641
|
+
panelRef.current = node;
|
|
2642
|
+
}, []);
|
|
2643
|
+
useLayoutEffect(() => {
|
|
2644
|
+
const panel = panelRef.current;
|
|
2645
|
+
if (!panel) return;
|
|
2646
|
+
panel.style.maxHeight = open ? `${panel.scrollHeight}px` : "";
|
|
2647
|
+
}, [open]);
|
|
2638
2648
|
const setOpen = useCallback4(
|
|
2639
2649
|
(next) => {
|
|
2640
2650
|
if (!isControlled) {
|
|
@@ -2658,9 +2668,10 @@ function useExpandToggle(options = {}) {
|
|
|
2658
2668
|
(baseClassName = "kds-expand-panel") => ({
|
|
2659
2669
|
id: panelId,
|
|
2660
2670
|
className: open ? `${baseClassName} open` : baseClassName,
|
|
2661
|
-
hidden: !open
|
|
2671
|
+
hidden: !open,
|
|
2672
|
+
ref: setPanelRef
|
|
2662
2673
|
}),
|
|
2663
|
-
[open, panelId]
|
|
2674
|
+
[open, panelId, setPanelRef]
|
|
2664
2675
|
);
|
|
2665
2676
|
return { open, setOpen, toggle, getToggleProps, getPanelProps };
|
|
2666
2677
|
}
|
package/package.json
CHANGED