@kjun-ui/react 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +16 -2
- package/dist/index.js +16 -2
- package/dist/styles.css +16 -0
- package/dist/types/packages/react/src/drawer.d.cts +7 -1
- package/dist/types/packages/react/src/drawer.d.ts +7 -1
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +36 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +36 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3033,6 +3033,17 @@ function KjunMenuButton({
|
|
|
3033
3033
|
|
|
3034
3034
|
// packages/react/src/drawer.tsx
|
|
3035
3035
|
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3036
|
+
|
|
3037
|
+
// shared/package-runtime/drawer-geometry.ts
|
|
3038
|
+
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
3039
|
+
return {
|
|
3040
|
+
"--_kjun-drawer-safe-top": Math.max(0, safeAreaTop) + "px",
|
|
3041
|
+
"--_kjun-drawer-safe-bottom": Math.max(0, safeAreaBottom) + "px",
|
|
3042
|
+
...maxHeight === void 0 ? {} : { "--_kjun-drawer-max-height": `min(${maxHeight}px, 100dvh)` }
|
|
3043
|
+
};
|
|
3044
|
+
}
|
|
3045
|
+
|
|
3046
|
+
// packages/react/src/drawer.tsx
|
|
3036
3047
|
var import_react_aria_components6 = require("react-aria-components");
|
|
3037
3048
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3038
3049
|
function KjunDrawer({
|
|
@@ -3049,7 +3060,10 @@ function KjunDrawer({
|
|
|
3049
3060
|
footer,
|
|
3050
3061
|
children,
|
|
3051
3062
|
onClose,
|
|
3052
|
-
ariaLabel
|
|
3063
|
+
ariaLabel,
|
|
3064
|
+
safeAreaTop = 0,
|
|
3065
|
+
safeAreaBottom = 0,
|
|
3066
|
+
maxHeight
|
|
3053
3067
|
}) {
|
|
3054
3068
|
const motion = usePresence(open, useReducedMotion(), import_tokens20.tokens.motion.layerExit);
|
|
3055
3069
|
const container = useKjunPortalContainer();
|
|
@@ -3065,7 +3079,7 @@ function KjunDrawer({
|
|
|
3065
3079
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3066
3080
|
import_react_aria_components6.ModalOverlay,
|
|
3067
3081
|
{
|
|
3068
|
-
style: { zIndex: layer.zIndex },
|
|
3082
|
+
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
3069
3083
|
isOpen: motion.present && layer.active,
|
|
3070
3084
|
isExiting: motion.present && !layer.active,
|
|
3071
3085
|
onOpenChange: (v) => {
|
package/dist/index.js
CHANGED
|
@@ -2965,6 +2965,17 @@ function KjunMenuButton({
|
|
|
2965
2965
|
|
|
2966
2966
|
// packages/react/src/drawer.tsx
|
|
2967
2967
|
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
2968
|
+
|
|
2969
|
+
// shared/package-runtime/drawer-geometry.ts
|
|
2970
|
+
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
2971
|
+
return {
|
|
2972
|
+
"--_kjun-drawer-safe-top": Math.max(0, safeAreaTop) + "px",
|
|
2973
|
+
"--_kjun-drawer-safe-bottom": Math.max(0, safeAreaBottom) + "px",
|
|
2974
|
+
...maxHeight === void 0 ? {} : { "--_kjun-drawer-max-height": `min(${maxHeight}px, 100dvh)` }
|
|
2975
|
+
};
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
// packages/react/src/drawer.tsx
|
|
2968
2979
|
import { Dialog as Dialog3, Modal as Modal2, ModalOverlay as ModalOverlay2 } from "react-aria-components";
|
|
2969
2980
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2970
2981
|
function KjunDrawer({
|
|
@@ -2981,7 +2992,10 @@ function KjunDrawer({
|
|
|
2981
2992
|
footer,
|
|
2982
2993
|
children,
|
|
2983
2994
|
onClose,
|
|
2984
|
-
ariaLabel
|
|
2995
|
+
ariaLabel,
|
|
2996
|
+
safeAreaTop = 0,
|
|
2997
|
+
safeAreaBottom = 0,
|
|
2998
|
+
maxHeight
|
|
2985
2999
|
}) {
|
|
2986
3000
|
const motion = usePresence(open, useReducedMotion(), tokens16.motion.layerExit);
|
|
2987
3001
|
const container = useKjunPortalContainer();
|
|
@@ -2997,7 +3011,7 @@ function KjunDrawer({
|
|
|
2997
3011
|
return /* @__PURE__ */ jsx16(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx16(
|
|
2998
3012
|
ModalOverlay2,
|
|
2999
3013
|
{
|
|
3000
|
-
style: { zIndex: layer.zIndex },
|
|
3014
|
+
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
3001
3015
|
isOpen: motion.present && layer.active,
|
|
3002
3016
|
isExiting: motion.present && !layer.active,
|
|
3003
3017
|
onOpenChange: (v) => {
|
package/dist/styles.css
CHANGED
|
@@ -417,6 +417,7 @@
|
|
|
417
417
|
--_kjun-extension-drawer-bottom-radius: 16px;
|
|
418
418
|
--_kjun-extension-drawer-radius: 0px;
|
|
419
419
|
--_kjun-extension-drawer-close-radius: 8px;
|
|
420
|
+
--_kjun-extension-drawer-sheet-gap: 48px;
|
|
420
421
|
--_kjun-extension-drawer-width: 400px;
|
|
421
422
|
--_kjun-extension-drawer-close-size: 32px;
|
|
422
423
|
--_kjun-extension-drawer-close-icon-size: 16px;
|
|
@@ -2559,6 +2560,19 @@
|
|
|
2559
2560
|
flex-direction: column;
|
|
2560
2561
|
outline: none;
|
|
2561
2562
|
}
|
|
2563
|
+
/* Safe areas arrive as --_kjun-drawer-safe-top/bottom on the overlay; the panel surface extends under them. */
|
|
2564
|
+
.kjun-drawer-overlay:not([data-position="bottom"]) .kjun-drawer-dialog { padding-top: var(--_kjun-drawer-safe-top); }
|
|
2565
|
+
.kjun-drawer-overlay:not([data-position="top"]) .kjun-drawer-dialog { padding-bottom: var(--_kjun-drawer-safe-bottom); }
|
|
2566
|
+
/* Top and bottom sheets stop short of the opposite edge (its safe area plus the sheet gap); only the body scrolls. */
|
|
2567
|
+
.kjun-drawer-overlay[data-position="bottom"] {
|
|
2568
|
+
--_kjun-drawer-sheet-max: calc(100dvh - var(--_kjun-drawer-safe-top) - var(--_kjun-extension-drawer-sheet-gap));
|
|
2569
|
+
}
|
|
2570
|
+
.kjun-drawer-overlay[data-position="top"] {
|
|
2571
|
+
--_kjun-drawer-sheet-max: calc(100dvh - var(--_kjun-drawer-safe-bottom) - var(--_kjun-extension-drawer-sheet-gap));
|
|
2572
|
+
}
|
|
2573
|
+
.kjun-drawer-overlay:is([data-position="top"], [data-position="bottom"]) :is(.kjun-drawer, .kjun-drawer-dialog) {
|
|
2574
|
+
max-height: var(--_kjun-drawer-max-height, var(--_kjun-drawer-sheet-max));
|
|
2575
|
+
}
|
|
2562
2576
|
.kjun-drawer-header {
|
|
2563
2577
|
display: flex;
|
|
2564
2578
|
align-items: center;
|
|
@@ -4393,6 +4407,8 @@
|
|
|
4393
4407
|
.kjun-kpi-row__value {
|
|
4394
4408
|
white-space: normal;
|
|
4395
4409
|
overflow-wrap: anywhere;
|
|
4410
|
+
/* Korean labels and values wrap at spaces, not between syllables; anywhere stays the last resort. */
|
|
4411
|
+
word-break: keep-all;
|
|
4396
4412
|
}
|
|
4397
4413
|
.kjun-kpi-row--mobile-summary
|
|
4398
4414
|
.kjun-kpi-row__item--secondary
|
|
@@ -14,5 +14,11 @@ export interface KjunDrawerProps {
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
onClose?: () => void;
|
|
16
16
|
ariaLabel?: string;
|
|
17
|
+
/** Top safe area in px, padded inside top and side drawers and kept clear above a bottom sheet. */
|
|
18
|
+
safeAreaTop?: number;
|
|
19
|
+
/** Bottom safe area in px, padded inside bottom and side drawers and kept clear below a top sheet. */
|
|
20
|
+
safeAreaBottom?: number;
|
|
21
|
+
/** Height limit in px for top and bottom drawers; by default they stop a sheet gap short of the opposite edge. */
|
|
22
|
+
maxHeight?: number;
|
|
17
23
|
}
|
|
18
|
-
export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, ariaLabel, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, ariaLabel, safeAreaTop, safeAreaBottom, maxHeight, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -14,5 +14,11 @@ export interface KjunDrawerProps {
|
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
onClose?: () => void;
|
|
16
16
|
ariaLabel?: string;
|
|
17
|
+
/** Top safe area in px, padded inside top and side drawers and kept clear above a bottom sheet. */
|
|
18
|
+
safeAreaTop?: number;
|
|
19
|
+
/** Bottom safe area in px, padded inside bottom and side drawers and kept clear below a top sheet. */
|
|
20
|
+
safeAreaBottom?: number;
|
|
21
|
+
/** Height limit in px for top and bottom drawers; by default they stop a sheet gap short of the opposite edge. */
|
|
22
|
+
maxHeight?: number;
|
|
17
23
|
}
|
|
18
|
-
export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, ariaLabel, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
export declare function KjunDrawer({ open, onOpenChange, title, position, width, closable, closeOnOverlay, closeOnEsc, noPadding, header, footer, children, onClose, ariaLabel, safeAreaTop, safeAreaBottom, maxHeight, }: KjunDrawerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type DrawerPosition = "left" | "right" | "top" | "bottom";
|
|
2
|
+
export interface DrawerFrameInput {
|
|
3
|
+
position: DrawerPosition;
|
|
4
|
+
windowHeight: number;
|
|
5
|
+
safeAreaTop: number;
|
|
6
|
+
safeAreaBottom: number;
|
|
7
|
+
/** Space a top or bottom sheet leaves at the opposite edge. */
|
|
8
|
+
gap: number;
|
|
9
|
+
/** Height of the window the keyboard covers (0 when hidden). */
|
|
10
|
+
keyboard: number;
|
|
11
|
+
maxHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DrawerFrame {
|
|
14
|
+
maxHeight: number;
|
|
15
|
+
height: number | undefined;
|
|
16
|
+
paddingTop: number;
|
|
17
|
+
paddingBottom: number;
|
|
18
|
+
lift: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Keyboard events a drawer listens to. Only iOS: React Native's Android Modal window is adjustResize,
|
|
22
|
+
* so the system already shrinks the modal and a measured root height covers it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function keyboardEvents(os: string): {
|
|
25
|
+
readonly show: "keyboardWillShow";
|
|
26
|
+
readonly hide: "keyboardWillHide";
|
|
27
|
+
} | null;
|
|
28
|
+
/** The part of the window the keyboard covers; 0 when the platform already resized the window. */
|
|
29
|
+
export declare function keyboardOverlap(windowHeight: number, keyboardScreenY: number): number;
|
|
30
|
+
export declare function drawerFrame({ position, windowHeight, safeAreaTop, safeAreaBottom, gap, keyboard, maxHeight }: DrawerFrameInput): DrawerFrame;
|
|
31
|
+
/** Web overlay variables read by the drawer CSS (tokens controls.css). */
|
|
32
|
+
export declare function drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }: {
|
|
33
|
+
safeAreaTop?: number;
|
|
34
|
+
safeAreaBottom?: number;
|
|
35
|
+
maxHeight?: number;
|
|
36
|
+
}): Record<string, string>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type DrawerPosition = "left" | "right" | "top" | "bottom";
|
|
2
|
+
export interface DrawerFrameInput {
|
|
3
|
+
position: DrawerPosition;
|
|
4
|
+
windowHeight: number;
|
|
5
|
+
safeAreaTop: number;
|
|
6
|
+
safeAreaBottom: number;
|
|
7
|
+
/** Space a top or bottom sheet leaves at the opposite edge. */
|
|
8
|
+
gap: number;
|
|
9
|
+
/** Height of the window the keyboard covers (0 when hidden). */
|
|
10
|
+
keyboard: number;
|
|
11
|
+
maxHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface DrawerFrame {
|
|
14
|
+
maxHeight: number;
|
|
15
|
+
height: number | undefined;
|
|
16
|
+
paddingTop: number;
|
|
17
|
+
paddingBottom: number;
|
|
18
|
+
lift: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Keyboard events a drawer listens to. Only iOS: React Native's Android Modal window is adjustResize,
|
|
22
|
+
* so the system already shrinks the modal and a measured root height covers it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function keyboardEvents(os: string): {
|
|
25
|
+
readonly show: "keyboardWillShow";
|
|
26
|
+
readonly hide: "keyboardWillHide";
|
|
27
|
+
} | null;
|
|
28
|
+
/** The part of the window the keyboard covers; 0 when the platform already resized the window. */
|
|
29
|
+
export declare function keyboardOverlap(windowHeight: number, keyboardScreenY: number): number;
|
|
30
|
+
export declare function drawerFrame({ position, windowHeight, safeAreaTop, safeAreaBottom, gap, keyboard, maxHeight }: DrawerFrameInput): DrawerFrame;
|
|
31
|
+
/** Web overlay variables read by the drawer CSS (tokens controls.css). */
|
|
32
|
+
export declare function drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }: {
|
|
33
|
+
safeAreaTop?: number;
|
|
34
|
+
safeAreaBottom?: number;
|
|
35
|
+
maxHeight?: number;
|
|
36
|
+
}): Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kjun-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://ui.kjun.dev",
|
|
6
6
|
"repository": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@kjun-ui/tokens": "0.
|
|
44
|
+
"@kjun-ui/tokens": "0.11.0",
|
|
45
45
|
"react-aria-components": "1.21.1",
|
|
46
|
-
"@kjun-ui/icons": "0.
|
|
46
|
+
"@kjun-ui/icons": "0.11.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": "^19.2.3",
|