@kjun-ui/native 0.13.0 → 0.14.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 +720 -607
- package/dist/index.js +712 -598
- package/dist/index.web.cjs +722 -609
- package/dist/index.web.js +714 -600
- package/dist/styles.css +72 -0
- package/dist/types/packages/native/src/card.d.cts +9 -2
- package/dist/types/packages/native/src/card.d.ts +9 -2
- package/dist/types/packages/native/src/display-primitives.d.cts +2 -1
- package/dist/types/packages/native/src/display-primitives.d.ts +2 -1
- package/dist/types/packages/native/src/feedback.d.cts +5 -1
- package/dist/types/packages/native/src/feedback.d.ts +5 -1
- package/dist/types/packages/native/src/list.d.cts +13 -2
- package/dist/types/packages/native/src/list.d.ts +13 -2
- package/dist/types/packages/native/src/media.d.cts +4 -2
- package/dist/types/packages/native/src/media.d.ts +4 -2
- package/dist/types/shared/package-runtime/layout-primitives.d.cts +1 -1
- package/dist/types/shared/package-runtime/layout-primitives.d.ts +1 -1
- package/dist/types/shared/package-runtime/progress-circle.d.cts +11 -0
- package/dist/types/shared/package-runtime/progress-circle.d.ts +11 -0
- package/package.json +3 -3
package/dist/index.web.cjs
CHANGED
|
@@ -75,6 +75,7 @@ __export(index_exports, {
|
|
|
75
75
|
KjunInput: () => KjunInput,
|
|
76
76
|
KjunKpiHero: () => KjunKpiHero,
|
|
77
77
|
KjunKpiRow: () => KjunKpiRow,
|
|
78
|
+
KjunListItem: () => KjunListItem,
|
|
78
79
|
KjunListRow: () => KjunListRow,
|
|
79
80
|
KjunListSection: () => KjunListSection,
|
|
80
81
|
KjunListSkeleton: () => KjunListSkeleton,
|
|
@@ -114,6 +115,7 @@ __export(index_exports, {
|
|
|
114
115
|
KjunTimePicker: () => KjunTimePicker,
|
|
115
116
|
KjunTooltip: () => KjunTooltip,
|
|
116
117
|
KjunTopNavigation: () => KjunTopNavigation,
|
|
118
|
+
createKjunFeedback: () => import_tokens22.createKjunFeedback,
|
|
117
119
|
kjunMessagesEn: () => kjunMessagesEn,
|
|
118
120
|
kjunMessagesKo: () => kjunMessagesKo,
|
|
119
121
|
useKjunFeedback: () => useKjunFeedback,
|
|
@@ -2317,7 +2319,11 @@ function KjunCard({
|
|
|
2317
2319
|
border = false,
|
|
2318
2320
|
dividers = false,
|
|
2319
2321
|
children,
|
|
2320
|
-
style
|
|
2322
|
+
style,
|
|
2323
|
+
pressable = false,
|
|
2324
|
+
disabled = false,
|
|
2325
|
+
ariaLabel,
|
|
2326
|
+
onPress
|
|
2321
2327
|
}) {
|
|
2322
2328
|
const { colors } = useKjunStyles();
|
|
2323
2329
|
const id = "kjun-" + (0, import_react23.useId)().replace(/[^a-z0-9]/gi, "");
|
|
@@ -2328,7 +2334,7 @@ function KjunCard({
|
|
|
2328
2334
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
2329
2335
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
2330
2336
|
const hasBody = hasContent(children), hasFooter = hasContent(footer), hasMedia = hasContent(media);
|
|
2331
|
-
|
|
2337
|
+
const base = [
|
|
2332
2338
|
{
|
|
2333
2339
|
minWidth: 0,
|
|
2334
2340
|
borderRadius: corner,
|
|
@@ -2337,7 +2343,8 @@ function KjunCard({
|
|
|
2337
2343
|
},
|
|
2338
2344
|
import_react_native15.Platform.OS === "web" && surface === "glass" ? { backdropFilter: `blur(${import_tokens12.tokens.card.glassBlur}px)` } : {},
|
|
2339
2345
|
style
|
|
2340
|
-
]
|
|
2346
|
+
];
|
|
2347
|
+
const parts = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2341
2348
|
paint.gradientEnd && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native15.View, { pointerEvents: "none", style: { position: "absolute", inset: 0, borderRadius: corner, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native_svg2.default, { width: "100%", height: "100%", children: [
|
|
2342
2349
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_svg2.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native_svg2.LinearGradient, { id, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
2343
2350
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_svg2.Stop, { offset: "0", stopColor: colors[paint.background] }),
|
|
@@ -2380,6 +2387,18 @@ function KjunCard({
|
|
|
2380
2387
|
boxShadow: [{ offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: import_tokens12.tokens.card.borderWidth, inset: true, color: borderColor }]
|
|
2381
2388
|
} })
|
|
2382
2389
|
] });
|
|
2390
|
+
return pressable ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2391
|
+
AccessiblePressable,
|
|
2392
|
+
{
|
|
2393
|
+
accessibilityRole: "button",
|
|
2394
|
+
accessibilityLabel: ariaLabel != null ? ariaLabel : title,
|
|
2395
|
+
accessibilityState: { disabled },
|
|
2396
|
+
disabled,
|
|
2397
|
+
onPress,
|
|
2398
|
+
style: ({ pressed }) => [base, pressed ? { transform: [{ scale: 0.99 }] } : null, disabled ? { opacity: import_tokens12.tokens.states.opacity.disabled } : null],
|
|
2399
|
+
children: parts
|
|
2400
|
+
}
|
|
2401
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native15.View, { style: base, children: parts });
|
|
2383
2402
|
}
|
|
2384
2403
|
|
|
2385
2404
|
// shared/package-runtime/alert-live.ts
|
|
@@ -2390,10 +2409,29 @@ function alertRole(tone, live) {
|
|
|
2390
2409
|
}
|
|
2391
2410
|
|
|
2392
2411
|
// packages/native/src/display-primitives.tsx
|
|
2393
|
-
var
|
|
2412
|
+
var import_tokens14 = require("@kjun-ui/tokens");
|
|
2394
2413
|
var import_react24 = require("react");
|
|
2395
2414
|
var import_react_native16 = require("react-native");
|
|
2396
2415
|
var import_react_native_svg3 = __toESM(require("react-native-svg"), 1);
|
|
2416
|
+
|
|
2417
|
+
// shared/package-runtime/progress-circle.ts
|
|
2418
|
+
var import_tokens13 = require("@kjun-ui/tokens");
|
|
2419
|
+
function progressCircle(size, percentage) {
|
|
2420
|
+
const { size: diameter, stroke } = import_tokens13.tokens.extensions.progress.circle[size];
|
|
2421
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
2422
|
+
return {
|
|
2423
|
+
diameter,
|
|
2424
|
+
stroke,
|
|
2425
|
+
radius,
|
|
2426
|
+
centre: diameter / 2,
|
|
2427
|
+
circumference,
|
|
2428
|
+
offset: circumference * (1 - percentage / 100),
|
|
2429
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
2430
|
+
showsPercentage: size !== "sm"
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
// packages/native/src/display-primitives.tsx
|
|
2397
2435
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2398
2436
|
var badgeLayoutKeys = /* @__PURE__ */ new Set([
|
|
2399
2437
|
"alignSelf",
|
|
@@ -2433,10 +2471,10 @@ function BadgeView({
|
|
|
2433
2471
|
dot = false,
|
|
2434
2472
|
children,
|
|
2435
2473
|
style,
|
|
2436
|
-
dotSize =
|
|
2474
|
+
dotSize = import_tokens14.tokens.extensions.badge.dotSize
|
|
2437
2475
|
}) {
|
|
2438
2476
|
const { colors, domainColors } = useKjunStyles();
|
|
2439
|
-
const { x, y } =
|
|
2477
|
+
const { x, y } = import_tokens14.tokens.extensions.badge.padding[size];
|
|
2440
2478
|
const type = typeStyle(size === "xl" ? "controlLarge" : size === "lg" ? "control" : "controlSmall");
|
|
2441
2479
|
const neutral = variant === "default" || variant === "secondary";
|
|
2442
2480
|
const financial = variant.startsWith("price-");
|
|
@@ -2454,10 +2492,10 @@ function BadgeView({
|
|
|
2454
2492
|
maxWidth: "100%",
|
|
2455
2493
|
minWidth: 0,
|
|
2456
2494
|
flexShrink: 1,
|
|
2457
|
-
gap:
|
|
2495
|
+
gap: import_tokens14.tokens.extensions.badge.gap,
|
|
2458
2496
|
paddingHorizontal: x,
|
|
2459
2497
|
paddingVertical: y,
|
|
2460
|
-
borderRadius:
|
|
2498
|
+
borderRadius: import_tokens14.tokens.extensions.badge.radius,
|
|
2461
2499
|
backgroundColor: background
|
|
2462
2500
|
},
|
|
2463
2501
|
inner
|
|
@@ -2495,7 +2533,7 @@ function KjunEmpty({
|
|
|
2495
2533
|
const m = useKjunMessages();
|
|
2496
2534
|
text != null ? text : text = m.noData;
|
|
2497
2535
|
const { colors } = useKjunStyles();
|
|
2498
|
-
const spec =
|
|
2536
|
+
const spec = import_tokens14.tokens.extensions.empty;
|
|
2499
2537
|
const stateContent = (0, import_react24.useContext)(DataStateContentContext);
|
|
2500
2538
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2501
2539
|
import_react_native16.View,
|
|
@@ -2503,7 +2541,7 @@ function KjunEmpty({
|
|
|
2503
2541
|
style: {
|
|
2504
2542
|
alignItems: "center",
|
|
2505
2543
|
justifyContent: "center",
|
|
2506
|
-
paddingVertical: stateContent === "empty" ? 0 :
|
|
2544
|
+
paddingVertical: stateContent === "empty" ? 0 : import_tokens14.tokens.dimension.value32
|
|
2507
2545
|
},
|
|
2508
2546
|
children: [
|
|
2509
2547
|
!!icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
@@ -2536,7 +2574,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2536
2574
|
const loop = import_react_native16.Animated.loop(
|
|
2537
2575
|
import_react_native16.Animated.timing(rotation, {
|
|
2538
2576
|
toValue: 1,
|
|
2539
|
-
duration:
|
|
2577
|
+
duration: import_tokens14.tokens.motion.spin,
|
|
2540
2578
|
easing: import_react_native16.Easing.linear,
|
|
2541
2579
|
useNativeDriver: import_react_native16.Platform.OS !== "web"
|
|
2542
2580
|
})
|
|
@@ -2547,8 +2585,8 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2547
2585
|
rotation.setValue(0);
|
|
2548
2586
|
};
|
|
2549
2587
|
}, [reduced, rotation]);
|
|
2550
|
-
const dimension =
|
|
2551
|
-
const stroke =
|
|
2588
|
+
const dimension = import_tokens14.tokens.extensions.spinner.sizes[size];
|
|
2589
|
+
const stroke = import_tokens14.tokens.extensions.spinner.strokeWidths[size] * 24 / dimension;
|
|
2552
2590
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2553
2591
|
import_react_native16.View,
|
|
2554
2592
|
{
|
|
@@ -2602,7 +2640,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2602
2640
|
)
|
|
2603
2641
|
}
|
|
2604
2642
|
),
|
|
2605
|
-
!!text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KText, { style: { marginLeft:
|
|
2643
|
+
!!text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KText, { style: { marginLeft: import_tokens14.tokens.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2606
2644
|
]
|
|
2607
2645
|
}
|
|
2608
2646
|
);
|
|
@@ -2623,8 +2661,8 @@ function KjunAlert({
|
|
|
2623
2661
|
const [visible, setVisible] = (0, import_react24.useState)(true);
|
|
2624
2662
|
if (!visible) return null;
|
|
2625
2663
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
2626
|
-
const geometry2 =
|
|
2627
|
-
const lineHeight =
|
|
2664
|
+
const geometry2 = import_tokens14.tokens.extensions.alert;
|
|
2665
|
+
const lineHeight = import_tokens14.tokens.typography[small ? "controlSmall" : "control"].lineHeightPx;
|
|
2628
2666
|
const titled = hasContent(title);
|
|
2629
2667
|
const closeSize = small ? geometry2.sm.closeSize : geometry2.closeSize;
|
|
2630
2668
|
const pick = (suffix) => tone === "primary" ? suffix === "Bg" ? colors.brandSubtleBg : suffix === "Light" ? colors.brandLight : colors.brand : colors[tone + suffix];
|
|
@@ -2635,11 +2673,11 @@ function KjunAlert({
|
|
|
2635
2673
|
style: {
|
|
2636
2674
|
flexDirection: "row",
|
|
2637
2675
|
alignItems: "flex-start",
|
|
2638
|
-
gap:
|
|
2639
|
-
borderWidth:
|
|
2640
|
-
borderRadius:
|
|
2641
|
-
paddingVertical:
|
|
2642
|
-
paddingHorizontal:
|
|
2676
|
+
gap: import_tokens14.tokens.extensions.alert[small ? "sm" : "md"].gap,
|
|
2677
|
+
borderWidth: import_tokens14.tokens.border.defaultWidth,
|
|
2678
|
+
borderRadius: import_tokens14.tokens.extensions.alert.radius,
|
|
2679
|
+
paddingVertical: import_tokens14.tokens.extensions.alert[small ? "sm" : "md"].paddingY,
|
|
2680
|
+
paddingHorizontal: import_tokens14.tokens.extensions.alert[small ? "sm" : "md"].paddingX,
|
|
2643
2681
|
backgroundColor: pick("Bg"),
|
|
2644
2682
|
borderColor: pick("Light")
|
|
2645
2683
|
},
|
|
@@ -2654,7 +2692,7 @@ function KjunAlert({
|
|
|
2654
2692
|
warning: "alert-triangle",
|
|
2655
2693
|
danger: "alert-circle"
|
|
2656
2694
|
}[tone],
|
|
2657
|
-
size:
|
|
2695
|
+
size: import_tokens14.tokens.extensions.alert.iconSizes[small ? "sm" : "md"],
|
|
2658
2696
|
color: pick("Accent")
|
|
2659
2697
|
}
|
|
2660
2698
|
) }),
|
|
@@ -2671,7 +2709,7 @@ function KjunAlert({
|
|
|
2671
2709
|
{
|
|
2672
2710
|
accessibilityRole: "button",
|
|
2673
2711
|
accessibilityLabel: m.close,
|
|
2674
|
-
hitSlop: Math.max(0, (
|
|
2712
|
+
hitSlop: Math.max(0, (import_tokens14.tokens.native.minimumTouchTarget - closeSize) / 2),
|
|
2675
2713
|
style: ({ pressed, hovered }) => ({
|
|
2676
2714
|
width: closeSize,
|
|
2677
2715
|
height: closeSize,
|
|
@@ -2709,11 +2747,58 @@ function KjunProgress({
|
|
|
2709
2747
|
variant = "primary",
|
|
2710
2748
|
showLabel = false,
|
|
2711
2749
|
label,
|
|
2712
|
-
subLabel
|
|
2750
|
+
subLabel,
|
|
2751
|
+
shape = "bar"
|
|
2713
2752
|
}) {
|
|
2714
2753
|
const m = useKjunMessages();
|
|
2715
|
-
const { colors } = useKjunStyles();
|
|
2754
|
+
const { colors, numericFontFamily, fontFamily } = useKjunStyles();
|
|
2716
2755
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2756
|
+
const name = typeof label === "string" ? label : m.progress, color = variant === "primary" ? colors.brand : colors[variant];
|
|
2757
|
+
const semantics = {
|
|
2758
|
+
accessibilityRole: "progressbar",
|
|
2759
|
+
accessibilityLabel: name,
|
|
2760
|
+
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2761
|
+
"aria-valuemin": 0,
|
|
2762
|
+
"aria-valuemax": 100,
|
|
2763
|
+
"aria-valuenow": percentage
|
|
2764
|
+
};
|
|
2765
|
+
if (shape === "circle") {
|
|
2766
|
+
const c = progressCircle(size, percentage);
|
|
2767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { style: { alignSelf: "flex-start", alignItems: "center" }, children: [
|
|
2768
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { ...semantics, style: { width: c.diameter, height: c.diameter, alignItems: "center", justifyContent: "center" }, children: [
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native_svg3.default, { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, style: import_react_native16.StyleSheet.absoluteFill, children: [
|
|
2770
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_svg3.Circle, { cx: c.centre, cy: c.centre, r: c.radius, stroke: colors.secondary, strokeWidth: c.stroke, fill: "none" }),
|
|
2771
|
+
percentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2772
|
+
import_react_native_svg3.Circle,
|
|
2773
|
+
{
|
|
2774
|
+
cx: c.centre,
|
|
2775
|
+
cy: c.centre,
|
|
2776
|
+
r: c.radius,
|
|
2777
|
+
stroke: color,
|
|
2778
|
+
strokeWidth: c.stroke,
|
|
2779
|
+
fill: "none",
|
|
2780
|
+
strokeLinecap: "round",
|
|
2781
|
+
strokeDasharray: c.circumference,
|
|
2782
|
+
strokeDashoffset: c.offset,
|
|
2783
|
+
rotation: -90,
|
|
2784
|
+
origin: `${c.centre}, ${c.centre}`
|
|
2785
|
+
}
|
|
2786
|
+
)
|
|
2787
|
+
] }),
|
|
2788
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(KText, { style: {
|
|
2789
|
+
...typeStyle(size === "lg" ? "numberMd" : "meta"),
|
|
2790
|
+
fontFamily: numericFontFamily || fontFamily,
|
|
2791
|
+
fontVariant: ["tabular-nums"],
|
|
2792
|
+
color: colors.text
|
|
2793
|
+
}, children: [
|
|
2794
|
+
percentage,
|
|
2795
|
+
"%"
|
|
2796
|
+
] })
|
|
2797
|
+
] }),
|
|
2798
|
+
content(label, { ...typeStyle("caption"), marginTop: import_tokens14.tokens.dimension.value8, color: colors.textSecondary, textAlign: "center" }),
|
|
2799
|
+
content(subLabel, { ...typeStyle("caption"), marginTop: import_tokens14.tokens.dimension.value4, color: colors.textTertiary, textAlign: "center" })
|
|
2800
|
+
] });
|
|
2801
|
+
}
|
|
2717
2802
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { children: [
|
|
2718
2803
|
!!(label || showLabel) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2719
2804
|
import_react_native16.View,
|
|
@@ -2721,7 +2806,7 @@ function KjunProgress({
|
|
|
2721
2806
|
style: {
|
|
2722
2807
|
flexDirection: "row",
|
|
2723
2808
|
justifyContent: "space-between",
|
|
2724
|
-
marginBottom:
|
|
2809
|
+
marginBottom: import_tokens14.tokens.dimension.value8
|
|
2725
2810
|
},
|
|
2726
2811
|
children: [
|
|
2727
2812
|
content(label, {
|
|
@@ -2747,13 +2832,11 @@ function KjunProgress({
|
|
|
2747
2832
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2748
2833
|
import_react_native16.View,
|
|
2749
2834
|
{
|
|
2750
|
-
|
|
2751
|
-
accessibilityLabel: typeof label === "string" ? label : m.progress,
|
|
2752
|
-
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2835
|
+
...semantics,
|
|
2753
2836
|
style: {
|
|
2754
|
-
height:
|
|
2837
|
+
height: import_tokens14.tokens.extensions.progress.heights[size],
|
|
2755
2838
|
backgroundColor: colors.secondary,
|
|
2756
|
-
borderRadius:
|
|
2839
|
+
borderRadius: import_tokens14.tokens.radius.radius9999,
|
|
2757
2840
|
overflow: "hidden"
|
|
2758
2841
|
},
|
|
2759
2842
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -2762,8 +2845,8 @@ function KjunProgress({
|
|
|
2762
2845
|
style: {
|
|
2763
2846
|
width: `${percentage}%`,
|
|
2764
2847
|
height: "100%",
|
|
2765
|
-
borderRadius:
|
|
2766
|
-
backgroundColor:
|
|
2848
|
+
borderRadius: import_tokens14.tokens.radius.radius9999,
|
|
2849
|
+
backgroundColor: color
|
|
2767
2850
|
}
|
|
2768
2851
|
}
|
|
2769
2852
|
)
|
|
@@ -2771,14 +2854,14 @@ function KjunProgress({
|
|
|
2771
2854
|
),
|
|
2772
2855
|
content(subLabel, {
|
|
2773
2856
|
...typeStyle("caption"),
|
|
2774
|
-
marginTop:
|
|
2857
|
+
marginTop: import_tokens14.tokens.dimension.value4,
|
|
2775
2858
|
color: colors.textTertiary
|
|
2776
2859
|
})
|
|
2777
2860
|
] });
|
|
2778
2861
|
}
|
|
2779
2862
|
|
|
2780
2863
|
// packages/native/src/skeleton-base.tsx
|
|
2781
|
-
var
|
|
2864
|
+
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2782
2865
|
var import_react25 = require("react");
|
|
2783
2866
|
var import_react_native17 = require("react-native");
|
|
2784
2867
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -2798,12 +2881,12 @@ function KjunSkeleton({
|
|
|
2798
2881
|
import_react_native17.Animated.sequence([
|
|
2799
2882
|
import_react_native17.Animated.timing(opacity, {
|
|
2800
2883
|
toValue: 0.6,
|
|
2801
|
-
duration:
|
|
2884
|
+
duration: import_tokens15.tokens.motion.shimmer / 2,
|
|
2802
2885
|
useNativeDriver: false
|
|
2803
2886
|
}),
|
|
2804
2887
|
import_react_native17.Animated.timing(opacity, {
|
|
2805
2888
|
toValue: 1,
|
|
2806
|
-
duration:
|
|
2889
|
+
duration: import_tokens15.tokens.motion.shimmer / 2,
|
|
2807
2890
|
useNativeDriver: false
|
|
2808
2891
|
})
|
|
2809
2892
|
])
|
|
@@ -2822,18 +2905,18 @@ function KjunSkeleton({
|
|
|
2822
2905
|
width: w,
|
|
2823
2906
|
height: h,
|
|
2824
2907
|
backgroundColor: shimmer,
|
|
2825
|
-
borderRadius:
|
|
2908
|
+
borderRadius: import_tokens15.tokens.extensions.skeleton.lineRadius,
|
|
2826
2909
|
...extra
|
|
2827
2910
|
}
|
|
2828
2911
|
}
|
|
2829
2912
|
);
|
|
2830
2913
|
const count = (n) => Array.from({ length: Math.max(0, Math.floor(n)) }, (_, i) => i + 1);
|
|
2831
|
-
const line = (w, key, h =
|
|
2914
|
+
const line = (w, key, h = import_tokens15.tokens.extensions.skeleton.lineHeights.md) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native17.View, { style: { marginBottom: key === rows ? 0 : import_tokens15.tokens.extensions.skeleton.gap }, children: block(w, h) }, key);
|
|
2832
2915
|
const frame = {
|
|
2833
|
-
padding:
|
|
2834
|
-
borderWidth:
|
|
2916
|
+
padding: import_tokens15.tokens.extensions.skeleton.padding,
|
|
2917
|
+
borderWidth: import_tokens15.tokens.border.defaultWidth,
|
|
2835
2918
|
borderColor: colors.border,
|
|
2836
|
-
borderRadius:
|
|
2919
|
+
borderRadius: import_tokens15.tokens.extensions.skeleton.radius,
|
|
2837
2920
|
backgroundColor: colors.background
|
|
2838
2921
|
};
|
|
2839
2922
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -2849,7 +2932,7 @@ function KjunSkeleton({
|
|
|
2849
2932
|
i
|
|
2850
2933
|
)
|
|
2851
2934
|
),
|
|
2852
|
-
type === "avatar" && block(width ||
|
|
2935
|
+
type === "avatar" && block(width || import_tokens15.tokens.extensions.skeleton.avatarSize, height || import_tokens15.tokens.extensions.skeleton.avatarSize, { borderRadius: rounded ? import_tokens15.tokens.radius.radius9999 : import_tokens15.tokens.extensions.skeleton.blockRadius }),
|
|
2853
2936
|
type === "card" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: frame, children: [
|
|
2854
2937
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2855
2938
|
import_react_native17.View,
|
|
@@ -2857,19 +2940,19 @@ function KjunSkeleton({
|
|
|
2857
2940
|
style: {
|
|
2858
2941
|
flexDirection: "row",
|
|
2859
2942
|
alignItems: "center",
|
|
2860
|
-
gap:
|
|
2861
|
-
marginBottom:
|
|
2943
|
+
gap: import_tokens15.tokens.extensions.skeleton.gap,
|
|
2944
|
+
marginBottom: import_tokens15.tokens.dimension.value16
|
|
2862
2945
|
},
|
|
2863
2946
|
children: [
|
|
2864
|
-
block(
|
|
2865
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap:
|
|
2947
|
+
block(import_tokens15.tokens.extensions.skeleton.cardAvatarSize, import_tokens15.tokens.extensions.skeleton.cardAvatarSize, { borderRadius: import_tokens15.tokens.radius.radius9999 }),
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap: import_tokens15.tokens.dimension.value8 }, children: [
|
|
2866
2949
|
block("60%"),
|
|
2867
|
-
block("40%",
|
|
2950
|
+
block("40%", import_tokens15.tokens.extensions.skeleton.lineHeights.sm)
|
|
2868
2951
|
] })
|
|
2869
2952
|
]
|
|
2870
2953
|
}
|
|
2871
2954
|
),
|
|
2872
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { gap:
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { gap: import_tokens15.tokens.dimension.value10 }, children: [
|
|
2873
2956
|
block("100%"),
|
|
2874
2957
|
block("80%"),
|
|
2875
2958
|
block("60%")
|
|
@@ -2879,9 +2962,9 @@ function KjunSkeleton({
|
|
|
2879
2962
|
import_react_native17.View,
|
|
2880
2963
|
{
|
|
2881
2964
|
style: {
|
|
2882
|
-
borderWidth:
|
|
2965
|
+
borderWidth: import_tokens15.tokens.border.defaultWidth,
|
|
2883
2966
|
borderColor: colors.border,
|
|
2884
|
-
borderRadius:
|
|
2967
|
+
borderRadius: import_tokens15.tokens.extensions.skeleton.blockRadius,
|
|
2885
2968
|
overflow: "hidden"
|
|
2886
2969
|
},
|
|
2887
2970
|
children: [0, ...count(rows)].map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -2890,7 +2973,7 @@ function KjunSkeleton({
|
|
|
2890
2973
|
style: {
|
|
2891
2974
|
flexDirection: "row",
|
|
2892
2975
|
backgroundColor: row === 0 ? colors.secondary : void 0,
|
|
2893
|
-
borderBottomWidth: row === rows ? 0 :
|
|
2976
|
+
borderBottomWidth: row === rows ? 0 : import_tokens15.tokens.border.defaultWidth,
|
|
2894
2977
|
borderBottomColor: colors.border
|
|
2895
2978
|
},
|
|
2896
2979
|
children: count(columns).map((col) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -2898,8 +2981,8 @@ function KjunSkeleton({
|
|
|
2898
2981
|
{
|
|
2899
2982
|
style: {
|
|
2900
2983
|
flex: 1,
|
|
2901
|
-
paddingVertical:
|
|
2902
|
-
paddingHorizontal:
|
|
2984
|
+
paddingVertical: import_tokens15.tokens.dimension.value12,
|
|
2985
|
+
paddingHorizontal: import_tokens15.tokens.dimension.value16
|
|
2903
2986
|
},
|
|
2904
2987
|
children: block(
|
|
2905
2988
|
row === 0 ? "70%" : [
|
|
@@ -2909,7 +2992,7 @@ function KjunSkeleton({
|
|
|
2909
2992
|
"75%",
|
|
2910
2993
|
"85%"
|
|
2911
2994
|
][(row + col) % 5],
|
|
2912
|
-
|
|
2995
|
+
import_tokens15.tokens.extensions.skeleton.tableLineHeight
|
|
2913
2996
|
)
|
|
2914
2997
|
},
|
|
2915
2998
|
col
|
|
@@ -2931,16 +3014,16 @@ function KjunSkeleton({
|
|
|
2931
3014
|
}
|
|
2932
3015
|
],
|
|
2933
3016
|
children: [
|
|
2934
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap:
|
|
2935
|
-
block("40%",
|
|
2936
|
-
block("60%",
|
|
2937
|
-
block("30%",
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap: import_tokens15.tokens.dimension.value8 }, children: [
|
|
3018
|
+
block("40%", import_tokens15.tokens.extensions.skeleton.lineHeights.sm),
|
|
3019
|
+
block("60%", import_tokens15.tokens.extensions.skeleton.lineHeights.lg),
|
|
3020
|
+
block("30%", import_tokens15.tokens.extensions.skeleton.lineHeights.sm)
|
|
2938
3021
|
] }),
|
|
2939
|
-
block(
|
|
3022
|
+
block(import_tokens15.tokens.extensions.skeleton.statWidth, import_tokens15.tokens.extensions.skeleton.statHeight)
|
|
2940
3023
|
]
|
|
2941
3024
|
}
|
|
2942
3025
|
),
|
|
2943
|
-
type === "block" && block(width || "100%", height != null ? height :
|
|
3026
|
+
type === "block" && block(width || "100%", height != null ? height : import_tokens15.tokens.extensions.skeleton.blockHeight, { borderRadius: import_tokens15.tokens.extensions.skeleton.blockRadius })
|
|
2944
3027
|
]
|
|
2945
3028
|
}
|
|
2946
3029
|
);
|
|
@@ -2949,7 +3032,7 @@ function KjunSkeleton({
|
|
|
2949
3032
|
// packages/native/src/layout-primitives.tsx
|
|
2950
3033
|
var import_react26 = require("react");
|
|
2951
3034
|
var import_react_native18 = require("react-native");
|
|
2952
|
-
var
|
|
3035
|
+
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2953
3036
|
|
|
2954
3037
|
// shared/package-runtime/layout-primitives.ts
|
|
2955
3038
|
var titleVariants = ["pageTitle", "sectionTitle", "cardTitle"];
|
|
@@ -2958,7 +3041,17 @@ var isNumericVariant = (variant) => numeric.test(variant);
|
|
|
2958
3041
|
|
|
2959
3042
|
// packages/native/src/layout-primitives.tsx
|
|
2960
3043
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2961
|
-
var toneRole = {
|
|
3044
|
+
var toneRole = {
|
|
3045
|
+
default: "text",
|
|
3046
|
+
secondary: "textSecondary",
|
|
3047
|
+
tertiary: "textTertiary",
|
|
3048
|
+
disabled: "textDisabled",
|
|
3049
|
+
brand: "brand",
|
|
3050
|
+
danger: "danger",
|
|
3051
|
+
success: "success",
|
|
3052
|
+
warning: "warning",
|
|
3053
|
+
inverse: "onBrand"
|
|
3054
|
+
};
|
|
2962
3055
|
var textAlign = { start: "left", center: "center", end: "right" };
|
|
2963
3056
|
function KjunText({ variant = "body", tone = "default", align, maxLines, style, children }) {
|
|
2964
3057
|
const { colors, fontFamily, numericFontFamily } = useKjunStyles();
|
|
@@ -2986,46 +3079,51 @@ function flatten(children, path = "") {
|
|
|
2986
3079
|
return (0, import_react26.isValidElement)(child) && child.type === import_react26.Fragment ? flatten(child.props.children, `${key}.`) : [[key, child]];
|
|
2987
3080
|
});
|
|
2988
3081
|
}
|
|
2989
|
-
function items(children) {
|
|
3082
|
+
function items(children, childAlign) {
|
|
2990
3083
|
return flatten(children).map(([key, child]) => {
|
|
2991
3084
|
if (typeof child === "string" || typeof child === "number") return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KText, { children: child }, key);
|
|
2992
3085
|
if ((0, import_react26.isValidElement)(child) && child.type === KjunFormGroup) {
|
|
2993
3086
|
const group = child;
|
|
2994
3087
|
return (0, import_react26.cloneElement)(group, { key, style: [{ marginBottom: 0 }, group.props.style] });
|
|
2995
3088
|
}
|
|
3089
|
+
if (childAlign && (0, import_react26.isValidElement)(child) && (child.type === KjunButton || child.type === KjunBadge)) {
|
|
3090
|
+
const control = child;
|
|
3091
|
+
return (0, import_react26.cloneElement)(control, { key, style: [{ alignSelf: childAlign }, control.props.style] });
|
|
3092
|
+
}
|
|
2996
3093
|
return (0, import_react26.isValidElement)(child) ? (0, import_react26.cloneElement)(child, { key }) : child;
|
|
2997
3094
|
});
|
|
2998
3095
|
}
|
|
3096
|
+
var followed = (align) => align && align !== "stretch" ? crossAxis[align] : void 0;
|
|
2999
3097
|
var stackGap = {
|
|
3000
3098
|
none: 0,
|
|
3001
|
-
sm:
|
|
3002
|
-
md:
|
|
3003
|
-
lg:
|
|
3004
|
-
"section-sm":
|
|
3005
|
-
"section-md":
|
|
3006
|
-
"section-lg":
|
|
3099
|
+
sm: import_tokens16.tokens.space.stack.sm,
|
|
3100
|
+
md: import_tokens16.tokens.space.stack.md,
|
|
3101
|
+
lg: import_tokens16.tokens.space.stack.lg,
|
|
3102
|
+
"section-sm": import_tokens16.tokens.space.section.sm,
|
|
3103
|
+
"section-md": import_tokens16.tokens.space.section.md,
|
|
3104
|
+
"section-lg": import_tokens16.tokens.space.section.lg
|
|
3007
3105
|
};
|
|
3008
3106
|
var inlineGap = {
|
|
3009
3107
|
none: 0,
|
|
3010
|
-
xs:
|
|
3011
|
-
sm:
|
|
3012
|
-
md:
|
|
3013
|
-
lg:
|
|
3108
|
+
xs: import_tokens16.tokens.space.inline.xs,
|
|
3109
|
+
sm: import_tokens16.tokens.space.inline.sm,
|
|
3110
|
+
md: import_tokens16.tokens.space.inline.md,
|
|
3111
|
+
lg: import_tokens16.tokens.space.inline.lg
|
|
3014
3112
|
};
|
|
3015
3113
|
var crossAxis = { stretch: "stretch", start: "flex-start", center: "center", end: "flex-end", baseline: "baseline" };
|
|
3016
3114
|
var mainAxis = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
|
|
3017
|
-
function KjunStack({ gap = "md", align
|
|
3018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: [{ flexDirection: "column", alignItems: crossAxis[align], gap: stackGap[gap], minWidth: 0 }, style], children: items(children) });
|
|
3115
|
+
function KjunStack({ gap = "md", align, style, children }) {
|
|
3116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: [{ flexDirection: "column", alignItems: crossAxis[align != null ? align : "stretch"], gap: stackGap[gap], minWidth: 0 }, style], children: items(children, followed(align)) });
|
|
3019
3117
|
}
|
|
3020
|
-
function KjunInline({ gap = "sm", align
|
|
3118
|
+
function KjunInline({ gap = "sm", align, justify = "start", wrap = true, style, children }) {
|
|
3021
3119
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: [{
|
|
3022
3120
|
flexDirection: "row",
|
|
3023
3121
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
3024
|
-
alignItems: crossAxis[align],
|
|
3122
|
+
alignItems: crossAxis[align != null ? align : "center"],
|
|
3025
3123
|
justifyContent: mainAxis[justify],
|
|
3026
3124
|
gap: inlineGap[gap],
|
|
3027
3125
|
minWidth: 0
|
|
3028
|
-
}, style], children: items(children) });
|
|
3126
|
+
}, style], children: items(children, followed(align)) });
|
|
3029
3127
|
}
|
|
3030
3128
|
|
|
3031
3129
|
// shared/package-runtime/feedback-dialog.ts
|
|
@@ -3077,7 +3175,7 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
3077
3175
|
}
|
|
3078
3176
|
|
|
3079
3177
|
// shared/package-runtime/feedback-motion.ts
|
|
3080
|
-
var
|
|
3178
|
+
var import_tokens17 = require("@kjun-ui/tokens");
|
|
3081
3179
|
var import_react28 = require("react");
|
|
3082
3180
|
function usePresentedToasts(toasts, reduced) {
|
|
3083
3181
|
const [items2, setItems] = (0, import_react28.useState)([]);
|
|
@@ -3095,7 +3193,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
3095
3193
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
3096
3194
|
removals.current.delete(item.toast.id);
|
|
3097
3195
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
3098
|
-
},
|
|
3196
|
+
}, import_tokens17.tokens.motion.toastExit));
|
|
3099
3197
|
}
|
|
3100
3198
|
return next;
|
|
3101
3199
|
});
|
|
@@ -3117,7 +3215,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
3117
3215
|
setRequest(current);
|
|
3118
3216
|
return;
|
|
3119
3217
|
}
|
|
3120
|
-
const timer = setTimeout(() => setRequest(current),
|
|
3218
|
+
const timer = setTimeout(() => setRequest(current), import_tokens17.tokens.motion.layerExit);
|
|
3121
3219
|
return () => clearTimeout(timer);
|
|
3122
3220
|
}, [current, request, reduced]);
|
|
3123
3221
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -3133,7 +3231,7 @@ function useOptionalKjunFeedback() {
|
|
|
3133
3231
|
// packages/native/src/toast-stack.tsx
|
|
3134
3232
|
var import_react32 = require("react");
|
|
3135
3233
|
var import_react_native20 = require("react-native");
|
|
3136
|
-
var
|
|
3234
|
+
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3137
3235
|
|
|
3138
3236
|
// shared/package-runtime/elevation.ts
|
|
3139
3237
|
function directionalShadow(layers, direction) {
|
|
@@ -3148,7 +3246,7 @@ function shadowLayers(layers, colors) {
|
|
|
3148
3246
|
}
|
|
3149
3247
|
|
|
3150
3248
|
// packages/native/src/toast.tsx
|
|
3151
|
-
var
|
|
3249
|
+
var import_tokens18 = require("@kjun-ui/tokens");
|
|
3152
3250
|
var import_react30 = require("react");
|
|
3153
3251
|
var import_react_native19 = require("react-native");
|
|
3154
3252
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -3192,7 +3290,7 @@ function ToastView({
|
|
|
3192
3290
|
accessible: false,
|
|
3193
3291
|
onHoverIn: () => controller.pauseToast(toast.id, reasons.hover),
|
|
3194
3292
|
onHoverOut: () => controller.resumeToast(toast.id, reasons.hover),
|
|
3195
|
-
style: { width: "100%", maxWidth:
|
|
3293
|
+
style: { width: "100%", maxWidth: import_tokens18.tokens.extensions.toast.maxWidth, alignSelf: "flex-end" },
|
|
3196
3294
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3197
3295
|
import_react_native19.View,
|
|
3198
3296
|
{
|
|
@@ -3201,19 +3299,19 @@ function ToastView({
|
|
|
3201
3299
|
style: {
|
|
3202
3300
|
flexDirection: "row",
|
|
3203
3301
|
alignItems: toast.title ? "flex-start" : "center",
|
|
3204
|
-
gap:
|
|
3205
|
-
padding:
|
|
3206
|
-
borderRadius:
|
|
3302
|
+
gap: import_tokens18.tokens.extensions.toast.gap,
|
|
3303
|
+
padding: import_tokens18.tokens.extensions.toast.padding,
|
|
3304
|
+
borderRadius: import_tokens18.tokens.extensions.toast.radius,
|
|
3207
3305
|
backgroundColor: colors.surface,
|
|
3208
|
-
boxShadow: shadowLayers(
|
|
3209
|
-
borderWidth:
|
|
3306
|
+
boxShadow: shadowLayers(import_tokens18.tokens.extensions.toast.elevation, colors),
|
|
3307
|
+
borderWidth: import_tokens18.tokens.border.defaultWidth,
|
|
3210
3308
|
borderColor: colors.border,
|
|
3211
3309
|
overflow: "hidden"
|
|
3212
3310
|
},
|
|
3213
3311
|
children: [
|
|
3214
3312
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: icon, color: colors[`${tone}Accent`] }),
|
|
3215
3313
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native19.View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
3216
|
-
!!toast.title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom:
|
|
3314
|
+
!!toast.title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: import_tokens18.tokens.extensions.toast.titleGap }, children: toast.title }),
|
|
3217
3315
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KText, { style: { color: colors.textSecondary }, children: toast.message }),
|
|
3218
3316
|
toast.action && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3219
3317
|
AccessiblePressable,
|
|
@@ -3231,7 +3329,7 @@ function ToastView({
|
|
|
3231
3329
|
dismiss();
|
|
3232
3330
|
}
|
|
3233
3331
|
},
|
|
3234
|
-
style: { minHeight:
|
|
3332
|
+
style: { minHeight: import_tokens18.tokens.native.minimumTouchTarget, justifyContent: "center", marginTop: import_tokens18.tokens.extensions.toast.actionGap },
|
|
3235
3333
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3236
3334
|
KText,
|
|
3237
3335
|
{
|
|
@@ -3253,11 +3351,11 @@ function ToastView({
|
|
|
3253
3351
|
onBlur: () => controller.resumeToast(toast.id, reasons.focus),
|
|
3254
3352
|
onPress: dismiss,
|
|
3255
3353
|
style: {
|
|
3256
|
-
minWidth: Math.max(
|
|
3257
|
-
minHeight: Math.max(
|
|
3354
|
+
minWidth: Math.max(import_tokens18.tokens.extensions.toast.closeSize, import_tokens18.tokens.native.minimumTouchTarget),
|
|
3355
|
+
minHeight: Math.max(import_tokens18.tokens.extensions.toast.closeSize, import_tokens18.tokens.native.minimumTouchTarget),
|
|
3258
3356
|
alignItems: "center",
|
|
3259
3357
|
justifyContent: "center",
|
|
3260
|
-
borderRadius:
|
|
3358
|
+
borderRadius: import_tokens18.tokens.extensions.toast.closeRadius
|
|
3261
3359
|
},
|
|
3262
3360
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", color: colors.textTertiary })
|
|
3263
3361
|
}
|
|
@@ -3270,7 +3368,7 @@ function ToastView({
|
|
|
3270
3368
|
position: "absolute",
|
|
3271
3369
|
bottom: 0,
|
|
3272
3370
|
left: 0,
|
|
3273
|
-
height:
|
|
3371
|
+
height: import_tokens18.tokens.extensions.toast.progressHeight,
|
|
3274
3372
|
width: progress.interpolate({
|
|
3275
3373
|
inputRange: [0, 1],
|
|
3276
3374
|
outputRange: ["0%", "100%"]
|
|
@@ -3290,7 +3388,7 @@ function ToastView({
|
|
|
3290
3388
|
var import_react31 = require("react");
|
|
3291
3389
|
|
|
3292
3390
|
// shared/package-runtime/toast-layout.ts
|
|
3293
|
-
var
|
|
3391
|
+
var import_tokens19 = require("@kjun-ui/tokens");
|
|
3294
3392
|
function createToastLayout() {
|
|
3295
3393
|
let root = null;
|
|
3296
3394
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -3333,7 +3431,7 @@ function createToastLayout() {
|
|
|
3333
3431
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
3334
3432
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
3335
3433
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
3336
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
3434
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: import_tokens19.tokens.motion.toastMove, easing: import_tokens19.tokens.motion.easeOut });
|
|
3337
3435
|
animations.set(node, animation);
|
|
3338
3436
|
}
|
|
3339
3437
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -3360,8 +3458,8 @@ function useToastReflow(root, reduced) {
|
|
|
3360
3458
|
// packages/native/src/toast-stack.tsx
|
|
3361
3459
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3362
3460
|
function ToastSlot({ item, controller, boxes }) {
|
|
3363
|
-
const born = (0, import_react32.useRef)(Math.min(
|
|
3364
|
-
const motion = useNativePresence(!item.exiting,
|
|
3461
|
+
const born = (0, import_react32.useRef)(Math.min(import_tokens20.tokens.motion.toastEnter, Date.now() - item.born)).current;
|
|
3462
|
+
const motion = useNativePresence(!item.exiting, import_tokens20.tokens.motion.toastEnter - born, import_tokens20.tokens.motion.toastExit, true, born / import_tokens20.tokens.motion.toastEnter);
|
|
3365
3463
|
const offset = (0, import_react32.useRef)(new import_react_native20.Animated.Value(0)).current;
|
|
3366
3464
|
const box = boxes.get(item.toast.id);
|
|
3367
3465
|
(0, import_react32.useLayoutEffect)(() => {
|
|
@@ -3382,7 +3480,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3382
3480
|
boxes.set(item.toast.id, next);
|
|
3383
3481
|
if (old && old.y !== next.y && !motion.reduced) offset.stopAnimation((current) => {
|
|
3384
3482
|
offset.setValue(current + old.y - next.y);
|
|
3385
|
-
import_react_native20.Animated.timing(offset, { toValue: 0, duration:
|
|
3483
|
+
import_react_native20.Animated.timing(offset, { toValue: 0, duration: import_tokens20.tokens.motion.toastMove, easing: motionOut, useNativeDriver: nativeDriver }).start();
|
|
3386
3484
|
});
|
|
3387
3485
|
},
|
|
3388
3486
|
style: { transform: [{ translateY: offset }], ...item.exiting && box ? {
|
|
@@ -3399,7 +3497,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3399
3497
|
accessibilityElementsHidden: item.exiting,
|
|
3400
3498
|
importantForAccessibility: item.exiting ? "no-hide-descendants" : "auto",
|
|
3401
3499
|
...item.exiting ? { inert: true } : {},
|
|
3402
|
-
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-
|
|
3500
|
+
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-import_tokens20.tokens.motionDistance.toast, 0] }) }] },
|
|
3403
3501
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToastView, { toast: item.toast, controller })
|
|
3404
3502
|
}
|
|
3405
3503
|
)
|
|
@@ -3415,19 +3513,20 @@ function ToastStack({ items: items2, controller }) {
|
|
|
3415
3513
|
for (const id of boxes.keys()) if (!items2.some((item) => item.toast.id === id)) boxes.delete(id);
|
|
3416
3514
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native20.View, { ref: root, pointerEvents: "box-none", style: {
|
|
3417
3515
|
position: "absolute",
|
|
3418
|
-
top:
|
|
3419
|
-
right:
|
|
3420
|
-
left:
|
|
3421
|
-
gap:
|
|
3516
|
+
top: import_tokens20.tokens.extensions.toast.inset,
|
|
3517
|
+
right: import_tokens20.tokens.extensions.toast.inset,
|
|
3518
|
+
left: import_tokens20.tokens.extensions.toast.inset,
|
|
3519
|
+
gap: import_tokens20.tokens.extensions.toast.stackGap,
|
|
3422
3520
|
minHeight: items2.some((item) => item.exiting) ? Math.max(0, ...[...boxes.values()].map((box) => box.y + box.height)) : void 0,
|
|
3423
3521
|
zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast")
|
|
3424
3522
|
}, children: items2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToastSlot, { item, controller, boxes }, item.toast.id)) });
|
|
3425
3523
|
}
|
|
3426
3524
|
|
|
3427
3525
|
// packages/native/src/feedback.tsx
|
|
3428
|
-
var
|
|
3526
|
+
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3429
3527
|
var import_react33 = require("react");
|
|
3430
3528
|
var import_react_native21 = require("react-native");
|
|
3529
|
+
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3431
3530
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3432
3531
|
function useKjunFeedback() {
|
|
3433
3532
|
const value = useOptionalKjunFeedback();
|
|
@@ -3459,7 +3558,7 @@ function FeedbackDialog({
|
|
|
3459
3558
|
onConfirm: submit,
|
|
3460
3559
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
3461
3560
|
children: [
|
|
3462
|
-
!!options.message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KText, { style: { marginBottom:
|
|
3561
|
+
!!options.message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KText, { style: { marginBottom: import_tokens21.tokens.dimension.value16 }, children: options.message }),
|
|
3463
3562
|
request.kind === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3464
3563
|
KjunInput,
|
|
3465
3564
|
{
|
|
@@ -3476,8 +3575,10 @@ function FeedbackDialog({
|
|
|
3476
3575
|
}
|
|
3477
3576
|
);
|
|
3478
3577
|
}
|
|
3479
|
-
function KjunFeedbackProvider({ children, style }) {
|
|
3480
|
-
const [
|
|
3578
|
+
function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
3579
|
+
const [owned] = (0, import_react33.useState)(() => controllerProp ? void 0 : (0, import_tokens21.createFeedbackController)());
|
|
3580
|
+
const controller = controllerProp ? (0, import_tokens21.feedbackControllerOf)(controllerProp) : owned;
|
|
3581
|
+
(0, import_react33.useEffect)(() => controller.attach(), [controller]);
|
|
3481
3582
|
const life = (0, import_react33.useRef)(0);
|
|
3482
3583
|
const snapshot = (0, import_react33.useSyncExternalStore)(
|
|
3483
3584
|
controller.subscribe,
|
|
@@ -3491,7 +3592,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3491
3592
|
const version = ++life.current;
|
|
3492
3593
|
return () => {
|
|
3493
3594
|
queueMicrotask(() => {
|
|
3494
|
-
if (life.current === version) controller.dispose();
|
|
3595
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
3495
3596
|
});
|
|
3496
3597
|
};
|
|
3497
3598
|
}, [controller]);
|
|
@@ -3526,7 +3627,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3526
3627
|
|
|
3527
3628
|
// packages/native/src/choice-controls.tsx
|
|
3528
3629
|
var import_react_native22 = require("react-native");
|
|
3529
|
-
var
|
|
3630
|
+
var import_tokens23 = require("@kjun-ui/tokens");
|
|
3530
3631
|
var import_react34 = require("react");
|
|
3531
3632
|
var import_react_native23 = require("react-native");
|
|
3532
3633
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -3541,7 +3642,7 @@ function KjunCheckbox({
|
|
|
3541
3642
|
onValueChange,
|
|
3542
3643
|
onChange
|
|
3543
3644
|
}) {
|
|
3544
|
-
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension =
|
|
3645
|
+
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension = import_tokens23.tokens.extensions.checkbox.sizes[size];
|
|
3545
3646
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3546
3647
|
AccessiblePressable,
|
|
3547
3648
|
{
|
|
@@ -3560,8 +3661,8 @@ function KjunCheckbox({
|
|
|
3560
3661
|
flexDirection: "row",
|
|
3561
3662
|
alignItems: "center",
|
|
3562
3663
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3563
|
-
minHeight: finePointer() ?
|
|
3564
|
-
opacity: disabled ?
|
|
3664
|
+
minHeight: finePointer() ? import_tokens23.tokens.extensions.choice.minimumHeight : import_tokens23.tokens.native.minimumTouchTarget,
|
|
3665
|
+
opacity: disabled ? import_tokens23.tokens.states.opacity.disabled : pressed ? import_tokens23.tokens.states.opacity.pressed : 1
|
|
3565
3666
|
}),
|
|
3566
3667
|
children: [
|
|
3567
3668
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -3572,8 +3673,8 @@ function KjunCheckbox({
|
|
|
3572
3673
|
justifyContent: "center",
|
|
3573
3674
|
width: dimension,
|
|
3574
3675
|
height: dimension,
|
|
3575
|
-
borderRadius:
|
|
3576
|
-
borderWidth:
|
|
3676
|
+
borderRadius: import_tokens23.tokens.extensions.checkbox.radii[size],
|
|
3677
|
+
borderWidth: import_tokens23.tokens.border.controlWidth,
|
|
3577
3678
|
// Same boundary roles as Radio: strong while enabled, secondary once disabled.
|
|
3578
3679
|
borderColor: checked ? colors.brand : disabled ? colors.borderSecondary : colors.borderStrong,
|
|
3579
3680
|
backgroundColor: checked ? colors.brand : colors.surface
|
|
@@ -3582,14 +3683,14 @@ function KjunCheckbox({
|
|
|
3582
3683
|
KjunIcon,
|
|
3583
3684
|
{
|
|
3584
3685
|
name: "check",
|
|
3585
|
-
size:
|
|
3686
|
+
size: import_tokens23.tokens.extensions.checkbox.iconSizes[size],
|
|
3586
3687
|
color: colors.onBrand
|
|
3587
3688
|
}
|
|
3588
3689
|
)
|
|
3589
3690
|
}
|
|
3590
3691
|
),
|
|
3591
3692
|
!!(children || label) && content(children || label, {
|
|
3592
|
-
marginLeft:
|
|
3693
|
+
marginLeft: import_tokens23.tokens.extensions.checkbox.labelGap,
|
|
3593
3694
|
...typeStyle("label")
|
|
3594
3695
|
})
|
|
3595
3696
|
]
|
|
@@ -3605,7 +3706,7 @@ function useControlFocus(disabled) {
|
|
|
3605
3706
|
onFocus: (event) => setFocused(focusVisible(event.currentTarget)),
|
|
3606
3707
|
onBlur: () => setFocused(false)
|
|
3607
3708
|
},
|
|
3608
|
-
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth:
|
|
3709
|
+
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth: import_tokens23.tokens.states.focus.width, outlineOffset: import_tokens23.tokens.states.focus.choiceOffset, outlineColor: colors.focusRing } : {}
|
|
3609
3710
|
};
|
|
3610
3711
|
}
|
|
3611
3712
|
function KjunSwitch({
|
|
@@ -3620,10 +3721,10 @@ function KjunSwitch({
|
|
|
3620
3721
|
onChange
|
|
3621
3722
|
}) {
|
|
3622
3723
|
const { colors } = useKjunStyles();
|
|
3623
|
-
const width =
|
|
3624
|
-
const height =
|
|
3625
|
-
const thumb = height - 2 *
|
|
3626
|
-
const offScale = (thumb - 2 *
|
|
3724
|
+
const width = import_tokens23.tokens.extensions.switch.widths[size];
|
|
3725
|
+
const height = import_tokens23.tokens.extensions.switch.heights[size];
|
|
3726
|
+
const thumb = height - 2 * import_tokens23.tokens.extensions.switch.padding;
|
|
3727
|
+
const offScale = (thumb - 2 * import_tokens23.tokens.border.controlWidth) / thumb;
|
|
3627
3728
|
const offset = width - height;
|
|
3628
3729
|
const motion = useMotionValue(value ? 1 : 0);
|
|
3629
3730
|
const focus = useControlFocus(disabled);
|
|
@@ -3652,8 +3753,8 @@ function KjunSwitch({
|
|
|
3652
3753
|
flexDirection: "row",
|
|
3653
3754
|
alignItems: "center",
|
|
3654
3755
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3655
|
-
minHeight: finePointer() ?
|
|
3656
|
-
opacity: disabled ?
|
|
3756
|
+
minHeight: finePointer() ? import_tokens23.tokens.extensions.choice.minimumHeight : import_tokens23.tokens.native.minimumTouchTarget,
|
|
3757
|
+
opacity: disabled ? import_tokens23.tokens.states.opacity.disabled : 1
|
|
3657
3758
|
},
|
|
3658
3759
|
children: [
|
|
3659
3760
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
@@ -3662,8 +3763,8 @@ function KjunSwitch({
|
|
|
3662
3763
|
style: {
|
|
3663
3764
|
width,
|
|
3664
3765
|
height,
|
|
3665
|
-
padding:
|
|
3666
|
-
borderRadius:
|
|
3766
|
+
padding: import_tokens23.tokens.extensions.switch.padding,
|
|
3767
|
+
borderRadius: import_tokens23.tokens.extensions.switch.radius,
|
|
3667
3768
|
backgroundColor: trackColor,
|
|
3668
3769
|
...focus.ring
|
|
3669
3770
|
},
|
|
@@ -3675,8 +3776,8 @@ function KjunSwitch({
|
|
|
3675
3776
|
style: {
|
|
3676
3777
|
position: "absolute",
|
|
3677
3778
|
inset: 0,
|
|
3678
|
-
borderRadius:
|
|
3679
|
-
borderWidth:
|
|
3779
|
+
borderRadius: import_tokens23.tokens.extensions.switch.radius,
|
|
3780
|
+
borderWidth: import_tokens23.tokens.border.controlWidth,
|
|
3680
3781
|
// Hover turns the boundary to brand, like Checkbox on Web.
|
|
3681
3782
|
borderColor: hovered && !disabled ? colors.brand : offRole,
|
|
3682
3783
|
opacity: motion.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })
|
|
@@ -3689,7 +3790,7 @@ function KjunSwitch({
|
|
|
3689
3790
|
style: {
|
|
3690
3791
|
width: thumb,
|
|
3691
3792
|
height: thumb,
|
|
3692
|
-
borderRadius:
|
|
3793
|
+
borderRadius: import_tokens23.tokens.extensions.switch.radius,
|
|
3693
3794
|
backgroundColor: thumbColor,
|
|
3694
3795
|
transform: [
|
|
3695
3796
|
{ translateX: motion.interpolate({ inputRange: [0, 1], outputRange: [0, offset] }) },
|
|
@@ -3701,11 +3802,11 @@ function KjunSwitch({
|
|
|
3701
3802
|
]
|
|
3702
3803
|
}
|
|
3703
3804
|
),
|
|
3704
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native23.View, { style: { marginLeft:
|
|
3805
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native23.View, { style: { marginLeft: import_tokens23.tokens.extensions.switch.labelGap, flexShrink: 1, minWidth: 0 }, children: [
|
|
3705
3806
|
!!(children || label) && content(children || label, typeStyle("label")),
|
|
3706
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KText, { style: { ...typeStyle("caption"), marginTop:
|
|
3807
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KText, { style: { ...typeStyle("caption"), marginTop: import_tokens23.tokens.dimension.value4, color: colors.textSecondary }, children: description })
|
|
3707
3808
|
] }) : !!(children || label) && content(children || label, {
|
|
3708
|
-
marginLeft:
|
|
3809
|
+
marginLeft: import_tokens23.tokens.extensions.switch.labelGap,
|
|
3709
3810
|
...typeStyle("label")
|
|
3710
3811
|
})
|
|
3711
3812
|
]
|
|
@@ -3724,7 +3825,7 @@ function KjunRadio({
|
|
|
3724
3825
|
onChange
|
|
3725
3826
|
}) {
|
|
3726
3827
|
const group = (0, import_react34.useContext)(RadioContext), { colors } = useKjunStyles(), selected = (group ? group.value : value) === val;
|
|
3727
|
-
const geometry2 =
|
|
3828
|
+
const geometry2 = import_tokens23.tokens.extensions.radio;
|
|
3728
3829
|
const [hovered, setHovered] = (0, import_react34.useState)(false);
|
|
3729
3830
|
(0, import_react34.useEffect)(() => {
|
|
3730
3831
|
if (disabled) setHovered(false);
|
|
@@ -3751,8 +3852,8 @@ function KjunRadio({
|
|
|
3751
3852
|
flexDirection: "row",
|
|
3752
3853
|
alignItems: "center",
|
|
3753
3854
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3754
|
-
minHeight: finePointer() ?
|
|
3755
|
-
opacity: disabled ?
|
|
3855
|
+
minHeight: finePointer() ? import_tokens23.tokens.extensions.choice.minimumHeight : import_tokens23.tokens.native.minimumTouchTarget,
|
|
3856
|
+
opacity: disabled ? import_tokens23.tokens.states.opacity.disabled : 1
|
|
3756
3857
|
},
|
|
3757
3858
|
children: ({ pressed }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3758
3859
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -3762,7 +3863,7 @@ function KjunRadio({
|
|
|
3762
3863
|
width: geometry2.size,
|
|
3763
3864
|
height: geometry2.size,
|
|
3764
3865
|
borderWidth: geometry2.borderWidth,
|
|
3765
|
-
borderRadius:
|
|
3866
|
+
borderRadius: import_tokens23.tokens.radius.radius9999,
|
|
3766
3867
|
alignItems: "center",
|
|
3767
3868
|
justifyContent: "center",
|
|
3768
3869
|
borderColor: disabled ? selected ? colors.brand : colors.borderSecondary : pressed ? colors.brandActive : hovered ? colors.brandHover : selected ? colors.brand : colors.borderStrong,
|
|
@@ -3774,7 +3875,7 @@ function KjunRadio({
|
|
|
3774
3875
|
style: {
|
|
3775
3876
|
width: geometry2.dot,
|
|
3776
3877
|
height: geometry2.dot,
|
|
3777
|
-
borderRadius:
|
|
3878
|
+
borderRadius: import_tokens23.tokens.radius.radius9999,
|
|
3778
3879
|
backgroundColor: colors.brand
|
|
3779
3880
|
}
|
|
3780
3881
|
}
|
|
@@ -3819,7 +3920,7 @@ function KjunRadioGroup({
|
|
|
3819
3920
|
style: {
|
|
3820
3921
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
3821
3922
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
3822
|
-
gap: direction === "vertical" ?
|
|
3923
|
+
gap: direction === "vertical" ? import_tokens23.tokens.dimension.value8 : import_tokens23.tokens.dimension.value16
|
|
3823
3924
|
},
|
|
3824
3925
|
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3825
3926
|
KjunRadio,
|
|
@@ -3837,16 +3938,16 @@ function KjunRadioGroup({
|
|
|
3837
3938
|
}
|
|
3838
3939
|
|
|
3839
3940
|
// packages/native/src/selection-groups.tsx
|
|
3840
|
-
var
|
|
3941
|
+
var import_tokens25 = require("@kjun-ui/tokens");
|
|
3841
3942
|
var import_react36 = require("react");
|
|
3842
3943
|
var import_react_native25 = require("react-native");
|
|
3843
3944
|
|
|
3844
3945
|
// packages/native/src/button-group-motion.tsx
|
|
3845
3946
|
var import_react35 = require("react");
|
|
3846
3947
|
var import_react_native24 = require("react-native");
|
|
3847
|
-
var
|
|
3948
|
+
var import_tokens24 = require("@kjun-ui/tokens");
|
|
3848
3949
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3849
|
-
var curve =
|
|
3950
|
+
var curve = import_tokens24.tokens.motion.easeOut.match(/-?\d*\.?\d+/g).map(Number);
|
|
3850
3951
|
var easing = import_react_native24.Easing.bezier(...curve);
|
|
3851
3952
|
var sameBox = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3852
3953
|
function useButtonGroupMotion(selected) {
|
|
@@ -3873,8 +3974,8 @@ function useButtonGroupMotion(selected) {
|
|
|
3873
3974
|
width.stopAnimation();
|
|
3874
3975
|
if (old && old.value !== selected.value && !reduced) {
|
|
3875
3976
|
import_react_native24.Animated.parallel([
|
|
3876
|
-
import_react_native24.Animated.timing(x, { toValue: layout.x, duration:
|
|
3877
|
-
import_react_native24.Animated.timing(width, { toValue: layout.width, duration:
|
|
3977
|
+
import_react_native24.Animated.timing(x, { toValue: layout.x, duration: import_tokens24.tokens.motion.indicator, easing, useNativeDriver: false }),
|
|
3978
|
+
import_react_native24.Animated.timing(width, { toValue: layout.width, duration: import_tokens24.tokens.motion.indicator, easing, useNativeDriver: false })
|
|
3878
3979
|
]).start();
|
|
3879
3980
|
} else {
|
|
3880
3981
|
x.setValue(layout.x);
|
|
@@ -3895,7 +3996,7 @@ function ButtonGroupLabel({ label, active, size, reduced }) {
|
|
|
3895
3996
|
(0, import_react35.useEffect)(() => {
|
|
3896
3997
|
progress.stopAnimation();
|
|
3897
3998
|
if (reduced || !interpolate) progress.setValue(active ? 1 : 0);
|
|
3898
|
-
else import_react_native24.Animated.timing(progress, { toValue: active ? 1 : 0, duration:
|
|
3999
|
+
else import_react_native24.Animated.timing(progress, { toValue: active ? 1 : 0, duration: import_tokens24.tokens.motion.indicator, easing, useNativeDriver: false }).start();
|
|
3899
4000
|
return () => progress.stopAnimation();
|
|
3900
4001
|
}, [active, reduced, interpolate, progress]);
|
|
3901
4002
|
const resolveFont = useResolveFont();
|
|
@@ -3937,8 +4038,8 @@ function KjunButtonGroup({
|
|
|
3937
4038
|
const { colors } = useKjunStyles();
|
|
3938
4039
|
const selected = options.find((option) => option.value === value);
|
|
3939
4040
|
const motion = useButtonGroupMotion(selected);
|
|
3940
|
-
const padding =
|
|
3941
|
-
const itemRadius =
|
|
4041
|
+
const padding = import_tokens25.tokens.buttonGroup.padding[size];
|
|
4042
|
+
const itemRadius = import_tokens25.tokens.buttonGroup.itemRadii[size];
|
|
3942
4043
|
const itemRefs = (0, import_react36.useRef)(/* @__PURE__ */ new Map());
|
|
3943
4044
|
const { updateLayout } = motion;
|
|
3944
4045
|
(0, import_react36.useLayoutEffect)(() => {
|
|
@@ -3964,7 +4065,7 @@ function KjunButtonGroup({
|
|
|
3964
4065
|
style: {
|
|
3965
4066
|
flexDirection: "row",
|
|
3966
4067
|
padding,
|
|
3967
|
-
borderRadius:
|
|
4068
|
+
borderRadius: import_tokens25.tokens.buttonGroup.radii[size],
|
|
3968
4069
|
backgroundColor: colors.secondary,
|
|
3969
4070
|
flexGrow: fullWidth ? 1 : 0
|
|
3970
4071
|
},
|
|
@@ -3988,7 +4089,7 @@ function KjunButtonGroup({
|
|
|
3988
4089
|
// Disabled options dim their own labels; the selected value stays readable. The edge keeps it
|
|
3989
4090
|
// apart from the track when surface and secondary are close.
|
|
3990
4091
|
backgroundColor: colors.surface,
|
|
3991
|
-
borderWidth:
|
|
4092
|
+
borderWidth: import_tokens25.tokens.border.defaultWidth,
|
|
3992
4093
|
borderColor: colors.border
|
|
3993
4094
|
}
|
|
3994
4095
|
}
|
|
@@ -4016,22 +4117,22 @@ function KjunButtonGroup({
|
|
|
4016
4117
|
flexDirection: "row",
|
|
4017
4118
|
alignItems: "center",
|
|
4018
4119
|
justifyContent: "center",
|
|
4019
|
-
gap:
|
|
4120
|
+
gap: import_tokens25.tokens.dimension.value6,
|
|
4020
4121
|
flex: fullWidth ? 1 : void 0,
|
|
4021
|
-
minWidth:
|
|
4022
|
-
minHeight:
|
|
4023
|
-
height: Math.max(
|
|
4024
|
-
paddingHorizontal:
|
|
4122
|
+
minWidth: import_tokens25.tokens.native.minimumTouchTarget,
|
|
4123
|
+
minHeight: import_tokens25.tokens.native.minimumTouchTarget,
|
|
4124
|
+
height: Math.max(import_tokens25.tokens.native.minimumTouchTarget, import_tokens25.tokens.buttonGroup.heights[size] - 2 * padding),
|
|
4125
|
+
paddingHorizontal: import_tokens25.tokens.buttonGroup.itemPaddingX[size],
|
|
4025
4126
|
borderRadius: itemRadius,
|
|
4026
4127
|
backgroundColor: active && !motion.layout ? colors.surface : pressed && !active ? colors.hover : "transparent",
|
|
4027
|
-
opacity: blocked ?
|
|
4128
|
+
opacity: blocked ? import_tokens25.tokens.states.opacity.disabled : 1
|
|
4028
4129
|
}),
|
|
4029
4130
|
children: [
|
|
4030
4131
|
!!option.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4031
4132
|
KjunIcon,
|
|
4032
4133
|
{
|
|
4033
4134
|
name: option.icon,
|
|
4034
|
-
size:
|
|
4135
|
+
size: import_tokens25.tokens.extensions.selection.iconSize,
|
|
4035
4136
|
color: active ? colors.text : colors.textSecondary
|
|
4036
4137
|
}
|
|
4037
4138
|
),
|
|
@@ -4067,7 +4168,7 @@ function KjunFilterGroup({
|
|
|
4067
4168
|
onChange
|
|
4068
4169
|
}) {
|
|
4069
4170
|
const { colors } = useKjunStyles();
|
|
4070
|
-
const wide = (0, import_react_native25.useWindowDimensions)().width >=
|
|
4171
|
+
const wide = (0, import_react_native25.useWindowDimensions)().width >= import_tokens25.tokens.responsive.selection, roomy = wide && finePointer();
|
|
4071
4172
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
4072
4173
|
const children = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4073
4174
|
import_react_native25.View,
|
|
@@ -4076,7 +4177,7 @@ function KjunFilterGroup({
|
|
|
4076
4177
|
style: {
|
|
4077
4178
|
flexDirection: "row",
|
|
4078
4179
|
flexWrap: scroll ? "nowrap" : "wrap",
|
|
4079
|
-
gap:
|
|
4180
|
+
gap: import_tokens25.tokens.dimension.value8
|
|
4080
4181
|
},
|
|
4081
4182
|
children: options.map((option) => {
|
|
4082
4183
|
const active = selected(option.value), blocked = disabled || option.disabled;
|
|
@@ -4093,9 +4194,9 @@ function KjunFilterGroup({
|
|
|
4093
4194
|
onChange == null ? void 0 : onChange(next);
|
|
4094
4195
|
},
|
|
4095
4196
|
style: {
|
|
4096
|
-
minHeight: roomy ? void 0 :
|
|
4197
|
+
minHeight: roomy ? void 0 : import_tokens25.tokens.native.minimumTouchTarget,
|
|
4097
4198
|
justifyContent: "center",
|
|
4098
|
-
opacity: blocked ?
|
|
4199
|
+
opacity: blocked ? import_tokens25.tokens.states.opacity.disabledStrong : 1
|
|
4099
4200
|
},
|
|
4100
4201
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4101
4202
|
import_react_native25.View,
|
|
@@ -4104,12 +4205,12 @@ function KjunFilterGroup({
|
|
|
4104
4205
|
flexDirection: "row",
|
|
4105
4206
|
alignItems: "center",
|
|
4106
4207
|
justifyContent: "center",
|
|
4107
|
-
gap:
|
|
4108
|
-
minHeight: roomy ? void 0 :
|
|
4109
|
-
height: roomy ?
|
|
4110
|
-
paddingHorizontal: { xs:
|
|
4208
|
+
gap: import_tokens25.tokens.dimension.value4,
|
|
4209
|
+
minHeight: roomy ? void 0 : import_tokens25.tokens.extensions.selection.minimumHeight,
|
|
4210
|
+
height: roomy ? import_tokens25.tokens.button.heights[size] : Math.max(import_tokens25.tokens.extensions.selection.minimumHeight, import_tokens25.tokens.button.heights[size]),
|
|
4211
|
+
paddingHorizontal: { xs: import_tokens25.tokens.dimension.value8, sm: import_tokens25.tokens.dimension.value12, md: import_tokens25.tokens.dimension.value12, lg: import_tokens25.tokens.dimension.value14, xl: import_tokens25.tokens.dimension.value16 }[size],
|
|
4111
4212
|
// Corners follow the button scale with the height, so every size keeps the same shape.
|
|
4112
|
-
borderRadius:
|
|
4213
|
+
borderRadius: import_tokens25.tokens.button.radii[size],
|
|
4113
4214
|
backgroundColor: active ? colors.text : colors.secondary
|
|
4114
4215
|
},
|
|
4115
4216
|
children: [
|
|
@@ -4117,9 +4218,9 @@ function KjunFilterGroup({
|
|
|
4117
4218
|
import_react_native25.View,
|
|
4118
4219
|
{
|
|
4119
4220
|
style: {
|
|
4120
|
-
width:
|
|
4121
|
-
height:
|
|
4122
|
-
borderRadius:
|
|
4221
|
+
width: import_tokens25.tokens.extensions.selection.dotSize,
|
|
4222
|
+
height: import_tokens25.tokens.extensions.selection.dotSize,
|
|
4223
|
+
borderRadius: import_tokens25.tokens.radius.radius4,
|
|
4123
4224
|
backgroundColor: option.dot
|
|
4124
4225
|
}
|
|
4125
4226
|
}
|
|
@@ -4128,7 +4229,7 @@ function KjunFilterGroup({
|
|
|
4128
4229
|
KjunIcon,
|
|
4129
4230
|
{
|
|
4130
4231
|
name: option.icon,
|
|
4131
|
-
size:
|
|
4232
|
+
size: import_tokens25.tokens.extensions.selection.iconSize,
|
|
4132
4233
|
color: active ? colors.inverse : colors.textSecondary
|
|
4133
4234
|
}
|
|
4134
4235
|
),
|
|
@@ -4179,7 +4280,7 @@ function KjunFilterGroup({
|
|
|
4179
4280
|
}
|
|
4180
4281
|
|
|
4181
4282
|
// packages/native/src/textarea.tsx
|
|
4182
|
-
var
|
|
4283
|
+
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4183
4284
|
var import_react37 = require("react");
|
|
4184
4285
|
var import_react_native26 = require("react-native");
|
|
4185
4286
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
@@ -4197,7 +4298,7 @@ var KjunTextarea = (0, import_react37.forwardRef)(
|
|
|
4197
4298
|
onBlur,
|
|
4198
4299
|
...props
|
|
4199
4300
|
}, ref) {
|
|
4200
|
-
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec =
|
|
4301
|
+
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec = import_tokens26.tokens.input[size];
|
|
4201
4302
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
4202
4303
|
const surface = useFieldSurface(size, { disabled, readOnly: readonly || props.readOnly || props.editable === false, invalid });
|
|
4203
4304
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -4238,8 +4339,8 @@ var KjunTextarea = (0, import_react37.forwardRef)(
|
|
|
4238
4339
|
...inputTypeStyle(size),
|
|
4239
4340
|
...surface.style,
|
|
4240
4341
|
height: void 0,
|
|
4241
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
4242
|
-
paddingHorizontal: spec.padding -
|
|
4342
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * import_tokens26.tokens.border.controlWidth),
|
|
4343
|
+
paddingHorizontal: spec.padding - import_tokens26.tokens.border.controlWidth,
|
|
4243
4344
|
paddingVertical: spec.textareaPaddingY,
|
|
4244
4345
|
textAlignVertical: "top",
|
|
4245
4346
|
color: surface.ink
|
|
@@ -4252,7 +4353,7 @@ var KjunTextarea = (0, import_react37.forwardRef)(
|
|
|
4252
4353
|
);
|
|
4253
4354
|
|
|
4254
4355
|
// packages/native/src/drawer.tsx
|
|
4255
|
-
var
|
|
4356
|
+
var import_tokens27 = require("@kjun-ui/tokens");
|
|
4256
4357
|
var import_react38 = require("react");
|
|
4257
4358
|
var import_react_native27 = require("react-native");
|
|
4258
4359
|
|
|
@@ -4304,7 +4405,7 @@ function KjunDrawer({
|
|
|
4304
4405
|
onOpenChange,
|
|
4305
4406
|
title,
|
|
4306
4407
|
position = "right",
|
|
4307
|
-
width =
|
|
4408
|
+
width = import_tokens27.tokens.extensions.drawer.width,
|
|
4308
4409
|
closable = true,
|
|
4309
4410
|
closeOnOverlay = true,
|
|
4310
4411
|
closeOnEsc = true,
|
|
@@ -4328,13 +4429,13 @@ function KjunDrawer({
|
|
|
4328
4429
|
windowHeight: rootHeight || window2.height,
|
|
4329
4430
|
safeAreaTop: Math.max(0, safeAreaTop),
|
|
4330
4431
|
safeAreaBottom: Math.max(0, safeAreaBottom),
|
|
4331
|
-
gap:
|
|
4432
|
+
gap: import_tokens27.tokens.extensions.drawer.sheetGap,
|
|
4332
4433
|
keyboard,
|
|
4333
4434
|
maxHeight
|
|
4334
4435
|
});
|
|
4335
4436
|
const [panelHeight, setPanelHeight] = (0, import_react38.useState)(0);
|
|
4336
|
-
const motion = useNativePresence(open,
|
|
4337
|
-
const backdrop = useNativePresence(open,
|
|
4437
|
+
const motion = useNativePresence(open, import_tokens27.tokens.motion.layerEnter, import_tokens27.tokens.motion.layerExit, vertical || panelHeight > 0, 0, { enterEasing: motionEmphasized });
|
|
4438
|
+
const backdrop = useNativePresence(open, import_tokens27.tokens.motion.backdrop, import_tokens27.tokens.motion.backdropExit, true, 0, { fade: import_tokens27.tokens.motion.backdropExit });
|
|
4338
4439
|
const close = () => {
|
|
4339
4440
|
if (!open) return;
|
|
4340
4441
|
onOpenChange(false);
|
|
@@ -4399,10 +4500,10 @@ function KjunDrawer({
|
|
|
4399
4500
|
paddingTop: frame.paddingTop,
|
|
4400
4501
|
paddingBottom: frame.paddingBottom,
|
|
4401
4502
|
marginBottom: frame.lift,
|
|
4402
|
-
borderRadius:
|
|
4403
|
-
borderTopLeftRadius: position === "bottom" ?
|
|
4404
|
-
borderTopRightRadius: position === "bottom" ?
|
|
4405
|
-
boxShadow: directionalShadow(
|
|
4503
|
+
borderRadius: import_tokens27.tokens.extensions.drawer.radius,
|
|
4504
|
+
borderTopLeftRadius: position === "bottom" ? import_tokens27.tokens.extensions.drawer.bottomRadius : import_tokens27.tokens.extensions.drawer.radius,
|
|
4505
|
+
borderTopRightRadius: position === "bottom" ? import_tokens27.tokens.extensions.drawer.bottomRadius : import_tokens27.tokens.extensions.drawer.radius,
|
|
4506
|
+
boxShadow: directionalShadow(import_tokens27.tokens.extensions.drawer.elevation, position).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4406
4507
|
backgroundColor: colors.surface
|
|
4407
4508
|
},
|
|
4408
4509
|
children: [
|
|
@@ -4413,9 +4514,9 @@ function KjunDrawer({
|
|
|
4413
4514
|
flexDirection: "row",
|
|
4414
4515
|
alignItems: "center",
|
|
4415
4516
|
justifyContent: "space-between",
|
|
4416
|
-
paddingVertical:
|
|
4417
|
-
paddingHorizontal:
|
|
4418
|
-
borderBottomWidth:
|
|
4517
|
+
paddingVertical: import_tokens27.tokens.extensions.drawer.paddingY,
|
|
4518
|
+
paddingHorizontal: import_tokens27.tokens.extensions.drawer.paddingX,
|
|
4519
|
+
borderBottomWidth: import_tokens27.tokens.border.defaultWidth,
|
|
4419
4520
|
borderBottomColor: colors.border
|
|
4420
4521
|
},
|
|
4421
4522
|
children: [
|
|
@@ -4433,8 +4534,8 @@ function KjunDrawer({
|
|
|
4433
4534
|
variant: "ghost",
|
|
4434
4535
|
ariaLabel: m.close,
|
|
4435
4536
|
onPress: close,
|
|
4436
|
-
style: { borderRadius:
|
|
4437
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "x", size:
|
|
4537
|
+
style: { borderRadius: import_tokens27.tokens.extensions.drawer.closeRadius, width: import_tokens27.tokens.extensions.drawer.closeSize, height: import_tokens27.tokens.extensions.drawer.closeSize, paddingHorizontal: 0, paddingVertical: 0 },
|
|
4538
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "x", size: import_tokens27.tokens.extensions.drawer.closeIconSize })
|
|
4438
4539
|
}
|
|
4439
4540
|
)
|
|
4440
4541
|
]
|
|
@@ -4445,7 +4546,7 @@ function KjunDrawer({
|
|
|
4445
4546
|
{
|
|
4446
4547
|
keyboardShouldPersistTaps: "handled",
|
|
4447
4548
|
style: vertical ? { flex: 1 } : { flexGrow: 0, flexShrink: 1 },
|
|
4448
|
-
contentContainerStyle: { padding: noPadding ? 0 :
|
|
4549
|
+
contentContainerStyle: { padding: noPadding ? 0 : import_tokens27.tokens.extensions.drawer.bodyPadding },
|
|
4449
4550
|
children: content(children)
|
|
4450
4551
|
}
|
|
4451
4552
|
),
|
|
@@ -4453,9 +4554,9 @@ function KjunDrawer({
|
|
|
4453
4554
|
import_react_native28.View,
|
|
4454
4555
|
{
|
|
4455
4556
|
style: {
|
|
4456
|
-
paddingVertical:
|
|
4457
|
-
paddingHorizontal:
|
|
4458
|
-
borderTopWidth:
|
|
4557
|
+
paddingVertical: import_tokens27.tokens.extensions.drawer.paddingY,
|
|
4558
|
+
paddingHorizontal: import_tokens27.tokens.extensions.drawer.paddingX,
|
|
4559
|
+
borderTopWidth: import_tokens27.tokens.border.defaultWidth,
|
|
4459
4560
|
borderTopColor: colors.border
|
|
4460
4561
|
},
|
|
4461
4562
|
children: content(footer)
|
|
@@ -4472,13 +4573,13 @@ function KjunDrawer({
|
|
|
4472
4573
|
}
|
|
4473
4574
|
|
|
4474
4575
|
// packages/native/src/dropdown.tsx
|
|
4475
|
-
var
|
|
4576
|
+
var import_tokens30 = require("@kjun-ui/tokens");
|
|
4476
4577
|
var import_react41 = require("react");
|
|
4477
4578
|
var import_react_native32 = require("react-native");
|
|
4478
4579
|
|
|
4479
4580
|
// packages/native/src/floating-panel.tsx
|
|
4480
4581
|
var import_react_native29 = require("react-native");
|
|
4481
|
-
var
|
|
4582
|
+
var import_tokens28 = require("@kjun-ui/tokens");
|
|
4482
4583
|
var import_react39 = require("react");
|
|
4483
4584
|
var import_react_native30 = require("react-native");
|
|
4484
4585
|
var import_react_native_svg4 = __toESM(require("react-native-svg"), 1);
|
|
@@ -4530,7 +4631,7 @@ function FloatingPanel({
|
|
|
4530
4631
|
const scroll = (0, import_react39.useRef)(null), viewport = (0, import_react39.useRef)(0);
|
|
4531
4632
|
const { colors } = useKjunStyles(), window2 = (0, import_react_native30.useWindowDimensions)(), [anchored, setAnchored] = (0, import_react39.useState)(false), [sized, setSized] = (0, import_react39.useState)(false), [anchor, setAnchor] = (0, import_react39.useState)({ x: 0, y: 0, width: 0, height: 0 }), [panel, setPanel] = (0, import_react39.useState)({ width: 0, height: 0 });
|
|
4532
4633
|
const measurement = (0, import_react39.useRef)(0);
|
|
4533
|
-
const motion = useNativePresence(open, tooltip ?
|
|
4634
|
+
const motion = useNativePresence(open, tooltip ? import_tokens28.tokens.motion.tooltipEnter : import_tokens28.tokens.motion.popupEnter, tooltip ? import_tokens28.tokens.motion.tooltipExit : import_tokens28.tokens.motion.popupExit, anchored && sized);
|
|
4534
4635
|
const layer = useLayer(open, motion.present, tooltip ? "tooltip" : "popup", () => onOpenChange(false), triggerRef);
|
|
4535
4636
|
(0, import_react39.useLayoutEffect)(() => {
|
|
4536
4637
|
var _a;
|
|
@@ -4555,7 +4656,7 @@ function FloatingPanel({
|
|
|
4555
4656
|
var _a;
|
|
4556
4657
|
const row = reveal == null ? void 0 : reveal.current;
|
|
4557
4658
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
4558
|
-
const offset = row.y + row.height + (menu || field ?
|
|
4659
|
+
const offset = row.y + row.height + (menu || field ? import_tokens28.tokens.extensions.menu.padding : 0) - viewport.current;
|
|
4559
4660
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
4560
4661
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
4561
4662
|
(0, import_react39.useEffect)(() => {
|
|
@@ -4568,30 +4669,30 @@ function FloatingPanel({
|
|
|
4568
4669
|
if (tag) import_react_native30.AccessibilityInfo.setAccessibilityFocus(tag);
|
|
4569
4670
|
}
|
|
4570
4671
|
}, [open, anchored, sized, focusOnOpen]);
|
|
4571
|
-
const gap = field ?
|
|
4672
|
+
const gap = field ? import_tokens28.tokens.extensions.floating.fieldGap : import_tokens28.tokens.extensions.floating.anchorGap;
|
|
4572
4673
|
const contentSizedMenu = menu && !matchTriggerWidth;
|
|
4573
|
-
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 *
|
|
4574
|
-
const maximumWidth = Math.max(0, window2.width - 2 *
|
|
4674
|
+
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 * import_tokens28.tokens.extensions.floating.viewportInset), import_tokens28.tokens.extensions.tooltip.maxWidth);
|
|
4675
|
+
const maximumWidth = Math.max(0, window2.width - 2 * import_tokens28.tokens.extensions.floating.viewportInset);
|
|
4575
4676
|
const minimumPanelWidth = Math.min(
|
|
4576
4677
|
maximumWidth,
|
|
4577
|
-
Math.max(minimumWidth, menu || field ?
|
|
4678
|
+
Math.max(minimumWidth, menu || field ? import_tokens28.tokens.extensions.menu.minimumWidth : 0)
|
|
4578
4679
|
);
|
|
4579
4680
|
const width = tooltip ? Math.min(tooltipWidth, panel.width || tooltipWidth) : Math.min(
|
|
4580
4681
|
maximumWidth,
|
|
4581
|
-
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width :
|
|
4682
|
+
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width : import_tokens28.tokens.extensions.popover.width)
|
|
4582
4683
|
);
|
|
4583
|
-
const available = Math.min(maxHeight != null ? maxHeight : field ?
|
|
4684
|
+
const available = Math.min(maxHeight != null ? maxHeight : field ? import_tokens28.tokens.extensions.menu.listMaxHeight : import_tokens28.tokens.extensions.floating.maxHeight, window2.height - 2 * import_tokens28.tokens.extensions.floating.viewportInset), height = Math.min(panel.height + (header != null ? headerHeight : 0), available), roomAbove = anchor.y - gap - import_tokens28.tokens.extensions.floating.viewportInset, roomBelow = window2.height - anchor.y - anchor.height - gap - import_tokens28.tokens.extensions.floating.viewportInset, above = placement.startsWith("top") ? !(flip && height > roomAbove && roomBelow > roomAbove) : flip && height > roomBelow && roomAbove > roomBelow;
|
|
4584
4685
|
let left = placement.endsWith("end") ? anchor.x + anchor.width - width : placement === "top" || placement === "bottom" ? anchor.x + (anchor.width - width) / 2 : anchor.x, top = above ? anchor.y - height - gap : anchor.y + anchor.height + gap;
|
|
4585
4686
|
if (placement === "left" || placement === "right") {
|
|
4586
4687
|
left = placement === "left" ? anchor.x - width - gap : anchor.x + anchor.width + gap;
|
|
4587
4688
|
top = anchor.y + (anchor.height - height) / 2;
|
|
4588
4689
|
}
|
|
4589
|
-
left = Math.max(
|
|
4590
|
-
top = Math.max(
|
|
4690
|
+
left = Math.max(import_tokens28.tokens.extensions.floating.viewportInset, Math.min(window2.width - width - import_tokens28.tokens.extensions.floating.viewportInset, left));
|
|
4691
|
+
top = Math.max(import_tokens28.tokens.extensions.floating.viewportInset, Math.min(window2.height - height - import_tokens28.tokens.extensions.floating.viewportInset, top));
|
|
4591
4692
|
if (layer.blocked) return null;
|
|
4592
4693
|
if (tooltip && import_react_native30.Platform.OS === "web") {
|
|
4593
4694
|
if (!motion.present) return null;
|
|
4594
|
-
const arrow =
|
|
4695
|
+
const arrow = import_tokens28.tokens.extensions.tooltip.arrowSize, corner = import_tokens28.tokens.radius.radius6, side = placement === "left" ? "right" : placement === "right" ? "left" : above ? "bottom" : "top", along = side === "top" || side === "bottom" ? Math.max(corner, Math.min(width - corner - arrow, anchor.x + anchor.width / 2 - left - arrow / 2)) : Math.max(corner, Math.min(height - corner - arrow, anchor.y + anchor.height / 2 - top - arrow / 2));
|
|
4595
4696
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4596
4697
|
import_react_native29.Animated.View,
|
|
4597
4698
|
{
|
|
@@ -4618,7 +4719,7 @@ function FloatingPanel({
|
|
|
4618
4719
|
borderRadius: corner,
|
|
4619
4720
|
overflow: "hidden",
|
|
4620
4721
|
backgroundColor: colors.chartTooltipBg,
|
|
4621
|
-
boxShadow: shadowLayers(
|
|
4722
|
+
boxShadow: shadowLayers(import_tokens28.tokens.extensions.tooltip.elevation, colors)
|
|
4622
4723
|
},
|
|
4623
4724
|
children
|
|
4624
4725
|
}
|
|
@@ -4680,8 +4781,8 @@ function FloatingPanel({
|
|
|
4680
4781
|
style: {
|
|
4681
4782
|
opacity: anchored && sized ? motion.opacity : 0,
|
|
4682
4783
|
transform: tooltip ? void 0 : [
|
|
4683
|
-
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ?
|
|
4684
|
-
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ?
|
|
4784
|
+
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ? import_tokens28.tokens.motionDistance.popup : placement === "right" ? -import_tokens28.tokens.motionDistance.popup : 0, 0] }) },
|
|
4785
|
+
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ? import_tokens28.tokens.motionDistance.popup : -import_tokens28.tokens.motionDistance.popup, 0] }) }
|
|
4685
4786
|
],
|
|
4686
4787
|
position: "absolute",
|
|
4687
4788
|
top,
|
|
@@ -4690,11 +4791,11 @@ function FloatingPanel({
|
|
|
4690
4791
|
minWidth: contentSizedMenu ? minimumPanelWidth : void 0,
|
|
4691
4792
|
maxWidth: tooltip ? tooltipWidth : maximumWidth,
|
|
4692
4793
|
maxHeight: available,
|
|
4693
|
-
borderRadius: popover ?
|
|
4694
|
-
borderWidth: popover ? 0 :
|
|
4794
|
+
borderRadius: popover ? import_tokens28.tokens.extensions.popover.radius : field ? import_tokens28.tokens.radius.radius12 : import_tokens28.tokens.extensions.menu.radius,
|
|
4795
|
+
borderWidth: popover ? 0 : import_tokens28.tokens.border.defaultWidth,
|
|
4695
4796
|
borderColor: colors.border,
|
|
4696
4797
|
backgroundColor: colors.surface,
|
|
4697
|
-
boxShadow: (tooltip ?
|
|
4798
|
+
boxShadow: (tooltip ? import_tokens28.tokens.extensions.tooltip.elevation : popover ? import_tokens28.tokens.extensions.popover.elevation : import_tokens28.tokens.extensions.menu.elevation).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4698
4799
|
overflow: "hidden"
|
|
4699
4800
|
},
|
|
4700
4801
|
children: [
|
|
@@ -4703,10 +4804,10 @@ function FloatingPanel({
|
|
|
4703
4804
|
{
|
|
4704
4805
|
onLayout: ({ nativeEvent: { layout } }) => setHeaderHeight(layout.height),
|
|
4705
4806
|
style: {
|
|
4706
|
-
paddingTop:
|
|
4707
|
-
paddingHorizontal:
|
|
4708
|
-
paddingBottom:
|
|
4709
|
-
borderBottomWidth:
|
|
4807
|
+
paddingTop: import_tokens28.tokens.extensions.popover.padding,
|
|
4808
|
+
paddingHorizontal: import_tokens28.tokens.extensions.popover.padding,
|
|
4809
|
+
paddingBottom: import_tokens28.tokens.extensions.popover.headerPaddingBottom,
|
|
4810
|
+
borderBottomWidth: import_tokens28.tokens.border.defaultWidth,
|
|
4710
4811
|
borderBottomColor: colors.divider
|
|
4711
4812
|
},
|
|
4712
4813
|
children: content(header, typeStyle("cardTitle"))
|
|
@@ -4721,7 +4822,7 @@ function FloatingPanel({
|
|
|
4721
4822
|
},
|
|
4722
4823
|
keyboardShouldPersistTaps: "handled",
|
|
4723
4824
|
style: { maxHeight: available - (header != null ? headerHeight : 0), flexShrink: 1 },
|
|
4724
|
-
contentContainerStyle: { padding: menu || field ?
|
|
4825
|
+
contentContainerStyle: { padding: menu || field ? import_tokens28.tokens.extensions.menu.padding : 0 },
|
|
4725
4826
|
onContentSizeChange: (width2, height2) => {
|
|
4726
4827
|
if (contentSizedMenu) return;
|
|
4727
4828
|
setSized(true);
|
|
@@ -4745,7 +4846,7 @@ function FloatingPanel({
|
|
|
4745
4846
|
// packages/native/src/popover.tsx
|
|
4746
4847
|
var import_react40 = require("react");
|
|
4747
4848
|
var import_react_native31 = require("react-native");
|
|
4748
|
-
var
|
|
4849
|
+
var import_tokens29 = require("@kjun-ui/tokens");
|
|
4749
4850
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4750
4851
|
function KjunPopover({
|
|
4751
4852
|
noPadding = false,
|
|
@@ -4794,7 +4895,7 @@ function KjunPopover({
|
|
|
4794
4895
|
ariaLabel,
|
|
4795
4896
|
header: header != null ? content(header, { ...typeStyle("cardTitle"), color: colors.text }) : void 0,
|
|
4796
4897
|
nonModal: !modal,
|
|
4797
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_native31.View, { style: { padding: noPadding ? 0 :
|
|
4898
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_native31.View, { style: { padding: noPadding ? 0 : import_tokens29.tokens.extensions.popover.padding, gap: noPadding ? 0 : import_tokens29.tokens.extensions.popover.gap }, children: content(
|
|
4798
4899
|
typeof children === "function" ? children(() => change(false)) : children,
|
|
4799
4900
|
import_react_native31.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : void 0
|
|
4800
4901
|
) })
|
|
@@ -4901,9 +5002,9 @@ function KjunTooltip({
|
|
|
4901
5002
|
import_react_native31.View,
|
|
4902
5003
|
{
|
|
4903
5004
|
style: {
|
|
4904
|
-
paddingVertical:
|
|
4905
|
-
paddingHorizontal:
|
|
4906
|
-
maxWidth:
|
|
5005
|
+
paddingVertical: import_tokens29.tokens.extensions.tooltip.paddingY,
|
|
5006
|
+
paddingHorizontal: import_tokens29.tokens.extensions.tooltip.paddingX,
|
|
5007
|
+
maxWidth: import_tokens29.tokens.extensions.tooltip.maxWidth,
|
|
4907
5008
|
backgroundColor: colors.chartTooltipBg
|
|
4908
5009
|
},
|
|
4909
5010
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -5006,18 +5107,18 @@ function KjunDropdownItem({
|
|
|
5006
5107
|
style: ({ pressed }) => ({
|
|
5007
5108
|
flexDirection: "row",
|
|
5008
5109
|
alignItems: "center",
|
|
5009
|
-
gap:
|
|
5010
|
-
paddingVertical:
|
|
5011
|
-
paddingHorizontal:
|
|
5012
|
-
minHeight:
|
|
5013
|
-
borderRadius:
|
|
5110
|
+
gap: import_tokens30.tokens.dimension.value8,
|
|
5111
|
+
paddingVertical: import_tokens30.tokens.extensions.menu.optionPaddingY,
|
|
5112
|
+
paddingHorizontal: import_tokens30.tokens.extensions.menu.optionPaddingX,
|
|
5113
|
+
minHeight: import_tokens30.tokens.extensions.menu.optionHeight,
|
|
5114
|
+
borderRadius: import_tokens30.tokens.extensions.menu.optionRadius,
|
|
5014
5115
|
backgroundColor: selected ? colors.selectedBg : !disabled && (pressed || hovered) ? variant === "danger" ? colors.dangerBg : colors.hover : void 0,
|
|
5015
|
-
opacity: disabled ?
|
|
5116
|
+
opacity: disabled ? import_tokens30.tokens.states.opacity.disabled : 1
|
|
5016
5117
|
}),
|
|
5017
5118
|
children: [
|
|
5018
|
-
icon ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: icon, size:
|
|
5019
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize:
|
|
5020
|
-
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: "check", size:
|
|
5119
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: icon, size: import_tokens30.tokens.extensions.menu.iconSize, color: iconColor }) : reserveIcon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { width: import_tokens30.tokens.extensions.menu.iconSize }, accessible: false }),
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize: import_tokens30.tokens.extensions.menu.optionFontSize, lineHeight: import_tokens30.tokens.extensions.menu.optionLineHeight }) }),
|
|
5121
|
+
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: "check", size: import_tokens30.tokens.extensions.menu.iconSize, color: colors.brand }) })
|
|
5021
5122
|
]
|
|
5022
5123
|
}
|
|
5023
5124
|
);
|
|
@@ -5028,7 +5129,7 @@ function KjunDropdownDivider() {
|
|
|
5028
5129
|
import_react_native32.View,
|
|
5029
5130
|
{
|
|
5030
5131
|
role: "separator",
|
|
5031
|
-
style: { height:
|
|
5132
|
+
style: { height: import_tokens30.tokens.extensions.menu.dividerHeight, marginVertical: import_tokens30.tokens.dimension.value4, backgroundColor: colors.border }
|
|
5032
5133
|
}
|
|
5033
5134
|
);
|
|
5034
5135
|
}
|
|
@@ -5201,12 +5302,12 @@ function useComboboxModel({
|
|
|
5201
5302
|
}
|
|
5202
5303
|
|
|
5203
5304
|
// packages/native/src/combobox.tsx
|
|
5204
|
-
var
|
|
5305
|
+
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5205
5306
|
var import_react43 = require("react");
|
|
5206
5307
|
var import_react_native34 = require("react-native");
|
|
5207
5308
|
|
|
5208
5309
|
// packages/native/src/select-options.tsx
|
|
5209
|
-
var
|
|
5310
|
+
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5210
5311
|
var import_react_native33 = require("react-native");
|
|
5211
5312
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5212
5313
|
function OptionRow({
|
|
@@ -5229,20 +5330,20 @@ function OptionRow({
|
|
|
5229
5330
|
onPress,
|
|
5230
5331
|
onLayout,
|
|
5231
5332
|
style: ({ pressed }) => ({
|
|
5232
|
-
borderRadius:
|
|
5233
|
-
minHeight:
|
|
5333
|
+
borderRadius: import_tokens31.tokens.radius.radius8,
|
|
5334
|
+
minHeight: import_tokens31.tokens.extensions.menu.optionHeight,
|
|
5234
5335
|
flexDirection: "row",
|
|
5235
5336
|
alignItems: "center",
|
|
5236
5337
|
justifyContent: "space-between",
|
|
5237
|
-
gap:
|
|
5238
|
-
paddingVertical:
|
|
5239
|
-
paddingHorizontal:
|
|
5338
|
+
gap: import_tokens31.tokens.dimension.value8,
|
|
5339
|
+
paddingVertical: import_tokens31.tokens.extensions.menu.optionPaddingY,
|
|
5340
|
+
paddingHorizontal: import_tokens31.tokens.extensions.menu.optionPaddingX,
|
|
5240
5341
|
backgroundColor: selected ? colors.selectedBg : pressed ? colors.hover : void 0,
|
|
5241
|
-
opacity: disabled ?
|
|
5342
|
+
opacity: disabled ? import_tokens31.tokens.states.opacity.disabled : 1
|
|
5242
5343
|
}),
|
|
5243
5344
|
children: [
|
|
5244
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native33.View, { style: { flex: 1 }, children: content(children || label, { fontSize:
|
|
5245
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunIcon, { name: "check", size:
|
|
5345
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native33.View, { style: { flex: 1 }, children: content(children || label, { fontSize: import_tokens31.tokens.extensions.menu.optionFontSize, lineHeight: import_tokens31.tokens.extensions.menu.optionLineHeight }) }),
|
|
5346
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunIcon, { name: "check", size: import_tokens31.tokens.extensions.menu.iconSize, color: colors.brand })
|
|
5246
5347
|
]
|
|
5247
5348
|
}
|
|
5248
5349
|
);
|
|
@@ -5380,8 +5481,8 @@ function SearchField({
|
|
|
5380
5481
|
import_react_native34.View,
|
|
5381
5482
|
{
|
|
5382
5483
|
style: {
|
|
5383
|
-
padding:
|
|
5384
|
-
borderBottomWidth:
|
|
5484
|
+
padding: import_tokens32.tokens.dimension.value8,
|
|
5485
|
+
borderBottomWidth: import_tokens32.tokens.border.defaultWidth,
|
|
5385
5486
|
borderBottomColor: colors.border
|
|
5386
5487
|
},
|
|
5387
5488
|
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunInput, { ...inputProps, nativeID: searchId, autoFocus: true })
|
|
@@ -5389,13 +5490,13 @@ function SearchField({
|
|
|
5389
5490
|
),
|
|
5390
5491
|
loading ? (
|
|
5391
5492
|
// Centered like the Select loading row on every platform.
|
|
5392
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native34.View, { style: { padding:
|
|
5493
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native34.View, { style: { padding: import_tokens32.tokens.dimension.value12, alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSpinner, { size: "sm", text: m.searching }) })
|
|
5393
5494
|
) : failed ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5394
5495
|
KText,
|
|
5395
5496
|
{
|
|
5396
5497
|
accessibilityRole: "alert",
|
|
5397
5498
|
style: {
|
|
5398
|
-
padding:
|
|
5499
|
+
padding: import_tokens32.tokens.dimension.value12,
|
|
5399
5500
|
textAlign: "center",
|
|
5400
5501
|
color: colors.danger
|
|
5401
5502
|
},
|
|
@@ -5418,7 +5519,7 @@ function SearchField({
|
|
|
5418
5519
|
KText,
|
|
5419
5520
|
{
|
|
5420
5521
|
style: {
|
|
5421
|
-
padding:
|
|
5522
|
+
padding: import_tokens32.tokens.dimension.value12,
|
|
5422
5523
|
textAlign: "center",
|
|
5423
5524
|
color: colors.textTertiary
|
|
5424
5525
|
},
|
|
@@ -5432,7 +5533,7 @@ function SearchField({
|
|
|
5432
5533
|
}
|
|
5433
5534
|
|
|
5434
5535
|
// packages/native/src/date-picker.tsx
|
|
5435
|
-
var
|
|
5536
|
+
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5436
5537
|
var import_react44 = require("react");
|
|
5437
5538
|
var import_react_native35 = require("react-native");
|
|
5438
5539
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -5456,7 +5557,7 @@ function KjunDatePicker({
|
|
|
5456
5557
|
const scope = useKjunMessageScope();
|
|
5457
5558
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
5458
5559
|
const clear = clearable && !!value && !disabled;
|
|
5459
|
-
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = (0, import_react44.useState)(false), [month, setMonth] = (0, import_react44.useState)(() => displayMonth(value)), ref = (0, import_react44.useRef)(null), spec =
|
|
5560
|
+
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = (0, import_react44.useState)(false), [month, setMonth] = (0, import_react44.useState)(() => displayMonth(value)), ref = (0, import_react44.useRef)(null), spec = import_tokens33.tokens.input[size];
|
|
5460
5561
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open });
|
|
5461
5562
|
const year = month.getFullYear(), m = month.getMonth(), first = new Date(year, m, 1).getDay(), count = new Date(year, m + 1, 0).getDate();
|
|
5462
5563
|
const date = (day) => `${year}-${String(m + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
@@ -5464,7 +5565,7 @@ function KjunDatePicker({
|
|
|
5464
5565
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native35.View, { ref, collapsable: false, ...fieldTarget(() => {
|
|
5465
5566
|
setMonth(displayMonth(value));
|
|
5466
5567
|
setOpen(true);
|
|
5467
|
-
}, disabled), style: { minHeight:
|
|
5568
|
+
}, disabled), style: { minHeight: import_tokens33.tokens.native.minimumTouchTarget, justifyContent: "center" }, children: [
|
|
5468
5569
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5469
5570
|
FieldPressable,
|
|
5470
5571
|
{
|
|
@@ -5490,7 +5591,7 @@ function KjunDatePicker({
|
|
|
5490
5591
|
},
|
|
5491
5592
|
style: {
|
|
5492
5593
|
...surface.style,
|
|
5493
|
-
paddingHorizontal: spec.padding -
|
|
5594
|
+
paddingHorizontal: spec.padding - import_tokens33.tokens.border.controlWidth,
|
|
5494
5595
|
flexDirection: "row",
|
|
5495
5596
|
alignItems: "center",
|
|
5496
5597
|
justifyContent: "space-between"
|
|
@@ -5533,9 +5634,9 @@ function KjunDatePicker({
|
|
|
5533
5634
|
triggerRef: ref,
|
|
5534
5635
|
placement: "bottom-start",
|
|
5535
5636
|
matchTriggerWidth: true,
|
|
5536
|
-
minimumWidth:
|
|
5637
|
+
minimumWidth: import_tokens33.tokens.extensions.calendar.minimumWidth,
|
|
5537
5638
|
ariaLabel: scope.messages.datePlaceholder,
|
|
5538
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native35.View, { style: { padding:
|
|
5639
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native35.View, { style: { padding: import_tokens33.tokens.dimension.value8 }, children: [
|
|
5539
5640
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5540
5641
|
import_react_native35.View,
|
|
5541
5642
|
{
|
|
@@ -5576,7 +5677,7 @@ function KjunDatePicker({
|
|
|
5576
5677
|
style: {
|
|
5577
5678
|
width: "14.2857%",
|
|
5578
5679
|
textAlign: "center",
|
|
5579
|
-
paddingVertical:
|
|
5680
|
+
paddingVertical: import_tokens33.tokens.dimension.value8,
|
|
5580
5681
|
color: colors.textTertiary
|
|
5581
5682
|
},
|
|
5582
5683
|
children: day
|
|
@@ -5603,12 +5704,12 @@ function KjunDatePicker({
|
|
|
5603
5704
|
},
|
|
5604
5705
|
style: {
|
|
5605
5706
|
width: "14.2857%",
|
|
5606
|
-
minHeight:
|
|
5707
|
+
minHeight: import_tokens33.tokens.native.minimumTouchTarget,
|
|
5607
5708
|
alignItems: "center",
|
|
5608
5709
|
justifyContent: "center",
|
|
5609
|
-
borderRadius:
|
|
5710
|
+
borderRadius: import_tokens33.tokens.radius.radius6,
|
|
5610
5711
|
backgroundColor: v === value ? colors.brand : void 0,
|
|
5611
|
-
opacity: blocked ?
|
|
5712
|
+
opacity: blocked ? import_tokens33.tokens.states.opacity.disabledStrong : 1
|
|
5612
5713
|
},
|
|
5613
5714
|
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5614
5715
|
KText,
|
|
@@ -5809,17 +5910,17 @@ function KjunSearchInput({
|
|
|
5809
5910
|
}
|
|
5810
5911
|
|
|
5811
5912
|
// packages/native/src/select-control.tsx
|
|
5812
|
-
var
|
|
5913
|
+
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5813
5914
|
var import_react49 = require("react");
|
|
5814
5915
|
|
|
5815
5916
|
// packages/native/src/compound-control.tsx
|
|
5816
5917
|
var import_react47 = require("react");
|
|
5817
5918
|
var import_react_native36 = require("react-native");
|
|
5818
|
-
var
|
|
5919
|
+
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5819
5920
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5820
5921
|
var CompoundControlContext = (0, import_react47.createContext)(null);
|
|
5821
5922
|
function CompoundTarget({ children, square = false }) {
|
|
5822
|
-
const touch = finePointer() ? void 0 :
|
|
5923
|
+
const touch = finePointer() ? void 0 : import_tokens34.tokens.native.minimumTouchTarget;
|
|
5823
5924
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native36.View, { style: { minHeight: touch, minWidth: square ? touch : void 0, alignItems: "center", justifyContent: "center" }, children });
|
|
5824
5925
|
}
|
|
5825
5926
|
|
|
@@ -5892,7 +5993,7 @@ function KjunSelect({
|
|
|
5892
5993
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
5893
5994
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
5894
5995
|
const { open, query, limit, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
5895
|
-
const { colors } = useKjunStyles(), field = useKjunField(), ref = (0, import_react49.useRef)(null), spec =
|
|
5996
|
+
const { colors } = useKjunStyles(), field = useKjunField(), ref = (0, import_react49.useRef)(null), spec = import_tokens35.tokens.input[size];
|
|
5896
5997
|
const trigger = (0, import_react49.useRef)(null);
|
|
5897
5998
|
const compound = (0, import_react49.useContext)(CompoundControlContext);
|
|
5898
5999
|
(0, import_react49.useEffect)(() => {
|
|
@@ -5924,10 +6025,10 @@ function KjunSelect({
|
|
|
5924
6025
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
5925
6026
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native37.View, { ref, collapsable: false, ...fieldTarget(() => changeOpen(!open), disabled), style: {
|
|
5926
6027
|
position: "relative",
|
|
5927
|
-
minHeight:
|
|
6028
|
+
minHeight: import_tokens35.tokens.native.minimumTouchTarget,
|
|
5928
6029
|
justifyContent: "center",
|
|
5929
6030
|
// Inside a compound field the touch target overflows so the shared surface keeps its size height.
|
|
5930
|
-
...compound ? { marginVertical: Math.min(0, (spec.height -
|
|
6031
|
+
...compound ? { marginVertical: Math.min(0, (spec.height - import_tokens35.tokens.native.minimumTouchTarget) / 2) } : {}
|
|
5931
6032
|
}, children: [
|
|
5932
6033
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5933
6034
|
FieldPressable,
|
|
@@ -5963,14 +6064,14 @@ function KjunSelect({
|
|
|
5963
6064
|
flexDirection: "row",
|
|
5964
6065
|
alignItems: "center",
|
|
5965
6066
|
justifyContent: "space-between",
|
|
5966
|
-
gap:
|
|
6067
|
+
gap: import_tokens35.tokens.dimension.value8,
|
|
5967
6068
|
...surface.style,
|
|
5968
|
-
paddingHorizontal: spec.padding -
|
|
5969
|
-
paddingRight: spec.padding -
|
|
5970
|
-
...compound ? { paddingHorizontal:
|
|
6069
|
+
paddingHorizontal: spec.padding - import_tokens35.tokens.border.controlWidth,
|
|
6070
|
+
paddingRight: spec.padding - import_tokens35.tokens.border.controlWidth,
|
|
6071
|
+
...compound ? { paddingHorizontal: import_tokens35.tokens.extensions.timePicker.segmentPadding, paddingRight: import_tokens35.tokens.extensions.timePicker.segmentPadding, paddingLeft: compound.leading ? spec.padding - import_tokens35.tokens.border.controlWidth : import_tokens35.tokens.extensions.timePicker.segmentPadding, gap: import_tokens35.tokens.extensions.timePicker.segmentPadding, backgroundColor: !disabled && (surface.active || surface.hovered) ? colors.hover : "transparent", borderColor: "transparent", outlineWidth: 0 } : {}
|
|
5971
6072
|
},
|
|
5972
6073
|
children: [
|
|
5973
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native37.View, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ?
|
|
6074
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native37.View, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ? import_tokens35.tokens.native.minimumTouchTarget + spec.affixGap : 0 }, children: [
|
|
5974
6075
|
compound && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KText, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: { ...inputTypeStyle(size), fontVariant: ["tabular-nums"], opacity: 0 }, children: "00" }),
|
|
5975
6076
|
(renderSelected == null ? void 0 : renderSelected(selectedOption)) || /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KText, { numberOfLines: 1, style: {
|
|
5976
6077
|
...inputTypeStyle(size),
|
|
@@ -5982,7 +6083,7 @@ function KjunSelect({
|
|
|
5982
6083
|
KjunIcon,
|
|
5983
6084
|
{
|
|
5984
6085
|
name: "chevron-down",
|
|
5985
|
-
size: compound ?
|
|
6086
|
+
size: compound ? import_tokens35.tokens.extensions.timePicker.iconSize : spec.iconSize,
|
|
5986
6087
|
color: surface.icon
|
|
5987
6088
|
}
|
|
5988
6089
|
) })
|
|
@@ -6026,8 +6127,8 @@ function KjunSelect({
|
|
|
6026
6127
|
import_react_native37.View,
|
|
6027
6128
|
{
|
|
6028
6129
|
style: {
|
|
6029
|
-
padding:
|
|
6030
|
-
borderBottomWidth:
|
|
6130
|
+
padding: import_tokens35.tokens.dimension.value8,
|
|
6131
|
+
borderBottomWidth: import_tokens35.tokens.border.defaultWidth,
|
|
6031
6132
|
borderBottomColor: colors.border
|
|
6032
6133
|
},
|
|
6033
6134
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -6047,7 +6148,7 @@ function KjunSelect({
|
|
|
6047
6148
|
)
|
|
6048
6149
|
}
|
|
6049
6150
|
),
|
|
6050
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native37.View, { style: { padding:
|
|
6151
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native37.View, { style: { padding: import_tokens35.tokens.dimension.value12 }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSpinner, { size: "sm", text: m.searching }) }) : visible.map(({ option: o, key }, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
6051
6152
|
OptionRow,
|
|
6052
6153
|
{
|
|
6053
6154
|
selected: selected(o),
|
|
@@ -6069,7 +6170,7 @@ function KjunSelect({
|
|
|
6069
6170
|
KText,
|
|
6070
6171
|
{
|
|
6071
6172
|
style: {
|
|
6072
|
-
padding:
|
|
6173
|
+
padding: import_tokens35.tokens.dimension.value12,
|
|
6073
6174
|
textAlign: "center",
|
|
6074
6175
|
color: colors.textTertiary
|
|
6075
6176
|
},
|
|
@@ -6093,10 +6194,10 @@ function KjunSelect({
|
|
|
6093
6194
|
}
|
|
6094
6195
|
|
|
6095
6196
|
// packages/native/src/navigation.tsx
|
|
6096
|
-
var
|
|
6197
|
+
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6097
6198
|
|
|
6098
6199
|
// packages/native/src/collapse.tsx
|
|
6099
|
-
var
|
|
6200
|
+
var import_tokens36 = require("@kjun-ui/tokens");
|
|
6100
6201
|
var import_react50 = require("react");
|
|
6101
6202
|
var import_react_native38 = require("react-native");
|
|
6102
6203
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -6123,7 +6224,7 @@ function Collapse({ open, children }) {
|
|
|
6123
6224
|
finish();
|
|
6124
6225
|
} else {
|
|
6125
6226
|
setSettled(false);
|
|
6126
|
-
import_react_native38.Animated.timing(value, { toValue: target, duration:
|
|
6227
|
+
import_react_native38.Animated.timing(value, { toValue: target, duration: import_tokens36.tokens.motion.collapse, easing: motionOut, useNativeDriver: false }).start(({ finished }) => {
|
|
6127
6228
|
if (finished) finish();
|
|
6128
6229
|
});
|
|
6129
6230
|
}
|
|
@@ -6190,7 +6291,7 @@ var import_react54 = require("react");
|
|
|
6190
6291
|
var import_react_native40 = require("react-native");
|
|
6191
6292
|
|
|
6192
6293
|
// packages/native/src/tabs.tsx
|
|
6193
|
-
var
|
|
6294
|
+
var import_tokens37 = require("@kjun-ui/tokens");
|
|
6194
6295
|
var import_react53 = require("react");
|
|
6195
6296
|
var import_react_native39 = require("react-native");
|
|
6196
6297
|
|
|
@@ -6323,14 +6424,14 @@ function KjunTabs({
|
|
|
6323
6424
|
if (!onTabMenu || !tabs.some((tab) => tab.name === pressedMenu.current && !tab.disabled)) pressedMenu.current = null;
|
|
6324
6425
|
}, [tabs, onTabMenu]);
|
|
6325
6426
|
const panelNames = panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name);
|
|
6326
|
-
const geometry2 =
|
|
6427
|
+
const geometry2 = import_tokens37.tokens.extensions.tabs;
|
|
6327
6428
|
const underline = variant === "underline";
|
|
6328
6429
|
const [hoveredTab, setHoveredTab] = (0, import_react53.useState)(null);
|
|
6329
6430
|
const singleLine = import_react_native39.Platform.OS === "web" ? { whiteSpace: "nowrap" } : {};
|
|
6330
6431
|
const paddingX = !underline ? geometry2.pillsPaddingX : density === "compact" ? geometry2.compactPaddingX : geometry2.paddingX;
|
|
6331
6432
|
const height = density === "compact" ? geometry2.compactHeight : geometry2.height;
|
|
6332
|
-
const ringRoom =
|
|
6333
|
-
const slop = Math.max(0, (
|
|
6433
|
+
const ringRoom = import_tokens37.tokens.states.focus.width + import_tokens37.tokens.states.focus.offset;
|
|
6434
|
+
const slop = Math.max(0, (import_tokens37.tokens.native.minimumTouchTarget - height) / 2);
|
|
6334
6435
|
const roomX = underline ? ringRoom : 0, roomY = Math.max(underline ? ringRoom : 0, slop);
|
|
6335
6436
|
const selectedTab = tabs.find((tab) => tab.name === value);
|
|
6336
6437
|
const selection = useButtonGroupMotion(selectedTab ? { ...selectedTab, value: selectedTab.name } : void 0);
|
|
@@ -6389,7 +6490,7 @@ function KjunTabs({
|
|
|
6389
6490
|
transform: [{ translateX: selection.x }],
|
|
6390
6491
|
borderRadius: underline ? geometry2.indicatorHeight / 2 : geometry2.radius,
|
|
6391
6492
|
backgroundColor: variant === "underline" ? colors.brand : colors.active,
|
|
6392
|
-
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ?
|
|
6493
|
+
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ? import_tokens37.tokens.states.opacity.disabled : 1
|
|
6393
6494
|
}
|
|
6394
6495
|
}
|
|
6395
6496
|
),
|
|
@@ -6449,7 +6550,7 @@ function KjunTabs({
|
|
|
6449
6550
|
borderRadius: geometry2.radius,
|
|
6450
6551
|
// Pills answer hover with the hover surface, like ButtonGroup and Web.
|
|
6451
6552
|
backgroundColor: !underline && !active && !tab.disabled && hoveredTab === tab.name ? colors.hover : void 0,
|
|
6452
|
-
opacity: tab.disabled ?
|
|
6553
|
+
opacity: tab.disabled ? import_tokens37.tokens.states.opacity.disabled : 1
|
|
6453
6554
|
},
|
|
6454
6555
|
children: [
|
|
6455
6556
|
!!tab.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -6544,7 +6645,7 @@ function KjunAccordion({
|
|
|
6544
6645
|
import_react_native40.View,
|
|
6545
6646
|
{
|
|
6546
6647
|
style: {
|
|
6547
|
-
borderRadius:
|
|
6648
|
+
borderRadius: import_tokens38.tokens.extensions.accordion.radius,
|
|
6548
6649
|
overflow: "hidden",
|
|
6549
6650
|
backgroundColor: tone === "muted" ? colors.secondary : colors.surface
|
|
6550
6651
|
},
|
|
@@ -6562,8 +6663,8 @@ function KjunAccordionItem({
|
|
|
6562
6663
|
children
|
|
6563
6664
|
}) {
|
|
6564
6665
|
const { colors } = useKjunStyles(), group = (0, import_react54.useContext)(AccordionContext), id = "kjun-" + (0, import_react54.useId)(), [own, setOwn] = (0, import_react54.useState)(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
6565
|
-
const rotation = useMotionValue(open ? 1 : 0,
|
|
6566
|
-
const geometry2 =
|
|
6666
|
+
const rotation = useMotionValue(open ? 1 : 0, import_tokens38.tokens.motion.collapse, void 0, void 0, true);
|
|
6667
|
+
const geometry2 = import_tokens38.tokens.extensions.accordion;
|
|
6567
6668
|
const [hovered, setHovered] = (0, import_react54.useState)(false);
|
|
6568
6669
|
const wrapping = import_react_native40.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
6569
6670
|
(0, import_react54.useEffect)(() => {
|
|
@@ -6576,7 +6677,7 @@ function KjunAccordionItem({
|
|
|
6576
6677
|
nativeID: id + "-heading",
|
|
6577
6678
|
accessibilityRole: "button",
|
|
6578
6679
|
focusRingInset: true,
|
|
6579
|
-
focusRingRadius:
|
|
6680
|
+
focusRingRadius: import_tokens38.tokens.extensions.accordion.radius,
|
|
6580
6681
|
accessibilityLabel: title,
|
|
6581
6682
|
accessibilityState: { expanded: open, disabled },
|
|
6582
6683
|
disabled,
|
|
@@ -6592,7 +6693,7 @@ function KjunAccordionItem({
|
|
|
6592
6693
|
paddingVertical: geometry2.headerPaddingY,
|
|
6593
6694
|
paddingHorizontal: geometry2.paddingX,
|
|
6594
6695
|
backgroundColor: !disabled && (pressed || hovered) ? colors.hover : void 0,
|
|
6595
|
-
opacity: disabled ?
|
|
6696
|
+
opacity: disabled ? import_tokens38.tokens.states.opacity.disabled : 1
|
|
6596
6697
|
}),
|
|
6597
6698
|
children: [
|
|
6598
6699
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native40.View, { style: { flex: 1, minWidth: 0 }, children: content(header || title, { ...typeStyle("control"), ...wrapping }) }),
|
|
@@ -6627,11 +6728,11 @@ function KjunBreadcrumb({
|
|
|
6627
6728
|
flexDirection: "row",
|
|
6628
6729
|
alignItems: "center",
|
|
6629
6730
|
flexWrap: "wrap",
|
|
6630
|
-
gap:
|
|
6731
|
+
gap: import_tokens38.tokens.dimension.value8
|
|
6631
6732
|
},
|
|
6632
6733
|
children: items2.map((item, i) => {
|
|
6633
|
-
const label = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6634
|
-
!!item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunIcon, { name: item.icon, size:
|
|
6734
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens38.tokens.dimension.value4 }, children: [
|
|
6735
|
+
!!item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunIcon, { name: item.icon, size: import_tokens38.tokens.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
6635
6736
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6636
6737
|
KText,
|
|
6637
6738
|
{
|
|
@@ -6648,7 +6749,7 @@ function KjunBreadcrumb({
|
|
|
6648
6749
|
KjunIcon,
|
|
6649
6750
|
{
|
|
6650
6751
|
name: "chevron-right",
|
|
6651
|
-
size:
|
|
6752
|
+
size: import_tokens38.tokens.extensions.breadcrumb.separatorSize,
|
|
6652
6753
|
color: colors.textTertiary
|
|
6653
6754
|
}
|
|
6654
6755
|
),
|
|
@@ -6658,7 +6759,7 @@ function KjunBreadcrumb({
|
|
|
6658
6759
|
{
|
|
6659
6760
|
accessibilityRole: "link",
|
|
6660
6761
|
onPress: () => onNavigate == null ? void 0 : onNavigate(item),
|
|
6661
|
-
style: { minHeight:
|
|
6762
|
+
style: { minHeight: import_tokens38.tokens.native.minimumTouchTarget, justifyContent: "center" },
|
|
6662
6763
|
children: label
|
|
6663
6764
|
}
|
|
6664
6765
|
) : label
|
|
@@ -6687,7 +6788,7 @@ function KjunPagination({
|
|
|
6687
6788
|
const m = useKjunMessages();
|
|
6688
6789
|
const { colors } = useKjunStyles(), window2 = (0, import_react_native40.useWindowDimensions)(), current = Math.max(1, Math.min(totalPages, (_a = currentPage != null ? currentPage : page) != null ? _a : 1));
|
|
6689
6790
|
if (totalPages <= 1 && !showSizeSelector && !(showInfo && totalRows > 0)) return null;
|
|
6690
|
-
const compact = window2.width <
|
|
6791
|
+
const compact = window2.width < import_tokens38.tokens.responsive.pagination;
|
|
6691
6792
|
const change = (v) => {
|
|
6692
6793
|
if (v < 1 || v > totalPages || v === current) return;
|
|
6693
6794
|
onPageChange == null ? void 0 : onPageChange(v);
|
|
@@ -6703,12 +6804,12 @@ function KjunPagination({
|
|
|
6703
6804
|
]);
|
|
6704
6805
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
6705
6806
|
const pageButtonStyle = {
|
|
6706
|
-
width: Math.max(
|
|
6707
|
-
height: Math.max(
|
|
6708
|
-
borderRadius:
|
|
6807
|
+
width: Math.max(import_tokens38.tokens.extensions.pagination.itemSize, import_tokens38.tokens.native.minimumTouchTarget),
|
|
6808
|
+
height: Math.max(import_tokens38.tokens.extensions.pagination.itemSize, import_tokens38.tokens.native.minimumTouchTarget),
|
|
6809
|
+
borderRadius: import_tokens38.tokens.extensions.pagination.radius,
|
|
6709
6810
|
paddingHorizontal: 0
|
|
6710
6811
|
};
|
|
6711
|
-
const arrowSize = (_b = Object.keys(
|
|
6812
|
+
const arrowSize = (_b = Object.keys(import_tokens38.tokens.button.iconSizes).find((size) => import_tokens38.tokens.button.iconSizes[size] === import_tokens38.tokens.extensions.pagination.iconSize)) != null ? _b : "sm";
|
|
6712
6813
|
const button = (target, label, icon) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6713
6814
|
KjunButton,
|
|
6714
6815
|
{
|
|
@@ -6729,9 +6830,9 @@ function KjunPagination({
|
|
|
6729
6830
|
flexDirection: compact ? "column" : "row",
|
|
6730
6831
|
alignItems: compact ? "stretch" : "center",
|
|
6731
6832
|
justifyContent: "space-between",
|
|
6732
|
-
gap:
|
|
6733
|
-
padding:
|
|
6734
|
-
borderTopWidth:
|
|
6833
|
+
gap: import_tokens38.tokens.extensions.pagination.gap,
|
|
6834
|
+
padding: import_tokens38.tokens.extensions.pagination.padding,
|
|
6835
|
+
borderTopWidth: import_tokens38.tokens.border.defaultWidth,
|
|
6735
6836
|
borderTopColor: colors.border
|
|
6736
6837
|
},
|
|
6737
6838
|
children: [
|
|
@@ -6742,11 +6843,11 @@ function KjunPagination({
|
|
|
6742
6843
|
style: {
|
|
6743
6844
|
flexDirection: "row",
|
|
6744
6845
|
alignItems: "center",
|
|
6745
|
-
gap:
|
|
6846
|
+
gap: import_tokens38.tokens.extensions.pagination.itemGap,
|
|
6746
6847
|
flexWrap: "wrap"
|
|
6747
6848
|
},
|
|
6748
6849
|
children: [
|
|
6749
|
-
showSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native40.View, { style: { minWidth:
|
|
6850
|
+
showSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native40.View, { style: { minWidth: import_tokens38.tokens.extensions.pagination.selectorMinimumWidth }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6750
6851
|
KjunSelect,
|
|
6751
6852
|
{
|
|
6752
6853
|
size: "sm",
|
|
@@ -6763,10 +6864,10 @@ function KjunPagination({
|
|
|
6763
6864
|
}
|
|
6764
6865
|
}
|
|
6765
6866
|
) }),
|
|
6766
|
-
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6867
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens38.tokens.extensions.pagination.itemGap, marginLeft: compact ? "auto" : void 0 }, children: [
|
|
6767
6868
|
!compact && showFirstLast && button(1, m.firstPage, "chevrons-left"),
|
|
6768
6869
|
button(current - 1, m.previousPage, "chevron-left"),
|
|
6769
|
-
compact ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(KText, { style: { paddingHorizontal:
|
|
6870
|
+
compact ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(KText, { style: { paddingHorizontal: import_tokens38.tokens.extensions.pagination.labelPaddingX, color: colors.text, fontVariant: ["tabular-nums"] }, children: [
|
|
6770
6871
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KText, { style: { fontWeight: typeStyle("control").fontWeight }, children: current }),
|
|
6771
6872
|
" / ",
|
|
6772
6873
|
totalPages
|
|
@@ -6796,7 +6897,7 @@ function KjunPagination({
|
|
|
6796
6897
|
}
|
|
6797
6898
|
|
|
6798
6899
|
// packages/native/src/actions.tsx
|
|
6799
|
-
var
|
|
6900
|
+
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6800
6901
|
var import_react55 = require("react");
|
|
6801
6902
|
var import_react_native41 = require("react-native");
|
|
6802
6903
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
@@ -6817,7 +6918,7 @@ function KjunIconToggle({
|
|
|
6817
6918
|
}) {
|
|
6818
6919
|
const { colors } = useKjunStyles();
|
|
6819
6920
|
const navigation = (0, import_react55.useContext)(TopNavigationContext);
|
|
6820
|
-
const box = navigation ? navigation.controlSize : size === "xs" ?
|
|
6921
|
+
const box = navigation ? navigation.controlSize : size === "xs" ? import_tokens39.tokens.extensions.iconToggle.compactSize : import_tokens39.tokens.extensions.iconToggle.sizes[size];
|
|
6821
6922
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6822
6923
|
AccessiblePressable,
|
|
6823
6924
|
{
|
|
@@ -6843,24 +6944,24 @@ function KjunIconToggle({
|
|
|
6843
6944
|
...import_react_native41.Platform.OS === "web" ? { pointerEvents: "auto" } : {},
|
|
6844
6945
|
// The touch target stays 44pt; the visible square follows the icon-toggle scale.
|
|
6845
6946
|
alignSelf: "flex-start",
|
|
6846
|
-
minWidth: Math.max(
|
|
6847
|
-
minHeight: Math.max(
|
|
6947
|
+
minWidth: Math.max(import_tokens39.tokens.native.minimumTouchTarget, box),
|
|
6948
|
+
minHeight: Math.max(import_tokens39.tokens.native.minimumTouchTarget, box),
|
|
6848
6949
|
alignItems: "center",
|
|
6849
6950
|
justifyContent: "center",
|
|
6850
6951
|
...navigation ? { width: navigation.controlSize, height: navigation.controlSize, flexShrink: 0 } : {},
|
|
6851
|
-
borderRadius:
|
|
6952
|
+
borderRadius: import_tokens39.tokens.extensions.iconToggle.radii[size],
|
|
6852
6953
|
// Loading blocks presses but stays legible; only disabled dims.
|
|
6853
|
-
opacity: disabled ?
|
|
6954
|
+
opacity: disabled ? import_tokens39.tokens.states.opacity.disabled : 1,
|
|
6854
6955
|
transform: [{ scale: pressed ? 0.94 : 1 }]
|
|
6855
6956
|
}),
|
|
6856
6957
|
children: ({ pressed, hovered }) => {
|
|
6857
6958
|
var _a;
|
|
6858
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_native41.View, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius:
|
|
6959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_native41.View, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius: import_tokens39.tokens.extensions.iconToggle.radii[size], backgroundColor: !disabled && !loading && (pressed || hovered) ? colors.hover : "transparent" }, children: loading ? navigation ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunIcon, { name: "loader-2", spin: true, size: navigation.iconSize }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunSpinner, { size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6859
6960
|
KjunIcon,
|
|
6860
6961
|
{
|
|
6861
6962
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
6862
6963
|
filled: active,
|
|
6863
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
6964
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens39.tokens.button.iconSizes[size],
|
|
6864
6965
|
color: active ? activeColor != null ? activeColor : colors.brand : hovered && !disabled && !loading ? colors.textSecondary : inactiveColor != null ? inactiveColor : colors.textTertiary
|
|
6865
6966
|
}
|
|
6866
6967
|
) });
|
|
@@ -6921,24 +7022,24 @@ function KjunCopyButton({
|
|
|
6921
7022
|
},
|
|
6922
7023
|
style: ({ pressed }) => ({
|
|
6923
7024
|
alignSelf: "flex-start",
|
|
6924
|
-
minWidth:
|
|
6925
|
-
minHeight:
|
|
7025
|
+
minWidth: import_tokens39.tokens.native.minimumTouchTarget,
|
|
7026
|
+
minHeight: import_tokens39.tokens.native.minimumTouchTarget,
|
|
6926
7027
|
alignItems: "center",
|
|
6927
7028
|
justifyContent: "center",
|
|
6928
7029
|
flexDirection: "row",
|
|
6929
|
-
gap:
|
|
6930
|
-
paddingHorizontal: { xs:
|
|
6931
|
-
paddingVertical: { xs:
|
|
6932
|
-
borderRadius:
|
|
7030
|
+
gap: import_tokens39.tokens.dimension.value6,
|
|
7031
|
+
paddingHorizontal: { xs: import_tokens39.tokens.dimension.value2, sm: import_tokens39.tokens.dimension.value8, md: import_tokens39.tokens.dimension.value12 }[size],
|
|
7032
|
+
paddingVertical: { xs: import_tokens39.tokens.dimension.value2, sm: import_tokens39.tokens.dimension.value4, md: import_tokens39.tokens.dimension.value6 }[size],
|
|
7033
|
+
borderRadius: import_tokens39.tokens.radius.radius6,
|
|
6933
7034
|
backgroundColor: pressed && !inline ? colors.hover : void 0,
|
|
6934
|
-
opacity: disabled ?
|
|
7035
|
+
opacity: disabled ? import_tokens39.tokens.states.opacity.disabled : 1
|
|
6935
7036
|
}),
|
|
6936
7037
|
children: [
|
|
6937
7038
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6938
7039
|
KjunIcon,
|
|
6939
7040
|
{
|
|
6940
7041
|
name: copied ? "check" : "copy",
|
|
6941
|
-
size:
|
|
7042
|
+
size: import_tokens39.tokens.button.iconSizes[size],
|
|
6942
7043
|
color: copied ? colors.success : colors.textSecondary
|
|
6943
7044
|
}
|
|
6944
7045
|
),
|
|
@@ -7013,12 +7114,12 @@ function KjunExternalLink({
|
|
|
7013
7114
|
accessibilityRole: "link",
|
|
7014
7115
|
accessibilityLabel: name ? name + m.newWindow : void 0,
|
|
7015
7116
|
onPress: () => openUrl(url),
|
|
7016
|
-
style: { alignSelf: "flex-start", minHeight:
|
|
7117
|
+
style: { alignSelf: "flex-start", minHeight: import_tokens39.tokens.native.minimumTouchTarget, justifyContent: "center" },
|
|
7017
7118
|
children: mode === "text" ? (
|
|
7018
7119
|
// Like Web, text links show the new-window cue after the text.
|
|
7019
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_native41.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
7120
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_native41.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens39.tokens.dimension.value4 }, children: [
|
|
7020
7121
|
body,
|
|
7021
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunIcon, { name: "external-link", size:
|
|
7122
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunIcon, { name: "external-link", size: import_tokens39.tokens.iconSizes.small, color: colors.text })
|
|
7022
7123
|
] })
|
|
7023
7124
|
) : body
|
|
7024
7125
|
}
|
|
@@ -7037,7 +7138,7 @@ function KjunScrollFade({ children }) {
|
|
|
7037
7138
|
}
|
|
7038
7139
|
|
|
7039
7140
|
// packages/native/src/data-state.tsx
|
|
7040
|
-
var
|
|
7141
|
+
var import_tokens40 = require("@kjun-ui/tokens");
|
|
7041
7142
|
var import_react57 = require("react");
|
|
7042
7143
|
var import_react_native42 = require("react-native");
|
|
7043
7144
|
|
|
@@ -7058,13 +7159,13 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
7058
7159
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7059
7160
|
function useQueryDisplay(props) {
|
|
7060
7161
|
var _a;
|
|
7061
|
-
const [state, setState] = (0, import_react57.useState)(() => (0,
|
|
7162
|
+
const [state, setState] = (0, import_react57.useState)(() => (0, import_tokens40.initialQueryDisplay)(props));
|
|
7062
7163
|
let next = state;
|
|
7063
7164
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
7064
|
-
next = (0,
|
|
7165
|
+
next = (0, import_tokens40.advanceQueryDisplay)(state, props);
|
|
7065
7166
|
setState(next);
|
|
7066
7167
|
}
|
|
7067
|
-
return (0,
|
|
7168
|
+
return (0, import_tokens40.queryDisplayStatus)(next, props);
|
|
7068
7169
|
}
|
|
7069
7170
|
function KjunDataState({
|
|
7070
7171
|
preserveContent = false,
|
|
@@ -7096,7 +7197,7 @@ function KjunDataState({
|
|
|
7096
7197
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
7097
7198
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
7098
7199
|
retryText != null ? retryText : retryText = m.retry;
|
|
7099
|
-
const state = useQueryDisplay(query), blockingError = query.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query.error : null), concealed = state.initialLoading || !!blockingError || empty, padding =
|
|
7200
|
+
const state = useQueryDisplay(query), blockingError = query.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = import_tokens40.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
7100
7201
|
const { colors } = useKjunStyles();
|
|
7101
7202
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
7102
7203
|
import_react_native42.View,
|
|
@@ -7111,13 +7212,13 @@ function KjunDataState({
|
|
|
7111
7212
|
style: {
|
|
7112
7213
|
alignSelf: "flex-end",
|
|
7113
7214
|
maxWidth: "100%",
|
|
7114
|
-
marginBottom:
|
|
7215
|
+
marginBottom: import_tokens40.tokens.dimension.value12,
|
|
7115
7216
|
flexDirection: "row",
|
|
7116
7217
|
alignItems: "center",
|
|
7117
|
-
gap:
|
|
7118
|
-
paddingVertical:
|
|
7119
|
-
paddingHorizontal:
|
|
7120
|
-
borderRadius:
|
|
7218
|
+
gap: import_tokens40.tokens.dimension.value6,
|
|
7219
|
+
paddingVertical: import_tokens40.tokens.dimension.value4,
|
|
7220
|
+
paddingHorizontal: import_tokens40.tokens.dimension.value8,
|
|
7221
|
+
borderRadius: import_tokens40.tokens.radius.radius12,
|
|
7121
7222
|
backgroundColor: colors.surface
|
|
7122
7223
|
},
|
|
7123
7224
|
children: [
|
|
@@ -7133,7 +7234,7 @@ function KjunDataState({
|
|
|
7133
7234
|
"aria-hidden": revealed ? void 0 : true,
|
|
7134
7235
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
7135
7236
|
style: { paddingVertical: loadingPadding === "none" ? 0 : padding, opacity: revealed ? void 0 : 0 },
|
|
7136
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { gap:
|
|
7237
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { gap: import_tokens40.tokens.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native42.View, { style: { alignItems: "center", gap: import_tokens40.tokens.dimension.value12 }, children: [
|
|
7137
7238
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSpinner, { size: "md" }),
|
|
7138
7239
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
7139
7240
|
] }))
|
|
@@ -7152,12 +7253,12 @@ function KjunDataState({
|
|
|
7152
7253
|
right: 0,
|
|
7153
7254
|
opacity: 0,
|
|
7154
7255
|
...import_react_native42.Platform.OS === "web" ? { visibility: "hidden" } : {}
|
|
7155
|
-
} : { opacity: query.loading && !state.usesQueryState ?
|
|
7256
|
+
} : { opacity: query.loading && !state.usesQueryState ? import_tokens40.tokens.states.opacity.pending : 1 },
|
|
7156
7257
|
children: content(children)
|
|
7157
7258
|
},
|
|
7158
7259
|
"content"
|
|
7159
7260
|
),
|
|
7160
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { marginTop:
|
|
7261
|
+
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { marginTop: import_tokens40.tokens.dimension.value12 }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunButton, { variant: "secondary", onPress: onRetry, children: retryText }), children: m.refreshError(String(visibleRefreshError)) }) }) })
|
|
7161
7262
|
]
|
|
7162
7263
|
}
|
|
7163
7264
|
);
|
|
@@ -7165,7 +7266,7 @@ function KjunDataState({
|
|
|
7165
7266
|
function BoundaryDescription() {
|
|
7166
7267
|
const m = useKjunMessages();
|
|
7167
7268
|
const { colors } = useKjunStyles();
|
|
7168
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...
|
|
7269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...import_tokens40.tokens.typography.caption, fontSizePx: import_tokens40.tokens.extensions.state.descriptionSize }), color: colors.textSecondary, textAlign: "center" }, children: m.retryHint });
|
|
7169
7270
|
}
|
|
7170
7271
|
var KjunErrorBoundary = class extends import_react57.Component {
|
|
7171
7272
|
constructor() {
|
|
@@ -7185,13 +7286,13 @@ var KjunErrorBoundary = class extends import_react57.Component {
|
|
|
7185
7286
|
{
|
|
7186
7287
|
style: {
|
|
7187
7288
|
alignItems: "center",
|
|
7188
|
-
paddingVertical:
|
|
7189
|
-
paddingHorizontal:
|
|
7190
|
-
gap:
|
|
7289
|
+
paddingVertical: import_tokens40.tokens.dimension.value64,
|
|
7290
|
+
paddingHorizontal: import_tokens40.tokens.dimension.value24,
|
|
7291
|
+
gap: import_tokens40.tokens.dimension.value16
|
|
7191
7292
|
},
|
|
7192
7293
|
children: [
|
|
7193
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native42.View, { style: { gap:
|
|
7194
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...
|
|
7294
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native42.View, { style: { gap: import_tokens40.tokens.dimension.value8, alignItems: "center" }, children: [
|
|
7295
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...import_tokens40.tokens.typography.sectionTitle, fontSizePx: import_tokens40.tokens.extensions.state.titleSize }), textAlign: "center" }, children: this.props.fallbackMessage || this.context.messages.somethingWentWrong }),
|
|
7195
7296
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BoundaryDescription, {})
|
|
7196
7297
|
] }),
|
|
7197
7298
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -7214,7 +7315,7 @@ var KjunErrorBoundary = class extends import_react57.Component {
|
|
|
7214
7315
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
7215
7316
|
|
|
7216
7317
|
// packages/native/src/skeletons.tsx
|
|
7217
|
-
var
|
|
7318
|
+
var import_tokens44 = require("@kjun-ui/tokens");
|
|
7218
7319
|
var import_react59 = require("react");
|
|
7219
7320
|
var import_react_native44 = require("react-native");
|
|
7220
7321
|
var import_react_native_svg5 = __toESM(require("react-native-svg"), 1);
|
|
@@ -7238,12 +7339,12 @@ function chartSkeletonKind(kind) {
|
|
|
7238
7339
|
}
|
|
7239
7340
|
|
|
7240
7341
|
// packages/native/src/market-skeleton.tsx
|
|
7241
|
-
var
|
|
7342
|
+
var import_tokens43 = require("@kjun-ui/tokens");
|
|
7242
7343
|
var import_react_native43 = require("react-native");
|
|
7243
7344
|
|
|
7244
7345
|
// shared/package-runtime/market-layout.ts
|
|
7245
|
-
var
|
|
7246
|
-
var marketGeometry =
|
|
7346
|
+
var import_tokens41 = require("@kjun-ui/tokens");
|
|
7347
|
+
var marketGeometry = import_tokens41.tokens.extensions.marketTable;
|
|
7247
7348
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
7248
7349
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
7249
7350
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -7261,33 +7362,33 @@ function nativeMarketLayout(columns, showActions, containerWidth) {
|
|
|
7261
7362
|
}
|
|
7262
7363
|
|
|
7263
7364
|
// packages/native/src/market-layout.ts
|
|
7264
|
-
var
|
|
7365
|
+
var import_tokens42 = require("@kjun-ui/tokens");
|
|
7265
7366
|
var import_react58 = require("react");
|
|
7266
7367
|
function useMarketLayout(columns, showActions) {
|
|
7267
7368
|
const [containerWidth, setContainerWidth] = (0, import_react58.useState)(0);
|
|
7268
7369
|
const onLayout = (event) => setContainerWidth(event.nativeEvent.layout.width);
|
|
7269
7370
|
return { ...nativeMarketLayout(columns, showActions, containerWidth), onLayout };
|
|
7270
7371
|
}
|
|
7271
|
-
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth:
|
|
7272
|
-
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth:
|
|
7372
|
+
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth: import_tokens42.tokens.border.defaultWidth };
|
|
7373
|
+
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth: import_tokens42.tokens.border.defaultWidth };
|
|
7273
7374
|
|
|
7274
7375
|
// packages/native/src/market-skeleton.tsx
|
|
7275
7376
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
7276
7377
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false }) {
|
|
7277
7378
|
const { colors } = useKjunStyles();
|
|
7278
7379
|
const cols = normalizeMarketColumns(columns), layout = useMarketLayout(cols, showActions);
|
|
7279
|
-
const actions = { width: marketGeometry.actionsWidth, paddingVertical:
|
|
7380
|
+
const actions = { width: marketGeometry.actionsWidth, paddingVertical: import_tokens43.tokens.dimension.value12, paddingHorizontal: import_tokens43.tokens.dimension.value4, justifyContent: "center", alignItems: "center" };
|
|
7280
7381
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.ScrollView, { horizontal: true, onLayout: layout.onLayout, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { width: layout.width }, children: [
|
|
7281
7382
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { ...marketHeaderStyle, borderBottomColor: colors.border }, children: [
|
|
7282
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width:
|
|
7283
|
-
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], padding:
|
|
7383
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: import_tokens43.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens43.tokens.extensions.marketTable.headerSkeletonHeight }) }),
|
|
7384
|
+
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], padding: import_tokens43.tokens.dimension.value12, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KText, { style: { ...typeStyle("meta"), color: colors.textTertiary, textAlign: col.align }, children: col.label }) }, col.key || i))
|
|
7284
7385
|
] }),
|
|
7285
7386
|
Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { ...marketRowStyle, borderBottomColor: colors.border }, children: [
|
|
7286
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width:
|
|
7287
|
-
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], paddingVertical:
|
|
7288
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height:
|
|
7289
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height:
|
|
7290
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width:
|
|
7387
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: import_tokens43.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens43.tokens.extensions.financial.priceSkeletonHeight }) }),
|
|
7388
|
+
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], paddingVertical: import_tokens43.tokens.dimension.value14, paddingHorizontal: import_tokens43.tokens.dimension.value12, justifyContent: "center", alignItems: isMarketIdentity(col.key) ? void 0 : col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start" }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { gap: import_tokens43.tokens.dimension.value2 }, children: [
|
|
7389
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height: import_tokens43.tokens.typography.body.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens43.tokens.extensions.skeleton.lineHeights.md }) }),
|
|
7390
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height: import_tokens43.tokens.typography.caption.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens43.tokens.extensions.skeleton.lineHeights.sm }) })
|
|
7391
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: import_tokens43.tokens.extensions.financial.priceSkeletonWidth, height: import_tokens43.tokens.extensions.financial.priceSkeletonHeight }) }, col.key || i))
|
|
7291
7392
|
] }, row))
|
|
7292
7393
|
] }) });
|
|
7293
7394
|
}
|
|
@@ -7298,11 +7399,11 @@ function KjunListSkeleton({
|
|
|
7298
7399
|
rows = 8,
|
|
7299
7400
|
variant = "market",
|
|
7300
7401
|
avatar = true,
|
|
7301
|
-
avatarSize =
|
|
7402
|
+
avatarSize = import_tokens44.tokens.extensions.skeleton.listAvatarSize,
|
|
7302
7403
|
quote = true
|
|
7303
7404
|
}) {
|
|
7304
7405
|
const { colors } = useKjunStyles();
|
|
7305
|
-
const market = variant === "market", narrow = (0, import_react_native44.useWindowDimensions)().width <
|
|
7406
|
+
const market = variant === "market", narrow = (0, import_react_native44.useWindowDimensions)().width < import_tokens44.tokens.responsive.market;
|
|
7306
7407
|
const slots = market ? [typeStyle(narrow ? "input" : "label").lineHeight, typeStyle(narrow ? "body" : "caption").lineHeight] : null;
|
|
7307
7408
|
const slot = (index, child) => slots ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { height: slots[index], justifyContent: "center" }, children: child }) : child;
|
|
7308
7409
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -7316,29 +7417,29 @@ function KjunListSkeleton({
|
|
|
7316
7417
|
style: {
|
|
7317
7418
|
flexDirection: "row",
|
|
7318
7419
|
alignItems: "center",
|
|
7319
|
-
gap:
|
|
7320
|
-
minHeight: market ? narrow ?
|
|
7321
|
-
paddingVertical: market ? narrow ?
|
|
7322
|
-
paddingHorizontal: market ? narrow ?
|
|
7323
|
-
borderBottomWidth:
|
|
7420
|
+
gap: import_tokens44.tokens.extensions.skeleton.gap,
|
|
7421
|
+
minHeight: market ? narrow ? import_tokens44.tokens.extensions.marketList.minimumHeight : void 0 : import_tokens44.tokens.extensions.skeleton.listHeights[variant],
|
|
7422
|
+
paddingVertical: market ? narrow ? import_tokens44.tokens.dimension.value14 : import_tokens44.tokens.dimension.value16 : import_tokens44.tokens.extensions.skeleton.list[variant].paddingY,
|
|
7423
|
+
paddingHorizontal: market ? narrow ? import_tokens44.tokens.dimension.value20 : import_tokens44.tokens.dimension.value16 : import_tokens44.tokens.extensions.skeleton.list[variant].paddingX,
|
|
7424
|
+
borderBottomWidth: import_tokens44.tokens.border.defaultWidth,
|
|
7324
7425
|
borderBottomColor: colors.border
|
|
7325
7426
|
},
|
|
7326
7427
|
children: [
|
|
7327
7428
|
avatar && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
7328
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { flex: 1, minWidth: 0, gap: market ?
|
|
7429
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { flex: 1, minWidth: 0, gap: market ? import_tokens44.tokens.dimension.value2 : import_tokens44.tokens.extensions.skeleton.detailGap }, children: [
|
|
7329
7430
|
slot(0, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7330
7431
|
KjunSkeleton,
|
|
7331
7432
|
{
|
|
7332
7433
|
type: "block",
|
|
7333
|
-
height:
|
|
7434
|
+
height: import_tokens44.tokens.extensions.skeleton.lineHeights.md,
|
|
7334
7435
|
width: i % 2 ? "80%" : "65%"
|
|
7335
7436
|
}
|
|
7336
7437
|
)),
|
|
7337
|
-
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7438
|
+
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens44.tokens.extensions.skeleton.lineHeights.sm, width: "50%" }))
|
|
7338
7439
|
] }),
|
|
7339
|
-
quote && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { alignItems: "flex-end", gap: market ?
|
|
7340
|
-
slot(0, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7341
|
-
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7440
|
+
quote && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { alignItems: "flex-end", gap: market ? import_tokens44.tokens.dimension.value2 : import_tokens44.tokens.extensions.skeleton.detailGap }, children: [
|
|
7441
|
+
slot(0, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens44.tokens.extensions.skeleton.quoteHeight, width: import_tokens44.tokens.extensions.skeleton.quoteWidth })),
|
|
7442
|
+
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens44.tokens.extensions.skeleton.lineHeights.sm, width: import_tokens44.tokens.extensions.skeleton.detailWidth }))
|
|
7342
7443
|
] })
|
|
7343
7444
|
]
|
|
7344
7445
|
},
|
|
@@ -7355,7 +7456,7 @@ function KjunFormSkeleton({
|
|
|
7355
7456
|
}) {
|
|
7356
7457
|
const { colors } = useKjunStyles();
|
|
7357
7458
|
const window2 = (0, import_react_native44.useWindowDimensions)();
|
|
7358
|
-
const twoColumns = columns === 2 && window2.width >=
|
|
7459
|
+
const twoColumns = columns === 2 && window2.width >= import_tokens44.tokens.responsive.formColumns;
|
|
7359
7460
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7360
7461
|
import_react_native44.View,
|
|
7361
7462
|
{
|
|
@@ -7364,13 +7465,13 @@ function KjunFormSkeleton({
|
|
|
7364
7465
|
style: {
|
|
7365
7466
|
flexDirection: twoColumns ? "row" : "column",
|
|
7366
7467
|
flexWrap: twoColumns ? "wrap" : "nowrap",
|
|
7367
|
-
gap:
|
|
7468
|
+
gap: import_tokens44.tokens.extensions.skeleton.formGap
|
|
7368
7469
|
},
|
|
7369
7470
|
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7370
7471
|
import_react_native44.View,
|
|
7371
7472
|
{
|
|
7372
7473
|
style: {
|
|
7373
|
-
gap:
|
|
7474
|
+
gap: import_tokens44.tokens.extensions.skeleton.fieldGap,
|
|
7374
7475
|
minWidth: 0,
|
|
7375
7476
|
flexBasis: twoColumns ? "45%" : void 0,
|
|
7376
7477
|
flexGrow: 1
|
|
@@ -7378,13 +7479,13 @@ function KjunFormSkeleton({
|
|
|
7378
7479
|
children: [
|
|
7379
7480
|
field ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KText, { style: { color: colors.text, ...typeStyle("label") }, children: typeof field === "string" ? field : field.label }) : (
|
|
7380
7481
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
7381
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7482
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens44.tokens.extensions.skeleton.formLabelHeight, width: import_tokens44.tokens.extensions.skeleton.formLabelWidth }) })
|
|
7382
7483
|
),
|
|
7383
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { borderRadius:
|
|
7484
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { borderRadius: import_tokens44.tokens.input[size].radius, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7384
7485
|
KjunSkeleton,
|
|
7385
7486
|
{
|
|
7386
7487
|
type: "block",
|
|
7387
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
7488
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? import_tokens44.tokens.input[size].lineHeight * 3 + import_tokens44.tokens.input[size].textareaPaddingY * 2 + 2 * import_tokens44.tokens.border.controlWidth : import_tokens44.tokens.input[size].height
|
|
7388
7489
|
}
|
|
7389
7490
|
) })
|
|
7390
7491
|
]
|
|
@@ -7397,7 +7498,7 @@ function KjunFormSkeleton({
|
|
|
7397
7498
|
var chartPart = (name) => import_react_native44.Platform.OS === "web" ? { dataSet: { kjunChartPart: name } } : {};
|
|
7398
7499
|
function KjunChartSkeleton({
|
|
7399
7500
|
kind: requestedKind = "frame",
|
|
7400
|
-
height =
|
|
7501
|
+
height = import_tokens44.tokens.extensions.chartSkeleton.height,
|
|
7401
7502
|
loadingText,
|
|
7402
7503
|
skeleton = true,
|
|
7403
7504
|
loadingDelay = 0,
|
|
@@ -7406,13 +7507,13 @@ function KjunChartSkeleton({
|
|
|
7406
7507
|
}) {
|
|
7407
7508
|
const m = useKjunMessages();
|
|
7408
7509
|
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
7409
|
-
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = (0, import_react59.useRef)(new import_react_native44.Animated.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = (0, import_react59.useState)(0), thickness =
|
|
7510
|
+
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = (0, import_react59.useRef)(new import_react_native44.Animated.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = (0, import_react59.useState)(0), thickness = import_tokens44.tokens.extensions.chartSkeleton.donutThickness, boxHeight = typeof height === "number" ? height : measured, hole = boxHeight > 0 ? chartDonutHole(boxHeight, thickness) : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns), status = revealed && loadingText ? "status" : void 0, hidden = { "aria-hidden": true, importantForAccessibility: "no-hide-descendants" };
|
|
7410
7511
|
(0, import_react59.useEffect)(() => {
|
|
7411
7512
|
if (reduced || !skeleton) return;
|
|
7412
7513
|
const loop = import_react_native44.Animated.loop(
|
|
7413
7514
|
import_react_native44.Animated.sequence([
|
|
7414
|
-
import_react_native44.Animated.timing(opacity, { toValue: 0.55, duration:
|
|
7415
|
-
import_react_native44.Animated.timing(opacity, { toValue: 1, duration:
|
|
7515
|
+
import_react_native44.Animated.timing(opacity, { toValue: 0.55, duration: import_tokens44.tokens.motion.shimmer / 2, useNativeDriver: true }),
|
|
7516
|
+
import_react_native44.Animated.timing(opacity, { toValue: 1, duration: import_tokens44.tokens.motion.shimmer / 2, useNativeDriver: true })
|
|
7416
7517
|
])
|
|
7417
7518
|
);
|
|
7418
7519
|
loop.start();
|
|
@@ -7429,7 +7530,7 @@ function KjunChartSkeleton({
|
|
|
7429
7530
|
"aria-hidden": revealed ? void 0 : true,
|
|
7430
7531
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
7431
7532
|
...import_react_native44.Platform.OS === "web" ? { dataSet: { kjunChartKind: kind, skeleton: skeleton ? void 0 : "false" } } : {},
|
|
7432
|
-
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap:
|
|
7533
|
+
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap: import_tokens44.tokens.dimension.value12 }, children: [
|
|
7433
7534
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...hidden, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSpinner, { size: "md" }) }),
|
|
7434
7535
|
!!loadingText && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
7435
7536
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
@@ -7438,21 +7539,21 @@ function KjunChartSkeleton({
|
|
|
7438
7539
|
{
|
|
7439
7540
|
...chartPart("donut"),
|
|
7440
7541
|
...hidden,
|
|
7441
|
-
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius:
|
|
7542
|
+
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius: import_tokens44.tokens.radius.radius9999 }
|
|
7442
7543
|
}
|
|
7443
|
-
) : kind === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap:
|
|
7544
|
+
) : kind === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap: import_tokens44.tokens.dimension.value4 }, children: Array.from({ length: rowCount }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { flex: 1, flexDirection: "row", gap: import_tokens44.tokens.dimension.value4 }, children: Array.from({ length: columnCount }, (_2, column) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7444
7545
|
import_react_native44.View,
|
|
7445
7546
|
{
|
|
7446
7547
|
...chartPart("cell"),
|
|
7447
7548
|
style: {
|
|
7448
7549
|
flex: 1,
|
|
7449
|
-
borderRadius:
|
|
7550
|
+
borderRadius: import_tokens44.tokens.extensions.skeleton.lineRadius,
|
|
7450
7551
|
backgroundColor: colors.skeleton,
|
|
7451
|
-
opacity: chartMatrixMuted(row, column) ?
|
|
7552
|
+
opacity: chartMatrixMuted(row, column) ? import_tokens44.tokens.states.opacity.pending : 1
|
|
7452
7553
|
}
|
|
7453
7554
|
},
|
|
7454
7555
|
column
|
|
7455
|
-
)) }, row)) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("plot"), ...hidden, style: { alignSelf: "stretch", flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.default, { viewBox: chartFrameViewBox, preserveAspectRatio: "none", width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.Path, { d: chartFramePath, fill: "none", stroke: colors.chartGrid, strokeWidth:
|
|
7556
|
+
)) }, row)) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("plot"), ...hidden, style: { alignSelf: "stretch", flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.default, { viewBox: chartFrameViewBox, preserveAspectRatio: "none", width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.Path, { d: chartFramePath, fill: "none", stroke: colors.chartGrid, strokeWidth: import_tokens44.tokens.border.defaultWidth, vectorEffect: "non-scaling-stroke" }) }) }),
|
|
7456
7557
|
!!loadingText && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7457
7558
|
import_react_native44.View,
|
|
7458
7559
|
{
|
|
@@ -7466,10 +7567,10 @@ function KjunChartSkeleton({
|
|
|
7466
7567
|
{
|
|
7467
7568
|
style: {
|
|
7468
7569
|
...typeStyle("body"),
|
|
7469
|
-
paddingHorizontal:
|
|
7470
|
-
paddingVertical:
|
|
7471
|
-
borderRadius:
|
|
7472
|
-
borderWidth: kind === "donut" ? 0 :
|
|
7570
|
+
paddingHorizontal: import_tokens44.tokens.dimension.value12,
|
|
7571
|
+
paddingVertical: import_tokens44.tokens.dimension.value4,
|
|
7572
|
+
borderRadius: import_tokens44.tokens.radius.radius6,
|
|
7573
|
+
borderWidth: kind === "donut" ? 0 : import_tokens44.tokens.border.defaultWidth,
|
|
7473
7574
|
borderColor: colors.chartGrid,
|
|
7474
7575
|
backgroundColor: colors.surface,
|
|
7475
7576
|
color: colors.textSecondary,
|
|
@@ -7487,19 +7588,19 @@ function KjunChartSkeleton({
|
|
|
7487
7588
|
}
|
|
7488
7589
|
|
|
7489
7590
|
// packages/native/src/financial-display.tsx
|
|
7490
|
-
var
|
|
7591
|
+
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7491
7592
|
var import_react62 = require("react");
|
|
7492
7593
|
var import_react_native46 = require("react-native");
|
|
7493
7594
|
var import_react_native_svg6 = __toESM(require("react-native-svg"), 1);
|
|
7494
7595
|
|
|
7495
7596
|
// packages/native/src/number-display.tsx
|
|
7496
|
-
var
|
|
7597
|
+
var import_tokens46 = require("@kjun-ui/tokens");
|
|
7497
7598
|
|
|
7498
7599
|
// shared/package-runtime/use-number-motion.ts
|
|
7499
7600
|
var import_react60 = require("react");
|
|
7500
7601
|
|
|
7501
7602
|
// shared/package-runtime/number-motion.ts
|
|
7502
|
-
var
|
|
7603
|
+
var import_tokens45 = require("@kjun-ui/tokens");
|
|
7503
7604
|
function createNumberMotion(apply) {
|
|
7504
7605
|
let frame = 0, revision = 0, current = 0;
|
|
7505
7606
|
let previous;
|
|
@@ -7530,7 +7631,7 @@ function createNumberMotion(apply) {
|
|
|
7530
7631
|
if (from === target) return;
|
|
7531
7632
|
const tick = (now) => {
|
|
7532
7633
|
if (version !== revision) return;
|
|
7533
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
7634
|
+
const progress = Math.min(1, Math.max(0, (now - started) / import_tokens45.tokens.motion.number));
|
|
7534
7635
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
7535
7636
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
7536
7637
|
};
|
|
@@ -7617,7 +7718,7 @@ function KjunFreshness({
|
|
|
7617
7718
|
KjunTooltip,
|
|
7618
7719
|
{
|
|
7619
7720
|
content: (source === "close" ? scope.messages.noRealtimeQuote : scope.messages.realtimeDelayed) + (fetchedAt ? " \xB7 " + ((formatter == null ? void 0 : formatter(fetchedAt)) || formatRelativeTime(fetchedAt, void 0, scope)) : ""),
|
|
7620
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AccessiblePressable, { accessibilityLabel: label, focusRingRadius:
|
|
7721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AccessiblePressable, { accessibilityLabel: label, focusRingRadius: import_tokens46.tokens.extensions.badge.radius, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunBadge, { variant: "warning", size: "xs", children: label }) })
|
|
7621
7722
|
}
|
|
7622
7723
|
) : null;
|
|
7623
7724
|
}
|
|
@@ -7631,11 +7732,11 @@ function KjunPriceCell({
|
|
|
7631
7732
|
fromPrevious = true
|
|
7632
7733
|
}) {
|
|
7633
7734
|
const { colors } = useKjunStyles(), quoteType = (0, import_react61.useContext)(MarketQuoteTypeContext);
|
|
7634
|
-
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height:
|
|
7735
|
+
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height: import_tokens46.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens46.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native45.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens46.tokens.extensions.financial.affixGap }, children: [
|
|
7635
7736
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7636
7737
|
import_react_native45.View,
|
|
7637
7738
|
{
|
|
7638
|
-
style: quoteType ? void 0 : { paddingVertical:
|
|
7739
|
+
style: quoteType ? void 0 : { paddingVertical: import_tokens46.tokens.extensions.financial.pillPaddingY, paddingHorizontal: import_tokens46.tokens.extensions.financial.pillPaddingX, borderRadius: import_tokens46.tokens.radius.radius9999 },
|
|
7639
7740
|
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7640
7741
|
KjunAnimatedNumber,
|
|
7641
7742
|
{
|
|
@@ -7674,14 +7775,14 @@ function KjunSignedValue({
|
|
|
7674
7775
|
flexDirection: "row",
|
|
7675
7776
|
alignItems: "center",
|
|
7676
7777
|
alignSelf: "flex-start",
|
|
7677
|
-
gap:
|
|
7678
|
-
paddingVertical: tone === "pill" ?
|
|
7679
|
-
paddingHorizontal: tone === "pill" ?
|
|
7680
|
-
borderRadius:
|
|
7778
|
+
gap: import_tokens46.tokens.extensions.financial.affixGap,
|
|
7779
|
+
paddingVertical: tone === "pill" ? import_tokens46.tokens.extensions.financial.pillPaddingY : 0,
|
|
7780
|
+
paddingHorizontal: tone === "pill" ? import_tokens46.tokens.extensions.financial.pillPaddingX : 0,
|
|
7781
|
+
borderRadius: import_tokens46.tokens.extensions.financial.pillRadius,
|
|
7681
7782
|
backgroundColor: tone === "pill" && !stale && !loading && n !== null ? domainColor(domainColors, role + "Bg") : void 0
|
|
7682
7783
|
},
|
|
7683
7784
|
children: [
|
|
7684
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", width:
|
|
7785
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", width: import_tokens46.tokens.extensions.financial.signedSkeletonWidth, height: import_tokens46.tokens.extensions.financial.signedSkeletonHeight }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7685
7786
|
KText,
|
|
7686
7787
|
{
|
|
7687
7788
|
style: {
|
|
@@ -7703,7 +7804,7 @@ function KjunSignedValue({
|
|
|
7703
7804
|
|
|
7704
7805
|
// packages/native/src/financial-display.tsx
|
|
7705
7806
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7706
|
-
var deviationFill = { neutral: 1, low:
|
|
7807
|
+
var deviationFill = { neutral: 1, low: import_tokens47.tokens.states.opacity.deviationLow, medium: import_tokens47.tokens.states.opacity.deviationMedium, strong: import_tokens47.tokens.states.opacity.deviationStrong };
|
|
7707
7808
|
function KjunDeviation({
|
|
7708
7809
|
value,
|
|
7709
7810
|
variant = "pill",
|
|
@@ -7715,7 +7816,7 @@ function KjunDeviation({
|
|
|
7715
7816
|
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), n = finiteNumber(value);
|
|
7716
7817
|
if (n === null)
|
|
7717
7818
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KText, { style: { color: colors.textDisabled }, children: "-" });
|
|
7718
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0,
|
|
7819
|
+
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens47.deviationLevel)(n), neutral = level === "neutral", color = neutral ? colors.textSecondary : domainColor(domainColors, n > 0 ? "priceUp" : "priceDown"), label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
7719
7820
|
if (variant === "badge")
|
|
7720
7821
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7721
7822
|
import_react_native46.View,
|
|
@@ -7724,7 +7825,7 @@ function KjunDeviation({
|
|
|
7724
7825
|
flexDirection: "row",
|
|
7725
7826
|
alignItems: "center",
|
|
7726
7827
|
justifyContent: "flex-end",
|
|
7727
|
-
gap:
|
|
7828
|
+
gap: import_tokens47.tokens.extensions.financial.badgeGap
|
|
7728
7829
|
},
|
|
7729
7830
|
children: [
|
|
7730
7831
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7743,22 +7844,22 @@ function KjunDeviation({
|
|
|
7743
7844
|
}, children: label })
|
|
7744
7845
|
}
|
|
7745
7846
|
),
|
|
7746
|
-
!signal && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { width:
|
|
7847
|
+
!signal && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { width: import_tokens47.tokens.extensions.financial.warningIconSize, flexShrink: 0 } }),
|
|
7747
7848
|
signal && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { alignSelf: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunTooltip, { content: m.deviationWarning(signalThreshold), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7748
7849
|
AccessiblePressable,
|
|
7749
7850
|
{
|
|
7750
7851
|
accessibilityRole: "image",
|
|
7751
7852
|
accessibilityLabel: m.arbitrage,
|
|
7752
7853
|
focusRingInset: true,
|
|
7753
|
-
focusRingRadius:
|
|
7854
|
+
focusRingRadius: import_tokens47.tokens.radius.radius4,
|
|
7754
7855
|
style: {
|
|
7755
|
-
width:
|
|
7756
|
-
height:
|
|
7757
|
-
margin: (
|
|
7856
|
+
width: import_tokens47.tokens.extensions.financial.warningTargetSize,
|
|
7857
|
+
height: import_tokens47.tokens.extensions.financial.warningTargetSize,
|
|
7858
|
+
margin: (import_tokens47.tokens.extensions.financial.warningIconSize - import_tokens47.tokens.extensions.financial.warningTargetSize) / 2,
|
|
7758
7859
|
alignItems: "center",
|
|
7759
7860
|
justifyContent: "center"
|
|
7760
7861
|
},
|
|
7761
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "alert-triangle", size:
|
|
7862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "alert-triangle", size: import_tokens47.tokens.extensions.financial.warningIconSize, color: colors.warning })
|
|
7762
7863
|
}
|
|
7763
7864
|
) }) }) })
|
|
7764
7865
|
]
|
|
@@ -7770,9 +7871,9 @@ function KjunDeviation({
|
|
|
7770
7871
|
style: {
|
|
7771
7872
|
alignSelf: "flex-start",
|
|
7772
7873
|
position: "relative",
|
|
7773
|
-
borderRadius:
|
|
7774
|
-
paddingVertical: variant === "pill" ?
|
|
7775
|
-
paddingHorizontal: variant === "pill" ?
|
|
7874
|
+
borderRadius: import_tokens47.tokens.extensions.financial.cellRadius,
|
|
7875
|
+
paddingVertical: variant === "pill" ? import_tokens47.tokens.extensions.financial.pillPaddingY : 0,
|
|
7876
|
+
paddingHorizontal: variant === "pill" ? import_tokens47.tokens.extensions.financial.pillPaddingX : 0
|
|
7776
7877
|
},
|
|
7777
7878
|
children: [
|
|
7778
7879
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7782,7 +7883,7 @@ function KjunDeviation({
|
|
|
7782
7883
|
style: {
|
|
7783
7884
|
position: "absolute",
|
|
7784
7885
|
inset: 0,
|
|
7785
|
-
borderRadius:
|
|
7886
|
+
borderRadius: import_tokens47.tokens.extensions.financial.cellRadius,
|
|
7786
7887
|
backgroundColor: neutral ? colors.secondary : color,
|
|
7787
7888
|
opacity: deviationFill[level]
|
|
7788
7889
|
}
|
|
@@ -7823,9 +7924,9 @@ function KjunHeatmapCell({
|
|
|
7823
7924
|
style: {
|
|
7824
7925
|
position: "relative",
|
|
7825
7926
|
alignSelf: "flex-start",
|
|
7826
|
-
paddingVertical:
|
|
7827
|
-
paddingHorizontal:
|
|
7828
|
-
borderRadius:
|
|
7927
|
+
paddingVertical: import_tokens47.tokens.extensions.financial.pillPaddingY,
|
|
7928
|
+
paddingHorizontal: import_tokens47.tokens.extensions.financial.pillPaddingX,
|
|
7929
|
+
borderRadius: import_tokens47.tokens.extensions.financial.cellRadius
|
|
7829
7930
|
},
|
|
7830
7931
|
children: [
|
|
7831
7932
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7835,10 +7936,10 @@ function KjunHeatmapCell({
|
|
|
7835
7936
|
style: {
|
|
7836
7937
|
position: "absolute",
|
|
7837
7938
|
inset: 0,
|
|
7838
|
-
borderRadius:
|
|
7939
|
+
borderRadius: import_tokens47.tokens.extensions.financial.cellRadius,
|
|
7839
7940
|
// A zero cell keeps its shape on the neutral fill; any other value starts from a visible minimum.
|
|
7840
7941
|
backgroundColor: magnitude ? background : colors.secondary,
|
|
7841
|
-
opacity: magnitude ?
|
|
7942
|
+
opacity: magnitude ? import_tokens47.tokens.states.opacity.heatMinimum + (import_tokens47.tokens.states.opacity.heatMaximum - import_tokens47.tokens.states.opacity.heatMinimum) * magnitude : 1
|
|
7842
7943
|
}
|
|
7843
7944
|
}
|
|
7844
7945
|
),
|
|
@@ -7856,7 +7957,7 @@ function KjunProgressCell({
|
|
|
7856
7957
|
showLabel = true,
|
|
7857
7958
|
color = "auto",
|
|
7858
7959
|
customColor,
|
|
7859
|
-
height =
|
|
7960
|
+
height = import_tokens47.tokens.extensions.financial.progressHeight
|
|
7860
7961
|
}) {
|
|
7861
7962
|
const { colors, numericFontFamily, fontFamily } = useKjunStyles(), percent = max > 0 && Number.isFinite(value) ? Math.min(100, Math.max(0, value / max * 100)) : 0, role = color === "auto" ? percent < 30 ? "danger" : percent < 70 ? "warning" : "success" : color;
|
|
7862
7963
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
@@ -7865,8 +7966,8 @@ function KjunProgressCell({
|
|
|
7865
7966
|
style: {
|
|
7866
7967
|
flexDirection: "row",
|
|
7867
7968
|
alignItems: "center",
|
|
7868
|
-
gap:
|
|
7869
|
-
minWidth:
|
|
7969
|
+
gap: import_tokens47.tokens.extensions.financial.progressGap,
|
|
7970
|
+
minWidth: import_tokens47.tokens.extensions.financial.progressMinimumWidth
|
|
7870
7971
|
},
|
|
7871
7972
|
children: [
|
|
7872
7973
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7876,7 +7977,7 @@ function KjunProgressCell({
|
|
|
7876
7977
|
height,
|
|
7877
7978
|
flex: 1,
|
|
7878
7979
|
backgroundColor: colors.tertiary,
|
|
7879
|
-
borderRadius:
|
|
7980
|
+
borderRadius: import_tokens47.tokens.extensions.financial.progressRadius,
|
|
7880
7981
|
overflow: "hidden"
|
|
7881
7982
|
},
|
|
7882
7983
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7885,7 +7986,7 @@ function KjunProgressCell({
|
|
|
7885
7986
|
style: {
|
|
7886
7987
|
width: `${percent}%`,
|
|
7887
7988
|
height: "100%",
|
|
7888
|
-
borderRadius:
|
|
7989
|
+
borderRadius: import_tokens47.tokens.extensions.financial.progressRadius,
|
|
7889
7990
|
backgroundColor: color === "custom" ? customColor : colors[role]
|
|
7890
7991
|
}
|
|
7891
7992
|
}
|
|
@@ -7898,7 +7999,7 @@ function KjunProgressCell({
|
|
|
7898
7999
|
style: {
|
|
7899
8000
|
...typeStyle("caption"),
|
|
7900
8001
|
color: colors.textSecondary,
|
|
7901
|
-
minWidth:
|
|
8002
|
+
minWidth: import_tokens47.tokens.extensions.financial.progressLabelWidth,
|
|
7902
8003
|
textAlign: "right",
|
|
7903
8004
|
fontFamily: numericFontFamily || fontFamily,
|
|
7904
8005
|
fontVariant: ["tabular-nums"]
|
|
@@ -7919,7 +8020,7 @@ function KjunCollectionMark({
|
|
|
7919
8020
|
size = "md"
|
|
7920
8021
|
}) {
|
|
7921
8022
|
const { colors, domainColors } = useKjunStyles();
|
|
7922
|
-
const box =
|
|
8023
|
+
const box = import_tokens47.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens47.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
7923
8024
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", overflow: "visible" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7924
8025
|
KjunIcon,
|
|
7925
8026
|
{
|
|
@@ -7951,8 +8052,8 @@ function KjunExecutionStatusBadge({
|
|
|
7951
8052
|
}
|
|
7952
8053
|
function KjunSparkline({
|
|
7953
8054
|
data = [],
|
|
7954
|
-
width =
|
|
7955
|
-
height =
|
|
8055
|
+
width = import_tokens47.tokens.extensions.financial.sparklineWidth,
|
|
8056
|
+
height = import_tokens47.tokens.extensions.financial.sparklineHeight,
|
|
7956
8057
|
color,
|
|
7957
8058
|
semantic = "price",
|
|
7958
8059
|
fill = true,
|
|
@@ -8005,7 +8106,7 @@ function KjunSparkline({
|
|
|
8005
8106
|
}
|
|
8006
8107
|
|
|
8007
8108
|
// shared/package-runtime/table.ts
|
|
8008
|
-
var
|
|
8109
|
+
var import_tokens48 = require("@kjun-ui/tokens");
|
|
8009
8110
|
var import_react63 = require("react");
|
|
8010
8111
|
|
|
8011
8112
|
// shared/package-runtime/table-model.ts
|
|
@@ -8079,7 +8180,7 @@ function useTableModel(props) {
|
|
|
8079
8180
|
sortColumn: (col) => {
|
|
8080
8181
|
var _a2;
|
|
8081
8182
|
if (!sortable || !col.sortable) return;
|
|
8082
|
-
const next = (0,
|
|
8183
|
+
const next = (0, import_tokens48.nextTableSort)(sort, col.key);
|
|
8083
8184
|
if (props.sort === void 0) setSort(next);
|
|
8084
8185
|
(_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
|
|
8085
8186
|
},
|
|
@@ -8143,7 +8244,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
8143
8244
|
}
|
|
8144
8245
|
|
|
8145
8246
|
// packages/native/src/table-toolbar.tsx
|
|
8146
|
-
var
|
|
8247
|
+
var import_tokens49 = require("@kjun-ui/tokens");
|
|
8147
8248
|
var import_react_native47 = require("react-native");
|
|
8148
8249
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
8149
8250
|
function TableToolbar({
|
|
@@ -8163,12 +8264,12 @@ function TableToolbar({
|
|
|
8163
8264
|
const toolbarStyle = {
|
|
8164
8265
|
flexDirection: "row",
|
|
8165
8266
|
alignItems: "center",
|
|
8166
|
-
gap:
|
|
8267
|
+
gap: import_tokens49.tokens.dimension.value8,
|
|
8167
8268
|
flexWrap: "wrap",
|
|
8168
|
-
paddingVertical:
|
|
8169
|
-
paddingHorizontal:
|
|
8269
|
+
paddingVertical: import_tokens49.tokens.dimension.value8,
|
|
8270
|
+
paddingHorizontal: import_tokens49.tokens.dimension.value12,
|
|
8170
8271
|
backgroundColor: colors.secondary,
|
|
8171
|
-
borderBottomWidth:
|
|
8272
|
+
borderBottomWidth: import_tokens49.tokens.border.defaultWidth,
|
|
8172
8273
|
borderBottomColor: colors.border
|
|
8173
8274
|
};
|
|
8174
8275
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
@@ -8196,7 +8297,7 @@ function TableToolbar({
|
|
|
8196
8297
|
),
|
|
8197
8298
|
(searchable || toolbar) && // Like Web: the search toolbar sits on the surface so the filled search field stands out from it.
|
|
8198
8299
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native47.View, { style: { ...toolbarStyle, backgroundColor: colors.surface }, children: [
|
|
8199
|
-
searchable && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native47.View, { style: { width:
|
|
8300
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native47.View, { style: { width: import_tokens49.tokens.table.searchWidth, maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8200
8301
|
KjunInput,
|
|
8201
8302
|
{
|
|
8202
8303
|
size: "sm",
|
|
@@ -8214,7 +8315,7 @@ function TableToolbar({
|
|
|
8214
8315
|
}
|
|
8215
8316
|
|
|
8216
8317
|
// packages/native/src/table-grid.tsx
|
|
8217
|
-
var
|
|
8318
|
+
var import_tokens50 = require("@kjun-ui/tokens");
|
|
8218
8319
|
var import_react64 = require("react");
|
|
8219
8320
|
var import_react_native_svg7 = __toESM(require("react-native-svg"), 1);
|
|
8220
8321
|
var import_react_native48 = require("react-native");
|
|
@@ -8222,7 +8323,7 @@ var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
|
8222
8323
|
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable }) {
|
|
8223
8324
|
const m = useKjunMessages();
|
|
8224
8325
|
const { colors } = useKjunStyles();
|
|
8225
|
-
const geometry2 =
|
|
8326
|
+
const geometry2 = import_tokens50.tokens.table;
|
|
8226
8327
|
const [scroll, setScroll] = (0, import_react64.useState)({ viewport: 0, x: 0 }), fadeId = "kjun-table-fade-" + (0, import_react64.useId)().replace(/[^a-z0-9]/gi, "");
|
|
8227
8328
|
const cellPadding = geometry2.cellPadding[compact ? "compact" : "regular"];
|
|
8228
8329
|
const width = (col) => typeof col.width === "number" ? col.width : typeof col.width === "string" && /^\d+(px)?$/.test(col.width) ? parseFloat(col.width) : geometry2.columnWidth;
|
|
@@ -8255,7 +8356,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8255
8356
|
style: {
|
|
8256
8357
|
flexDirection: "row",
|
|
8257
8358
|
backgroundColor: colors.tableHeaderBg,
|
|
8258
|
-
borderBottomWidth:
|
|
8359
|
+
borderBottomWidth: import_tokens50.tokens.border.defaultWidth,
|
|
8259
8360
|
borderBottomColor: colors.border
|
|
8260
8361
|
},
|
|
8261
8362
|
children: [
|
|
@@ -8279,13 +8380,13 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8279
8380
|
onPress: () => state.sortColumn(col),
|
|
8280
8381
|
style: {
|
|
8281
8382
|
width: width(col),
|
|
8282
|
-
minHeight:
|
|
8383
|
+
minHeight: import_tokens50.tokens.native.minimumTouchTarget,
|
|
8283
8384
|
paddingVertical: geometry2.headerPadding.y,
|
|
8284
8385
|
paddingHorizontal: geometry2.headerPadding.x,
|
|
8285
8386
|
flexDirection: "row",
|
|
8286
8387
|
alignItems: "center",
|
|
8287
8388
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
8288
|
-
gap:
|
|
8389
|
+
gap: import_tokens50.tokens.dimension.value4
|
|
8289
8390
|
},
|
|
8290
8391
|
children: [
|
|
8291
8392
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
@@ -8302,7 +8403,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8302
8403
|
KjunIcon,
|
|
8303
8404
|
{
|
|
8304
8405
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
8305
|
-
size:
|
|
8406
|
+
size: import_tokens50.tokens.table.sortIconSize,
|
|
8306
8407
|
color: colors.text
|
|
8307
8408
|
}
|
|
8308
8409
|
)
|
|
@@ -8329,7 +8430,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8329
8430
|
{
|
|
8330
8431
|
type: "block",
|
|
8331
8432
|
height: geometry2.skeletonHeight,
|
|
8332
|
-
width: col.key === "actions" ?
|
|
8433
|
+
width: col.key === "actions" ? import_tokens50.tokens.table.actionColumnWidth : "75%"
|
|
8333
8434
|
}
|
|
8334
8435
|
)
|
|
8335
8436
|
},
|
|
@@ -8345,7 +8446,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8345
8446
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8346
8447
|
style: ({ pressed }) => ({
|
|
8347
8448
|
flexDirection: "row",
|
|
8348
|
-
borderBottomWidth:
|
|
8449
|
+
borderBottomWidth: import_tokens50.tokens.border.defaultWidth,
|
|
8349
8450
|
borderBottomColor: colors.border,
|
|
8350
8451
|
backgroundColor: pressed && hoverable ? colors.tableRowHover : striped && i % 2 ? colors.secondary : void 0
|
|
8351
8452
|
}),
|
|
@@ -8405,7 +8506,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8405
8506
|
)
|
|
8406
8507
|
}
|
|
8407
8508
|
),
|
|
8408
|
-
fade && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native48.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
8509
|
+
fade && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native48.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: import_tokens50.tokens.extensions.scrollFade.width }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native_svg7.default, { width: "100%", height: "100%", children: [
|
|
8409
8510
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native_svg7.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native_svg7.LinearGradient, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
8410
8511
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native_svg7.Stop, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
8411
8512
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native_svg7.Stop, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -8416,11 +8517,11 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8416
8517
|
}
|
|
8417
8518
|
|
|
8418
8519
|
// packages/native/src/table-view.tsx
|
|
8419
|
-
var
|
|
8520
|
+
var import_tokens52 = require("@kjun-ui/tokens");
|
|
8420
8521
|
var import_react_native50 = require("react-native");
|
|
8421
8522
|
|
|
8422
8523
|
// packages/native/src/table-cards.tsx
|
|
8423
|
-
var
|
|
8524
|
+
var import_tokens51 = require("@kjun-ui/tokens");
|
|
8424
8525
|
var import_react_native49 = require("react-native");
|
|
8425
8526
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
8426
8527
|
function TableCards({
|
|
@@ -8444,7 +8545,7 @@ function TableCards({
|
|
|
8444
8545
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
8445
8546
|
import_react_native49.View,
|
|
8446
8547
|
{
|
|
8447
|
-
style: { gap:
|
|
8548
|
+
style: { gap: import_tokens51.tokens.extensions.tableCard.gap, padding: import_tokens51.tokens.extensions.tableCard.listPadding, opacity: skeletonHidden ? 0 : void 0 },
|
|
8448
8549
|
"aria-hidden": skeletonHidden || void 0,
|
|
8449
8550
|
children: [
|
|
8450
8551
|
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunSkeleton, { type: "card" }, i)) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
@@ -8453,10 +8554,10 @@ function TableCards({
|
|
|
8453
8554
|
accessible: false,
|
|
8454
8555
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8455
8556
|
style: ({ pressed }) => ({
|
|
8456
|
-
padding:
|
|
8457
|
-
borderWidth:
|
|
8557
|
+
padding: import_tokens51.tokens.extensions.tableCard.padding,
|
|
8558
|
+
borderWidth: import_tokens51.tokens.border.defaultWidth,
|
|
8458
8559
|
borderColor: colors.border,
|
|
8459
|
-
borderRadius:
|
|
8560
|
+
borderRadius: import_tokens51.tokens.extensions.tableCard.radius,
|
|
8460
8561
|
backgroundColor: pressed ? colors.hover : colors.background
|
|
8461
8562
|
}),
|
|
8462
8563
|
children: [
|
|
@@ -8466,8 +8567,8 @@ function TableCards({
|
|
|
8466
8567
|
style: {
|
|
8467
8568
|
flexDirection: "row",
|
|
8468
8569
|
alignItems: "center",
|
|
8469
|
-
gap:
|
|
8470
|
-
marginBottom:
|
|
8570
|
+
gap: import_tokens51.tokens.extensions.tableCard.gap,
|
|
8571
|
+
marginBottom: import_tokens51.tokens.dimension.value8
|
|
8471
8572
|
},
|
|
8472
8573
|
children: [
|
|
8473
8574
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
@@ -8477,7 +8578,7 @@ function TableCards({
|
|
|
8477
8578
|
flexDirection: "row",
|
|
8478
8579
|
flex: 1,
|
|
8479
8580
|
alignItems: "center",
|
|
8480
|
-
gap:
|
|
8581
|
+
gap: import_tokens51.tokens.extensions.tableCard.gap,
|
|
8481
8582
|
minWidth: 0
|
|
8482
8583
|
},
|
|
8483
8584
|
children: [
|
|
@@ -8486,8 +8587,8 @@ function TableCards({
|
|
|
8486
8587
|
]
|
|
8487
8588
|
}
|
|
8488
8589
|
),
|
|
8489
|
-
badges.length ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap:
|
|
8490
|
-
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap:
|
|
8590
|
+
badges.length ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap: import_tokens51.tokens.extensions.tableCard.fieldGap }, children: badges.map((col) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { children: cell(col, row, i) }, col.key)) }) : subtitle ? cell(subtitle, row, i) : null,
|
|
8591
|
+
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap: import_tokens51.tokens.extensions.tableCard.fieldGap }, children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { children: cell(col, row, i) }, col.key)) })
|
|
8491
8592
|
]
|
|
8492
8593
|
}
|
|
8493
8594
|
),
|
|
@@ -8497,10 +8598,10 @@ function TableCards({
|
|
|
8497
8598
|
import_react_native49.View,
|
|
8498
8599
|
{
|
|
8499
8600
|
style: {
|
|
8500
|
-
borderTopWidth: index ?
|
|
8601
|
+
borderTopWidth: index ? import_tokens51.tokens.border.defaultWidth : 0,
|
|
8501
8602
|
borderTopColor: colors.border,
|
|
8502
|
-
paddingTop: index ?
|
|
8503
|
-
marginTop: index ?
|
|
8603
|
+
paddingTop: index ? import_tokens51.tokens.dimension.value12 : 0,
|
|
8604
|
+
marginTop: index ? import_tokens51.tokens.dimension.value12 : 0
|
|
8504
8605
|
},
|
|
8505
8606
|
children: [
|
|
8506
8607
|
!!section.label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
@@ -8509,7 +8610,7 @@ function TableCards({
|
|
|
8509
8610
|
style: {
|
|
8510
8611
|
...typeStyle("controlSmall"),
|
|
8511
8612
|
color: colors.textTertiary,
|
|
8512
|
-
marginBottom:
|
|
8613
|
+
marginBottom: import_tokens51.tokens.dimension.value6
|
|
8513
8614
|
},
|
|
8514
8615
|
children: section.label
|
|
8515
8616
|
}
|
|
@@ -8520,7 +8621,7 @@ function TableCards({
|
|
|
8520
8621
|
style: {
|
|
8521
8622
|
flexDirection: "row",
|
|
8522
8623
|
flexWrap: "wrap",
|
|
8523
|
-
gap: section.layout === "metrics" ?
|
|
8624
|
+
gap: section.layout === "metrics" ? import_tokens51.tokens.extensions.tableCard.gap : import_tokens51.tokens.extensions.tableCard.metricGap
|
|
8524
8625
|
},
|
|
8525
8626
|
children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
8526
8627
|
import_react_native49.View,
|
|
@@ -8529,7 +8630,7 @@ function TableCards({
|
|
|
8529
8630
|
flexBasis: col.fullWidthInCard || section.layout === "stack" ? "100%" : section.layout === "metrics" ? "30%" : "47%",
|
|
8530
8631
|
flexGrow: 1,
|
|
8531
8632
|
minWidth: 0,
|
|
8532
|
-
gap:
|
|
8633
|
+
gap: import_tokens51.tokens.extensions.tableCard.valueGap
|
|
8533
8634
|
},
|
|
8534
8635
|
children: [
|
|
8535
8636
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
@@ -8560,10 +8661,10 @@ function TableCards({
|
|
|
8560
8661
|
import_react_native49.View,
|
|
8561
8662
|
{
|
|
8562
8663
|
style: {
|
|
8563
|
-
borderTopWidth:
|
|
8664
|
+
borderTopWidth: import_tokens51.tokens.border.defaultWidth,
|
|
8564
8665
|
borderTopColor: colors.border,
|
|
8565
|
-
paddingTop:
|
|
8566
|
-
marginTop:
|
|
8666
|
+
paddingTop: import_tokens51.tokens.dimension.value8,
|
|
8667
|
+
marginTop: import_tokens51.tokens.dimension.value4
|
|
8567
8668
|
},
|
|
8568
8669
|
children: content(renderExpand == null ? void 0 : renderExpand(row, i))
|
|
8569
8670
|
}
|
|
@@ -8572,10 +8673,10 @@ function TableCards({
|
|
|
8572
8673
|
import_react_native49.View,
|
|
8573
8674
|
{
|
|
8574
8675
|
style: {
|
|
8575
|
-
borderTopWidth:
|
|
8676
|
+
borderTopWidth: import_tokens51.tokens.border.defaultWidth,
|
|
8576
8677
|
borderTopColor: colors.border,
|
|
8577
|
-
paddingTop:
|
|
8578
|
-
marginTop:
|
|
8678
|
+
paddingTop: import_tokens51.tokens.dimension.value8,
|
|
8679
|
+
marginTop: import_tokens51.tokens.dimension.value8,
|
|
8579
8680
|
alignItems: "flex-end"
|
|
8580
8681
|
},
|
|
8581
8682
|
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { alignSelf: "flex-end" }, children: cell(actions, row, i) })
|
|
@@ -8585,7 +8686,7 @@ function TableCards({
|
|
|
8585
8686
|
},
|
|
8586
8687
|
state.key(row, i)
|
|
8587
8688
|
)),
|
|
8588
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { padding:
|
|
8689
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { padding: import_tokens51.tokens.extensions.tableCard.emptyPadding, alignItems: "center" }, children: content(emptyContent || emptyText, {
|
|
8589
8690
|
color: colors.textTertiary
|
|
8590
8691
|
}) })
|
|
8591
8692
|
]
|
|
@@ -8622,7 +8723,7 @@ function KjunTable(props) {
|
|
|
8622
8723
|
onRowClick,
|
|
8623
8724
|
onRetry
|
|
8624
8725
|
} = props;
|
|
8625
|
-
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = (0, import_react_native50.useWindowDimensions)().width <
|
|
8726
|
+
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = (0, import_react_native50.useWindowDimensions)().width < import_tokens52.tokens.table.mobileBreakpoint;
|
|
8626
8727
|
const layout = tablePresentation(props, mobile);
|
|
8627
8728
|
const { card, visible } = layout;
|
|
8628
8729
|
const cell = (col, row, index, role) => {
|
|
@@ -8634,9 +8735,9 @@ function KjunTable(props) {
|
|
|
8634
8735
|
{
|
|
8635
8736
|
style: {
|
|
8636
8737
|
alignSelf: "flex-start",
|
|
8637
|
-
paddingVertical:
|
|
8638
|
-
paddingHorizontal:
|
|
8639
|
-
borderRadius:
|
|
8738
|
+
paddingVertical: import_tokens52.tokens.dimension.value2,
|
|
8739
|
+
paddingHorizontal: import_tokens52.tokens.dimension.value8,
|
|
8740
|
+
borderRadius: import_tokens52.tokens.radius.radius4,
|
|
8640
8741
|
backgroundColor: role2 ? domainColor(domainColors, role2 + "Bg") : void 0
|
|
8641
8742
|
},
|
|
8642
8743
|
children: content(body, {
|
|
@@ -8739,7 +8840,7 @@ function KpiNumberLine({ prefix, suffix, prefixGap, suffixGap, style, unitStyle,
|
|
|
8739
8840
|
}
|
|
8740
8841
|
|
|
8741
8842
|
// packages/native/src/kpi-hero.tsx
|
|
8742
|
-
var
|
|
8843
|
+
var import_tokens53 = require("@kjun-ui/tokens");
|
|
8743
8844
|
var import_react_native52 = require("react-native");
|
|
8744
8845
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
8745
8846
|
var kpiFormat = (item, value = item.value) => {
|
|
@@ -8769,8 +8870,8 @@ function KjunKpiHero(props) {
|
|
|
8769
8870
|
deltaFormatter,
|
|
8770
8871
|
renderSecondary
|
|
8771
8872
|
} = props;
|
|
8772
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = (0, import_react_native52.useWindowDimensions)().width, mobile = windowWidth <=
|
|
8773
|
-
const geometry2 =
|
|
8873
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = (0, import_react_native52.useWindowDimensions)().width, mobile = windowWidth <= import_tokens53.tokens.responsive.kpiHero, small = size === "sm", numberRole = small ? "displaySm" : mobile ? "displayMd" : "displayLg", font = typeStyle(numberRole).fontSize, unitStyle = typeStyle(small ? "numberSm" : mobile ? "numberMd" : "numberLg");
|
|
8874
|
+
const geometry2 = import_tokens53.tokens.extensions.kpiHero;
|
|
8774
8875
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8775
8876
|
const numeric2 = {
|
|
8776
8877
|
fontFamily: numericFontFamily || fontFamily,
|
|
@@ -8782,7 +8883,7 @@ function KjunKpiHero(props) {
|
|
|
8782
8883
|
);
|
|
8783
8884
|
const delta = (v, kind, style) => {
|
|
8784
8885
|
if (deltaFormatter) return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KText, { style, children: deltaFormatter(v, kind) });
|
|
8785
|
-
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap =
|
|
8886
|
+
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap = import_tokens53.tokens.extensions.financial.affixGap, number = new Intl.NumberFormat(void 0, {
|
|
8786
8887
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
8787
8888
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
8788
8889
|
}).format(Math.abs(v));
|
|
@@ -8885,11 +8986,11 @@ function KjunKpiHero(props) {
|
|
|
8885
8986
|
gap: small && mobile ? geometry2.smallMobileGap : spec.secondaryGap,
|
|
8886
8987
|
marginTop: spec.secondaryMargin,
|
|
8887
8988
|
paddingTop: spec.secondaryPadding,
|
|
8888
|
-
borderTopWidth:
|
|
8989
|
+
borderTopWidth: import_tokens53.tokens.border.defaultWidth,
|
|
8889
8990
|
borderTopColor: colors.border
|
|
8890
8991
|
},
|
|
8891
8992
|
children: secondary.map((item, i) => {
|
|
8892
|
-
const columns = mobile && !small && windowWidth <=
|
|
8993
|
+
const columns = mobile && !small && windowWidth <= import_tokens53.tokens.responsive.kpiHeroSecondary && secondary.length >= 3 ? 2 : 0;
|
|
8893
8994
|
const first = columns ? i % columns === 0 : i === 0;
|
|
8894
8995
|
const last = columns ? i % columns === columns - 1 || i === secondary.length - 1 : i === secondary.length - 1;
|
|
8895
8996
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
@@ -8900,7 +9001,7 @@ function KjunKpiHero(props) {
|
|
|
8900
9001
|
minWidth: 0,
|
|
8901
9002
|
paddingLeft: first ? 0 : geometry2.itemPadding,
|
|
8902
9003
|
paddingRight: last ? 0 : geometry2.itemPadding,
|
|
8903
|
-
borderLeftWidth: first ? 0 :
|
|
9004
|
+
borderLeftWidth: first ? 0 : import_tokens53.tokens.border.defaultWidth,
|
|
8904
9005
|
borderLeftColor: colors.border
|
|
8905
9006
|
} : { minWidth: 0, maxWidth: "100%", flexShrink: 1 },
|
|
8906
9007
|
children: [
|
|
@@ -8965,7 +9066,7 @@ function KjunKpiHero(props) {
|
|
|
8965
9066
|
}
|
|
8966
9067
|
|
|
8967
9068
|
// packages/native/src/kpi-row.tsx
|
|
8968
|
-
var
|
|
9069
|
+
var import_tokens54 = require("@kjun-ui/tokens");
|
|
8969
9070
|
var import_react65 = require("react");
|
|
8970
9071
|
var import_react_native53 = require("react-native");
|
|
8971
9072
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
@@ -8978,8 +9079,8 @@ function KjunKpiRow({
|
|
|
8978
9079
|
onItemClick,
|
|
8979
9080
|
renderValue
|
|
8980
9081
|
}) {
|
|
8981
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = (0, import_react_native53.useWindowDimensions)().width <=
|
|
8982
|
-
const geometry2 =
|
|
9082
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = (0, import_react_native53.useWindowDimensions)().width <= import_tokens54.tokens.responsive.kpiRow, small = size === "sm", summary = mobileSummary && mobile && !small;
|
|
9083
|
+
const geometry2 = import_tokens54.tokens.extensions.kpiRow;
|
|
8983
9084
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8984
9085
|
const [width, setWidth] = (0, import_react65.useState)(0);
|
|
8985
9086
|
const paddingX = summary ? geometry2.summary.paddingX : spec.paddingX;
|
|
@@ -9058,8 +9159,8 @@ function KjunKpiRow({
|
|
|
9058
9159
|
minWidth: 0,
|
|
9059
9160
|
paddingVertical: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingY : spec.itemPaddingY,
|
|
9060
9161
|
paddingHorizontal: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingX : spec.itemPaddingX,
|
|
9061
|
-
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ?
|
|
9062
|
-
borderTopWidth: mobile && !small && !summary && i >= 2 ?
|
|
9162
|
+
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ? import_tokens54.tokens.border.defaultWidth : 0 : i ? import_tokens54.tokens.border.defaultWidth : 0,
|
|
9163
|
+
borderTopWidth: mobile && !small && !summary && i >= 2 ? import_tokens54.tokens.border.defaultWidth : 0,
|
|
9063
9164
|
borderColor: colors.border,
|
|
9064
9165
|
borderRadius: item.clickable ? geometry2.itemRadius : 0,
|
|
9065
9166
|
flexDirection: sub ? "row" : "column",
|
|
@@ -9102,7 +9203,7 @@ function KjunKpiRow({
|
|
|
9102
9203
|
summary && seg.label && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9103
9204
|
KText,
|
|
9104
9205
|
{
|
|
9105
|
-
style: { ...typeStyle("caption"), marginRight: sub ?
|
|
9206
|
+
style: { ...typeStyle("caption"), marginRight: sub ? import_tokens54.tokens.dimension.value4 : 0, color: colors.textTertiary },
|
|
9106
9207
|
children: seg.label
|
|
9107
9208
|
}
|
|
9108
9209
|
),
|
|
@@ -9196,7 +9297,7 @@ function KjunKpiRow({
|
|
|
9196
9297
|
}
|
|
9197
9298
|
|
|
9198
9299
|
// packages/native/src/market-cards.tsx
|
|
9199
|
-
var
|
|
9300
|
+
var import_tokens56 = require("@kjun-ui/tokens");
|
|
9200
9301
|
var import_react_native55 = require("react-native");
|
|
9201
9302
|
|
|
9202
9303
|
// shared/package-runtime/market-cards.ts
|
|
@@ -9262,7 +9363,7 @@ function useMarketCards(props) {
|
|
|
9262
9363
|
}
|
|
9263
9364
|
|
|
9264
9365
|
// packages/native/src/market-parts.tsx
|
|
9265
|
-
var
|
|
9366
|
+
var import_tokens55 = require("@kjun-ui/tokens");
|
|
9266
9367
|
var import_react_native54 = require("react-native");
|
|
9267
9368
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
9268
9369
|
function MarketIdentity({
|
|
@@ -9272,7 +9373,7 @@ function MarketIdentity({
|
|
|
9272
9373
|
compact = false
|
|
9273
9374
|
}) {
|
|
9274
9375
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9275
|
-
const { colors } = useKjunStyles(), mobile = (0, import_react_native54.useWindowDimensions)().width <
|
|
9376
|
+
const { colors } = useKjunStyles(), mobile = (0, import_react_native54.useWindowDimensions)().width < import_tokens55.tokens.responsive.market && !table && !compact, label = (_c = (_a = props.primaryLabel) == null ? void 0 : _a.call(props, row)) != null ? _c : String((_b = getValue(row, "name")) != null ? _b : ""), meta = ((_d = props.subMeta) == null ? void 0 : _d.call(props, row)) || "", id = getValue(row, props.rowKey || "id");
|
|
9276
9377
|
const body = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
9277
9378
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
9278
9379
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_react_native54.View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
@@ -9282,7 +9383,7 @@ function MarketIdentity({
|
|
|
9282
9383
|
style: {
|
|
9283
9384
|
flexDirection: "row",
|
|
9284
9385
|
alignItems: "center",
|
|
9285
|
-
gap:
|
|
9386
|
+
gap: import_tokens55.tokens.dimension.value4,
|
|
9286
9387
|
minWidth: 0
|
|
9287
9388
|
},
|
|
9288
9389
|
children: [
|
|
@@ -9304,7 +9405,7 @@ function MarketIdentity({
|
|
|
9304
9405
|
]
|
|
9305
9406
|
}
|
|
9306
9407
|
),
|
|
9307
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native54.View, { style: { marginTop:
|
|
9408
|
+
(meta || props.renderSubMeta) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native54.View, { style: { marginTop: import_tokens55.tokens.dimension.value2 }, children: ((_i = props.renderSubMeta) == null ? void 0 : _i.call(props, row)) || /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9308
9409
|
KText,
|
|
9309
9410
|
{
|
|
9310
9411
|
numberOfLines: 1,
|
|
@@ -9366,9 +9467,9 @@ function MarketFooter({
|
|
|
9366
9467
|
flexWrap: "wrap",
|
|
9367
9468
|
alignItems: "center",
|
|
9368
9469
|
justifyContent: "space-between",
|
|
9369
|
-
gap:
|
|
9370
|
-
paddingVertical:
|
|
9371
|
-
paddingHorizontal:
|
|
9470
|
+
gap: import_tokens55.tokens.dimension.value8,
|
|
9471
|
+
paddingVertical: import_tokens55.tokens.dimension.value12,
|
|
9472
|
+
paddingHorizontal: import_tokens55.tokens.dimension.value16
|
|
9372
9473
|
},
|
|
9373
9474
|
children: [
|
|
9374
9475
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(KText, { style: { ...typeStyle("caption"), color: colors.textTertiary }, children: calculatedAt ? m.lastUpdated + (((_a = props.formatDate) == null ? void 0 : _a.call(props, calculatedAt)) || calculatedAt) : footerNote }),
|
|
@@ -9414,9 +9515,9 @@ function KjunMarketCards(props) {
|
|
|
9414
9515
|
showsHorizontalScrollIndicator: false,
|
|
9415
9516
|
contentContainerStyle: {
|
|
9416
9517
|
flexDirection: "row",
|
|
9417
|
-
gap:
|
|
9418
|
-
paddingVertical:
|
|
9419
|
-
paddingHorizontal:
|
|
9518
|
+
gap: import_tokens56.tokens.dimension.value8,
|
|
9519
|
+
paddingVertical: import_tokens56.tokens.dimension.value10,
|
|
9520
|
+
paddingHorizontal: import_tokens56.tokens.dimension.value16
|
|
9420
9521
|
},
|
|
9421
9522
|
children: state.pills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
9422
9523
|
AccessiblePressable,
|
|
@@ -9425,14 +9526,14 @@ function KjunMarketCards(props) {
|
|
|
9425
9526
|
accessibilityLabel: pill.label,
|
|
9426
9527
|
accessibilityState: { selected: state.key === pill.key },
|
|
9427
9528
|
onPress: () => state.select(pill.key),
|
|
9428
|
-
hitSlop: { top: (
|
|
9529
|
+
hitSlop: { top: (import_tokens56.tokens.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * import_tokens56.tokens.dimension.value8) / 2, bottom: (import_tokens56.tokens.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * import_tokens56.tokens.dimension.value8) / 2 },
|
|
9429
9530
|
style: {
|
|
9430
9531
|
flexDirection: "row",
|
|
9431
9532
|
alignItems: "center",
|
|
9432
|
-
gap:
|
|
9433
|
-
paddingVertical:
|
|
9434
|
-
paddingHorizontal:
|
|
9435
|
-
borderRadius:
|
|
9533
|
+
gap: import_tokens56.tokens.dimension.value4,
|
|
9534
|
+
paddingVertical: import_tokens56.tokens.dimension.value8,
|
|
9535
|
+
paddingHorizontal: import_tokens56.tokens.dimension.value16,
|
|
9536
|
+
borderRadius: import_tokens56.tokens.radius.radius9999,
|
|
9436
9537
|
backgroundColor: state.key === pill.key ? colors.brand : colors.secondary
|
|
9437
9538
|
},
|
|
9438
9539
|
children: [
|
|
@@ -9468,7 +9569,7 @@ function KjunMarketCards(props) {
|
|
|
9468
9569
|
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunListSkeleton, { variant: "compact" }),
|
|
9469
9570
|
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
9470
9571
|
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react_native55.View, { children: [
|
|
9471
|
-
state.pill && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KText, { style: { textAlign: "right", paddingHorizontal:
|
|
9572
|
+
state.pill && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KText, { style: { textAlign: "right", paddingHorizontal: import_tokens56.tokens.dimension.value16, paddingVertical: import_tokens56.tokens.dimension.value8, ...typeStyle("caption"), color: colors.textSecondary }, children: state.pill.label }),
|
|
9472
9573
|
rows.map((row, i) => {
|
|
9473
9574
|
var _a, _b, _c;
|
|
9474
9575
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
@@ -9483,22 +9584,22 @@ function KjunMarketCards(props) {
|
|
|
9483
9584
|
flexDirection: "row",
|
|
9484
9585
|
alignItems: "center",
|
|
9485
9586
|
justifyContent: "space-between",
|
|
9486
|
-
paddingVertical:
|
|
9487
|
-
paddingHorizontal:
|
|
9488
|
-
borderBottomWidth:
|
|
9587
|
+
paddingVertical: import_tokens56.tokens.dimension.value10,
|
|
9588
|
+
paddingHorizontal: import_tokens56.tokens.dimension.value16,
|
|
9589
|
+
borderBottomWidth: import_tokens56.tokens.border.defaultWidth,
|
|
9489
9590
|
borderBottomColor: colors.border,
|
|
9490
9591
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9491
9592
|
}),
|
|
9492
9593
|
children: [
|
|
9493
9594
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(MarketIdentity, { row, props, compact: true }),
|
|
9494
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_native55.View, { style: { marginLeft:
|
|
9595
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_native55.View, { style: { marginLeft: import_tokens56.tokens.dimension.value12, alignItems: "flex-end" }, children: ((_b = state.pill) == null ? void 0 : _b.format) === "sparkline" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9495
9596
|
KjunSparkline,
|
|
9496
9597
|
{
|
|
9497
9598
|
data: getValue(row, state.key) || [],
|
|
9498
|
-
width:
|
|
9499
|
-
height:
|
|
9599
|
+
width: import_tokens56.tokens.extensions.marketTable.sparklineWidth,
|
|
9600
|
+
height: import_tokens56.tokens.extensions.marketTable.sparklineHeight
|
|
9500
9601
|
}
|
|
9501
|
-
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height:
|
|
9602
|
+
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height: import_tokens56.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens56.tokens.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9502
9603
|
KjunSignedValue,
|
|
9503
9604
|
{
|
|
9504
9605
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -9506,14 +9607,14 @@ function KjunMarketCards(props) {
|
|
|
9506
9607
|
stale: !!getValue(row, "stale"),
|
|
9507
9608
|
tone: "pill"
|
|
9508
9609
|
}
|
|
9509
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height:
|
|
9610
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height: import_tokens56.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens56.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
9510
9611
|
import_react_native55.View,
|
|
9511
9612
|
{
|
|
9512
9613
|
style: {
|
|
9513
9614
|
flexDirection: "row",
|
|
9514
9615
|
alignItems: "center",
|
|
9515
9616
|
justifyContent: "flex-end",
|
|
9516
|
-
gap:
|
|
9617
|
+
gap: import_tokens56.tokens.dimension.value4
|
|
9517
9618
|
},
|
|
9518
9619
|
children: [
|
|
9519
9620
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
@@ -9550,7 +9651,7 @@ function KjunMarketCards(props) {
|
|
|
9550
9651
|
}
|
|
9551
9652
|
|
|
9552
9653
|
// packages/native/src/market-list.tsx
|
|
9553
|
-
var
|
|
9654
|
+
var import_tokens57 = require("@kjun-ui/tokens");
|
|
9554
9655
|
var import_react_native56 = require("react-native");
|
|
9555
9656
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
9556
9657
|
var changeWeight = { fontWeight: typeStyle("label").fontWeight };
|
|
@@ -9568,7 +9669,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9568
9669
|
closingPrice = false,
|
|
9569
9670
|
emptyMessage = m.noItems,
|
|
9570
9671
|
emptySubMessage = ""
|
|
9571
|
-
} = props, { colors } = useKjunStyles(), mobile = (0, import_react_native56.useWindowDimensions)().width <
|
|
9672
|
+
} = props, { colors } = useKjunStyles(), mobile = (0, import_react_native56.useWindowDimensions)().width < import_tokens57.tokens.responsive.market;
|
|
9572
9673
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react_native56.View, { children: [
|
|
9573
9674
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9574
9675
|
KjunDataState,
|
|
@@ -9594,11 +9695,11 @@ function KjunMarketSimpleList(props) {
|
|
|
9594
9695
|
flexDirection: "row",
|
|
9595
9696
|
alignItems: "center",
|
|
9596
9697
|
justifyContent: "space-between",
|
|
9597
|
-
paddingVertical: mobile ?
|
|
9598
|
-
paddingHorizontal: mobile ?
|
|
9698
|
+
paddingVertical: mobile ? import_tokens57.tokens.dimension.value14 : import_tokens57.tokens.dimension.value16,
|
|
9699
|
+
paddingHorizontal: mobile ? import_tokens57.tokens.dimension.value20 : import_tokens57.tokens.dimension.value16,
|
|
9599
9700
|
// Like Web, the minimum height belongs to the narrow layout only.
|
|
9600
|
-
minHeight: mobile ?
|
|
9601
|
-
borderBottomWidth:
|
|
9701
|
+
minHeight: mobile ? import_tokens57.tokens.extensions.marketList.minimumHeight : void 0,
|
|
9702
|
+
borderBottomWidth: import_tokens57.tokens.border.defaultWidth,
|
|
9602
9703
|
borderBottomColor: colors.border,
|
|
9603
9704
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9604
9705
|
}),
|
|
@@ -9608,8 +9709,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9608
9709
|
import_react_native56.View,
|
|
9609
9710
|
{
|
|
9610
9711
|
style: {
|
|
9611
|
-
marginLeft:
|
|
9612
|
-
minWidth: mobile ?
|
|
9712
|
+
marginLeft: import_tokens57.tokens.dimension.value12,
|
|
9713
|
+
minWidth: mobile ? import_tokens57.tokens.extensions.marketList.mobileQuoteMinimumWidth : void 0,
|
|
9613
9714
|
maxWidth: "50%",
|
|
9614
9715
|
alignItems: "flex-end"
|
|
9615
9716
|
},
|
|
@@ -9631,8 +9732,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9631
9732
|
flexWrap: "wrap",
|
|
9632
9733
|
alignItems: "center",
|
|
9633
9734
|
justifyContent: "flex-end",
|
|
9634
|
-
gap:
|
|
9635
|
-
marginTop:
|
|
9735
|
+
gap: import_tokens57.tokens.dimension.value6,
|
|
9736
|
+
marginTop: import_tokens57.tokens.dimension.value2
|
|
9636
9737
|
},
|
|
9637
9738
|
children: [
|
|
9638
9739
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
@@ -9644,7 +9745,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9644
9745
|
fetchedAt
|
|
9645
9746
|
}
|
|
9646
9747
|
)),
|
|
9647
|
-
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(KjunSkeleton, { type: "block", height:
|
|
9748
|
+
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(KjunSkeleton, { type: "block", height: import_tokens57.tokens.extensions.marketList.changeSkeletonHeight, width: import_tokens57.tokens.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9648
9749
|
KjunSignedValue,
|
|
9649
9750
|
{
|
|
9650
9751
|
value: change,
|
|
@@ -9678,7 +9779,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9678
9779
|
}
|
|
9679
9780
|
|
|
9680
9781
|
// packages/native/src/market-panel.tsx
|
|
9681
|
-
var
|
|
9782
|
+
var import_tokens58 = require("@kjun-ui/tokens");
|
|
9682
9783
|
var import_react_native57 = require("react-native");
|
|
9683
9784
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
9684
9785
|
function KjunMarketListPanel({
|
|
@@ -9692,8 +9793,8 @@ function KjunMarketListPanel({
|
|
|
9692
9793
|
import_react_native57.View,
|
|
9693
9794
|
{
|
|
9694
9795
|
style: {
|
|
9695
|
-
marginTop:
|
|
9696
|
-
borderTopWidth:
|
|
9796
|
+
marginTop: import_tokens58.tokens.dimension.value16,
|
|
9797
|
+
borderTopWidth: import_tokens58.tokens.border.defaultWidth,
|
|
9697
9798
|
borderTopColor: colors.border
|
|
9698
9799
|
},
|
|
9699
9800
|
children
|
|
@@ -9703,7 +9804,7 @@ function KjunMarketListPanel({
|
|
|
9703
9804
|
}
|
|
9704
9805
|
|
|
9705
9806
|
// packages/native/src/market-table.tsx
|
|
9706
|
-
var
|
|
9807
|
+
var import_tokens59 = require("@kjun-ui/tokens");
|
|
9707
9808
|
var import_react67 = require("react");
|
|
9708
9809
|
var import_react_native58 = require("react-native");
|
|
9709
9810
|
var import_react_native_svg8 = __toESM(require("react-native-svg"), 1);
|
|
@@ -9731,7 +9832,7 @@ function KjunMarketTable(props) {
|
|
|
9731
9832
|
const render = (row, col) => {
|
|
9732
9833
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
9733
9834
|
if (cellLoading(row, col))
|
|
9734
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(KjunSkeleton, { type: "block", height:
|
|
9835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(KjunSkeleton, { type: "block", height: import_tokens59.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens59.tokens.extensions.marketTable.valueSkeletonWidth });
|
|
9735
9836
|
if (renderCell) return content(renderCell(row, col));
|
|
9736
9837
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
9737
9838
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(MarketIdentity, { row, props, table: true });
|
|
@@ -9740,8 +9841,8 @@ function KjunMarketTable(props) {
|
|
|
9740
9841
|
KjunSparkline,
|
|
9741
9842
|
{
|
|
9742
9843
|
data: Array.isArray(value) ? value : [],
|
|
9743
|
-
width:
|
|
9744
|
-
height:
|
|
9844
|
+
width: import_tokens59.tokens.extensions.marketTable.sparklineWidth,
|
|
9845
|
+
height: import_tokens59.tokens.extensions.marketTable.sparklineHeight
|
|
9745
9846
|
}
|
|
9746
9847
|
);
|
|
9747
9848
|
if (col.type === "price")
|
|
@@ -9799,7 +9900,7 @@ function KjunMarketTable(props) {
|
|
|
9799
9900
|
onLayout: layout.onLayout,
|
|
9800
9901
|
style: {
|
|
9801
9902
|
backgroundColor: embedded ? void 0 : colors.surface,
|
|
9802
|
-
borderRadius: embedded ? 0 :
|
|
9903
|
+
borderRadius: embedded ? 0 : import_tokens59.tokens.radius.radius12
|
|
9803
9904
|
},
|
|
9804
9905
|
children: [
|
|
9805
9906
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -9839,13 +9940,13 @@ function KjunMarketTable(props) {
|
|
|
9839
9940
|
{
|
|
9840
9941
|
style: {
|
|
9841
9942
|
width: marketGeometry.actionsWidth,
|
|
9842
|
-
paddingVertical:
|
|
9843
|
-
paddingHorizontal:
|
|
9943
|
+
paddingVertical: import_tokens59.tokens.dimension.value12,
|
|
9944
|
+
paddingHorizontal: import_tokens59.tokens.dimension.value4,
|
|
9844
9945
|
flexDirection: "row",
|
|
9845
9946
|
alignItems: "center",
|
|
9846
9947
|
justifyContent: "center"
|
|
9847
9948
|
},
|
|
9848
|
-
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { style: { width: Math.max(
|
|
9949
|
+
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { style: { width: Math.max(import_tokens59.tokens.native.minimumTouchTarget, import_tokens59.tokens.extensions.iconToggle.sizes.xs), alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(KjunCollectionMark, { kind, size: "md" }) }, kind))
|
|
9849
9950
|
}
|
|
9850
9951
|
),
|
|
9851
9952
|
columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
@@ -9860,11 +9961,11 @@ function KjunMarketTable(props) {
|
|
|
9860
9961
|
},
|
|
9861
9962
|
style: {
|
|
9862
9963
|
width: layout.widths[columnIndex],
|
|
9863
|
-
padding:
|
|
9964
|
+
padding: import_tokens59.tokens.dimension.value12,
|
|
9864
9965
|
flexDirection: "row",
|
|
9865
9966
|
alignItems: "center",
|
|
9866
9967
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
9867
|
-
gap:
|
|
9968
|
+
gap: import_tokens59.tokens.dimension.value4
|
|
9868
9969
|
},
|
|
9869
9970
|
children: [
|
|
9870
9971
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -9881,7 +9982,7 @@ function KjunMarketTable(props) {
|
|
|
9881
9982
|
KjunIcon,
|
|
9882
9983
|
{
|
|
9883
9984
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
9884
|
-
size:
|
|
9985
|
+
size: import_tokens59.tokens.extensions.marketTable.sortIconSize,
|
|
9885
9986
|
color: sortKey === col.key ? colors.brand : colors.textTertiary
|
|
9886
9987
|
}
|
|
9887
9988
|
)
|
|
@@ -9916,8 +10017,8 @@ function KjunMarketTable(props) {
|
|
|
9916
10017
|
{
|
|
9917
10018
|
style: {
|
|
9918
10019
|
width: marketGeometry.actionsWidth,
|
|
9919
|
-
paddingVertical:
|
|
9920
|
-
paddingHorizontal:
|
|
10020
|
+
paddingVertical: import_tokens59.tokens.dimension.value12,
|
|
10021
|
+
paddingHorizontal: import_tokens59.tokens.dimension.value4,
|
|
9921
10022
|
flexDirection: "row",
|
|
9922
10023
|
alignItems: "center",
|
|
9923
10024
|
justifyContent: "center"
|
|
@@ -9961,8 +10062,8 @@ function KjunMarketTable(props) {
|
|
|
9961
10062
|
{
|
|
9962
10063
|
style: {
|
|
9963
10064
|
width: layout.widths[columnIndex],
|
|
9964
|
-
paddingVertical:
|
|
9965
|
-
paddingHorizontal:
|
|
10065
|
+
paddingVertical: import_tokens59.tokens.dimension.value14,
|
|
10066
|
+
paddingHorizontal: import_tokens59.tokens.dimension.value12,
|
|
9966
10067
|
justifyContent: "center",
|
|
9967
10068
|
alignItems: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : void 0
|
|
9968
10069
|
},
|
|
@@ -9988,7 +10089,7 @@ function KjunMarketTable(props) {
|
|
|
9988
10089
|
] })
|
|
9989
10090
|
}
|
|
9990
10091
|
),
|
|
9991
|
-
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
10092
|
+
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: import_tokens59.tokens.extensions.scrollFade.width }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react_native_svg8.default, { width: "100%", height: "100%", children: [
|
|
9992
10093
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native_svg8.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react_native_svg8.LinearGradient, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
9993
10094
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native_svg8.Stop, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
9994
10095
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native_svg8.Stop, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -10005,50 +10106,61 @@ function KjunMarketTable(props) {
|
|
|
10005
10106
|
}
|
|
10006
10107
|
|
|
10007
10108
|
// packages/native/src/list.tsx
|
|
10008
|
-
var
|
|
10109
|
+
var import_tokens60 = require("@kjun-ui/tokens");
|
|
10009
10110
|
var import_react68 = require("react");
|
|
10010
10111
|
var import_react_native59 = require("react-native");
|
|
10011
10112
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
10012
10113
|
var ListRowContext = (0, import_react68.createContext)({ divider: true, compact: false });
|
|
10013
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onPress }) {
|
|
10114
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress }) {
|
|
10014
10115
|
const { colors } = useKjunStyles(), { divider, compact } = (0, import_react68.useContext)(ListRowContext);
|
|
10015
10116
|
const parts = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
10016
10117
|
hasContent(leading) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { children: content(leading) }),
|
|
10017
10118
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
10018
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { ...typeStyle("label") }, children: title }),
|
|
10019
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop:
|
|
10119
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { ...typeStyle("label"), ...destructive ? { color: colors.danger } : {} }, children: title }),
|
|
10120
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop: import_tokens60.tokens.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
10020
10121
|
] }),
|
|
10021
|
-
hasContent(trailing) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
10122
|
+
hasContent(trailing) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { style: { maxWidth: "35%" }, children: content(trailing) }),
|
|
10123
|
+
chevron && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { accessible: false, importantForAccessibility: "no-hide-descendants", accessibilityElementsHidden: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens60.tokens.iconSizes.default, color: colors.textTertiary }) })
|
|
10022
10124
|
] });
|
|
10023
|
-
const style = { flex: 1, minWidth: 0, minHeight: compact ?
|
|
10024
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap:
|
|
10025
|
-
onPress || href ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccessiblePressable, { ...import_react_native59.Platform.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ?
|
|
10026
|
-
hasContent(actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { pointerEvents: disabled ? "none" : "auto", ...disabled && import_react_native59.Platform.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap:
|
|
10125
|
+
const style = { flex: 1, minWidth: 0, minHeight: compact ? import_tokens60.tokens.extensions.list.compactMinimumHeight : import_tokens60.tokens.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: import_tokens60.tokens.extensions.list.gap, padding: import_tokens60.tokens.extensions.list.padding, ...compact ? { paddingVertical: import_tokens60.tokens.extensions.list.compactPaddingY } : {} };
|
|
10126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: import_tokens60.tokens.extensions.list.gap, borderBottomWidth: divider ? import_tokens60.tokens.border.defaultWidth : 0, borderBottomColor: colors.divider }, children: [
|
|
10127
|
+
onPress || href ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccessiblePressable, { ...import_react_native59.Platform.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ? import_tokens60.tokens.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { style, children: parts }),
|
|
10128
|
+
hasContent(actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { pointerEvents: disabled ? "none" : "auto", ...disabled && import_react_native59.Platform.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: import_tokens60.tokens.extensions.list.actionsGap, paddingRight: import_tokens60.tokens.extensions.list.actionsPadding, opacity: disabled ? import_tokens60.tokens.states.opacity.disabled : 1 }, children: content(actions) })
|
|
10027
10129
|
] });
|
|
10028
10130
|
}
|
|
10029
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
10131
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
10030
10132
|
const { colors } = useKjunStyles();
|
|
10031
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { minWidth: 0, backgroundColor: colors.surface }, children: [
|
|
10032
|
-
!!(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
10133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { minWidth: 0, backgroundColor: surface ? colors.surface : "transparent" }, children: [
|
|
10134
|
+
!!(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens60.tokens.extensions.list.gap, padding: import_tokens60.tokens.extensions.list.padding }, children: [
|
|
10033
10135
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flex: 1 }, children: [
|
|
10034
10136
|
!!title && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
10035
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop:
|
|
10137
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop: import_tokens60.tokens.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
10036
10138
|
] }),
|
|
10037
10139
|
content(actions)
|
|
10038
10140
|
] }),
|
|
10039
10141
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { role: "list", accessibilityLabel: ariaLabel || title, children: import_react68.Children.toArray(children).map((row, i, rows) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ListRowContext.Provider, { value: { divider: divider && i < rows.length - 1, compact: density === "compact" }, children: row }, i)) })
|
|
10040
10142
|
] });
|
|
10041
10143
|
}
|
|
10144
|
+
function KjunListItem({ children }) {
|
|
10145
|
+
const { colors } = useKjunStyles(), { divider, compact } = (0, import_react68.useContext)(ListRowContext);
|
|
10146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { role: "listitem", style: {
|
|
10147
|
+
padding: import_tokens60.tokens.extensions.list.padding,
|
|
10148
|
+
...compact ? { paddingVertical: import_tokens60.tokens.extensions.list.compactPaddingY } : {},
|
|
10149
|
+
borderBottomWidth: divider ? import_tokens60.tokens.border.defaultWidth : 0,
|
|
10150
|
+
borderBottomColor: colors.divider,
|
|
10151
|
+
minWidth: 0
|
|
10152
|
+
}, children: content(children) });
|
|
10153
|
+
}
|
|
10042
10154
|
|
|
10043
10155
|
// packages/native/src/app-navigation.tsx
|
|
10044
|
-
var
|
|
10156
|
+
var import_tokens61 = require("@kjun-ui/tokens");
|
|
10045
10157
|
var import_react69 = require("react");
|
|
10046
10158
|
var import_react_native60 = require("react-native");
|
|
10047
10159
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10048
10160
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
10049
10161
|
const { colors } = useKjunStyles();
|
|
10050
|
-
const geometry2 =
|
|
10051
|
-
const titleInset = Math.max(0, (geometry2.controlSize -
|
|
10162
|
+
const geometry2 = import_tokens61.tokens.extensions.topNavigation;
|
|
10163
|
+
const titleInset = Math.max(0, (geometry2.controlSize - import_tokens61.tokens.typography.sectionTitle.lineHeightPx) / 2);
|
|
10052
10164
|
const wrapping = import_react_native60.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
10053
10165
|
const edgeInset = (geometry2.controlSize - geometry2.iconSize) / 2;
|
|
10054
10166
|
const [iconEdges, setIconEdges] = (0, import_react69.useState)({ leading: false, trailing: false });
|
|
@@ -10072,13 +10184,13 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
10072
10184
|
const m = useKjunMessages();
|
|
10073
10185
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
10074
10186
|
const { colors } = useKjunStyles();
|
|
10075
|
-
const geometry2 =
|
|
10187
|
+
const geometry2 = import_tokens61.tokens.extensions.bottomNavigation;
|
|
10076
10188
|
const hasIcons = items2.some((item) => item.icon);
|
|
10077
10189
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
10078
10190
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react_native60.View, { role: "navigation", accessibilityLabel: ariaLabel, style: { flexShrink: 0, flexDirection: "row", backgroundColor: colors.surface, paddingBottom: Math.max(0, safeAreaBottom) }, children: items2.map((item) => {
|
|
10079
10191
|
const selected = item.key === value;
|
|
10080
10192
|
const ink = selected ? colors.brand : colors.textSecondary;
|
|
10081
|
-
const ring =
|
|
10193
|
+
const ring = import_tokens61.tokens.border.controlWidth;
|
|
10082
10194
|
const badge = item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react_native60.View, { pointerEvents: "none", "aria-hidden": true, style: {
|
|
10083
10195
|
position: "absolute",
|
|
10084
10196
|
top: -geometry2.badgeOffset - ring,
|
|
@@ -10113,7 +10225,7 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
10113
10225
|
gap: geometry2.itemGap,
|
|
10114
10226
|
paddingHorizontal: geometry2.itemPaddingX,
|
|
10115
10227
|
paddingVertical: geometry2.itemPaddingY,
|
|
10116
|
-
opacity: item.disabled ?
|
|
10228
|
+
opacity: item.disabled ? import_tokens61.tokens.states.opacity.disabled : 1
|
|
10117
10229
|
},
|
|
10118
10230
|
children: [
|
|
10119
10231
|
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react_native60.View, { style: { width: geometry2.iconSize, height: geometry2.iconSize, flexShrink: 0 }, children: [
|
|
@@ -10134,8 +10246,8 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
10134
10246
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
10135
10247
|
const { colors } = useKjunStyles();
|
|
10136
10248
|
const [width, setWidth] = (0, import_react69.useState)(0);
|
|
10137
|
-
const geometry2 =
|
|
10138
|
-
const wide = width >=
|
|
10249
|
+
const geometry2 = import_tokens61.tokens.extensions.navigation;
|
|
10250
|
+
const wide = width >= import_tokens61.tokens.responsive.bottomAction + geometry2.padding * 2;
|
|
10139
10251
|
const wrapping = import_react_native60.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
10140
10252
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
10141
10253
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BottomActionBarContext.Provider, { value: !wide, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react_native60.View, { onLayout: (event) => setWidth(event.nativeEvent.layout.width), style: {
|
|
@@ -10157,50 +10269,51 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
10157
10269
|
// packages/native/src/media.tsx
|
|
10158
10270
|
var import_react70 = require("react");
|
|
10159
10271
|
var import_react_native61 = require("react-native");
|
|
10160
|
-
var
|
|
10272
|
+
var import_tokens62 = require("@kjun-ui/tokens");
|
|
10161
10273
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10274
|
+
var ImageBackgroundContext = (0, import_react70.createContext)(void 0);
|
|
10162
10275
|
function KjunImage({ src, source, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, onLoad, onError }) {
|
|
10163
|
-
const { colors } = useKjunStyles();
|
|
10276
|
+
const { colors } = useKjunStyles(), background = (0, import_react70.useContext)(ImageBackgroundContext);
|
|
10164
10277
|
const request = JSON.stringify(source != null ? source : src), current = (0, import_react70.useRef)({ request, version: 0 });
|
|
10165
10278
|
if (current.current.request !== request) current.current = { request, version: current.current.version + 1 };
|
|
10166
10279
|
const version = current.current.version;
|
|
10167
10280
|
const [failed, setFailed] = (0, import_react70.useState)(null);
|
|
10168
10281
|
const missing = !source && !src;
|
|
10169
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessibilityElementsHidden: decorative, importantForAccessibility: decorative ? "no-hide-descendants" : "auto", "aria-hidden": decorative || void 0, style: { width: "100%", aspectRatio: aspectRatio > 0 ? aspectRatio : 1, overflow: "hidden", backgroundColor: colors.secondary }, children: !missing && failed !== version ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.Image, { source: source != null ? source : { uri: src }, accessible: !decorative, accessibilityLabel: decorative ? void 0 : alt, resizeMode: fit, style: { position: "absolute", inset: 0, width: "100%", height: "100%" }, onLoad: () => {
|
|
10282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessibilityElementsHidden: decorative, importantForAccessibility: decorative ? "no-hide-descendants" : "auto", "aria-hidden": decorative || void 0, style: { width: "100%", aspectRatio: aspectRatio > 0 ? aspectRatio : 1, overflow: "hidden", backgroundColor: background != null ? background : colors.secondary }, children: !missing && failed !== version ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.Image, { source: source != null ? source : { uri: src }, accessible: !decorative, accessibilityLabel: decorative ? void 0 : alt, resizeMode: fit, style: { position: "absolute", inset: 0, width: "100%", height: "100%" }, onLoad: () => {
|
|
10170
10283
|
if (version === current.current.version) onLoad == null ? void 0 : onLoad();
|
|
10171
10284
|
}, onError: () => {
|
|
10172
10285
|
if (version === current.current.version) {
|
|
10173
10286
|
setFailed(version);
|
|
10174
10287
|
onError == null ? void 0 : onError();
|
|
10175
10288
|
}
|
|
10176
|
-
} }, version) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessible: !decorative, accessibilityRole: "image", accessibilityLabel: decorative ? void 0 : alt, "aria-hidden": decorative || void 0, style: { flex: 1, alignItems: "center", justifyContent: "center" }, children: content(fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunIcon, { name: "image", size:
|
|
10289
|
+
} }, version) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessible: !decorative, accessibilityRole: "image", accessibilityLabel: decorative ? void 0 : alt, "aria-hidden": decorative || void 0, style: { flex: 1, alignItems: "center", justifyContent: "center" }, children: content(fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunIcon, { name: "image", size: import_tokens62.tokens.extensions.image.fallbackIconSize, color: colors.textSecondary }), { color: colors.textSecondary, fontWeight: typeStyle("control").fontWeight, textAlign: "center" }) }) });
|
|
10177
10290
|
}
|
|
10178
|
-
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
10291
|
+
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
10179
10292
|
const m = useKjunMessages();
|
|
10180
10293
|
const { colors } = useKjunStyles(), initial = Array.from(name.trim())[0];
|
|
10181
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { style: { width:
|
|
10294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { style: { width: import_tokens62.tokens.extensions.avatar[size], height: import_tokens62.tokens.extensions.avatar[size], borderRadius: shape === "circle" ? import_tokens62.tokens.radius.radius9999 : import_tokens62.tokens.radius.radius8, overflow: "hidden", flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ImageBackgroundContext.Provider, { value: color, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunImage, { src, source, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : initial ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KText, { style: { ...typeStyle(size === "sm" ? "control" : size === "lg" ? "sectionTitle" : "input"), fontWeight: typeStyle("control").fontWeight, color: textColor != null ? textColor : colors.textSecondary }, children: initial.toLocaleUpperCase() }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunIcon, { name: "user", size: import_tokens62.tokens.extensions.avatar.fallbackIconSizes[size], color: textColor }), onLoad, onError }) }) });
|
|
10182
10295
|
}
|
|
10183
10296
|
|
|
10184
10297
|
// packages/native/src/chip.tsx
|
|
10185
10298
|
var import_react_native62 = require("react-native");
|
|
10186
|
-
var
|
|
10299
|
+
var import_tokens63 = require("@kjun-ui/tokens");
|
|
10187
10300
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10188
10301
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
10189
10302
|
const m = useKjunMessages();
|
|
10190
10303
|
const { colors } = useKjunStyles();
|
|
10191
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap:
|
|
10192
|
-
!!icon && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunIcon, { name: icon, size:
|
|
10193
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KText, { style: { ...typeStyle(
|
|
10194
|
-
removable && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width:
|
|
10304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: import_tokens63.tokens.extensions.chip.gap, minHeight: removable ? import_tokens63.tokens.extensions.chip.nativeRemoveSize : import_tokens63.tokens.extensions.chip[size], paddingVertical: removable ? 0 : import_tokens63.tokens.extensions.chip.paddingY, paddingLeft: import_tokens63.tokens.extensions.chip.paddingX, paddingRight: removable ? 0 : import_tokens63.tokens.extensions.chip.paddingX, borderRadius: import_tokens63.tokens.extensions.chip.radius, backgroundColor: colors.secondary, opacity: disabled ? import_tokens63.tokens.states.opacity.disabled : 1 }, children: [
|
|
10305
|
+
!!icon && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunIcon, { name: icon, size: import_tokens63.tokens.extensions.chip.iconSizes[size] }),
|
|
10306
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KText, { style: { ...typeStyle(import_tokens63.tokens.extensions.chip.typography[size]), flexShrink: 1, minWidth: 0 }, children: label }),
|
|
10307
|
+
removable && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width: import_tokens63.tokens.extensions.chip.nativeRemoveSize, height: import_tokens63.tokens.extensions.chip.nativeRemoveSize, borderRadius: import_tokens63.tokens.extensions.chip.radius, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunIcon, { name: "x", size: import_tokens63.tokens.extensions.chip.removeIconSizes[size] }) })
|
|
10195
10308
|
] });
|
|
10196
10309
|
}
|
|
10197
10310
|
|
|
10198
10311
|
// packages/native/src/fab.tsx
|
|
10199
|
-
var
|
|
10312
|
+
var import_tokens64 = require("@kjun-ui/tokens");
|
|
10200
10313
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10201
10314
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onPress }) {
|
|
10202
10315
|
const { colors } = useKjunStyles();
|
|
10203
|
-
const { size, inset, iconSize } =
|
|
10316
|
+
const { size, inset, iconSize } = import_tokens64.tokens.extensions.fab;
|
|
10204
10317
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10205
10318
|
AccessiblePressable,
|
|
10206
10319
|
{
|
|
@@ -10213,15 +10326,15 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10213
10326
|
position: "absolute",
|
|
10214
10327
|
right: inset,
|
|
10215
10328
|
bottom: inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom),
|
|
10216
|
-
zIndex:
|
|
10329
|
+
zIndex: import_tokens64.tokens.layers.page.navigation,
|
|
10217
10330
|
width: size,
|
|
10218
10331
|
height: size,
|
|
10219
10332
|
borderRadius: size / 2,
|
|
10220
10333
|
alignItems: "center",
|
|
10221
10334
|
justifyContent: "center",
|
|
10222
10335
|
backgroundColor: pressed ? colors.brandActive : colors.brand,
|
|
10223
|
-
opacity: disabled ?
|
|
10224
|
-
boxShadow: shadowLayers(
|
|
10336
|
+
opacity: disabled ? import_tokens64.tokens.states.opacity.disabled : 1,
|
|
10337
|
+
boxShadow: shadowLayers(import_tokens64.tokens.elevation.floating, colors)
|
|
10225
10338
|
}),
|
|
10226
10339
|
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(KjunIcon, { name: icon, size: iconSize, color: colors.onBrand })
|
|
10227
10340
|
}
|
|
@@ -10231,10 +10344,10 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10231
10344
|
// packages/native/src/range-input.tsx
|
|
10232
10345
|
var import_react71 = require("react");
|
|
10233
10346
|
var import_react_native63 = require("react-native");
|
|
10234
|
-
var
|
|
10347
|
+
var import_tokens65 = require("@kjun-ui/tokens");
|
|
10235
10348
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10236
|
-
var geometry =
|
|
10237
|
-
var targetSize =
|
|
10349
|
+
var geometry = import_tokens65.tokens.extensions.slider;
|
|
10350
|
+
var targetSize = import_tokens65.tokens.native.minimumTouchTarget;
|
|
10238
10351
|
var trackFocus = { tabIndex: -1 };
|
|
10239
10352
|
function RangeInput({
|
|
10240
10353
|
value,
|
|
@@ -10250,7 +10363,7 @@ function RangeInput({
|
|
|
10250
10363
|
}) {
|
|
10251
10364
|
const m = useKjunMessages();
|
|
10252
10365
|
const { colors, numericFontFamily, fontFamily } = useKjunStyles();
|
|
10253
|
-
const domain = (0,
|
|
10366
|
+
const domain = (0, import_tokens65.createSliderDomain)(min, max, step), values = Array.isArray(value) ? value : [value];
|
|
10254
10367
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && values.every(domain.accepts) && (values.length === 1 || values[0] <= values[1]);
|
|
10255
10368
|
const blocked = disabled || !valid;
|
|
10256
10369
|
const effectiveMax = valid ? domain.snap(max) : min;
|
|
@@ -10334,10 +10447,10 @@ function RangeInput({
|
|
|
10334
10447
|
import_react_native63.View,
|
|
10335
10448
|
{
|
|
10336
10449
|
style: {
|
|
10337
|
-
minWidth:
|
|
10450
|
+
minWidth: import_tokens65.tokens.extensions.slider.minimumWidth,
|
|
10338
10451
|
width: "100%",
|
|
10339
|
-
gap:
|
|
10340
|
-
opacity: blocked ?
|
|
10452
|
+
gap: import_tokens65.tokens.dimension.value4,
|
|
10453
|
+
opacity: blocked ? import_tokens65.tokens.states.opacity.disabled : 1
|
|
10341
10454
|
},
|
|
10342
10455
|
children: [
|
|
10343
10456
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
@@ -10347,7 +10460,7 @@ function RangeInput({
|
|
|
10347
10460
|
flexDirection: "row",
|
|
10348
10461
|
alignItems: "baseline",
|
|
10349
10462
|
justifyContent: "space-between",
|
|
10350
|
-
gap:
|
|
10463
|
+
gap: import_tokens65.tokens.dimension.value12,
|
|
10351
10464
|
minWidth: 0
|
|
10352
10465
|
},
|
|
10353
10466
|
children: [
|
|
@@ -10408,7 +10521,7 @@ function RangeInput({
|
|
|
10408
10521
|
{
|
|
10409
10522
|
style: {
|
|
10410
10523
|
height: geometry.track,
|
|
10411
|
-
borderRadius:
|
|
10524
|
+
borderRadius: import_tokens65.tokens.radius.radius9999,
|
|
10412
10525
|
backgroundColor: colors.border
|
|
10413
10526
|
}
|
|
10414
10527
|
}
|
|
@@ -10423,7 +10536,7 @@ function RangeInput({
|
|
|
10423
10536
|
position: "absolute",
|
|
10424
10537
|
top: (targetSize - geometry.track) / 2,
|
|
10425
10538
|
height: geometry.track,
|
|
10426
|
-
borderRadius:
|
|
10539
|
+
borderRadius: import_tokens65.tokens.radius.radius9999,
|
|
10427
10540
|
left: pct(values.length === 2 ? percent(values[0]) : 0),
|
|
10428
10541
|
width: pct(
|
|
10429
10542
|
percent(values[values.length - 1]) - (values.length === 2 ? percent(values[0]) : 0)
|
|
@@ -10469,7 +10582,7 @@ function RangeInput({
|
|
|
10469
10582
|
"aria-valuetext": String(number),
|
|
10470
10583
|
"aria-disabled": blocked,
|
|
10471
10584
|
onKeyDown: (event) => {
|
|
10472
|
-
const next = (0,
|
|
10585
|
+
const next = (0, import_tokens65.sliderKey)(event.key, number, min, max, step);
|
|
10473
10586
|
if (next !== null) {
|
|
10474
10587
|
event.preventDefault();
|
|
10475
10588
|
emit(index, next);
|
|
@@ -10499,14 +10612,14 @@ function RangeInput({
|
|
|
10499
10612
|
style: {
|
|
10500
10613
|
width: geometry.thumb,
|
|
10501
10614
|
height: geometry.thumb,
|
|
10502
|
-
borderRadius:
|
|
10503
|
-
borderWidth:
|
|
10615
|
+
borderRadius: import_tokens65.tokens.radius.radius9999,
|
|
10616
|
+
borderWidth: import_tokens65.tokens.border.controlWidth,
|
|
10504
10617
|
borderColor: !blocked && dragging === index ? colors.brandActive : !blocked && hovered === index ? colors.brandHover : colors.brand,
|
|
10505
10618
|
backgroundColor: colors.surface,
|
|
10506
10619
|
...import_react_native63.Platform.OS === "web" && !blocked && focused === index ? {
|
|
10507
10620
|
outlineStyle: "solid",
|
|
10508
|
-
outlineWidth:
|
|
10509
|
-
outlineOffset:
|
|
10621
|
+
outlineWidth: import_tokens65.tokens.states.focus.width,
|
|
10622
|
+
outlineOffset: import_tokens65.tokens.states.focus.choiceOffset,
|
|
10510
10623
|
outlineColor: colors.focusRing
|
|
10511
10624
|
} : {}
|
|
10512
10625
|
}
|
|
@@ -10532,7 +10645,7 @@ function KjunRangeSlider(props) {
|
|
|
10532
10645
|
// packages/native/src/quantity-stepper.tsx
|
|
10533
10646
|
var import_react72 = require("react");
|
|
10534
10647
|
var import_react_native64 = require("react-native");
|
|
10535
|
-
var
|
|
10648
|
+
var import_tokens66 = require("@kjun-ui/tokens");
|
|
10536
10649
|
|
|
10537
10650
|
// shared/package-runtime/component-icons.ts
|
|
10538
10651
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -10546,12 +10659,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10546
10659
|
const field = useKjunField();
|
|
10547
10660
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
10548
10661
|
const labelledBy = !ariaLabel && (field == null ? void 0 : field.label) && !field.labelHidden ? field.id + "-label" : void 0;
|
|
10549
|
-
const geometry2 =
|
|
10550
|
-
const buttonStyle = { width:
|
|
10551
|
-
const outer =
|
|
10662
|
+
const geometry2 = import_tokens66.tokens.extensions.compound;
|
|
10663
|
+
const buttonStyle = { width: import_tokens66.tokens.input[size].height, paddingHorizontal: 0 };
|
|
10664
|
+
const outer = import_tokens66.tokens.input[size].radius;
|
|
10552
10665
|
const decreaseStyle = { ...buttonStyle, borderRadius: 0, borderTopLeftRadius: outer, borderBottomLeftRadius: outer };
|
|
10553
10666
|
const increaseStyle = { ...buttonStyle, borderRadius: 0, borderTopRightRadius: outer, borderBottomRightRadius: outer };
|
|
10554
|
-
const domain = (0,
|
|
10667
|
+
const domain = (0, import_tokens66.createNumberDomain)({ min, max, step, precision }), valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
10555
10668
|
const surface = useFieldSurface(size, { disabled: blocked, invalid });
|
|
10556
10669
|
const [draft, setDraft] = (0, import_react72.useState)(String(value));
|
|
10557
10670
|
const inputRef = (0, import_react72.useRef)(null);
|
|
@@ -10588,7 +10701,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10588
10701
|
const key = (event) => {
|
|
10589
10702
|
var _a, _b;
|
|
10590
10703
|
if (blocked) return;
|
|
10591
|
-
const action = (0,
|
|
10704
|
+
const action = (0, import_tokens66.quantityKeyAction)(event, composing.current, dirty.current);
|
|
10592
10705
|
if (!action) return;
|
|
10593
10706
|
(_a = event.preventDefault) == null ? void 0 : _a.call(event);
|
|
10594
10707
|
if (action === "cancel") {
|
|
@@ -10636,12 +10749,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10636
10749
|
input.removeEventListener("compositionend", end);
|
|
10637
10750
|
};
|
|
10638
10751
|
}, []);
|
|
10639
|
-
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height:
|
|
10752
|
+
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: import_tokens66.tokens.input[size].height, marginTop: -import_tokens66.tokens.input[size].height / 2, borderRadius: surface.spec.radius };
|
|
10640
10753
|
const hug = import_react_native64.Platform.OS === "web" && !block ? { width: "fit-content" } : {};
|
|
10641
10754
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react_native64.View, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
|
|
10642
10755
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
|
|
10643
10756
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CompoundTarget, { square: true, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: m.decreaseQuantity, disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
|
|
10644
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 :
|
|
10757
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : import_tokens66.tokens.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
|
|
10645
10758
|
var _a;
|
|
10646
10759
|
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
10647
10760
|
}, blocked), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
@@ -10670,29 +10783,29 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10670
10783
|
},
|
|
10671
10784
|
onSubmitEditing: import_react_native64.Platform.OS === "web" ? void 0 : commit,
|
|
10672
10785
|
...import_react_native64.Platform.OS === "web" ? { "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, "aria-labelledby": labelledBy, "aria-describedby": field == null ? void 0 : field.describedBy, "aria-invalid": invalid || void 0, "aria-required": (field == null ? void 0 : field.required) || void 0 } : { onKeyPress: key },
|
|
10673
|
-
style: { width: "100%", minWidth: 0, ...surface.style, borderRadius: 0, borderTopColor: "transparent", borderBottomColor: "transparent", borderLeftColor: "transparent", borderRightColor: "transparent", backgroundColor: !blocked && (surface.active || surface.hovered) ? colors.hover : "transparent", outlineWidth: 0, color: surface.ink, fontFamily, ...inputTypeStyle(size), textAlign: "center", paddingHorizontal: surface.spec.padding -
|
|
10786
|
+
style: { width: "100%", minWidth: 0, ...surface.style, borderRadius: 0, borderTopColor: "transparent", borderBottomColor: "transparent", borderLeftColor: "transparent", borderRightColor: "transparent", backgroundColor: !blocked && (surface.active || surface.hovered) ? colors.hover : "transparent", outlineWidth: 0, color: surface.ink, fontFamily, ...inputTypeStyle(size), textAlign: "center", paddingHorizontal: surface.spec.padding - import_tokens66.tokens.border.controlWidth, paddingVertical: 0 }
|
|
10674
10787
|
}
|
|
10675
10788
|
) }),
|
|
10676
10789
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CompoundTarget, { square: true, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(KjunButton, { size, style: increaseStyle, variant: "ghost", ariaLabel: m.increaseQuantity, disabled: blocked || max !== void 0 && value >= max, onPress: () => move(1), prefixIcon: "plus" }) }),
|
|
10677
|
-
(invalid || surface.active) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ?
|
|
10790
|
+
(invalid || surface.active) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ? import_tokens66.tokens.border.controlWidth : import_tokens66.tokens.states.focus.width, borderColor: invalid ? colors.danger : colors.focusRing } })
|
|
10678
10791
|
] }) });
|
|
10679
10792
|
}
|
|
10680
10793
|
|
|
10681
10794
|
// packages/native/src/time-picker.tsx
|
|
10682
10795
|
var import_react73 = require("react");
|
|
10683
10796
|
var import_react_native65 = require("react-native");
|
|
10684
|
-
var
|
|
10797
|
+
var import_tokens67 = require("@kjun-ui/tokens");
|
|
10685
10798
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10686
10799
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
10687
10800
|
const m = useKjunMessages();
|
|
10688
10801
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
10689
|
-
const geometry2 =
|
|
10802
|
+
const geometry2 = import_tokens67.tokens.extensions.timePicker, spec = import_tokens67.tokens.input[size];
|
|
10690
10803
|
const { colors } = useKjunStyles();
|
|
10691
10804
|
const first = (0, import_react73.useRef)(null);
|
|
10692
10805
|
const [focused, setFocused] = (0, import_react73.useState)(false), [opened, setOpened] = (0, import_react73.useState)(null);
|
|
10693
10806
|
const field = useKjunField(), uid = (0, import_react73.useId)();
|
|
10694
10807
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
10695
|
-
const domain = (0, import_react73.useMemo)(() => (0,
|
|
10808
|
+
const domain = (0, import_react73.useMemo)(() => (0, import_tokens67.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]), valid = domain.valid && domain.accepts(value);
|
|
10696
10809
|
(0, import_react73.useEffect)(() => {
|
|
10697
10810
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10698
10811
|
}, [valid]);
|
|
@@ -10710,11 +10823,11 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10710
10823
|
if (typeof next === "number") change(domain.select(value, index, next));
|
|
10711
10824
|
}, onOpenChange: (open) => setOpened(open ? index : null), ariaLabel: ((field == null ? void 0 : field.label) || ariaLabel) + " " + label, placeholder: label, disabled: disabled || !valid, error, size, clearable: false, searchable: false }) }) }) })
|
|
10712
10825
|
] }, label)) }),
|
|
10713
|
-
clearable && value !== null && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { style: { marginVertical: Math.min(0, (spec.height -
|
|
10826
|
+
clearable && value !== null && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { style: { marginVertical: Math.min(0, (spec.height - import_tokens67.tokens.native.minimumTouchTarget) / 2) }, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(FieldClear, { size, label: m.clearValue(ariaLabel), disabled: disabled || !valid, onPress: () => {
|
|
10714
10827
|
var _a;
|
|
10715
10828
|
change(null);
|
|
10716
10829
|
(_a = first.current) == null ? void 0 : _a.focus();
|
|
10717
10830
|
} }) }),
|
|
10718
|
-
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ?
|
|
10831
|
+
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? import_tokens67.tokens.border.controlWidth : import_tokens67.tokens.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
10719
10832
|
] });
|
|
10720
10833
|
}
|