@womp/kookie-ui 0.36.0 → 0.37.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/components.css +0 -20
- package/dist/cjs/components/_internal/base-menu.utils.js +1 -1
- package/dist/cjs/components/_internal/base-menu.utils.js.map +2 -2
- package/dist/cjs/components/_internal/menu-context.js +1 -1
- package/dist/cjs/components/_internal/menu-context.js.map +2 -2
- package/dist/cjs/components/_internal/pane-chrome.js +1 -1
- package/dist/cjs/components/_internal/pane-chrome.js.map +2 -2
- package/dist/cjs/components/_internal/shell-bottom.d.ts +3 -3
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-handles.js +1 -1
- package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-pane.d.ts +2 -7
- package/dist/cjs/components/_internal/shell-pane.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-pane.js +1 -1
- package/dist/cjs/components/_internal/shell-pane.js.map +3 -3
- package/dist/cjs/components/_internal/shell-resizable.d.ts +3 -9
- package/dist/cjs/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js.map +3 -3
- package/dist/cjs/components/_internal/shell-resize.d.ts +0 -4
- package/dist/cjs/components/_internal/shell-resize.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-resize.js +1 -1
- package/dist/cjs/components/_internal/shell-resize.js.map +2 -2
- package/dist/cjs/components/_internal/shell-rest.d.ts +1 -6
- package/dist/cjs/components/_internal/shell-rest.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-rest.js +1 -1
- package/dist/cjs/components/_internal/shell-rest.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/_internal/shell-store.d.ts +0 -10
- package/dist/cjs/components/_internal/shell-store.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-store.js +1 -1
- package/dist/cjs/components/_internal/shell-store.js.map +3 -3
- package/dist/cjs/components/accordion.js +1 -1
- package/dist/cjs/components/accordion.js.map +1 -1
- package/dist/cjs/components/accordion.props.d.ts +4 -3
- package/dist/cjs/components/accordion.props.d.ts.map +1 -1
- package/dist/cjs/components/accordion.props.js +1 -1
- package/dist/cjs/components/accordion.props.js.map +1 -1
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox-group.js.map +3 -3
- package/dist/cjs/components/checkbox-group.primitive.d.ts +0 -10
- package/dist/cjs/components/checkbox-group.primitive.d.ts.map +1 -1
- package/dist/cjs/components/checkbox-group.primitive.js +1 -1
- package/dist/cjs/components/checkbox-group.primitive.js.map +3 -3
- package/dist/cjs/components/context-menu.d.ts +1 -5
- package/dist/cjs/components/context-menu.d.ts.map +1 -1
- package/dist/cjs/components/context-menu.js +1 -1
- package/dist/cjs/components/context-menu.js.map +3 -3
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +2 -2
- package/dist/cjs/components/index.js +2 -2
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/navigator.js.map +2 -2
- package/dist/cjs/components/schemas/index.d.ts +1 -1
- package/dist/cjs/components/schemas/index.d.ts.map +1 -1
- package/dist/cjs/components/schemas/index.js +1 -1
- package/dist/cjs/components/schemas/index.js.map +3 -3
- package/dist/cjs/components/schemas/shell.schema.d.ts +6 -112
- package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/shell.schema.js +1 -1
- package/dist/cjs/components/schemas/shell.schema.js.map +3 -3
- package/dist/cjs/components/separator.js +1 -1
- package/dist/cjs/components/separator.js.map +2 -2
- package/dist/cjs/components/shell.context.d.ts +1 -45
- package/dist/cjs/components/shell.context.d.ts.map +1 -1
- package/dist/cjs/components/shell.context.js +1 -1
- package/dist/cjs/components/shell.context.js.map +4 -4
- package/dist/cjs/components/shell.d.ts +7 -37
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +4 -4
- package/dist/cjs/components/shell.types.d.ts +6 -27
- package/dist/cjs/components/shell.types.d.ts.map +1 -1
- package/dist/cjs/components/shell.types.js +1 -1
- package/dist/cjs/components/shell.types.js.map +2 -2
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +2 -2
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +2 -2
- package/dist/cjs/hooks/use-breakpoint.js +1 -1
- package/dist/cjs/hooks/use-breakpoint.js.map +2 -2
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +1 -1
- package/dist/esm/{chunk-5RLGDXOM.js → chunk-2K46JPUL.js} +2 -2
- package/dist/esm/chunk-3DBHPBG6.js +3 -0
- package/dist/esm/{chunk-ASBTPKH3.js.map → chunk-3DBHPBG6.js.map} +2 -2
- package/dist/esm/chunk-3K7E4XL3.js +3 -0
- package/dist/esm/chunk-3K7E4XL3.js.map +7 -0
- package/dist/esm/chunk-3LR7KMBE.js +3 -0
- package/dist/esm/chunk-3LR7KMBE.js.map +7 -0
- package/dist/esm/chunk-5U2LEJLU.js +3 -0
- package/dist/esm/chunk-5U2LEJLU.js.map +7 -0
- package/dist/esm/{chunk-IN6D33TU.js → chunk-5XO3PLDH.js} +2 -2
- package/dist/esm/{chunk-COLJWVN7.js → chunk-AQR42GKA.js} +2 -2
- package/dist/esm/{chunk-FTNZWAPB.js → chunk-ARPUPT4M.js} +2 -2
- package/dist/esm/{chunk-ISCZ57VL.js → chunk-DJGZ4K3V.js} +2 -2
- package/dist/esm/{chunk-PMXIQ5B4.js → chunk-FKCKELUB.js} +2 -2
- package/dist/esm/chunk-H7GH3DTF.js +3 -0
- package/dist/esm/chunk-H7GH3DTF.js.map +7 -0
- package/dist/esm/{chunk-E6MOZSYV.js → chunk-HNOT2HS4.js} +2 -2
- package/dist/esm/chunk-LBAC2X4U.js +3 -0
- package/dist/esm/{chunk-5BXCPANF.js.map → chunk-LBAC2X4U.js.map} +3 -3
- package/dist/esm/{chunk-MAA6LEE2.js → chunk-MDQ7ZHOS.js} +1 -1
- package/dist/esm/chunk-MDQ7ZHOS.js.map +7 -0
- package/dist/esm/chunk-MQA3BKF4.js +3 -0
- package/dist/esm/chunk-MQA3BKF4.js.map +7 -0
- package/dist/esm/chunk-MXNPCJPV.js +3 -0
- package/dist/esm/chunk-MXNPCJPV.js.map +7 -0
- package/dist/esm/chunk-QBVTI32A.js +2 -0
- package/dist/esm/chunk-QBVTI32A.js.map +7 -0
- package/dist/esm/{chunk-EB4AG3OL.js → chunk-REELD6CT.js} +2 -2
- package/dist/esm/chunk-RYXIRZQW.js +3 -0
- package/dist/esm/chunk-RYXIRZQW.js.map +7 -0
- package/dist/esm/chunk-S66WR5R7.js +3 -0
- package/dist/esm/{chunk-MXEOE4LA.js.map → chunk-S66WR5R7.js.map} +2 -2
- package/dist/esm/chunk-SECVO3CW.js +3 -0
- package/dist/esm/chunk-SECVO3CW.js.map +7 -0
- package/dist/esm/chunk-SHDZYFUN.js +3 -0
- package/dist/esm/chunk-SHDZYFUN.js.map +7 -0
- package/dist/esm/{chunk-3M5ZM67R.js → chunk-TCFBNE6A.js} +2 -2
- package/dist/esm/chunk-U7P64MXD.js +3 -0
- package/dist/esm/chunk-U7P64MXD.js.map +7 -0
- package/dist/esm/chunk-UFYQC5XY.js +3 -0
- package/dist/esm/chunk-UFYQC5XY.js.map +7 -0
- package/dist/esm/{chunk-G66WDIIV.js → chunk-WJKCXGVN.js} +2 -2
- package/dist/esm/chunk-XBDAE77C.js +3 -0
- package/dist/esm/chunk-XBDAE77C.js.map +7 -0
- package/dist/esm/{chunk-SIYOLE6P.js → chunk-YM47BXKK.js} +2 -2
- package/dist/esm/components/_internal/base-menu.utils.js +1 -1
- package/dist/esm/components/_internal/menu-context.js +1 -1
- package/dist/esm/components/_internal/pane-chrome.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.d.ts +3 -3
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-handles.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.d.ts +3 -3
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-pane.d.ts +2 -7
- package/dist/esm/components/_internal/shell-pane.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-pane.js +1 -1
- package/dist/esm/components/_internal/shell-resizable.d.ts +3 -9
- package/dist/esm/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-resizable.js +1 -1
- package/dist/esm/components/_internal/shell-resize.d.ts +0 -4
- package/dist/esm/components/_internal/shell-resize.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-resize.js +1 -1
- package/dist/esm/components/_internal/shell-rest.d.ts +1 -6
- package/dist/esm/components/_internal/shell-rest.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-rest.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.d.ts +3 -3
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-store.d.ts +0 -10
- package/dist/esm/components/_internal/shell-store.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-store.js +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/accordion.props.d.ts +4 -3
- package/dist/esm/components/accordion.props.d.ts.map +1 -1
- package/dist/esm/components/accordion.props.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox-group.primitive.d.ts +0 -10
- package/dist/esm/components/checkbox-group.primitive.d.ts.map +1 -1
- package/dist/esm/components/checkbox-group.primitive.js +1 -1
- package/dist/esm/components/context-menu.d.ts +1 -5
- package/dist/esm/components/context-menu.d.ts.map +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/navigator.js +1 -1
- package/dist/esm/components/schemas/index.d.ts +1 -1
- package/dist/esm/components/schemas/index.d.ts.map +1 -1
- package/dist/esm/components/schemas/index.js +1 -1
- package/dist/esm/components/schemas/index.js.map +2 -2
- package/dist/esm/components/schemas/shell.schema.d.ts +6 -112
- package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/shell.schema.js +1 -1
- package/dist/esm/components/separator.js +1 -1
- package/dist/esm/components/shell.context.d.ts +1 -45
- package/dist/esm/components/shell.context.d.ts.map +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.d.ts +7 -37
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.types.d.ts +6 -27
- package/dist/esm/components/shell.types.d.ts.map +1 -1
- package/dist/esm/components/shell.types.js +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/virtual-menu.js +1 -1
- package/dist/esm/hooks/use-breakpoint.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/index.js +1 -1
- package/package.json +1 -1
- package/schemas/index.json +13 -335
- package/schemas/shell-bottom.json +2 -63
- package/schemas/shell-inspector.json +2 -63
- package/schemas/shell-panel.json +2 -63
- package/schemas/shell-rail.json +2 -38
- package/schemas/shell-sidebar.json +5 -102
- package/schemas/shell-trigger.json +0 -6
- package/src/components/_internal/shell-bottom.tsx +6 -26
- package/src/components/_internal/shell-handles.tsx +2 -32
- package/src/components/_internal/shell-inspector.tsx +6 -26
- package/src/components/_internal/shell-pane.tsx +7 -56
- package/src/components/_internal/shell-resizable.tsx +6 -81
- package/src/components/_internal/shell-resize.tsx +0 -4
- package/src/components/_internal/shell-rest.ts +2 -11
- package/src/components/_internal/shell-sidebar.tsx +8 -30
- package/src/components/_internal/shell-store.tsx +1 -34
- package/src/components/accordion.props.tsx +2 -4
- package/src/components/checkbox-group.primitive.tsx +0 -12
- package/src/components/context-menu.tsx +1 -6
- package/src/components/schemas/index.ts +0 -1
- package/src/components/schemas/shell.schema.ts +3 -20
- package/src/components/shell.context.tsx +5 -112
- package/src/components/shell.css +1 -29
- package/src/components/shell.tsx +12 -97
- package/src/components/shell.types.ts +6 -28
- package/styles.css +0 -20
- package/dist/cjs/components/shell.hooks.d.ts +0 -10
- package/dist/cjs/components/shell.hooks.d.ts.map +0 -1
- package/dist/cjs/components/shell.hooks.js +0 -3
- package/dist/cjs/components/shell.hooks.js.map +0 -7
- package/dist/esm/chunk-2VSRZ4IT.js +0 -3
- package/dist/esm/chunk-2VSRZ4IT.js.map +0 -7
- package/dist/esm/chunk-2WFN4D52.js +0 -3
- package/dist/esm/chunk-2WFN4D52.js.map +0 -7
- package/dist/esm/chunk-4OJRLS5N.js +0 -3
- package/dist/esm/chunk-4OJRLS5N.js.map +0 -7
- package/dist/esm/chunk-4TTRPCGG.js +0 -3
- package/dist/esm/chunk-4TTRPCGG.js.map +0 -7
- package/dist/esm/chunk-5BXCPANF.js +0 -3
- package/dist/esm/chunk-ASBTPKH3.js +0 -3
- package/dist/esm/chunk-B447PNRD.js +0 -3
- package/dist/esm/chunk-B447PNRD.js.map +0 -7
- package/dist/esm/chunk-BJVXB3PN.js +0 -3
- package/dist/esm/chunk-BJVXB3PN.js.map +0 -7
- package/dist/esm/chunk-DNY4WWZF.js +0 -3
- package/dist/esm/chunk-DNY4WWZF.js.map +0 -7
- package/dist/esm/chunk-HQT32HQ6.js +0 -3
- package/dist/esm/chunk-HQT32HQ6.js.map +0 -7
- package/dist/esm/chunk-I77CYEBT.js +0 -2
- package/dist/esm/chunk-I77CYEBT.js.map +0 -7
- package/dist/esm/chunk-KGCGT4MJ.js +0 -3
- package/dist/esm/chunk-KGCGT4MJ.js.map +0 -7
- package/dist/esm/chunk-M26LLCQC.js +0 -3
- package/dist/esm/chunk-M26LLCQC.js.map +0 -7
- package/dist/esm/chunk-MAA6LEE2.js.map +0 -7
- package/dist/esm/chunk-MXEOE4LA.js +0 -3
- package/dist/esm/chunk-TS4QCDSI.js +0 -3
- package/dist/esm/chunk-TS4QCDSI.js.map +0 -7
- package/dist/esm/chunk-XOAOSRTH.js +0 -3
- package/dist/esm/chunk-XOAOSRTH.js.map +0 -7
- package/dist/esm/chunk-XUCR7L4G.js +0 -3
- package/dist/esm/chunk-XUCR7L4G.js.map +0 -7
- package/dist/esm/components/shell.hooks.d.ts +0 -10
- package/dist/esm/components/shell.hooks.d.ts.map +0 -1
- package/dist/esm/components/shell.hooks.js +0 -3
- package/dist/esm/components/shell.hooks.js.map +0 -7
- package/src/components/shell.hooks.ts +0 -20
- /package/dist/esm/{chunk-5RLGDXOM.js.map → chunk-2K46JPUL.js.map} +0 -0
- /package/dist/esm/{chunk-IN6D33TU.js.map → chunk-5XO3PLDH.js.map} +0 -0
- /package/dist/esm/{chunk-COLJWVN7.js.map → chunk-AQR42GKA.js.map} +0 -0
- /package/dist/esm/{chunk-FTNZWAPB.js.map → chunk-ARPUPT4M.js.map} +0 -0
- /package/dist/esm/{chunk-ISCZ57VL.js.map → chunk-DJGZ4K3V.js.map} +0 -0
- /package/dist/esm/{chunk-PMXIQ5B4.js.map → chunk-FKCKELUB.js.map} +0 -0
- /package/dist/esm/{chunk-E6MOZSYV.js.map → chunk-HNOT2HS4.js.map} +0 -0
- /package/dist/esm/{chunk-EB4AG3OL.js.map → chunk-REELD6CT.js.map} +0 -0
- /package/dist/esm/{chunk-3M5ZM67R.js.map → chunk-TCFBNE6A.js.map} +0 -0
- /package/dist/esm/{chunk-G66WDIIV.js.map → chunk-WJKCXGVN.js.map} +0 -0
- /package/dist/esm/{chunk-SIYOLE6P.js.map → chunk-YM47BXKK.js.map} +0 -0
package/src/components/shell.css
CHANGED
|
@@ -885,34 +885,6 @@
|
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
887
|
|
|
888
|
-
/* ── Peek ──────────────────────────────────────────────────────────────────── */
|
|
889
|
-
|
|
890
|
-
/*
|
|
891
|
-
* A Trigger with `peekOnHover` previews a closed pane while the pointer is on
|
|
892
|
-
* it. The pane shows, floating above the content at its edge. After every
|
|
893
|
-
* breakpoint block, so it wins over a closed state at any width.
|
|
894
|
-
*/
|
|
895
|
-
.kui-ShellPane[data-peek][data-state],
|
|
896
|
-
.kui-ShellRail ~ .kui-ShellPanel[data-presentation-follows][data-peek][data-state] {
|
|
897
|
-
--kui-shell-position: absolute;
|
|
898
|
-
--kui-shell-z: 4;
|
|
899
|
-
--kui-shell-pin: fixed;
|
|
900
|
-
--kui-shell-pin-top: initial;
|
|
901
|
-
--kui-shell-row: 2 / 3;
|
|
902
|
-
--kui-shell-col: 1 / -1;
|
|
903
|
-
--kui-shell-surface: var(--color-surface);
|
|
904
|
-
--kui-shell-shadow: var(--surface-chrome);
|
|
905
|
-
--kui-shell-edge: 1px;
|
|
906
|
-
--kui-shell-offset: var(--shell-rail-offset, 0px);
|
|
907
|
-
--kui-shell-handle: none;
|
|
908
|
-
|
|
909
|
-
display: flex;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
.kui-ShellSidebar[data-peek][data-state] {
|
|
913
|
-
inline-size: var(--peek-sidebar-width, var(--sidebar-size, var(--sidebar-expanded-size, 288px)));
|
|
914
|
-
}
|
|
915
|
-
|
|
916
888
|
/* ── Scrim ─────────────────────────────────────────────────────────────────── */
|
|
917
889
|
|
|
918
890
|
/* Root-owned and always mounted; shown while an overlay is live. Under the overlay panes, over everything else. */
|
|
@@ -1207,7 +1179,7 @@
|
|
|
1207
1179
|
}
|
|
1208
1180
|
|
|
1209
1181
|
/*
|
|
1210
|
-
* The panes. A pane over the page (overlay, stacked
|
|
1182
|
+
* The panes. A pane over the page (overlay, stacked) attaches to the screen: its posture
|
|
1211
1183
|
* writes `--kui-shell-pin: fixed`. A pane in flow sticks beneath the header, a screen tall, and
|
|
1212
1184
|
* the bottom pane sticks to the screen's bottom. An overlay covers the header
|
|
1213
1185
|
* (`--kui-shell-pin-top: 0px`); the rest start beneath it.
|
package/src/components/shell.tsx
CHANGED
|
@@ -39,17 +39,14 @@ import {
|
|
|
39
39
|
ShellFrameContext,
|
|
40
40
|
ShellStoreContext,
|
|
41
41
|
createShellStore,
|
|
42
|
-
setShellPeek,
|
|
43
42
|
subscribeShellStore,
|
|
44
43
|
useFrameRegistration,
|
|
45
44
|
usePaneEntry,
|
|
46
45
|
useShellStore,
|
|
47
|
-
warnOnce,
|
|
48
46
|
type FramePaneId,
|
|
49
47
|
} from './_internal/shell-store.js';
|
|
50
|
-
import { navigationRest, detailRest, toPaneValue, startAnchoredGrowth
|
|
51
|
-
import {
|
|
52
|
-
import { useResponsivePresentation } from './shell.hooks.js';
|
|
48
|
+
import { navigationRest, detailRest, toPaneValue, startAnchoredGrowth } from './_internal/shell-rest.js';
|
|
49
|
+
import { useSidebarMode } from './shell.context.js';
|
|
53
50
|
import { readBreakpoint } from '../hooks/use-breakpoint.js';
|
|
54
51
|
import { useThemeSize } from '../hooks/theme-size.js';
|
|
55
52
|
import { PageScope } from './_internal/page-scope.js';
|
|
@@ -57,7 +54,7 @@ import { PaneChromeScope, PaneFooter, PaneHeader, Scroll, ShellContentContext, S
|
|
|
57
54
|
import { onPageScrollMediaChange, pageScrollMatches } from './_internal/shell-page-scroll.js';
|
|
58
55
|
import type { PaneSize, PaneHeaderProps, PaneFooterProps, ScrollProps } from './_internal/pane-chrome.js';
|
|
59
56
|
import { PaneBandSizeContext } from './_internal/pane-band-context.js';
|
|
60
|
-
import type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps, PaneMode, PaneName, PaneTarget, ResponsivePresentation, SidebarMode } from './shell.types.js';
|
|
57
|
+
import type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps, PaneMode, PaneName, PaneOpenChangeReason, PaneTarget, ResponsivePresentation, SidebarMode } from './shell.types.js';
|
|
61
58
|
|
|
62
59
|
/* ── Root ──────────────────────────────────────────────────────────────────── */
|
|
63
60
|
|
|
@@ -536,46 +533,17 @@ const Header = React.forwardRef<HTMLElement, ShellHeaderProps>(({ className, hei
|
|
|
536
533
|
});
|
|
537
534
|
Header.displayName = 'Shell.Header';
|
|
538
535
|
|
|
539
|
-
/* ── Left (deprecated) ─────────────────────────────────────────────────────── */
|
|
540
|
-
|
|
541
|
-
interface LeftProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
542
|
-
presentation?: ResponsivePresentation;
|
|
543
|
-
open?: boolean;
|
|
544
|
-
defaultOpen?: boolean;
|
|
545
|
-
onOpenChange?: (open: boolean, meta: { reason: 'init' | 'toggle' | 'panel' | 'responsive' | 'dismiss' }) => void;
|
|
546
|
-
collapsible?: boolean;
|
|
547
|
-
onExpand?: () => void;
|
|
548
|
-
onCollapse?: () => void;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
/**
|
|
552
|
-
* @deprecated The Root no longer wraps the Rail and Panel in a Left
|
|
553
|
-
* container: each is its own pane. `Shell.Left` renders its children and
|
|
554
|
-
* ignores its own props. Removed in 1.0.
|
|
555
|
-
*/
|
|
556
|
-
const Left = React.forwardRef<HTMLDivElement, LeftProps>(({ children }, _ref) => {
|
|
557
|
-
React.useEffect(() => {
|
|
558
|
-
warnOnce('Shell.Left is deprecated and is removed in 1.0. Render Shell.Rail and Shell.Panel directly in Shell.Root.');
|
|
559
|
-
}, []);
|
|
560
|
-
return <>{children}</>;
|
|
561
|
-
});
|
|
562
|
-
Left.displayName = 'Shell.Left';
|
|
563
|
-
|
|
564
536
|
/* ── Rail ──────────────────────────────────────────────────────────────────── */
|
|
565
537
|
|
|
566
|
-
type RailOpenChangeMeta = { reason:
|
|
538
|
+
type RailOpenChangeMeta = { reason: PaneOpenChangeReason };
|
|
567
539
|
|
|
568
|
-
type RailControlledProps = { open: boolean
|
|
540
|
+
type RailControlledProps = { open: boolean; onOpenChange?: (open: boolean, meta: RailOpenChangeMeta) => void; defaultOpen?: never };
|
|
569
541
|
type RailUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: RailOpenChangeMeta) => void; open?: never };
|
|
570
542
|
|
|
571
543
|
type RailProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
572
544
|
presentation?: ResponsivePresentation;
|
|
573
545
|
expandedSize?: number;
|
|
574
546
|
collapsible?: boolean;
|
|
575
|
-
/** @deprecated Use `onOpenChange`. */
|
|
576
|
-
onExpand?: () => void;
|
|
577
|
-
/** @deprecated Use `onOpenChange`. */
|
|
578
|
-
onCollapse?: () => void;
|
|
579
547
|
/**
|
|
580
548
|
* Sets whether this pane joins the app frame. The default is `true`: the pane sits against its
|
|
581
549
|
* neighbours with one hairline between them. Set `flush={false}` to pull it off the frame as a
|
|
@@ -588,7 +556,7 @@ type RailProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
|
588
556
|
const RAIL_PROP_NAMES = { controlled: 'open', default: 'defaultOpen' };
|
|
589
557
|
|
|
590
558
|
const Rail = React.forwardRef<HTMLDivElement, RailProps>((props, ref) => {
|
|
591
|
-
const { className, presentation, expandedSize = 64, collapsible: _collapsible,
|
|
559
|
+
const { className, presentation, expandedSize = 64, collapsible: _collapsible, children, style, open, defaultOpen, onOpenChange, flush = true, id, ...domProps } = props;
|
|
592
560
|
const { table, attributes } = usePresentationTable(presentation, 'fixed');
|
|
593
561
|
const pane = usePane({
|
|
594
562
|
name: 'rail',
|
|
@@ -600,8 +568,6 @@ const Rail = React.forwardRef<HTMLDivElement, RailProps>((props, ref) => {
|
|
|
600
568
|
presentationTable: table,
|
|
601
569
|
builtIn: navigationRest,
|
|
602
570
|
onChange: (value, reason) => onOpenChange?.(value !== 'closed', { reason }),
|
|
603
|
-
onExpand,
|
|
604
|
-
onCollapse,
|
|
605
571
|
size: expandedSize,
|
|
606
572
|
});
|
|
607
573
|
useFrameRegistration('rail', flush);
|
|
@@ -639,8 +605,8 @@ function RailContent({ children }: { children: React.ReactNode }) {
|
|
|
639
605
|
|
|
640
606
|
type HandleComponent = React.ForwardRefExoticComponent<React.ComponentPropsWithoutRef<'div'> & React.RefAttributes<HTMLDivElement>>;
|
|
641
607
|
|
|
642
|
-
type PanelOpenChangeMeta = { reason:
|
|
643
|
-
type PanelControlledProps = { open: boolean
|
|
608
|
+
type PanelOpenChangeMeta = { reason: PaneOpenChangeReason };
|
|
609
|
+
type PanelControlledProps = { open: boolean; onOpenChange?: (open: boolean, meta: PanelOpenChangeMeta) => void; defaultOpen?: never };
|
|
644
610
|
type PanelUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: PanelOpenChangeMeta) => void; open?: never };
|
|
645
611
|
|
|
646
612
|
type PanelSizeControlledProps = { size: number | string; defaultSize?: never };
|
|
@@ -687,16 +653,9 @@ const Panel = React.forwardRef<HTMLDivElement, PanelPublicProps>((props, ref) =>
|
|
|
687
653
|
maxSize = 800,
|
|
688
654
|
resizable = false,
|
|
689
655
|
collapsible = true,
|
|
690
|
-
onExpand,
|
|
691
|
-
onCollapse,
|
|
692
656
|
onResize,
|
|
693
657
|
onResizeStart,
|
|
694
658
|
onResizeEnd,
|
|
695
|
-
snapPoints,
|
|
696
|
-
snapTolerance,
|
|
697
|
-
collapseThreshold,
|
|
698
|
-
paneId,
|
|
699
|
-
persistence,
|
|
700
659
|
children,
|
|
701
660
|
style,
|
|
702
661
|
onSizeChange,
|
|
@@ -723,17 +682,10 @@ const Panel = React.forwardRef<HTMLDivElement, PanelPublicProps>((props, ref) =>
|
|
|
723
682
|
presentationTable,
|
|
724
683
|
builtIn: detailRest,
|
|
725
684
|
onChange: (value, reason) => onOpenChange?.(value !== 'closed', { reason }),
|
|
726
|
-
onExpand,
|
|
727
|
-
onCollapse,
|
|
728
685
|
size: expandedSize,
|
|
729
686
|
});
|
|
730
687
|
useFrameRegistration('panel', flush);
|
|
731
688
|
|
|
732
|
-
React.useEffect(() => {
|
|
733
|
-
if (snapPoints !== undefined || collapseThreshold !== undefined || paneId !== undefined || persistence !== undefined) {
|
|
734
|
-
warnOnce('Shell.Panel: `snapPoints`, `collapseThreshold`, `paneId` and `persistence` are deprecated and are removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`.');
|
|
735
|
-
}
|
|
736
|
-
}, [snapPoints, collapseThreshold, paneId, persistence]);
|
|
737
689
|
|
|
738
690
|
const elementRef = React.useRef<HTMLElement | null>(null);
|
|
739
691
|
const composedRef = useComposedRefs(ref, pane.setElement, elementRef);
|
|
@@ -759,11 +711,6 @@ const Panel = React.forwardRef<HTMLDivElement, PanelPublicProps>((props, ref) =>
|
|
|
759
711
|
onResize,
|
|
760
712
|
onResizeStart,
|
|
761
713
|
onResizeEnd,
|
|
762
|
-
snapPoints,
|
|
763
|
-
snapTolerance,
|
|
764
|
-
collapseThreshold,
|
|
765
|
-
paneId,
|
|
766
|
-
persistence,
|
|
767
714
|
overlaying: pane.overlaying,
|
|
768
715
|
// Asked when the effect runs: the Rail registers its table after this
|
|
769
716
|
// Panel first renders, so the render's answer can be out of date.
|
|
@@ -771,7 +718,6 @@ const Panel = React.forwardRef<HTMLDivElement, PanelPublicProps>((props, ref) =>
|
|
|
771
718
|
const table = followsRail ? (store.entries.get('rail')?.presentationTable ?? FIXED_TABLE) : own.table;
|
|
772
719
|
return table[readBreakpoint()] === 'overlay';
|
|
773
720
|
},
|
|
774
|
-
requestCollapse: () => pane.setValue('closed', 'toggle'),
|
|
775
721
|
requestToggle: () => pane.toggle('toggle'),
|
|
776
722
|
});
|
|
777
723
|
|
|
@@ -782,7 +728,7 @@ const Panel = React.forwardRef<HTMLDivElement, PanelPublicProps>((props, ref) =>
|
|
|
782
728
|
|
|
783
729
|
return (
|
|
784
730
|
<div
|
|
785
|
-
{...
|
|
731
|
+
{...domProps}
|
|
786
732
|
role={domProps.role ?? 'navigation'}
|
|
787
733
|
id={pane.id}
|
|
788
734
|
ref={composedRef}
|
|
@@ -851,14 +797,6 @@ interface TriggerProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
|
851
797
|
* `Button` the trigger: `<Shell.Trigger asChild><Button iconOnly aria-label="Toggle sidebar">…</Button></Shell.Trigger>`.
|
|
852
798
|
*/
|
|
853
799
|
asChild?: boolean;
|
|
854
|
-
/**
|
|
855
|
-
* Whether to show a preview of the target pane on hover while it is closed
|
|
856
|
-
* and not an overlay. Defaults to false.
|
|
857
|
-
*
|
|
858
|
-
* @deprecated Removed in 1.0. A preview reachable only by mouse hover has no
|
|
859
|
-
* keyboard or touch equivalent; open the pane instead.
|
|
860
|
-
*/
|
|
861
|
-
peekOnHover?: boolean;
|
|
862
800
|
}
|
|
863
801
|
|
|
864
802
|
/**
|
|
@@ -868,40 +806,22 @@ interface TriggerProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
|
868
806
|
* consumer's `onClick` first: calling `preventDefault()` there cancels it. With `asChild` the
|
|
869
807
|
* child is the button, and its own `type` stands.
|
|
870
808
|
*/
|
|
871
|
-
const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(({ target, action = 'toggle',
|
|
809
|
+
const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(({ target, action = 'toggle', asChild = false, onClick, children, ...props }, ref) => {
|
|
872
810
|
const store = useShellStore('Shell.Trigger');
|
|
873
|
-
React.useEffect(() => {
|
|
874
|
-
if (target === 'left') warnOnce('Shell.Trigger target="left" is deprecated and is removed in 1.0. Use target="rail".');
|
|
875
|
-
if (peekOnHover) warnOnce('Shell.Trigger: `peekOnHover` is deprecated and is removed in 1.0.');
|
|
876
|
-
}, [target, peekOnHover]);
|
|
877
|
-
const name: PaneName = target === 'left' ? 'rail' : target;
|
|
878
811
|
// Subscribes to its own pane only.
|
|
879
|
-
const entry = usePaneEntry(store,
|
|
812
|
+
const entry = usePaneEntry(store, target);
|
|
880
813
|
const shown = entry?.value === undefined ? undefined : entry.value !== 'closed';
|
|
881
814
|
|
|
882
815
|
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
883
816
|
onClick?.(event);
|
|
884
817
|
if (event.defaultPrevented) return;
|
|
885
|
-
const current = store.entries.get(
|
|
818
|
+
const current = store.entries.get(target);
|
|
886
819
|
if (!current) return;
|
|
887
|
-
if (store.peek === name) setShellPeek(store, null);
|
|
888
820
|
if (action === 'toggle') current.toggle('toggle');
|
|
889
821
|
else if (action === 'expand') current.setValue('open', 'toggle');
|
|
890
822
|
else current.setValue('closed', 'toggle');
|
|
891
823
|
};
|
|
892
824
|
|
|
893
|
-
const handleMouseEnter = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
894
|
-
onMouseEnter?.(event);
|
|
895
|
-
if (!peekOnHover) return;
|
|
896
|
-
const current = store.entries.get(name);
|
|
897
|
-
if (current && current.value === 'closed' && current.presentation !== 'overlay') setShellPeek(store, name);
|
|
898
|
-
};
|
|
899
|
-
|
|
900
|
-
const handleMouseLeave = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
901
|
-
onMouseLeave?.(event);
|
|
902
|
-
if (peekOnHover && store.peek === name) setShellPeek(store, null);
|
|
903
|
-
};
|
|
904
|
-
|
|
905
825
|
const Comp = asChild ? Slot.Root : 'button';
|
|
906
826
|
return (
|
|
907
827
|
<Comp
|
|
@@ -914,8 +834,6 @@ const Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(({ target, act
|
|
|
914
834
|
{...props}
|
|
915
835
|
ref={ref}
|
|
916
836
|
onClick={handleClick}
|
|
917
|
-
onMouseEnter={handleMouseEnter}
|
|
918
|
-
onMouseLeave={handleMouseLeave}
|
|
919
837
|
data-shell-trigger={target}
|
|
920
838
|
data-shell-action={action}
|
|
921
839
|
>
|
|
@@ -929,7 +847,6 @@ Trigger.displayName = 'Shell.Trigger';
|
|
|
929
847
|
export {
|
|
930
848
|
Root,
|
|
931
849
|
Header,
|
|
932
|
-
Left,
|
|
933
850
|
Rail,
|
|
934
851
|
Panel,
|
|
935
852
|
Sidebar,
|
|
@@ -940,9 +857,7 @@ export {
|
|
|
940
857
|
PaneHeader,
|
|
941
858
|
PaneFooter,
|
|
942
859
|
Scroll,
|
|
943
|
-
useShell,
|
|
944
860
|
useSidebarMode,
|
|
945
|
-
useResponsivePresentation,
|
|
946
861
|
type PaneMode,
|
|
947
862
|
type SidebarMode,
|
|
948
863
|
type ResponsivePresentation,
|
|
@@ -13,19 +13,11 @@ export type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs
|
|
|
13
13
|
|
|
14
14
|
export type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;
|
|
15
15
|
|
|
16
|
-
export type PaneSizePersistence = {
|
|
17
|
-
load?: () => number | Promise<number | undefined> | undefined;
|
|
18
|
-
save?: (size: number) => void | Promise<void>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
16
|
/**
|
|
22
|
-
* Why a pane's open state changed.
|
|
23
|
-
* `
|
|
24
|
-
* `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.
|
|
25
|
-
* `init`, `responsive`, `panel` and `left` are kept in the types for
|
|
26
|
-
* compatibility and are never sent.
|
|
17
|
+
* Why a pane's open state changed. Only a user action is reported: `toggle` for a Trigger or a
|
|
18
|
+
* handle double-click, and `dismiss` for Escape or a press on the scrim.
|
|
27
19
|
*/
|
|
28
|
-
export type PaneOpenChangeReason = 'toggle' | 'dismiss'
|
|
20
|
+
export type PaneOpenChangeReason = 'toggle' | 'dismiss';
|
|
29
21
|
|
|
30
22
|
export interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
31
23
|
presentation?: ResponsivePresentation;
|
|
@@ -34,23 +26,9 @@ export interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
34
26
|
maxSize?: number;
|
|
35
27
|
resizable?: boolean;
|
|
36
28
|
collapsible?: boolean;
|
|
37
|
-
/** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */
|
|
38
|
-
onExpand?: () => void;
|
|
39
|
-
/** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */
|
|
40
|
-
onCollapse?: () => void;
|
|
41
29
|
onResize?: (size: number) => void;
|
|
42
30
|
onResizeStart?: (size: number) => void;
|
|
43
31
|
onResizeEnd?: (size: number) => void;
|
|
44
|
-
/** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */
|
|
45
|
-
snapPoints?: number[];
|
|
46
|
-
/** @deprecated Removed in 1.0, with `snapPoints`. */
|
|
47
|
-
snapTolerance?: number;
|
|
48
|
-
/** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */
|
|
49
|
-
collapseThreshold?: number;
|
|
50
|
-
/** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */
|
|
51
|
-
paneId?: string;
|
|
52
|
-
/** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */
|
|
53
|
-
persistence?: PaneSizePersistence;
|
|
54
32
|
}
|
|
55
33
|
|
|
56
34
|
export const _BREAKPOINTS = {
|
|
@@ -66,10 +44,10 @@ export type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;
|
|
|
66
44
|
/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */
|
|
67
45
|
export const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];
|
|
68
46
|
|
|
69
|
-
|
|
47
|
+
/** The panes a Trigger can drive. */
|
|
48
|
+
export type PaneTarget = 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';
|
|
70
49
|
|
|
71
|
-
|
|
72
|
-
export type PaneName = Exclude<PaneTarget, 'left'>;
|
|
50
|
+
export type PaneName = PaneTarget;
|
|
73
51
|
|
|
74
52
|
/**
|
|
75
53
|
* CSS custom property key type for type-safe style objects.
|
package/styles.css
CHANGED
|
@@ -17747,26 +17747,6 @@
|
|
|
17747
17747
|
inline-size: var(--sidebar-size, var(--sidebar-expanded-size, 288px));
|
|
17748
17748
|
}
|
|
17749
17749
|
}
|
|
17750
|
-
.kui-ShellPane[data-peek][data-state],
|
|
17751
|
-
.kui-ShellRail ~ .kui-ShellPanel[data-presentation-follows][data-peek][data-state] {
|
|
17752
|
-
--kui-shell-position: absolute;
|
|
17753
|
-
--kui-shell-z: 4;
|
|
17754
|
-
--kui-shell-pin: fixed;
|
|
17755
|
-
--kui-shell-pin-top: initial;
|
|
17756
|
-
--kui-shell-row: 2 / 3;
|
|
17757
|
-
--kui-shell-col: 1 / -1;
|
|
17758
|
-
--kui-shell-surface: var(--color-surface);
|
|
17759
|
-
--kui-shell-shadow: var(--surface-chrome);
|
|
17760
|
-
--kui-shell-edge: 1px;
|
|
17761
|
-
--kui-shell-offset: var(--shell-rail-offset, 0px);
|
|
17762
|
-
--kui-shell-handle: none;
|
|
17763
|
-
display: -webkit-box;
|
|
17764
|
-
display: -ms-flexbox;
|
|
17765
|
-
display: flex;
|
|
17766
|
-
}
|
|
17767
|
-
.kui-ShellSidebar[data-peek][data-state] {
|
|
17768
|
-
inline-size: var(--peek-sidebar-width, var(--sidebar-size, var(--sidebar-expanded-size, 288px)));
|
|
17769
|
-
}
|
|
17770
17750
|
.kui-ShellScrim {
|
|
17771
17751
|
display: none;
|
|
17772
17752
|
position: absolute;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PresentationValue, ResponsivePresentation } from './shell.types.js';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Since 0.8.0 the Shell resolves a responsive `presentation` in
|
|
4
|
-
* its stylesheet, so the pane is placed before any script runs. This hook
|
|
5
|
-
* resolves it in JS after mount, which is the behaviour the Shell left
|
|
6
|
-
* behind. It keeps working until 1.0.
|
|
7
|
-
*/
|
|
8
|
-
declare function useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue;
|
|
9
|
-
export { useResponsivePresentation };
|
|
10
|
-
//# sourceMappingURL=shell.hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell.hooks.d.ts","sourceRoot":"","sources":["../../../src/components/shell.hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAGlF;;;;;GAKG;AACH,iBAAS,yBAAyB,CAAC,YAAY,EAAE,sBAAsB,GAAG,iBAAiB,CAM1F;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";var T=Object.create;var p=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of B(t))!C.call(e,r)&&r!==n&&p(e,r,{get:()=>t[r],enumerable:!(i=E(t,r))||i.enumerable});return e};var d=(e,t,n)=>(n=e!=null?T(w(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),L=e=>y(p({},"__esModule",{value:!0}),e);var K={};O(K,{useResponsivePresentation:()=>_});module.exports=L(K);var k=d(require("react"));var l=d(require("react"));var P={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},b=["initial","xs","sm","md","lg","xl"];var M=Object.entries(P),c=null,s=new Set,o=null;function f(){return c??(c=M.map(([e,t])=>[e,window.matchMedia(t)])),c}function m(){let e="initial";for(let[t,n]of f())n.matches&&(e=t);return e}function u(){let e=m();e!==o&&(o=e,s.forEach(t=>t()))}function R(e){if(typeof window>"u")return()=>{};if(s.size===0){o=m();for(let[,t]of f())typeof t.addEventListener=="function"?t.addEventListener("change",u):t.addListener?.(u)}return s.add(e),()=>{if(s.delete(e),!(s.size>0)){for(let[,t]of f())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",u):t.removeListener?.(u)}catch{}o=null}}}function N(){return typeof window>"u"?"initial":(o??(o=m()),o)}function V(){return"initial"}var z=()=>!0,I=()=>!1,h=()=>()=>{},F=()=>"initial";function g(e=!0){let t=l.useSyncExternalStore(e?R:h,e?N:F,V),n=l.useSyncExternalStore(e?R:h,z,I);return l.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var a=d(require("react")),A=require("radix-ui/internal");function v(e){return typeof e=="object"&&e!==null}function S(e,t){let n={},i=null;for(let r of b){if(e!==void 0&&!v(e)){n[r]=e;continue}let x=v(e)?e[r]:void 0;x!==void 0&&(i={value:x}),n[r]=i?i.value:t(r)}return n}var H=S("fixed",()=>"fixed");var W=a.createContext(null);var J=a.createContext(null);function _(e){k.useEffect(()=>{},[]);let{breakpoint:t}=g(typeof e!="string");return S(e,()=>"fixed")[t]}
|
|
3
|
-
//# sourceMappingURL=shell.hooks.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/shell.hooks.ts", "../../../src/hooks/use-breakpoint.ts", "../../../src/components/shell.types.ts", "../../../src/components/_internal/shell-store.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport { useBreakpoint } from '../hooks/use-breakpoint.js';\nimport type { PresentationValue, ResponsivePresentation } from './shell.types.js';\nimport { tableOf, warnOnce } from './_internal/shell-store.js';\n\n/**\n * @deprecated Since 0.8.0 the Shell resolves a responsive `presentation` in\n * its stylesheet, so the pane is placed before any script runs. This hook\n * resolves it in JS after mount, which is the behaviour the Shell left\n * behind. It keeps working until 1.0.\n */\nfunction useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue {\n React.useEffect(() => {\n warnOnce('Shell.useResponsivePresentation is deprecated and is removed in 1.0. The Shell resolves presentation in CSS.');\n }, []);\n const { breakpoint } = useBreakpoint(typeof presentation !== 'string');\n return tableOf<PresentationValue>(presentation, () => 'fixed')[breakpoint];\n}\n\nexport { useResponsivePresentation };\n", "'use client';\n\nimport * as React from 'react';\nimport { _BREAKPOINTS, type Breakpoint } from '../components/shell.types.js';\n\nconst QUERIES = Object.entries(_BREAKPOINTS) as Array<[Breakpoint, string]>;\n\ntype Listener = () => void;\n\n/**\n * One set of `MediaQueryList`s and one set of listeners for the whole\n * application. Every component that asks for the breakpoint used to create and\n * subscribe to its own copy of all five queries.\n */\nlet mediaQueryLists: Array<[Breakpoint, MediaQueryList]> | null = null;\nconst listeners = new Set<Listener>();\nlet cachedBreakpoint: Breakpoint | null = null;\n\nfunction getMediaQueryLists() {\n mediaQueryLists ??= QUERIES.map(([name, query]) => [name, window.matchMedia(query)] as [Breakpoint, MediaQueryList]);\n return mediaQueryLists;\n}\n\nfunction computeBreakpoint(): Breakpoint {\n // The largest matching query wins; `_BREAKPOINTS` is ordered smallest first.\n let matched: Breakpoint = 'initial';\n for (const [name, mql] of getMediaQueryLists()) {\n if (mql.matches) matched = name;\n }\n return matched;\n}\n\nfunction handleChange() {\n const next = computeBreakpoint();\n if (next === cachedBreakpoint) return;\n cachedBreakpoint = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: Listener) {\n if (typeof window === 'undefined') return () => {};\n\n if (listeners.size === 0) {\n cachedBreakpoint = computeBreakpoint();\n for (const [, mql] of getMediaQueryLists()) {\n // Safari below 14 only has the deprecated listener API.\n if (typeof mql.addEventListener === 'function') mql.addEventListener('change', handleChange);\n else mql.addListener?.(handleChange);\n }\n }\n\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size > 0) return;\n\n for (const [, mql] of getMediaQueryLists()) {\n try {\n if (typeof mql.removeEventListener === 'function') mql.removeEventListener('change', handleChange);\n else mql.removeListener?.(handleChange);\n } catch (error) {\n // Removal can throw in edge cases, e.g. the list was already torn down.\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[useBreakpoint] MediaQueryList cleanup warning:', error);\n }\n }\n }\n cachedBreakpoint = null;\n };\n}\n\n/**\n * `getSnapshot` must return a referentially stable value between changes, so it\n * reads the cache that `handleChange` maintains rather than recomputing.\n */\nfunction getSnapshot(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n cachedBreakpoint ??= computeBreakpoint();\n return cachedBreakpoint;\n}\n\nfunction getServerSnapshot(): Breakpoint {\n return 'initial';\n}\n\n/**\n * The breakpoint right now, outside React's render. For an effect that needs\n * the answer at the moment it runs rather than the one its render saw.\n */\nexport function readBreakpoint(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n return computeBreakpoint();\n}\n\nconst getReadySnapshot = () => true;\nconst getReadyServerSnapshot = () => false;\n\nconst noopSubscribe = () => () => {};\nconst getInitialSnapshot = (): Breakpoint => 'initial';\n\n/**\n * The current breakpoint, and whether it has been resolved against a real\n * viewport yet (`false` on the server and during hydration).\n *\n * Reads through `useSyncExternalStore` rather than settling into state from an\n * effect. On a client render the very first pass already has the real\n * breakpoint, instead of rendering the whole shell at `initial` and correcting\n * it after the browser has painted.\n *\n * Pass `enabled = false` to skip the subscription (the breakpoint then reads as\n * `initial`).\n */\nexport function useBreakpoint(enabled = true): { breakpoint: Breakpoint; ready: boolean } {\n // Callers with a non-responsive value pass `enabled = false` so they neither\n // subscribe to the media queries nor re-render when the viewport crosses one.\n const breakpoint = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n enabled ? getSnapshot : getInitialSnapshot,\n getServerSnapshot,\n );\n const ready = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n getReadySnapshot,\n getReadyServerSnapshot,\n );\n\n return React.useMemo(() => ({ breakpoint, ready }), [breakpoint, ready]);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Off the frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type FramePaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellFrameContext = React.createContext<{\n registerOffFrame: (id: FramePaneId) => void;\n unregisterOffFrame: (id: FramePaneId) => void;\n} | null>(null);\n\n/** Tells the Root a pane is off the frame (`flush={false}`); the Rail's card moves a floating Panel over. */\nexport function useFrameRegistration(id: FramePaneId, flush: boolean) {\n const ctx = React.useContext(ShellFrameContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerOffFrame, unregisterOffFrame } = ctx;\n useLayoutEffect(() => {\n if (flush) return;\n registerOffFrame(id);\n return () => unregisterOffFrame(id);\n }, [id, flush, registerOffFrame, unregisterOffFrame]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["shell_hooks_exports", "__export", "useResponsivePresentation", "__toCommonJS", "React", "React", "_BREAKPOINTS", "SHELL_BREAKPOINTS", "QUERIES", "_BREAKPOINTS", "mediaQueryLists", "listeners", "cachedBreakpoint", "getMediaQueryLists", "name", "query", "computeBreakpoint", "matched", "mql", "handleChange", "next", "listener", "subscribe", "getSnapshot", "getServerSnapshot", "getReadySnapshot", "getReadyServerSnapshot", "noopSubscribe", "getInitialSnapshot", "useBreakpoint", "enabled", "breakpoint", "subscribe", "getSnapshot", "getServerSnapshot", "ready", "React", "import_internal", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "ShellStoreContext", "ShellFrameContext", "useResponsivePresentation", "presentation", "breakpoint", "useBreakpoint", "tableOf"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import*as e from"react";import{Checkbox as s,Direction as S}from"radix-ui";import{Context as V,Primitive as q,useControllableState as N}from"radix-ui/internal";var{useDirection:D}=S,l="CheckboxGroup",[U,T]=V.createContextScope(l,[s.createCheckboxScope]),x=s.createCheckboxScope(),[W,A]=U(l),m=e.forwardRef((t,n)=>{let{__scopeCheckboxGroup:r,name:i,defaultValue:c,value:o,required:u=!1,disabled:a=!1,orientation:b,dir:C,loop:k,onValueChange:G,...I}=t,R=D(C),[y=[],p]=N({prop:o,defaultProp:c??[],onChange:G}),g=e.useCallback(d=>p((h=[])=>[...h,d]),[p]),E=e.useCallback(d=>p((h=[])=>h.filter(_=>_!==d)),[p]);return e.createElement(W,{scope:r,name:i,required:u,disabled:a,value:y,onItemCheck:g,onItemUncheck:E},e.createElement(q.div,{role:"group","data-disabled":a?"":void 0,dir:R,...I,ref:n}))});m.displayName=l;var P="CheckboxGroupItem",f=e.forwardRef((t,n)=>{let{__scopeCheckboxGroup:r,disabled:i,...c}=t,o=A(P,r),u=o.disabled||i,a=x(r),b=o.value?.includes(c.value),C=o.required&&(o.value?.length??0)===0;return e.createElement(s.Root,{name:o.name,disabled:u,required:C,checked:b,...a,...c,ref:n,onCheckedChange:k=>{k?o.onItemCheck(t.value):o.onItemUncheck(t.value)}})});f.displayName=P;var M="CheckboxGroupIndicator",v=e.forwardRef((t,n)=>{let{__scopeCheckboxGroup:r,...i}=t,c=x(r);return e.createElement(s.Indicator,{...c,...i,ref:n})});v.displayName=M;var z=m,B=f,H=v;export{T as a,m as b,f as c,v as d,z as e,B as f,H as g};
|
|
3
|
-
//# sourceMappingURL=chunk-2VSRZ4IT.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/checkbox-group.primitive.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport { Checkbox as CheckboxPrimitive, Direction } from 'radix-ui';\nimport { Context, Primitive, useControllableState } from 'radix-ui/internal';\n\nconst { useDirection } = Direction;\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxGroup\n * -----------------------------------------------------------------------------------------------*/\nconst CHECKBOX_GROUP_NAME = 'CheckboxGroup';\n\ntype ScopedProps<P> = P & { __scopeCheckboxGroup?: Context.Scope };\nconst [createCheckboxGroupContext, createCheckboxGroupScope] = Context.createContextScope(\n CHECKBOX_GROUP_NAME,\n [CheckboxPrimitive.createCheckboxScope],\n);\nconst useCheckboxScope = CheckboxPrimitive.createCheckboxScope();\n\ntype CheckboxGroupContextValue = {\n name?: string;\n required: boolean;\n disabled: boolean;\n value?: string[];\n onItemCheck(value: string): void;\n onItemUncheck(value: string): void;\n};\n\nconst [CheckboxGroupProvider, useCheckboxGroupContext] =\n createCheckboxGroupContext<CheckboxGroupContextValue>(CHECKBOX_GROUP_NAME);\n\ntype CheckboxGroupElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface CheckboxGroupProps extends PrimitiveDivProps {\n name?: CheckboxGroupContextValue['name'];\n required?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['required'];\n disabled?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['disabled'];\n dir?: 'ltr' | 'rtl';\n /**\n * @deprecated Has no effect. Each checkbox is its own tab stop, as with native checkboxes,\n * so there is no arrow-key navigation to orient.\n */\n orientation?: 'horizontal' | 'vertical';\n /**\n * @deprecated Has no effect. Each checkbox is its own tab stop, as with native checkboxes,\n * so there is no arrow-key navigation to loop.\n */\n loop?: boolean;\n defaultValue?: string[];\n value?: CheckboxGroupContextValue['value'];\n onValueChange?: (value: string[]) => void;\n}\n\nconst CheckboxGroup = React.forwardRef<CheckboxGroupElement, CheckboxGroupProps>(\n (props: ScopedProps<CheckboxGroupProps>, forwardedRef) => {\n const {\n __scopeCheckboxGroup,\n name,\n defaultValue,\n value: valueProp,\n required = false,\n disabled = false,\n orientation: _orientation,\n dir,\n loop: _loop,\n onValueChange,\n ...groupProps\n } = props;\n const direction = useDirection(dir);\n const [value = [], setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue ?? [],\n onChange: onValueChange,\n });\n\n const handleItemCheck = React.useCallback(\n (itemValue: string) => setValue((prevValue = []) => [...prevValue, itemValue]),\n [setValue],\n );\n\n const handleItemUncheck = React.useCallback(\n (itemValue: string) =>\n setValue((prevValue = []) => prevValue.filter((value) => value !== itemValue)),\n [setValue],\n );\n\n return (\n <CheckboxGroupProvider\n scope={__scopeCheckboxGroup}\n name={name}\n required={required}\n disabled={disabled}\n value={value}\n onItemCheck={handleItemCheck}\n onItemUncheck={handleItemUncheck}\n >\n <Primitive.div\n role=\"group\"\n data-disabled={disabled ? '' : undefined}\n dir={direction}\n {...groupProps}\n ref={forwardedRef}\n />\n </CheckboxGroupProvider>\n );\n },\n);\n\nCheckboxGroup.displayName = CHECKBOX_GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'CheckboxGroupItem';\n\ntype CheckboxGroupItemElement = React.ElementRef<typeof CheckboxPrimitive.Root>;\ntype CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;\ninterface CheckboxGroupItemProps\n extends Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onCheckedChange' | 'name'> {\n value: string;\n}\n\nconst CheckboxGroupItem = React.forwardRef<CheckboxGroupItemElement, CheckboxGroupItemProps>(\n (props: ScopedProps<CheckboxGroupItemProps>, forwardedRef) => {\n const { __scopeCheckboxGroup, disabled, ...itemProps } = props;\n const context = useCheckboxGroupContext(ITEM_NAME, __scopeCheckboxGroup);\n const isDisabled = context.disabled || disabled;\n const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);\n const checked = context.value?.includes(itemProps.value);\n // A required group needs at least one box checked, not every box: the items are\n // required only while none is checked.\n const isRequired = context.required && (context.value?.length ?? 0) === 0;\n\n return (\n <CheckboxPrimitive.Root\n name={context.name}\n disabled={isDisabled}\n required={isRequired}\n checked={checked}\n {...checkboxScope}\n {...itemProps}\n ref={forwardedRef}\n onCheckedChange={(checked) => {\n if (checked) {\n context.onItemCheck(props.value);\n } else {\n context.onItemUncheck(props.value);\n }\n }}\n />\n );\n },\n);\n\nCheckboxGroupItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * CheckboxGroupIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'CheckboxGroupIndicator';\n\ntype CheckboxGroupIndicatorElement = React.ElementRef<typeof CheckboxPrimitive.Indicator>;\ntype CheckboxIndicatorProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Indicator>;\ninterface CheckboxGroupIndicatorProps extends CheckboxIndicatorProps {}\n\nconst CheckboxGroupIndicator = React.forwardRef<\n CheckboxGroupIndicatorElement,\n CheckboxGroupIndicatorProps\n>((props: ScopedProps<CheckboxGroupIndicatorProps>, forwardedRef) => {\n const { __scopeCheckboxGroup, ...indicatorProps } = props;\n const checkboxScope = useCheckboxScope(__scopeCheckboxGroup);\n return <CheckboxPrimitive.Indicator {...checkboxScope} {...indicatorProps} ref={forwardedRef} />;\n});\n\nCheckboxGroupIndicator.displayName = INDICATOR_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nconst Root = CheckboxGroup;\nconst Item = CheckboxGroupItem;\nconst Indicator = CheckboxGroupIndicator;\n\nexport {\n createCheckboxGroupScope,\n //\n CheckboxGroup,\n CheckboxGroupItem,\n CheckboxGroupIndicator,\n //\n Root,\n Item,\n Indicator,\n};\nexport type { CheckboxGroupProps, CheckboxGroupItemProps, CheckboxGroupIndicatorProps };\n"],
|
|
5
|
-
"mappings": ";AAEA,UAAYA,MAAW,QACvB,OAAS,YAAYC,EAAmB,aAAAC,MAAiB,WACzD,OAAS,WAAAC,EAAS,aAAAC,EAAW,wBAAAC,MAA4B,oBAEzD,GAAM,CAAE,aAAAC,CAAa,EAAIJ,EAKnBK,EAAsB,gBAGtB,CAACC,EAA4BC,CAAwB,EAAIN,EAAQ,mBACrEI,EACA,CAACN,EAAkB,mBAAmB,CACxC,EACMS,EAAmBT,EAAkB,oBAAoB,EAWzD,CAACU,EAAuBC,CAAuB,EACnDJ,EAAsDD,CAAmB,EAwBrEM,EAAsB,aAC1B,CAACC,EAAwCC,IAAiB,CACxD,GAAM,CACJ,qBAAAC,EACA,KAAAC,EACA,aAAAC,EACA,MAAOC,EACP,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,YAAaC,EACb,IAAAC,EACA,KAAMC,EACN,cAAAC,EACA,GAAGC,CACL,EAAIZ,EACEa,EAAYrB,EAAaiB,CAAG,EAC5B,CAACK,EAAQ,CAAC,EAAGC,CAAQ,EAAIxB,EAAqB,CAClD,KAAMc,EACN,YAAaD,GAAgB,CAAC,EAC9B,SAAUO,CACZ,CAAC,EAEKK,EAAwB,cAC3BC,GAAsBF,EAAS,CAACG,EAAY,CAAC,IAAM,CAAC,GAAGA,EAAWD,CAAS,CAAC,EAC7E,CAACF,CAAQ,CACX,EAEMI,EAA0B,cAC7BF,GACCF,EAAS,CAACG,EAAY,CAAC,IAAMA,EAAU,OAAQJ,GAAUA,IAAUG,CAAS,CAAC,EAC/E,CAACF,CAAQ,CACX,EAEA,OACE,gBAAClB,EAAA,CACC,MAAOK,EACP,KAAMC,EACN,SAAUG,EACV,SAAUC,EACV,MAAOO,EACP,YAAaE,EACb,cAAeG,GAEf,gBAAC7B,EAAU,IAAV,CACC,KAAK,QACL,gBAAeiB,EAAW,GAAK,OAC/B,IAAKM,EACJ,GAAGD,EACJ,IAAKX,EACP,CACF,CAEJ,CACF,EAEAF,EAAc,YAAcN,EAM5B,IAAM2B,EAAY,oBASZC,EAA0B,aAC9B,CAACrB,EAA4CC,IAAiB,CAC5D,GAAM,CAAE,qBAAAC,EAAsB,SAAAK,EAAU,GAAGe,CAAU,EAAItB,EACnDuB,EAAUzB,EAAwBsB,EAAWlB,CAAoB,EACjEsB,EAAaD,EAAQ,UAAYhB,EACjCkB,EAAgB7B,EAAiBM,CAAoB,EACrDwB,EAAUH,EAAQ,OAAO,SAASD,EAAU,KAAK,EAGjDK,EAAaJ,EAAQ,WAAaA,EAAQ,OAAO,QAAU,KAAO,EAExE,OACE,gBAACpC,EAAkB,KAAlB,CACC,KAAMoC,EAAQ,KACd,SAAUC,EACV,SAAUG,EACV,QAASD,EACR,GAAGD,EACH,GAAGH,EACJ,IAAKrB,EACL,gBAAkByB,GAAY,CACxBA,EACFH,EAAQ,YAAYvB,EAAM,KAAK,EAE/BuB,EAAQ,cAAcvB,EAAM,KAAK,CAErC,EACF,CAEJ,CACF,EAEAqB,EAAkB,YAAcD,EAMhC,IAAMQ,EAAiB,yBAMjBC,EAA+B,aAGnC,CAAC7B,EAAiDC,IAAiB,CACnE,GAAM,CAAE,qBAAAC,EAAsB,GAAG4B,CAAe,EAAI9B,EAC9CyB,EAAgB7B,EAAiBM,CAAoB,EAC3D,OAAO,gBAACf,EAAkB,UAAlB,CAA6B,GAAGsC,EAAgB,GAAGK,EAAgB,IAAK7B,EAAc,CAChG,CAAC,EAED4B,EAAuB,YAAcD,EAIrC,IAAMG,EAAOhC,EACPiC,EAAOX,EACPY,EAAYJ",
|
|
6
|
-
"names": ["React", "CheckboxPrimitive", "Direction", "Context", "Primitive", "useControllableState", "useDirection", "CHECKBOX_GROUP_NAME", "createCheckboxGroupContext", "createCheckboxGroupScope", "useCheckboxScope", "CheckboxGroupProvider", "useCheckboxGroupContext", "CheckboxGroup", "props", "forwardedRef", "__scopeCheckboxGroup", "name", "defaultValue", "valueProp", "required", "disabled", "_orientation", "dir", "_loop", "onValueChange", "groupProps", "direction", "value", "setValue", "handleItemCheck", "itemValue", "prevValue", "handleItemUncheck", "ITEM_NAME", "CheckboxGroupItem", "itemProps", "context", "isDisabled", "checkboxScope", "checked", "isRequired", "INDICATOR_NAME", "CheckboxGroupIndicator", "indicatorProps", "Root", "Item", "Indicator"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{b as H,d as U,g as D}from"./chunk-XUCR7L4G.js";import{a as V,c as m}from"./chunk-4OJRLS5N.js";import{a as k,b as N,c as w}from"./chunk-KGCGT4MJ.js";import{a as B,b as I,c as A}from"./chunk-4TTRPCGG.js";import{a as T}from"./chunk-MXEOE4LA.js";import{a as y}from"./chunk-G66WDIIV.js";import{b as M}from"./chunk-VWRPVM5K.js";import{f as E}from"./chunk-PMXIQ5B4.js";import{o as x}from"./chunk-5BXCPANF.js";import*as e from"react";import ue from"classnames";import{useComposedRefs as Se}from"radix-ui/internal";var L=t=>t==="collapsed"?"closed":"open",ce=t=>t==="closed"?"collapsed":"expanded";function O(t){if(t===void 0)return;if(typeof t=="string")return L(t);let n={};for(let[r,i]of Object.entries(t))i!==void 0&&(n[r]=L(i));return n}var me={controlled:"state",default:"defaultState"},be={initial:"overlay",sm:"fixed"},_=e.forwardRef((t,n)=>{let{className:r,presentation:i=be,expandedSize:o=288,minSize:s=200,maxSize:d=400,resizable:b=!1,collapsible:$=!0,onExpand:F,onCollapse:W,onResize:j,onResizeStart:q,onResizeEnd:G,snapPoints:l,snapTolerance:K,collapseThreshold:p,paneId:u,persistence:S,children:J,style:Q,state:X,defaultState:Y,onStateChange:Z,size:f,defaultSize:P,onSizeChange:ee,sizeUpdate:ae,sizeUpdateMs:te=50,flush:h=!0,id:ne,...c}=t,{table:g,attributes:ie}=w(i,"fixed"),a=k({name:"sidebar",label:"Sidebar",propNames:me,id:ne,controlled:O(X),defaultValue:O(Y),presentationTable:g,builtIn:H,onChange:(le,pe)=>Z?.(ce(le),{reason:pe}),onExpand:F,onCollapse:W,size:o});x("sidebar",h),e.useEffect(()=>{(l!==void 0||p!==void 0||u!==void 0||S!==void 0)&&void 0},[l,p,u,S]);let z=e.useRef(null),oe=Se(n,a.setElement,z),re=I({name:"sidebar",elementId:a.id,elementRef:z,cssVarName:"--sidebar-size",orientation:"vertical",edge:"end",growth:U,expandedSize:o,minSize:s,maxSize:d,resizable:b,collapsible:$,size:f,defaultSize:P,onSizeChange:ee,sizeUpdate:ae,sizeUpdateMs:te,onResize:j,onResizeStart:q,onResizeEnd:G,snapPoints:l,snapTolerance:K,collapseThreshold:p,paneId:u,persistence:S,overlaying:a.overlaying,overlayingNow:()=>g[y()]==="overlay",requestCollapse:()=>a.setValue("closed","toggle"),requestToggle:()=>a.toggle("toggle")}),{handles:v,content:se}=A(J,m),de=b&&a.value!=="closed"&&!a.overlaying?e.createElement(T.Provider,{value:re},v.length>0?v:e.createElement(V,null)):null,R=a.peeking?`var(--sidebar-size, ${o}px)`:void 0,C=B(f,P,s,d);return e.createElement("div",{...D(c),role:c.role??"navigation",id:a.id,ref:oe,className:ue("kui-ShellPane","kui-ShellSidebar",r),...N(a,ie),"data-flush":h||void 0,tabIndex:a.overlaying?-1:c.tabIndex,style:{...Q,"--sidebar-expanded-size":`${o}px`,...C?{"--sidebar-size":C}:{},"--sidebar-min-size":`${s}px`,"--sidebar-max-size":`${d}px`,...R?{"--peek-sidebar-width":R}:{}}},e.createElement("div",{className:"kui-ShellSidebarContent"},e.createElement(E,null,e.createElement(M,null,se))),de)});_.displayName="Shell.Sidebar";_.Handle=m;export{_ as a};
|
|
3
|
-
//# sourceMappingURL=chunk-2WFN4D52.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/_internal/shell-sidebar.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useComposedRefs } from 'radix-ui/internal';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { PaneHandle, SidebarHandle } from './shell-handles.js';\nimport { usePane, paneAttributes, usePresentationTable } from './shell-pane.js';\nimport { splitHandles, useInitialPaneSize, useResizablePane, type SizeChangeMeta } from './shell-resizable.js';\nimport { useFrameRegistration, warnOnce, type PaneValue } from './shell-store.js';\nimport { navigationRest, startAnchoredGrowth, withoutRemovedPaneProps } from './shell-rest.js';\nimport { readBreakpoint } from '../../hooks/use-breakpoint.js';\nimport { PaneChromeScope } from './pane-chrome.js';\nimport { PageScope } from './page-scope.js';\nimport type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps, Responsive, SidebarMode } from '../shell.types.js';\n\ntype SidebarStateChangeMeta = { reason: 'init' | 'toggle' | 'responsive' | 'dismiss' };\ntype SidebarControlledProps = { state: Responsive<SidebarMode>; onStateChange?: (state: SidebarMode, meta: SidebarStateChangeMeta) => void; defaultState?: never };\ntype SidebarUncontrolledProps = { defaultState?: SidebarMode | Partial<Record<Breakpoint, SidebarMode>>; onStateChange?: (state: SidebarMode, meta: SidebarStateChangeMeta) => void; state?: never };\ntype SidebarPublicProps = PaneBaseProps & {\n size?: number | string;\n defaultSize?: number | string;\n onSizeChange?: (size: number, meta: SizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n /**\n * Sets whether this pane joins the app frame. The default is `true`: the pane sits against its\n * neighbours with one hairline between them. Set `flush={false}` to pull it off the frame as a\n * card. It then floats over the content if the content is flush, and otherwise sits on the\n * Shell's background beside a card content.\n */\n flush?: boolean;\n} & (SidebarControlledProps | SidebarUncontrolledProps);\n\ntype SidebarComponent = React.ForwardRefExoticComponent<SidebarPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof SidebarHandle };\n\nconst toValue = (mode: SidebarMode): PaneValue => (mode === 'collapsed' ? 'closed' : 'open');\nconst toMode = (value: PaneValue): SidebarMode => (value === 'closed' ? 'collapsed' : 'expanded');\n\nfunction modeToValue(state: Responsive<SidebarMode> | undefined): PaneValue | Partial<Record<Breakpoint, PaneValue>> | undefined {\n if (state === undefined) return undefined;\n if (typeof state === 'string') return toValue(state);\n const map: Partial<Record<Breakpoint, PaneValue>> = {};\n for (const [bp, mode] of Object.entries(state) as Array<[Breakpoint, SidebarMode | undefined]>) {\n if (mode !== undefined) map[bp] = toValue(mode);\n }\n return map;\n}\n\nconst SIDEBAR_PROP_NAMES = { controlled: 'state', default: 'defaultState' };\n\n/** Since 0.8.0 the Sidebar is in the frame from 768px up, the boundary kookie-ui-v2 uses everywhere. It was 1024px. */\nconst SIDEBAR_DEFAULT_PRESENTATION = { initial: 'overlay', sm: 'fixed' } as const;\n\n\nexport const Sidebar = React.forwardRef<HTMLDivElement, SidebarPublicProps>((props, ref) => {\n const {\n className,\n presentation = SIDEBAR_DEFAULT_PRESENTATION,\n expandedSize = 288,\n minSize = 200,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n state,\n defaultState,\n onStateChange,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n flush = true,\n id,\n ...domProps\n } = props;\n\n const { table, attributes } = usePresentationTable(presentation, 'fixed');\n const pane = usePane({\n name: 'sidebar',\n label: 'Sidebar',\n propNames: SIDEBAR_PROP_NAMES,\n id,\n controlled: modeToValue(state),\n defaultValue: modeToValue(defaultState),\n presentationTable: table,\n builtIn: navigationRest,\n onChange: (value, reason) => onStateChange?.(toMode(value), { reason }),\n onExpand,\n onCollapse,\n size: expandedSize,\n });\n useFrameRegistration('sidebar', flush);\n\n React.useEffect(() => {\n if (snapPoints !== undefined || collapseThreshold !== undefined || paneId !== undefined || persistence !== undefined) {\n warnOnce('Shell.Sidebar: `snapPoints`, `collapseThreshold`, `paneId` and `persistence` are deprecated and are removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`.');\n }\n }, [snapPoints, collapseThreshold, paneId, persistence]);\n\n const elementRef = React.useRef<HTMLElement | null>(null);\n const composedRef = useComposedRefs(ref, pane.setElement, elementRef);\n\n const resize = useResizablePane({\n name: 'sidebar',\n elementId: pane.id,\n elementRef,\n cssVarName: '--sidebar-size',\n orientation: 'vertical',\n edge: 'end',\n growth: startAnchoredGrowth,\n expandedSize,\n minSize,\n maxSize,\n resizable,\n collapsible,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n overlaying: pane.overlaying,\n overlayingNow: () => table[readBreakpoint()] === 'overlay',\n requestCollapse: () => pane.setValue('closed', 'toggle'),\n requestToggle: () => pane.toggle('toggle'),\n });\n\n const { handles, content } = splitHandles(children, SidebarHandle);\n const handle =\n resizable && pane.value !== 'closed' && !pane.overlaying ? (\n <PaneResizeContext.Provider value={resize}>{handles.length > 0 ? handles : <PaneHandle />}</PaneResizeContext.Provider>\n ) : null;\n\n // A peek previews the width the next toggle opens to.\n const peekWidth = pane.peeking ? `var(--sidebar-size, ${expandedSize}px)` : undefined;\n\n const initialSize = useInitialPaneSize(size, defaultSize, minSize, maxSize);\n return (\n <div\n {...withoutRemovedPaneProps(domProps)}\n role={domProps.role ?? 'navigation'}\n id={pane.id}\n ref={composedRef}\n className={classNames('kui-ShellPane', 'kui-ShellSidebar', className)}\n {...paneAttributes(pane, attributes)}\n data-flush={flush || undefined}\n tabIndex={pane.overlaying ? -1 : domProps.tabIndex}\n style={\n {\n ...style,\n '--sidebar-expanded-size': `${expandedSize}px`,\n ...(initialSize ? { '--sidebar-size': initialSize } : {}),\n '--sidebar-min-size': `${minSize}px`,\n '--sidebar-max-size': `${maxSize}px`,\n ...(peekWidth ? { '--peek-sidebar-width': peekWidth } : {}),\n } as CSSPropertiesWithVars\n }\n >\n <div className=\"kui-ShellSidebarContent\">\n <PaneChromeScope>\n <PageScope>{content}</PageScope>\n </PaneChromeScope>\n </div>\n {handle}\n </div>\n );\n}) as SidebarComponent;\n\nSidebar.displayName = 'Shell.Sidebar';\nSidebar.Handle = SidebarHandle;\n\nexport type { SidebarPublicProps };\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["React", "classNames", "useComposedRefs", "toValue", "mode", "toMode", "value", "modeToValue", "state", "map", "bp", "SIDEBAR_PROP_NAMES", "SIDEBAR_DEFAULT_PRESENTATION", "Sidebar", "props", "ref", "className", "presentation", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "defaultState", "onStateChange", "size", "defaultSize", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "flush", "id", "domProps", "table", "attributes", "usePresentationTable", "pane", "usePane", "navigationRest", "reason", "useFrameRegistration", "elementRef", "composedRef", "useComposedRefs", "resize", "useResizablePane", "startAnchoredGrowth", "readBreakpoint", "handles", "content", "splitHandles", "SidebarHandle", "handle", "PaneResizeContext", "PaneHandle", "peekWidth", "initialSize", "useInitialPaneSize", "withoutRemovedPaneProps", "classNames", "paneAttributes", "PaneChromeScope", "PageScope"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{b as _}from"./chunk-MXEOE4LA.js";import*as n from"react";import{useLayoutEffect as me}from"radix-ui/internal";import ve from"classnames";var x=n.forwardRef(({className:d,children:m,...R},b)=>{let{containerRef:E,controls:ee,cssVarName:k,minSize:L,maxSize:g,defaultSize:A,startSize:te,orientation:v,edge:ne,growth:D,onResize:y,onResizeStart:q,onResizeEnd:z,snapPoints:T,snapTolerance:re,collapseThreshold:V,collapsible:F,target:j,requestCollapse:oe,requestToggle:B}=_(),S=n.useRef(null),ie=n.useCallback(e=>{S.current=e,typeof b=="function"?b(e):b&&(b.current=e)},[b]),M=n.useRef(null);n.useEffect(()=>()=>{M.current?.(),M.current=null},[]);let I=n.useCallback(()=>{let e=E.current;if(!e)return A;let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(k));return Number.isFinite(t)?t:A},[E,k,A]),K=n.useCallback(()=>{let e=E.current,t=S.current,r=e?.closest(".kui-ShellRoot")?.getBoundingClientRect();if(!e||!r||!t)return g;let c=e.getBoundingClientRect(),p=t.getBoundingClientRect(),s=D(getComputedStyle(e).direction==="rtl"),o;v==="vertical"?o=s>0?r.right-c.left:c.right-r.left:o=s>0?r.bottom-c.top:c.bottom-r.top;let H=v==="vertical"?p.width:p.height;return!(r.width>0&&r.height>0)||!Number.isFinite(o)?g:Math.max(L,Math.min(g,Math.round(o-H)))},[E,D,g,L,v]),ae=()=>{S.current?.setAttribute("aria-valuemax",String(K()))};me(()=>{S.current?.setAttribute("aria-valuenow",String(Math.round(I())))},[I]);let C=(e,t)=>{e.style.setProperty(k,`${t}px`),S.current?.setAttribute("aria-valuenow",String(Math.round(t)))},se=j.charAt(0).toUpperCase()+j.slice(1);return n.createElement("div",{ref:ie,className:ve("kui-ShellResizer",d),"data-orientation":v,"data-edge":ne,role:"separator",tabIndex:0,"aria-label":`Resize ${se} pane`,"aria-controls":ee,"aria-orientation":v,"aria-valuenow":Math.round(te),"aria-valuemin":L,"aria-valuemax":g,...R,onPointerDown:e=>{R.onPointerDown?.(e);let t=E.current;if(!t||e.defaultPrevented||e.button!==0)return;e.preventDefault();let r=e.currentTarget,c=e.pointerId;M.current?.();try{r.setPointerCapture(c)}catch{}let p=getComputedStyle(t),s=Number.parseFloat(p.getPropertyValue(k)),o=Number.isFinite(s)?s:A,H=v==="vertical"?e.clientX:e.clientY,le=D(p.direction==="rtl"),X=K();r.setAttribute("aria-valuemax",String(X));let Y=i=>Math.min(Math.max(i,L),X);t.setAttribute("data-resizing",""),r.setAttribute("data-dragging","");let h=document.body,ce=h.style.cursor,ue=h.style.userSelect;h.style.cursor=v==="vertical"?"col-resize":"row-resize",h.style.userSelect="none",q?.(o);let f=o,W=o,l=0,P=null,$=()=>{if(l=0,P===null)return;let i=P;P=null,y?.(i)},O=null,G=!1,de=(i,w)=>{if(i.type===w)G=!0;else if(G)return!1;return!0},u=i=>{if(!de(i,"pointermove")||i===O)return;O=i;let w=v==="vertical"?i.clientX:i.clientY;W=o+(w-H)*le,f=Y(W),C(t,f),P=f,l||(l=requestAnimationFrame($))},N=()=>{l&&cancelAnimationFrame(l),l=0;try{r.releasePointerCapture(c)}catch{}window.removeEventListener("pointermove",u),document.removeEventListener("pointermove",u),window.removeEventListener("mousemove",u),document.removeEventListener("mousemove",u),r.removeEventListener("pointermove",u),window.removeEventListener("pointerup",a),document.removeEventListener("pointerup",a),window.removeEventListener("mouseup",a),document.removeEventListener("mouseup",a),window.removeEventListener("pointercancel",a),document.removeEventListener("pointercancel",a),window.removeEventListener("keydown",J),r.removeEventListener("lostpointercapture",a),t.removeAttribute("data-resizing"),r.removeAttribute("data-dragging"),h.style.cursor=ce,h.style.userSelect=ue,M.current=null},U=!1,a=()=>{if(U)return;if(U=!0,l&&cancelAnimationFrame(l),$(),F&&typeof V=="number"&&W<=V){C(t,o),y?.(o),N(),oe?.(),z?.(o);return}let i=f;if(T&&T.length){let w=T.reduce((Q,Z)=>Math.abs(Z-f)<Math.abs(Q-f)?Z:Q,T[0]);Math.abs(w-f)<=re&&(i=Y(w),C(t,i),y?.(i))}z?.(i),N()},J=i=>{i.key==="Escape"&&(l&&cancelAnimationFrame(l),l=0,P=null,C(t,o),y?.(o),U=!0,z?.(o),N())};window.addEventListener("pointermove",u),document.addEventListener("pointermove",u),window.addEventListener("mousemove",u),document.addEventListener("mousemove",u),r.addEventListener("pointermove",u),window.addEventListener("pointerup",a),document.addEventListener("pointerup",a),window.addEventListener("mouseup",a),document.addEventListener("mouseup",a),window.addEventListener("pointercancel",a),document.addEventListener("pointercancel",a),window.addEventListener("keydown",J),r.addEventListener("lostpointercapture",a),M.current=N},onDoubleClick:e=>{R.onDoubleClick?.(e),!e.defaultPrevented&&F&&B?.()},onFocus:e=>{R.onFocus?.(e),ae()},onKeyDown:e=>{R.onKeyDown?.(e);let t=E.current;if(!t||e.defaultPrevented)return;if(e.key==="Enter"){F&&B&&(e.preventDefault(),B());return}let r=I(),c=K(),p=o=>Math.min(Math.max(o,L),c),s;if(e.key==="Home")s=p(L);else if(e.key==="End")s=p(c);else{let o=v==="vertical"?e.key==="ArrowRight"?1:e.key==="ArrowLeft"?-1:0:e.key==="ArrowDown"?1:e.key==="ArrowUp"?-1:0;if(o===0)return;let H=e.shiftKey?32:8;s=p(r+o*H*D(getComputedStyle(t).direction==="rtl"))}e.preventDefault(),q?.(r),C(t,s),y?.(s),z?.(s)}},m)});x.displayName="Shell.Handle";var pe=n.forwardRef((d,m)=>n.createElement(x,{...d,ref:m}));pe.displayName="Shell.Panel.Handle";var fe=n.forwardRef((d,m)=>n.createElement(x,{...d,ref:m}));fe.displayName="Shell.Sidebar.Handle";var Ee=n.forwardRef((d,m)=>n.createElement(x,{...d,ref:m}));Ee.displayName="Shell.Inspector.Handle";var Le=n.forwardRef((d,m)=>n.createElement(x,{...d,ref:m}));Le.displayName="Shell.Bottom.Handle";export{x as a,pe as b,fe as c,Ee as d,Le as e};
|
|
3
|
-
//# sourceMappingURL=chunk-4OJRLS5N.js.map
|