@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.js
CHANGED
|
@@ -2250,7 +2250,11 @@ function KjunCard({
|
|
|
2250
2250
|
border = false,
|
|
2251
2251
|
dividers = false,
|
|
2252
2252
|
children,
|
|
2253
|
-
style
|
|
2253
|
+
style,
|
|
2254
|
+
pressable = false,
|
|
2255
|
+
disabled = false,
|
|
2256
|
+
ariaLabel,
|
|
2257
|
+
onPress
|
|
2254
2258
|
}) {
|
|
2255
2259
|
const { colors } = useKjunStyles();
|
|
2256
2260
|
const id = "kjun-" + useId4().replace(/[^a-z0-9]/gi, "");
|
|
@@ -2261,7 +2265,7 @@ function KjunCard({
|
|
|
2261
2265
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
2262
2266
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
2263
2267
|
const hasBody = hasContent(children), hasFooter = hasContent(footer), hasMedia = hasContent(media);
|
|
2264
|
-
|
|
2268
|
+
const base = [
|
|
2265
2269
|
{
|
|
2266
2270
|
minWidth: 0,
|
|
2267
2271
|
borderRadius: corner,
|
|
@@ -2270,7 +2274,8 @@ function KjunCard({
|
|
|
2270
2274
|
},
|
|
2271
2275
|
Platform11.OS === "web" && surface === "glass" ? { backdropFilter: `blur(${tokens10.card.glassBlur}px)` } : {},
|
|
2272
2276
|
style
|
|
2273
|
-
]
|
|
2277
|
+
];
|
|
2278
|
+
const parts = /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
2274
2279
|
paint.gradientEnd && /* @__PURE__ */ jsx14(View9, { pointerEvents: "none", style: { position: "absolute", inset: 0, borderRadius: corner, overflow: "hidden" }, children: /* @__PURE__ */ jsxs6(Svg2, { width: "100%", height: "100%", children: [
|
|
2275
2280
|
/* @__PURE__ */ jsx14(Defs, { children: /* @__PURE__ */ jsxs6(LinearGradient, { id, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
2276
2281
|
/* @__PURE__ */ jsx14(Stop, { offset: "0", stopColor: colors[paint.background] }),
|
|
@@ -2313,6 +2318,18 @@ function KjunCard({
|
|
|
2313
2318
|
boxShadow: [{ offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: tokens10.card.borderWidth, inset: true, color: borderColor }]
|
|
2314
2319
|
} })
|
|
2315
2320
|
] });
|
|
2321
|
+
return pressable ? /* @__PURE__ */ jsx14(
|
|
2322
|
+
AccessiblePressable,
|
|
2323
|
+
{
|
|
2324
|
+
accessibilityRole: "button",
|
|
2325
|
+
accessibilityLabel: ariaLabel != null ? ariaLabel : title,
|
|
2326
|
+
accessibilityState: { disabled },
|
|
2327
|
+
disabled,
|
|
2328
|
+
onPress,
|
|
2329
|
+
style: ({ pressed }) => [base, pressed ? { transform: [{ scale: 0.99 }] } : null, disabled ? { opacity: tokens10.states.opacity.disabled } : null],
|
|
2330
|
+
children: parts
|
|
2331
|
+
}
|
|
2332
|
+
) : /* @__PURE__ */ jsx14(View9, { style: base, children: parts });
|
|
2316
2333
|
}
|
|
2317
2334
|
|
|
2318
2335
|
// shared/package-runtime/alert-live.ts
|
|
@@ -2323,7 +2340,7 @@ function alertRole(tone, live) {
|
|
|
2323
2340
|
}
|
|
2324
2341
|
|
|
2325
2342
|
// packages/native/src/display-primitives.tsx
|
|
2326
|
-
import { tokens as
|
|
2343
|
+
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2327
2344
|
import { useContext as useContext10, useEffect as useEffect5, useRef as useRef6, useState as useState10 } from "react";
|
|
2328
2345
|
import {
|
|
2329
2346
|
Animated as Animated5,
|
|
@@ -2333,6 +2350,25 @@ import {
|
|
|
2333
2350
|
View as View10
|
|
2334
2351
|
} from "react-native";
|
|
2335
2352
|
import Svg3, { Circle as Circle2, Path as Path2 } from "react-native-svg";
|
|
2353
|
+
|
|
2354
|
+
// shared/package-runtime/progress-circle.ts
|
|
2355
|
+
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
2356
|
+
function progressCircle(size, percentage) {
|
|
2357
|
+
const { size: diameter, stroke } = tokens11.extensions.progress.circle[size];
|
|
2358
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
2359
|
+
return {
|
|
2360
|
+
diameter,
|
|
2361
|
+
stroke,
|
|
2362
|
+
radius,
|
|
2363
|
+
centre: diameter / 2,
|
|
2364
|
+
circumference,
|
|
2365
|
+
offset: circumference * (1 - percentage / 100),
|
|
2366
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
2367
|
+
showsPercentage: size !== "sm"
|
|
2368
|
+
};
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
// packages/native/src/display-primitives.tsx
|
|
2336
2372
|
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2337
2373
|
var badgeLayoutKeys = /* @__PURE__ */ new Set([
|
|
2338
2374
|
"alignSelf",
|
|
@@ -2372,10 +2408,10 @@ function BadgeView({
|
|
|
2372
2408
|
dot = false,
|
|
2373
2409
|
children,
|
|
2374
2410
|
style,
|
|
2375
|
-
dotSize =
|
|
2411
|
+
dotSize = tokens12.extensions.badge.dotSize
|
|
2376
2412
|
}) {
|
|
2377
2413
|
const { colors, domainColors } = useKjunStyles();
|
|
2378
|
-
const { x, y } =
|
|
2414
|
+
const { x, y } = tokens12.extensions.badge.padding[size];
|
|
2379
2415
|
const type = typeStyle(size === "xl" ? "controlLarge" : size === "lg" ? "control" : "controlSmall");
|
|
2380
2416
|
const neutral = variant === "default" || variant === "secondary";
|
|
2381
2417
|
const financial = variant.startsWith("price-");
|
|
@@ -2393,10 +2429,10 @@ function BadgeView({
|
|
|
2393
2429
|
maxWidth: "100%",
|
|
2394
2430
|
minWidth: 0,
|
|
2395
2431
|
flexShrink: 1,
|
|
2396
|
-
gap:
|
|
2432
|
+
gap: tokens12.extensions.badge.gap,
|
|
2397
2433
|
paddingHorizontal: x,
|
|
2398
2434
|
paddingVertical: y,
|
|
2399
|
-
borderRadius:
|
|
2435
|
+
borderRadius: tokens12.extensions.badge.radius,
|
|
2400
2436
|
backgroundColor: background
|
|
2401
2437
|
},
|
|
2402
2438
|
inner
|
|
@@ -2434,7 +2470,7 @@ function KjunEmpty({
|
|
|
2434
2470
|
const m = useKjunMessages();
|
|
2435
2471
|
text != null ? text : text = m.noData;
|
|
2436
2472
|
const { colors } = useKjunStyles();
|
|
2437
|
-
const spec =
|
|
2473
|
+
const spec = tokens12.extensions.empty;
|
|
2438
2474
|
const stateContent = useContext10(DataStateContentContext);
|
|
2439
2475
|
return /* @__PURE__ */ jsxs7(
|
|
2440
2476
|
View10,
|
|
@@ -2442,7 +2478,7 @@ function KjunEmpty({
|
|
|
2442
2478
|
style: {
|
|
2443
2479
|
alignItems: "center",
|
|
2444
2480
|
justifyContent: "center",
|
|
2445
|
-
paddingVertical: stateContent === "empty" ? 0 :
|
|
2481
|
+
paddingVertical: stateContent === "empty" ? 0 : tokens12.dimension.value32
|
|
2446
2482
|
},
|
|
2447
2483
|
children: [
|
|
2448
2484
|
!!icon && /* @__PURE__ */ jsx15(View10, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ jsx15(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
@@ -2475,7 +2511,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2475
2511
|
const loop = Animated5.loop(
|
|
2476
2512
|
Animated5.timing(rotation, {
|
|
2477
2513
|
toValue: 1,
|
|
2478
|
-
duration:
|
|
2514
|
+
duration: tokens12.motion.spin,
|
|
2479
2515
|
easing: Easing3.linear,
|
|
2480
2516
|
useNativeDriver: Platform12.OS !== "web"
|
|
2481
2517
|
})
|
|
@@ -2486,8 +2522,8 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2486
2522
|
rotation.setValue(0);
|
|
2487
2523
|
};
|
|
2488
2524
|
}, [reduced, rotation]);
|
|
2489
|
-
const dimension =
|
|
2490
|
-
const stroke =
|
|
2525
|
+
const dimension = tokens12.extensions.spinner.sizes[size];
|
|
2526
|
+
const stroke = tokens12.extensions.spinner.strokeWidths[size] * 24 / dimension;
|
|
2491
2527
|
return /* @__PURE__ */ jsxs7(
|
|
2492
2528
|
View10,
|
|
2493
2529
|
{
|
|
@@ -2541,7 +2577,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2541
2577
|
)
|
|
2542
2578
|
}
|
|
2543
2579
|
),
|
|
2544
|
-
!!text && /* @__PURE__ */ jsx15(KText, { style: { marginLeft:
|
|
2580
|
+
!!text && /* @__PURE__ */ jsx15(KText, { style: { marginLeft: tokens12.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2545
2581
|
]
|
|
2546
2582
|
}
|
|
2547
2583
|
);
|
|
@@ -2562,8 +2598,8 @@ function KjunAlert({
|
|
|
2562
2598
|
const [visible, setVisible] = useState10(true);
|
|
2563
2599
|
if (!visible) return null;
|
|
2564
2600
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
2565
|
-
const geometry2 =
|
|
2566
|
-
const lineHeight =
|
|
2601
|
+
const geometry2 = tokens12.extensions.alert;
|
|
2602
|
+
const lineHeight = tokens12.typography[small ? "controlSmall" : "control"].lineHeightPx;
|
|
2567
2603
|
const titled = hasContent(title);
|
|
2568
2604
|
const closeSize = small ? geometry2.sm.closeSize : geometry2.closeSize;
|
|
2569
2605
|
const pick = (suffix) => tone === "primary" ? suffix === "Bg" ? colors.brandSubtleBg : suffix === "Light" ? colors.brandLight : colors.brand : colors[tone + suffix];
|
|
@@ -2574,11 +2610,11 @@ function KjunAlert({
|
|
|
2574
2610
|
style: {
|
|
2575
2611
|
flexDirection: "row",
|
|
2576
2612
|
alignItems: "flex-start",
|
|
2577
|
-
gap:
|
|
2578
|
-
borderWidth:
|
|
2579
|
-
borderRadius:
|
|
2580
|
-
paddingVertical:
|
|
2581
|
-
paddingHorizontal:
|
|
2613
|
+
gap: tokens12.extensions.alert[small ? "sm" : "md"].gap,
|
|
2614
|
+
borderWidth: tokens12.border.defaultWidth,
|
|
2615
|
+
borderRadius: tokens12.extensions.alert.radius,
|
|
2616
|
+
paddingVertical: tokens12.extensions.alert[small ? "sm" : "md"].paddingY,
|
|
2617
|
+
paddingHorizontal: tokens12.extensions.alert[small ? "sm" : "md"].paddingX,
|
|
2582
2618
|
backgroundColor: pick("Bg"),
|
|
2583
2619
|
borderColor: pick("Light")
|
|
2584
2620
|
},
|
|
@@ -2593,7 +2629,7 @@ function KjunAlert({
|
|
|
2593
2629
|
warning: "alert-triangle",
|
|
2594
2630
|
danger: "alert-circle"
|
|
2595
2631
|
}[tone],
|
|
2596
|
-
size:
|
|
2632
|
+
size: tokens12.extensions.alert.iconSizes[small ? "sm" : "md"],
|
|
2597
2633
|
color: pick("Accent")
|
|
2598
2634
|
}
|
|
2599
2635
|
) }),
|
|
@@ -2610,7 +2646,7 @@ function KjunAlert({
|
|
|
2610
2646
|
{
|
|
2611
2647
|
accessibilityRole: "button",
|
|
2612
2648
|
accessibilityLabel: m.close,
|
|
2613
|
-
hitSlop: Math.max(0, (
|
|
2649
|
+
hitSlop: Math.max(0, (tokens12.native.minimumTouchTarget - closeSize) / 2),
|
|
2614
2650
|
style: ({ pressed, hovered }) => ({
|
|
2615
2651
|
width: closeSize,
|
|
2616
2652
|
height: closeSize,
|
|
@@ -2648,11 +2684,58 @@ function KjunProgress({
|
|
|
2648
2684
|
variant = "primary",
|
|
2649
2685
|
showLabel = false,
|
|
2650
2686
|
label,
|
|
2651
|
-
subLabel
|
|
2687
|
+
subLabel,
|
|
2688
|
+
shape = "bar"
|
|
2652
2689
|
}) {
|
|
2653
2690
|
const m = useKjunMessages();
|
|
2654
|
-
const { colors } = useKjunStyles();
|
|
2691
|
+
const { colors, numericFontFamily, fontFamily } = useKjunStyles();
|
|
2655
2692
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2693
|
+
const name = typeof label === "string" ? label : m.progress, color = variant === "primary" ? colors.brand : colors[variant];
|
|
2694
|
+
const semantics = {
|
|
2695
|
+
accessibilityRole: "progressbar",
|
|
2696
|
+
accessibilityLabel: name,
|
|
2697
|
+
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2698
|
+
"aria-valuemin": 0,
|
|
2699
|
+
"aria-valuemax": 100,
|
|
2700
|
+
"aria-valuenow": percentage
|
|
2701
|
+
};
|
|
2702
|
+
if (shape === "circle") {
|
|
2703
|
+
const c = progressCircle(size, percentage);
|
|
2704
|
+
return /* @__PURE__ */ jsxs7(View10, { style: { alignSelf: "flex-start", alignItems: "center" }, children: [
|
|
2705
|
+
/* @__PURE__ */ jsxs7(View10, { ...semantics, style: { width: c.diameter, height: c.diameter, alignItems: "center", justifyContent: "center" }, children: [
|
|
2706
|
+
/* @__PURE__ */ jsxs7(Svg3, { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, style: StyleSheet4.absoluteFill, children: [
|
|
2707
|
+
/* @__PURE__ */ jsx15(Circle2, { cx: c.centre, cy: c.centre, r: c.radius, stroke: colors.secondary, strokeWidth: c.stroke, fill: "none" }),
|
|
2708
|
+
percentage > 0 && /* @__PURE__ */ jsx15(
|
|
2709
|
+
Circle2,
|
|
2710
|
+
{
|
|
2711
|
+
cx: c.centre,
|
|
2712
|
+
cy: c.centre,
|
|
2713
|
+
r: c.radius,
|
|
2714
|
+
stroke: color,
|
|
2715
|
+
strokeWidth: c.stroke,
|
|
2716
|
+
fill: "none",
|
|
2717
|
+
strokeLinecap: "round",
|
|
2718
|
+
strokeDasharray: c.circumference,
|
|
2719
|
+
strokeDashoffset: c.offset,
|
|
2720
|
+
rotation: -90,
|
|
2721
|
+
origin: `${c.centre}, ${c.centre}`
|
|
2722
|
+
}
|
|
2723
|
+
)
|
|
2724
|
+
] }),
|
|
2725
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ jsxs7(KText, { style: {
|
|
2726
|
+
...typeStyle(size === "lg" ? "numberMd" : "meta"),
|
|
2727
|
+
fontFamily: numericFontFamily || fontFamily,
|
|
2728
|
+
fontVariant: ["tabular-nums"],
|
|
2729
|
+
color: colors.text
|
|
2730
|
+
}, children: [
|
|
2731
|
+
percentage,
|
|
2732
|
+
"%"
|
|
2733
|
+
] })
|
|
2734
|
+
] }),
|
|
2735
|
+
content(label, { ...typeStyle("caption"), marginTop: tokens12.dimension.value8, color: colors.textSecondary, textAlign: "center" }),
|
|
2736
|
+
content(subLabel, { ...typeStyle("caption"), marginTop: tokens12.dimension.value4, color: colors.textTertiary, textAlign: "center" })
|
|
2737
|
+
] });
|
|
2738
|
+
}
|
|
2656
2739
|
return /* @__PURE__ */ jsxs7(View10, { children: [
|
|
2657
2740
|
!!(label || showLabel) && /* @__PURE__ */ jsxs7(
|
|
2658
2741
|
View10,
|
|
@@ -2660,7 +2743,7 @@ function KjunProgress({
|
|
|
2660
2743
|
style: {
|
|
2661
2744
|
flexDirection: "row",
|
|
2662
2745
|
justifyContent: "space-between",
|
|
2663
|
-
marginBottom:
|
|
2746
|
+
marginBottom: tokens12.dimension.value8
|
|
2664
2747
|
},
|
|
2665
2748
|
children: [
|
|
2666
2749
|
content(label, {
|
|
@@ -2686,13 +2769,11 @@ function KjunProgress({
|
|
|
2686
2769
|
/* @__PURE__ */ jsx15(
|
|
2687
2770
|
View10,
|
|
2688
2771
|
{
|
|
2689
|
-
|
|
2690
|
-
accessibilityLabel: typeof label === "string" ? label : m.progress,
|
|
2691
|
-
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2772
|
+
...semantics,
|
|
2692
2773
|
style: {
|
|
2693
|
-
height:
|
|
2774
|
+
height: tokens12.extensions.progress.heights[size],
|
|
2694
2775
|
backgroundColor: colors.secondary,
|
|
2695
|
-
borderRadius:
|
|
2776
|
+
borderRadius: tokens12.radius.radius9999,
|
|
2696
2777
|
overflow: "hidden"
|
|
2697
2778
|
},
|
|
2698
2779
|
children: /* @__PURE__ */ jsx15(
|
|
@@ -2701,8 +2782,8 @@ function KjunProgress({
|
|
|
2701
2782
|
style: {
|
|
2702
2783
|
width: `${percentage}%`,
|
|
2703
2784
|
height: "100%",
|
|
2704
|
-
borderRadius:
|
|
2705
|
-
backgroundColor:
|
|
2785
|
+
borderRadius: tokens12.radius.radius9999,
|
|
2786
|
+
backgroundColor: color
|
|
2706
2787
|
}
|
|
2707
2788
|
}
|
|
2708
2789
|
)
|
|
@@ -2710,14 +2791,14 @@ function KjunProgress({
|
|
|
2710
2791
|
),
|
|
2711
2792
|
content(subLabel, {
|
|
2712
2793
|
...typeStyle("caption"),
|
|
2713
|
-
marginTop:
|
|
2794
|
+
marginTop: tokens12.dimension.value4,
|
|
2714
2795
|
color: colors.textTertiary
|
|
2715
2796
|
})
|
|
2716
2797
|
] });
|
|
2717
2798
|
}
|
|
2718
2799
|
|
|
2719
2800
|
// packages/native/src/skeleton-base.tsx
|
|
2720
|
-
import { tokens as
|
|
2801
|
+
import { tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2721
2802
|
import { useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
2722
2803
|
import {
|
|
2723
2804
|
Animated as Animated6,
|
|
@@ -2740,12 +2821,12 @@ function KjunSkeleton({
|
|
|
2740
2821
|
Animated6.sequence([
|
|
2741
2822
|
Animated6.timing(opacity, {
|
|
2742
2823
|
toValue: 0.6,
|
|
2743
|
-
duration:
|
|
2824
|
+
duration: tokens13.motion.shimmer / 2,
|
|
2744
2825
|
useNativeDriver: false
|
|
2745
2826
|
}),
|
|
2746
2827
|
Animated6.timing(opacity, {
|
|
2747
2828
|
toValue: 1,
|
|
2748
|
-
duration:
|
|
2829
|
+
duration: tokens13.motion.shimmer / 2,
|
|
2749
2830
|
useNativeDriver: false
|
|
2750
2831
|
})
|
|
2751
2832
|
])
|
|
@@ -2764,18 +2845,18 @@ function KjunSkeleton({
|
|
|
2764
2845
|
width: w,
|
|
2765
2846
|
height: h,
|
|
2766
2847
|
backgroundColor: shimmer,
|
|
2767
|
-
borderRadius:
|
|
2848
|
+
borderRadius: tokens13.extensions.skeleton.lineRadius,
|
|
2768
2849
|
...extra
|
|
2769
2850
|
}
|
|
2770
2851
|
}
|
|
2771
2852
|
);
|
|
2772
2853
|
const count = (n) => Array.from({ length: Math.max(0, Math.floor(n)) }, (_, i) => i + 1);
|
|
2773
|
-
const line = (w, key, h =
|
|
2854
|
+
const line = (w, key, h = tokens13.extensions.skeleton.lineHeights.md) => /* @__PURE__ */ jsx16(View11, { style: { marginBottom: key === rows ? 0 : tokens13.extensions.skeleton.gap }, children: block(w, h) }, key);
|
|
2774
2855
|
const frame = {
|
|
2775
|
-
padding:
|
|
2776
|
-
borderWidth:
|
|
2856
|
+
padding: tokens13.extensions.skeleton.padding,
|
|
2857
|
+
borderWidth: tokens13.border.defaultWidth,
|
|
2777
2858
|
borderColor: colors.border,
|
|
2778
|
-
borderRadius:
|
|
2859
|
+
borderRadius: tokens13.extensions.skeleton.radius,
|
|
2779
2860
|
backgroundColor: colors.background
|
|
2780
2861
|
};
|
|
2781
2862
|
return /* @__PURE__ */ jsxs8(
|
|
@@ -2791,7 +2872,7 @@ function KjunSkeleton({
|
|
|
2791
2872
|
i
|
|
2792
2873
|
)
|
|
2793
2874
|
),
|
|
2794
|
-
type === "avatar" && block(width ||
|
|
2875
|
+
type === "avatar" && block(width || tokens13.extensions.skeleton.avatarSize, height || tokens13.extensions.skeleton.avatarSize, { borderRadius: rounded ? tokens13.radius.radius9999 : tokens13.extensions.skeleton.blockRadius }),
|
|
2795
2876
|
type === "card" && /* @__PURE__ */ jsxs8(View11, { style: frame, children: [
|
|
2796
2877
|
/* @__PURE__ */ jsxs8(
|
|
2797
2878
|
View11,
|
|
@@ -2799,19 +2880,19 @@ function KjunSkeleton({
|
|
|
2799
2880
|
style: {
|
|
2800
2881
|
flexDirection: "row",
|
|
2801
2882
|
alignItems: "center",
|
|
2802
|
-
gap:
|
|
2803
|
-
marginBottom:
|
|
2883
|
+
gap: tokens13.extensions.skeleton.gap,
|
|
2884
|
+
marginBottom: tokens13.dimension.value16
|
|
2804
2885
|
},
|
|
2805
2886
|
children: [
|
|
2806
|
-
block(
|
|
2807
|
-
/* @__PURE__ */ jsxs8(View11, { style: { flex: 1, gap:
|
|
2887
|
+
block(tokens13.extensions.skeleton.cardAvatarSize, tokens13.extensions.skeleton.cardAvatarSize, { borderRadius: tokens13.radius.radius9999 }),
|
|
2888
|
+
/* @__PURE__ */ jsxs8(View11, { style: { flex: 1, gap: tokens13.dimension.value8 }, children: [
|
|
2808
2889
|
block("60%"),
|
|
2809
|
-
block("40%",
|
|
2890
|
+
block("40%", tokens13.extensions.skeleton.lineHeights.sm)
|
|
2810
2891
|
] })
|
|
2811
2892
|
]
|
|
2812
2893
|
}
|
|
2813
2894
|
),
|
|
2814
|
-
/* @__PURE__ */ jsxs8(View11, { style: { gap:
|
|
2895
|
+
/* @__PURE__ */ jsxs8(View11, { style: { gap: tokens13.dimension.value10 }, children: [
|
|
2815
2896
|
block("100%"),
|
|
2816
2897
|
block("80%"),
|
|
2817
2898
|
block("60%")
|
|
@@ -2821,9 +2902,9 @@ function KjunSkeleton({
|
|
|
2821
2902
|
View11,
|
|
2822
2903
|
{
|
|
2823
2904
|
style: {
|
|
2824
|
-
borderWidth:
|
|
2905
|
+
borderWidth: tokens13.border.defaultWidth,
|
|
2825
2906
|
borderColor: colors.border,
|
|
2826
|
-
borderRadius:
|
|
2907
|
+
borderRadius: tokens13.extensions.skeleton.blockRadius,
|
|
2827
2908
|
overflow: "hidden"
|
|
2828
2909
|
},
|
|
2829
2910
|
children: [0, ...count(rows)].map((row) => /* @__PURE__ */ jsx16(
|
|
@@ -2832,7 +2913,7 @@ function KjunSkeleton({
|
|
|
2832
2913
|
style: {
|
|
2833
2914
|
flexDirection: "row",
|
|
2834
2915
|
backgroundColor: row === 0 ? colors.secondary : void 0,
|
|
2835
|
-
borderBottomWidth: row === rows ? 0 :
|
|
2916
|
+
borderBottomWidth: row === rows ? 0 : tokens13.border.defaultWidth,
|
|
2836
2917
|
borderBottomColor: colors.border
|
|
2837
2918
|
},
|
|
2838
2919
|
children: count(columns).map((col) => /* @__PURE__ */ jsx16(
|
|
@@ -2840,8 +2921,8 @@ function KjunSkeleton({
|
|
|
2840
2921
|
{
|
|
2841
2922
|
style: {
|
|
2842
2923
|
flex: 1,
|
|
2843
|
-
paddingVertical:
|
|
2844
|
-
paddingHorizontal:
|
|
2924
|
+
paddingVertical: tokens13.dimension.value12,
|
|
2925
|
+
paddingHorizontal: tokens13.dimension.value16
|
|
2845
2926
|
},
|
|
2846
2927
|
children: block(
|
|
2847
2928
|
row === 0 ? "70%" : [
|
|
@@ -2851,7 +2932,7 @@ function KjunSkeleton({
|
|
|
2851
2932
|
"75%",
|
|
2852
2933
|
"85%"
|
|
2853
2934
|
][(row + col) % 5],
|
|
2854
|
-
|
|
2935
|
+
tokens13.extensions.skeleton.tableLineHeight
|
|
2855
2936
|
)
|
|
2856
2937
|
},
|
|
2857
2938
|
col
|
|
@@ -2873,16 +2954,16 @@ function KjunSkeleton({
|
|
|
2873
2954
|
}
|
|
2874
2955
|
],
|
|
2875
2956
|
children: [
|
|
2876
|
-
/* @__PURE__ */ jsxs8(View11, { style: { flex: 1, gap:
|
|
2877
|
-
block("40%",
|
|
2878
|
-
block("60%",
|
|
2879
|
-
block("30%",
|
|
2957
|
+
/* @__PURE__ */ jsxs8(View11, { style: { flex: 1, gap: tokens13.dimension.value8 }, children: [
|
|
2958
|
+
block("40%", tokens13.extensions.skeleton.lineHeights.sm),
|
|
2959
|
+
block("60%", tokens13.extensions.skeleton.lineHeights.lg),
|
|
2960
|
+
block("30%", tokens13.extensions.skeleton.lineHeights.sm)
|
|
2880
2961
|
] }),
|
|
2881
|
-
block(
|
|
2962
|
+
block(tokens13.extensions.skeleton.statWidth, tokens13.extensions.skeleton.statHeight)
|
|
2882
2963
|
]
|
|
2883
2964
|
}
|
|
2884
2965
|
),
|
|
2885
|
-
type === "block" && block(width || "100%", height != null ? height :
|
|
2966
|
+
type === "block" && block(width || "100%", height != null ? height : tokens13.extensions.skeleton.blockHeight, { borderRadius: tokens13.extensions.skeleton.blockRadius })
|
|
2886
2967
|
]
|
|
2887
2968
|
}
|
|
2888
2969
|
);
|
|
@@ -2891,7 +2972,7 @@ function KjunSkeleton({
|
|
|
2891
2972
|
// packages/native/src/layout-primitives.tsx
|
|
2892
2973
|
import { Children as Children2, Fragment as Fragment5, cloneElement as cloneElement2, isValidElement as isValidElement3 } from "react";
|
|
2893
2974
|
import { View as View12 } from "react-native";
|
|
2894
|
-
import { tokens as
|
|
2975
|
+
import { tokens as tokens14 } from "@kjun-ui/tokens";
|
|
2895
2976
|
|
|
2896
2977
|
// shared/package-runtime/layout-primitives.ts
|
|
2897
2978
|
var titleVariants = ["pageTitle", "sectionTitle", "cardTitle"];
|
|
@@ -2900,7 +2981,17 @@ var isNumericVariant = (variant) => numeric.test(variant);
|
|
|
2900
2981
|
|
|
2901
2982
|
// packages/native/src/layout-primitives.tsx
|
|
2902
2983
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2903
|
-
var toneRole = {
|
|
2984
|
+
var toneRole = {
|
|
2985
|
+
default: "text",
|
|
2986
|
+
secondary: "textSecondary",
|
|
2987
|
+
tertiary: "textTertiary",
|
|
2988
|
+
disabled: "textDisabled",
|
|
2989
|
+
brand: "brand",
|
|
2990
|
+
danger: "danger",
|
|
2991
|
+
success: "success",
|
|
2992
|
+
warning: "warning",
|
|
2993
|
+
inverse: "onBrand"
|
|
2994
|
+
};
|
|
2904
2995
|
var textAlign = { start: "left", center: "center", end: "right" };
|
|
2905
2996
|
function KjunText({ variant = "body", tone = "default", align, maxLines, style, children }) {
|
|
2906
2997
|
const { colors, fontFamily, numericFontFamily } = useKjunStyles();
|
|
@@ -2928,46 +3019,51 @@ function flatten(children, path = "") {
|
|
|
2928
3019
|
return isValidElement3(child) && child.type === Fragment5 ? flatten(child.props.children, `${key}.`) : [[key, child]];
|
|
2929
3020
|
});
|
|
2930
3021
|
}
|
|
2931
|
-
function items(children) {
|
|
3022
|
+
function items(children, childAlign) {
|
|
2932
3023
|
return flatten(children).map(([key, child]) => {
|
|
2933
3024
|
if (typeof child === "string" || typeof child === "number") return /* @__PURE__ */ jsx17(KText, { children: child }, key);
|
|
2934
3025
|
if (isValidElement3(child) && child.type === KjunFormGroup) {
|
|
2935
3026
|
const group = child;
|
|
2936
3027
|
return cloneElement2(group, { key, style: [{ marginBottom: 0 }, group.props.style] });
|
|
2937
3028
|
}
|
|
3029
|
+
if (childAlign && isValidElement3(child) && (child.type === KjunButton || child.type === KjunBadge)) {
|
|
3030
|
+
const control = child;
|
|
3031
|
+
return cloneElement2(control, { key, style: [{ alignSelf: childAlign }, control.props.style] });
|
|
3032
|
+
}
|
|
2938
3033
|
return isValidElement3(child) ? cloneElement2(child, { key }) : child;
|
|
2939
3034
|
});
|
|
2940
3035
|
}
|
|
3036
|
+
var followed = (align) => align && align !== "stretch" ? crossAxis[align] : void 0;
|
|
2941
3037
|
var stackGap = {
|
|
2942
3038
|
none: 0,
|
|
2943
|
-
sm:
|
|
2944
|
-
md:
|
|
2945
|
-
lg:
|
|
2946
|
-
"section-sm":
|
|
2947
|
-
"section-md":
|
|
2948
|
-
"section-lg":
|
|
3039
|
+
sm: tokens14.space.stack.sm,
|
|
3040
|
+
md: tokens14.space.stack.md,
|
|
3041
|
+
lg: tokens14.space.stack.lg,
|
|
3042
|
+
"section-sm": tokens14.space.section.sm,
|
|
3043
|
+
"section-md": tokens14.space.section.md,
|
|
3044
|
+
"section-lg": tokens14.space.section.lg
|
|
2949
3045
|
};
|
|
2950
3046
|
var inlineGap = {
|
|
2951
3047
|
none: 0,
|
|
2952
|
-
xs:
|
|
2953
|
-
sm:
|
|
2954
|
-
md:
|
|
2955
|
-
lg:
|
|
3048
|
+
xs: tokens14.space.inline.xs,
|
|
3049
|
+
sm: tokens14.space.inline.sm,
|
|
3050
|
+
md: tokens14.space.inline.md,
|
|
3051
|
+
lg: tokens14.space.inline.lg
|
|
2956
3052
|
};
|
|
2957
3053
|
var crossAxis = { stretch: "stretch", start: "flex-start", center: "center", end: "flex-end", baseline: "baseline" };
|
|
2958
3054
|
var mainAxis = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
|
|
2959
|
-
function KjunStack({ gap = "md", align
|
|
2960
|
-
return /* @__PURE__ */ jsx17(View12, { style: [{ flexDirection: "column", alignItems: crossAxis[align], gap: stackGap[gap], minWidth: 0 }, style], children: items(children) });
|
|
3055
|
+
function KjunStack({ gap = "md", align, style, children }) {
|
|
3056
|
+
return /* @__PURE__ */ jsx17(View12, { style: [{ flexDirection: "column", alignItems: crossAxis[align != null ? align : "stretch"], gap: stackGap[gap], minWidth: 0 }, style], children: items(children, followed(align)) });
|
|
2961
3057
|
}
|
|
2962
|
-
function KjunInline({ gap = "sm", align
|
|
3058
|
+
function KjunInline({ gap = "sm", align, justify = "start", wrap = true, style, children }) {
|
|
2963
3059
|
return /* @__PURE__ */ jsx17(View12, { style: [{
|
|
2964
3060
|
flexDirection: "row",
|
|
2965
3061
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
2966
|
-
alignItems: crossAxis[align],
|
|
3062
|
+
alignItems: crossAxis[align != null ? align : "center"],
|
|
2967
3063
|
justifyContent: mainAxis[justify],
|
|
2968
3064
|
gap: inlineGap[gap],
|
|
2969
3065
|
minWidth: 0
|
|
2970
|
-
}, style], children: items(children) });
|
|
3066
|
+
}, style], children: items(children, followed(align)) });
|
|
2971
3067
|
}
|
|
2972
3068
|
|
|
2973
3069
|
// shared/package-runtime/feedback-dialog.ts
|
|
@@ -3019,7 +3115,7 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
3019
3115
|
}
|
|
3020
3116
|
|
|
3021
3117
|
// shared/package-runtime/feedback-motion.ts
|
|
3022
|
-
import { tokens as
|
|
3118
|
+
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
3023
3119
|
import { useLayoutEffect as useLayoutEffect6, useRef as useRef9, useState as useState12 } from "react";
|
|
3024
3120
|
function usePresentedToasts(toasts, reduced) {
|
|
3025
3121
|
const [items2, setItems] = useState12([]);
|
|
@@ -3037,7 +3133,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
3037
3133
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
3038
3134
|
removals.current.delete(item.toast.id);
|
|
3039
3135
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
3040
|
-
},
|
|
3136
|
+
}, tokens15.motion.toastExit));
|
|
3041
3137
|
}
|
|
3042
3138
|
return next;
|
|
3043
3139
|
});
|
|
@@ -3059,7 +3155,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
3059
3155
|
setRequest(current);
|
|
3060
3156
|
return;
|
|
3061
3157
|
}
|
|
3062
|
-
const timer = setTimeout(() => setRequest(current),
|
|
3158
|
+
const timer = setTimeout(() => setRequest(current), tokens15.motion.layerExit);
|
|
3063
3159
|
return () => clearTimeout(timer);
|
|
3064
3160
|
}, [current, request, reduced]);
|
|
3065
3161
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -3075,7 +3171,7 @@ function useOptionalKjunFeedback() {
|
|
|
3075
3171
|
// packages/native/src/toast-stack.tsx
|
|
3076
3172
|
import { useLayoutEffect as useLayoutEffect8, useRef as useRef12 } from "react";
|
|
3077
3173
|
import { Animated as Animated8, Platform as Platform13, View as View14 } from "react-native";
|
|
3078
|
-
import { tokens as
|
|
3174
|
+
import { tokens as tokens18 } from "@kjun-ui/tokens";
|
|
3079
3175
|
|
|
3080
3176
|
// shared/package-runtime/elevation.ts
|
|
3081
3177
|
function directionalShadow(layers, direction) {
|
|
@@ -3090,7 +3186,7 @@ function shadowLayers(layers, colors) {
|
|
|
3090
3186
|
}
|
|
3091
3187
|
|
|
3092
3188
|
// packages/native/src/toast.tsx
|
|
3093
|
-
import { tokens as
|
|
3189
|
+
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
3094
3190
|
import { useEffect as useEffect7, useRef as useRef10 } from "react";
|
|
3095
3191
|
import { Animated as Animated7, View as View13 } from "react-native";
|
|
3096
3192
|
import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
@@ -3134,7 +3230,7 @@ function ToastView({
|
|
|
3134
3230
|
accessible: false,
|
|
3135
3231
|
onHoverIn: () => controller.pauseToast(toast.id, reasons.hover),
|
|
3136
3232
|
onHoverOut: () => controller.resumeToast(toast.id, reasons.hover),
|
|
3137
|
-
style: { width: "100%", maxWidth:
|
|
3233
|
+
style: { width: "100%", maxWidth: tokens16.extensions.toast.maxWidth, alignSelf: "flex-end" },
|
|
3138
3234
|
children: /* @__PURE__ */ jsxs9(
|
|
3139
3235
|
View13,
|
|
3140
3236
|
{
|
|
@@ -3143,19 +3239,19 @@ function ToastView({
|
|
|
3143
3239
|
style: {
|
|
3144
3240
|
flexDirection: "row",
|
|
3145
3241
|
alignItems: toast.title ? "flex-start" : "center",
|
|
3146
|
-
gap:
|
|
3147
|
-
padding:
|
|
3148
|
-
borderRadius:
|
|
3242
|
+
gap: tokens16.extensions.toast.gap,
|
|
3243
|
+
padding: tokens16.extensions.toast.padding,
|
|
3244
|
+
borderRadius: tokens16.extensions.toast.radius,
|
|
3149
3245
|
backgroundColor: colors.surface,
|
|
3150
|
-
boxShadow: shadowLayers(
|
|
3151
|
-
borderWidth:
|
|
3246
|
+
boxShadow: shadowLayers(tokens16.extensions.toast.elevation, colors),
|
|
3247
|
+
borderWidth: tokens16.border.defaultWidth,
|
|
3152
3248
|
borderColor: colors.border,
|
|
3153
3249
|
overflow: "hidden"
|
|
3154
3250
|
},
|
|
3155
3251
|
children: [
|
|
3156
3252
|
/* @__PURE__ */ jsx18(KjunIcon, { name: icon, color: colors[`${tone}Accent`] }),
|
|
3157
3253
|
/* @__PURE__ */ jsxs9(View13, { style: { flex: 1, minWidth: 0 }, children: [
|
|
3158
|
-
!!toast.title && /* @__PURE__ */ jsx18(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom:
|
|
3254
|
+
!!toast.title && /* @__PURE__ */ jsx18(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: tokens16.extensions.toast.titleGap }, children: toast.title }),
|
|
3159
3255
|
/* @__PURE__ */ jsx18(KText, { style: { color: colors.textSecondary }, children: toast.message }),
|
|
3160
3256
|
toast.action && /* @__PURE__ */ jsx18(
|
|
3161
3257
|
AccessiblePressable,
|
|
@@ -3173,7 +3269,7 @@ function ToastView({
|
|
|
3173
3269
|
dismiss();
|
|
3174
3270
|
}
|
|
3175
3271
|
},
|
|
3176
|
-
style: { minHeight:
|
|
3272
|
+
style: { minHeight: tokens16.native.minimumTouchTarget, justifyContent: "center", marginTop: tokens16.extensions.toast.actionGap },
|
|
3177
3273
|
children: /* @__PURE__ */ jsx18(
|
|
3178
3274
|
KText,
|
|
3179
3275
|
{
|
|
@@ -3195,11 +3291,11 @@ function ToastView({
|
|
|
3195
3291
|
onBlur: () => controller.resumeToast(toast.id, reasons.focus),
|
|
3196
3292
|
onPress: dismiss,
|
|
3197
3293
|
style: {
|
|
3198
|
-
minWidth: Math.max(
|
|
3199
|
-
minHeight: Math.max(
|
|
3294
|
+
minWidth: Math.max(tokens16.extensions.toast.closeSize, tokens16.native.minimumTouchTarget),
|
|
3295
|
+
minHeight: Math.max(tokens16.extensions.toast.closeSize, tokens16.native.minimumTouchTarget),
|
|
3200
3296
|
alignItems: "center",
|
|
3201
3297
|
justifyContent: "center",
|
|
3202
|
-
borderRadius:
|
|
3298
|
+
borderRadius: tokens16.extensions.toast.closeRadius
|
|
3203
3299
|
},
|
|
3204
3300
|
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", color: colors.textTertiary })
|
|
3205
3301
|
}
|
|
@@ -3212,7 +3308,7 @@ function ToastView({
|
|
|
3212
3308
|
position: "absolute",
|
|
3213
3309
|
bottom: 0,
|
|
3214
3310
|
left: 0,
|
|
3215
|
-
height:
|
|
3311
|
+
height: tokens16.extensions.toast.progressHeight,
|
|
3216
3312
|
width: progress.interpolate({
|
|
3217
3313
|
inputRange: [0, 1],
|
|
3218
3314
|
outputRange: ["0%", "100%"]
|
|
@@ -3232,7 +3328,7 @@ function ToastView({
|
|
|
3232
3328
|
import { useLayoutEffect as useLayoutEffect7, useRef as useRef11 } from "react";
|
|
3233
3329
|
|
|
3234
3330
|
// shared/package-runtime/toast-layout.ts
|
|
3235
|
-
import { tokens as
|
|
3331
|
+
import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
3236
3332
|
function createToastLayout() {
|
|
3237
3333
|
let root = null;
|
|
3238
3334
|
const boxes = /* @__PURE__ */ new Map();
|
|
@@ -3275,7 +3371,7 @@ function createToastLayout() {
|
|
|
3275
3371
|
const top = node.offsetTop, left = node.offsetLeft;
|
|
3276
3372
|
(_a = animations.get(node)) == null ? void 0 : _a.cancel();
|
|
3277
3373
|
if (old && !reduced && Math.abs(old.top + offset - top) > 0.5) {
|
|
3278
|
-
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration:
|
|
3374
|
+
const animation = node.animate([{ transform: `translateY(${old.top + offset - top}px)` }, { transform: "translateY(0)" }], { duration: tokens17.motion.toastMove, easing: tokens17.motion.easeOut });
|
|
3279
3375
|
animations.set(node, animation);
|
|
3280
3376
|
}
|
|
3281
3377
|
boxes.set(id, { top, left, width: node.offsetWidth, height: node.offsetHeight });
|
|
@@ -3302,8 +3398,8 @@ function useToastReflow(root, reduced) {
|
|
|
3302
3398
|
// packages/native/src/toast-stack.tsx
|
|
3303
3399
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3304
3400
|
function ToastSlot({ item, controller, boxes }) {
|
|
3305
|
-
const born = useRef12(Math.min(
|
|
3306
|
-
const motion = useNativePresence(!item.exiting,
|
|
3401
|
+
const born = useRef12(Math.min(tokens18.motion.toastEnter, Date.now() - item.born)).current;
|
|
3402
|
+
const motion = useNativePresence(!item.exiting, tokens18.motion.toastEnter - born, tokens18.motion.toastExit, true, born / tokens18.motion.toastEnter);
|
|
3307
3403
|
const offset = useRef12(new Animated8.Value(0)).current;
|
|
3308
3404
|
const box = boxes.get(item.toast.id);
|
|
3309
3405
|
useLayoutEffect8(() => {
|
|
@@ -3324,7 +3420,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3324
3420
|
boxes.set(item.toast.id, next);
|
|
3325
3421
|
if (old && old.y !== next.y && !motion.reduced) offset.stopAnimation((current) => {
|
|
3326
3422
|
offset.setValue(current + old.y - next.y);
|
|
3327
|
-
Animated8.timing(offset, { toValue: 0, duration:
|
|
3423
|
+
Animated8.timing(offset, { toValue: 0, duration: tokens18.motion.toastMove, easing: motionOut, useNativeDriver: nativeDriver }).start();
|
|
3328
3424
|
});
|
|
3329
3425
|
},
|
|
3330
3426
|
style: { transform: [{ translateY: offset }], ...item.exiting && box ? {
|
|
@@ -3341,7 +3437,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3341
3437
|
accessibilityElementsHidden: item.exiting,
|
|
3342
3438
|
importantForAccessibility: item.exiting ? "no-hide-descendants" : "auto",
|
|
3343
3439
|
...item.exiting ? { inert: true } : {},
|
|
3344
|
-
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-
|
|
3440
|
+
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-tokens18.motionDistance.toast, 0] }) }] },
|
|
3345
3441
|
children: /* @__PURE__ */ jsx19(ToastView, { toast: item.toast, controller })
|
|
3346
3442
|
}
|
|
3347
3443
|
)
|
|
@@ -3357,10 +3453,10 @@ function ToastStack({ items: items2, controller }) {
|
|
|
3357
3453
|
for (const id of boxes.keys()) if (!items2.some((item) => item.toast.id === id)) boxes.delete(id);
|
|
3358
3454
|
return /* @__PURE__ */ jsx19(View14, { ref: root, pointerEvents: "box-none", style: {
|
|
3359
3455
|
position: "absolute",
|
|
3360
|
-
top:
|
|
3361
|
-
right:
|
|
3362
|
-
left:
|
|
3363
|
-
gap:
|
|
3456
|
+
top: tokens18.extensions.toast.inset,
|
|
3457
|
+
right: tokens18.extensions.toast.inset,
|
|
3458
|
+
left: tokens18.extensions.toast.inset,
|
|
3459
|
+
gap: tokens18.extensions.toast.stackGap,
|
|
3364
3460
|
minHeight: items2.some((item) => item.exiting) ? Math.max(0, ...[...boxes.values()].map((box) => box.y + box.height)) : void 0,
|
|
3365
3461
|
zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast")
|
|
3366
3462
|
}, children: items2.map((item) => /* @__PURE__ */ jsx19(ToastSlot, { item, controller, boxes }, item.toast.id)) });
|
|
@@ -3368,8 +3464,9 @@ function ToastStack({ items: items2, controller }) {
|
|
|
3368
3464
|
|
|
3369
3465
|
// packages/native/src/feedback.tsx
|
|
3370
3466
|
import {
|
|
3371
|
-
tokens as
|
|
3372
|
-
createFeedbackController
|
|
3467
|
+
tokens as tokens19,
|
|
3468
|
+
createFeedbackController,
|
|
3469
|
+
feedbackControllerOf
|
|
3373
3470
|
} from "@kjun-ui/tokens";
|
|
3374
3471
|
import {
|
|
3375
3472
|
useCallback as useCallback3,
|
|
@@ -3379,6 +3476,7 @@ import {
|
|
|
3379
3476
|
useSyncExternalStore as useSyncExternalStore2
|
|
3380
3477
|
} from "react";
|
|
3381
3478
|
import { View as View15 } from "react-native";
|
|
3479
|
+
import { createKjunFeedback } from "@kjun-ui/tokens";
|
|
3382
3480
|
import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3383
3481
|
function useKjunFeedback() {
|
|
3384
3482
|
const value = useOptionalKjunFeedback();
|
|
@@ -3410,7 +3508,7 @@ function FeedbackDialog({
|
|
|
3410
3508
|
onConfirm: submit,
|
|
3411
3509
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
3412
3510
|
children: [
|
|
3413
|
-
!!options.message && /* @__PURE__ */ jsx20(KText, { style: { marginBottom:
|
|
3511
|
+
!!options.message && /* @__PURE__ */ jsx20(KText, { style: { marginBottom: tokens19.dimension.value16 }, children: options.message }),
|
|
3414
3512
|
request.kind === "prompt" && /* @__PURE__ */ jsx20(
|
|
3415
3513
|
KjunInput,
|
|
3416
3514
|
{
|
|
@@ -3427,8 +3525,10 @@ function FeedbackDialog({
|
|
|
3427
3525
|
}
|
|
3428
3526
|
);
|
|
3429
3527
|
}
|
|
3430
|
-
function KjunFeedbackProvider({ children, style }) {
|
|
3431
|
-
const [
|
|
3528
|
+
function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
3529
|
+
const [owned] = useState13(() => controllerProp ? void 0 : createFeedbackController());
|
|
3530
|
+
const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
|
|
3531
|
+
useEffect8(() => controller.attach(), [controller]);
|
|
3432
3532
|
const life = useRef13(0);
|
|
3433
3533
|
const snapshot = useSyncExternalStore2(
|
|
3434
3534
|
controller.subscribe,
|
|
@@ -3442,7 +3542,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3442
3542
|
const version = ++life.current;
|
|
3443
3543
|
return () => {
|
|
3444
3544
|
queueMicrotask(() => {
|
|
3445
|
-
if (life.current === version) controller.dispose();
|
|
3545
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
3446
3546
|
});
|
|
3447
3547
|
};
|
|
3448
3548
|
}, [controller]);
|
|
@@ -3477,7 +3577,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3477
3577
|
|
|
3478
3578
|
// packages/native/src/choice-controls.tsx
|
|
3479
3579
|
import { Animated as Animated9 } from "react-native";
|
|
3480
|
-
import { tokens as
|
|
3580
|
+
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
3481
3581
|
import {
|
|
3482
3582
|
createContext as createContext16,
|
|
3483
3583
|
useContext as useContext12,
|
|
@@ -3500,7 +3600,7 @@ function KjunCheckbox({
|
|
|
3500
3600
|
onValueChange,
|
|
3501
3601
|
onChange
|
|
3502
3602
|
}) {
|
|
3503
|
-
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension =
|
|
3603
|
+
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension = tokens20.extensions.checkbox.sizes[size];
|
|
3504
3604
|
return /* @__PURE__ */ jsxs11(
|
|
3505
3605
|
AccessiblePressable,
|
|
3506
3606
|
{
|
|
@@ -3519,8 +3619,8 @@ function KjunCheckbox({
|
|
|
3519
3619
|
flexDirection: "row",
|
|
3520
3620
|
alignItems: "center",
|
|
3521
3621
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3522
|
-
minHeight: finePointer() ?
|
|
3523
|
-
opacity: disabled ?
|
|
3622
|
+
minHeight: finePointer() ? tokens20.extensions.choice.minimumHeight : tokens20.native.minimumTouchTarget,
|
|
3623
|
+
opacity: disabled ? tokens20.states.opacity.disabled : pressed ? tokens20.states.opacity.pressed : 1
|
|
3524
3624
|
}),
|
|
3525
3625
|
children: [
|
|
3526
3626
|
/* @__PURE__ */ jsx21(
|
|
@@ -3531,8 +3631,8 @@ function KjunCheckbox({
|
|
|
3531
3631
|
justifyContent: "center",
|
|
3532
3632
|
width: dimension,
|
|
3533
3633
|
height: dimension,
|
|
3534
|
-
borderRadius:
|
|
3535
|
-
borderWidth:
|
|
3634
|
+
borderRadius: tokens20.extensions.checkbox.radii[size],
|
|
3635
|
+
borderWidth: tokens20.border.controlWidth,
|
|
3536
3636
|
// Same boundary roles as Radio: strong while enabled, secondary once disabled.
|
|
3537
3637
|
borderColor: checked ? colors.brand : disabled ? colors.borderSecondary : colors.borderStrong,
|
|
3538
3638
|
backgroundColor: checked ? colors.brand : colors.surface
|
|
@@ -3541,14 +3641,14 @@ function KjunCheckbox({
|
|
|
3541
3641
|
KjunIcon,
|
|
3542
3642
|
{
|
|
3543
3643
|
name: "check",
|
|
3544
|
-
size:
|
|
3644
|
+
size: tokens20.extensions.checkbox.iconSizes[size],
|
|
3545
3645
|
color: colors.onBrand
|
|
3546
3646
|
}
|
|
3547
3647
|
)
|
|
3548
3648
|
}
|
|
3549
3649
|
),
|
|
3550
3650
|
!!(children || label) && content(children || label, {
|
|
3551
|
-
marginLeft:
|
|
3651
|
+
marginLeft: tokens20.extensions.checkbox.labelGap,
|
|
3552
3652
|
...typeStyle("label")
|
|
3553
3653
|
})
|
|
3554
3654
|
]
|
|
@@ -3564,7 +3664,7 @@ function useControlFocus(disabled) {
|
|
|
3564
3664
|
onFocus: (event) => setFocused(focusVisible(event.currentTarget)),
|
|
3565
3665
|
onBlur: () => setFocused(false)
|
|
3566
3666
|
},
|
|
3567
|
-
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth:
|
|
3667
|
+
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth: tokens20.states.focus.width, outlineOffset: tokens20.states.focus.choiceOffset, outlineColor: colors.focusRing } : {}
|
|
3568
3668
|
};
|
|
3569
3669
|
}
|
|
3570
3670
|
function KjunSwitch({
|
|
@@ -3579,10 +3679,10 @@ function KjunSwitch({
|
|
|
3579
3679
|
onChange
|
|
3580
3680
|
}) {
|
|
3581
3681
|
const { colors } = useKjunStyles();
|
|
3582
|
-
const width =
|
|
3583
|
-
const height =
|
|
3584
|
-
const thumb = height - 2 *
|
|
3585
|
-
const offScale = (thumb - 2 *
|
|
3682
|
+
const width = tokens20.extensions.switch.widths[size];
|
|
3683
|
+
const height = tokens20.extensions.switch.heights[size];
|
|
3684
|
+
const thumb = height - 2 * tokens20.extensions.switch.padding;
|
|
3685
|
+
const offScale = (thumb - 2 * tokens20.border.controlWidth) / thumb;
|
|
3586
3686
|
const offset = width - height;
|
|
3587
3687
|
const motion = useMotionValue(value ? 1 : 0);
|
|
3588
3688
|
const focus = useControlFocus(disabled);
|
|
@@ -3611,8 +3711,8 @@ function KjunSwitch({
|
|
|
3611
3711
|
flexDirection: "row",
|
|
3612
3712
|
alignItems: "center",
|
|
3613
3713
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3614
|
-
minHeight: finePointer() ?
|
|
3615
|
-
opacity: disabled ?
|
|
3714
|
+
minHeight: finePointer() ? tokens20.extensions.choice.minimumHeight : tokens20.native.minimumTouchTarget,
|
|
3715
|
+
opacity: disabled ? tokens20.states.opacity.disabled : 1
|
|
3616
3716
|
},
|
|
3617
3717
|
children: [
|
|
3618
3718
|
/* @__PURE__ */ jsxs11(
|
|
@@ -3621,8 +3721,8 @@ function KjunSwitch({
|
|
|
3621
3721
|
style: {
|
|
3622
3722
|
width,
|
|
3623
3723
|
height,
|
|
3624
|
-
padding:
|
|
3625
|
-
borderRadius:
|
|
3724
|
+
padding: tokens20.extensions.switch.padding,
|
|
3725
|
+
borderRadius: tokens20.extensions.switch.radius,
|
|
3626
3726
|
backgroundColor: trackColor,
|
|
3627
3727
|
...focus.ring
|
|
3628
3728
|
},
|
|
@@ -3634,8 +3734,8 @@ function KjunSwitch({
|
|
|
3634
3734
|
style: {
|
|
3635
3735
|
position: "absolute",
|
|
3636
3736
|
inset: 0,
|
|
3637
|
-
borderRadius:
|
|
3638
|
-
borderWidth:
|
|
3737
|
+
borderRadius: tokens20.extensions.switch.radius,
|
|
3738
|
+
borderWidth: tokens20.border.controlWidth,
|
|
3639
3739
|
// Hover turns the boundary to brand, like Checkbox on Web.
|
|
3640
3740
|
borderColor: hovered && !disabled ? colors.brand : offRole,
|
|
3641
3741
|
opacity: motion.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })
|
|
@@ -3648,7 +3748,7 @@ function KjunSwitch({
|
|
|
3648
3748
|
style: {
|
|
3649
3749
|
width: thumb,
|
|
3650
3750
|
height: thumb,
|
|
3651
|
-
borderRadius:
|
|
3751
|
+
borderRadius: tokens20.extensions.switch.radius,
|
|
3652
3752
|
backgroundColor: thumbColor,
|
|
3653
3753
|
transform: [
|
|
3654
3754
|
{ translateX: motion.interpolate({ inputRange: [0, 1], outputRange: [0, offset] }) },
|
|
@@ -3660,11 +3760,11 @@ function KjunSwitch({
|
|
|
3660
3760
|
]
|
|
3661
3761
|
}
|
|
3662
3762
|
),
|
|
3663
|
-
description ? /* @__PURE__ */ jsxs11(View16, { style: { marginLeft:
|
|
3763
|
+
description ? /* @__PURE__ */ jsxs11(View16, { style: { marginLeft: tokens20.extensions.switch.labelGap, flexShrink: 1, minWidth: 0 }, children: [
|
|
3664
3764
|
!!(children || label) && content(children || label, typeStyle("label")),
|
|
3665
|
-
/* @__PURE__ */ jsx21(KText, { style: { ...typeStyle("caption"), marginTop:
|
|
3765
|
+
/* @__PURE__ */ jsx21(KText, { style: { ...typeStyle("caption"), marginTop: tokens20.dimension.value4, color: colors.textSecondary }, children: description })
|
|
3666
3766
|
] }) : !!(children || label) && content(children || label, {
|
|
3667
|
-
marginLeft:
|
|
3767
|
+
marginLeft: tokens20.extensions.switch.labelGap,
|
|
3668
3768
|
...typeStyle("label")
|
|
3669
3769
|
})
|
|
3670
3770
|
]
|
|
@@ -3683,7 +3783,7 @@ function KjunRadio({
|
|
|
3683
3783
|
onChange
|
|
3684
3784
|
}) {
|
|
3685
3785
|
const group = useContext12(RadioContext), { colors } = useKjunStyles(), selected = (group ? group.value : value) === val;
|
|
3686
|
-
const geometry2 =
|
|
3786
|
+
const geometry2 = tokens20.extensions.radio;
|
|
3687
3787
|
const [hovered, setHovered] = useState14(false);
|
|
3688
3788
|
useEffect9(() => {
|
|
3689
3789
|
if (disabled) setHovered(false);
|
|
@@ -3710,8 +3810,8 @@ function KjunRadio({
|
|
|
3710
3810
|
flexDirection: "row",
|
|
3711
3811
|
alignItems: "center",
|
|
3712
3812
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3713
|
-
minHeight: finePointer() ?
|
|
3714
|
-
opacity: disabled ?
|
|
3813
|
+
minHeight: finePointer() ? tokens20.extensions.choice.minimumHeight : tokens20.native.minimumTouchTarget,
|
|
3814
|
+
opacity: disabled ? tokens20.states.opacity.disabled : 1
|
|
3715
3815
|
},
|
|
3716
3816
|
children: ({ pressed }) => /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
3717
3817
|
/* @__PURE__ */ jsx21(
|
|
@@ -3721,7 +3821,7 @@ function KjunRadio({
|
|
|
3721
3821
|
width: geometry2.size,
|
|
3722
3822
|
height: geometry2.size,
|
|
3723
3823
|
borderWidth: geometry2.borderWidth,
|
|
3724
|
-
borderRadius:
|
|
3824
|
+
borderRadius: tokens20.radius.radius9999,
|
|
3725
3825
|
alignItems: "center",
|
|
3726
3826
|
justifyContent: "center",
|
|
3727
3827
|
borderColor: disabled ? selected ? colors.brand : colors.borderSecondary : pressed ? colors.brandActive : hovered ? colors.brandHover : selected ? colors.brand : colors.borderStrong,
|
|
@@ -3733,7 +3833,7 @@ function KjunRadio({
|
|
|
3733
3833
|
style: {
|
|
3734
3834
|
width: geometry2.dot,
|
|
3735
3835
|
height: geometry2.dot,
|
|
3736
|
-
borderRadius:
|
|
3836
|
+
borderRadius: tokens20.radius.radius9999,
|
|
3737
3837
|
backgroundColor: colors.brand
|
|
3738
3838
|
}
|
|
3739
3839
|
}
|
|
@@ -3778,7 +3878,7 @@ function KjunRadioGroup({
|
|
|
3778
3878
|
style: {
|
|
3779
3879
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
3780
3880
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
3781
|
-
gap: direction === "vertical" ?
|
|
3881
|
+
gap: direction === "vertical" ? tokens20.dimension.value8 : tokens20.dimension.value16
|
|
3782
3882
|
},
|
|
3783
3883
|
children: children || options.map((option) => /* @__PURE__ */ jsx21(
|
|
3784
3884
|
KjunRadio,
|
|
@@ -3796,7 +3896,7 @@ function KjunRadioGroup({
|
|
|
3796
3896
|
}
|
|
3797
3897
|
|
|
3798
3898
|
// packages/native/src/selection-groups.tsx
|
|
3799
|
-
import { tokens as
|
|
3899
|
+
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
3800
3900
|
import { useLayoutEffect as useLayoutEffect10, useRef as useRef16 } from "react";
|
|
3801
3901
|
import {
|
|
3802
3902
|
Animated as Animated11,
|
|
@@ -3808,9 +3908,9 @@ import {
|
|
|
3808
3908
|
// packages/native/src/button-group-motion.tsx
|
|
3809
3909
|
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect9, useRef as useRef15, useState as useState15 } from "react";
|
|
3810
3910
|
import { Animated as Animated10, Easing as Easing4, StyleSheet as StyleSheet5, View as View17 } from "react-native";
|
|
3811
|
-
import { tokens as
|
|
3911
|
+
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
3812
3912
|
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3813
|
-
var curve =
|
|
3913
|
+
var curve = tokens21.motion.easeOut.match(/-?\d*\.?\d+/g).map(Number);
|
|
3814
3914
|
var easing = Easing4.bezier(...curve);
|
|
3815
3915
|
var sameBox = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3816
3916
|
function useButtonGroupMotion(selected) {
|
|
@@ -3837,8 +3937,8 @@ function useButtonGroupMotion(selected) {
|
|
|
3837
3937
|
width.stopAnimation();
|
|
3838
3938
|
if (old && old.value !== selected.value && !reduced) {
|
|
3839
3939
|
Animated10.parallel([
|
|
3840
|
-
Animated10.timing(x, { toValue: layout.x, duration:
|
|
3841
|
-
Animated10.timing(width, { toValue: layout.width, duration:
|
|
3940
|
+
Animated10.timing(x, { toValue: layout.x, duration: tokens21.motion.indicator, easing, useNativeDriver: false }),
|
|
3941
|
+
Animated10.timing(width, { toValue: layout.width, duration: tokens21.motion.indicator, easing, useNativeDriver: false })
|
|
3842
3942
|
]).start();
|
|
3843
3943
|
} else {
|
|
3844
3944
|
x.setValue(layout.x);
|
|
@@ -3859,7 +3959,7 @@ function ButtonGroupLabel({ label, active, size, reduced }) {
|
|
|
3859
3959
|
useEffect10(() => {
|
|
3860
3960
|
progress.stopAnimation();
|
|
3861
3961
|
if (reduced || !interpolate) progress.setValue(active ? 1 : 0);
|
|
3862
|
-
else Animated10.timing(progress, { toValue: active ? 1 : 0, duration:
|
|
3962
|
+
else Animated10.timing(progress, { toValue: active ? 1 : 0, duration: tokens21.motion.indicator, easing, useNativeDriver: false }).start();
|
|
3863
3963
|
return () => progress.stopAnimation();
|
|
3864
3964
|
}, [active, reduced, interpolate, progress]);
|
|
3865
3965
|
const resolveFont = useResolveFont();
|
|
@@ -3901,8 +4001,8 @@ function KjunButtonGroup({
|
|
|
3901
4001
|
const { colors } = useKjunStyles();
|
|
3902
4002
|
const selected = options.find((option) => option.value === value);
|
|
3903
4003
|
const motion = useButtonGroupMotion(selected);
|
|
3904
|
-
const padding =
|
|
3905
|
-
const itemRadius =
|
|
4004
|
+
const padding = tokens22.buttonGroup.padding[size];
|
|
4005
|
+
const itemRadius = tokens22.buttonGroup.itemRadii[size];
|
|
3906
4006
|
const itemRefs = useRef16(/* @__PURE__ */ new Map());
|
|
3907
4007
|
const { updateLayout } = motion;
|
|
3908
4008
|
useLayoutEffect10(() => {
|
|
@@ -3928,7 +4028,7 @@ function KjunButtonGroup({
|
|
|
3928
4028
|
style: {
|
|
3929
4029
|
flexDirection: "row",
|
|
3930
4030
|
padding,
|
|
3931
|
-
borderRadius:
|
|
4031
|
+
borderRadius: tokens22.buttonGroup.radii[size],
|
|
3932
4032
|
backgroundColor: colors.secondary,
|
|
3933
4033
|
flexGrow: fullWidth ? 1 : 0
|
|
3934
4034
|
},
|
|
@@ -3952,7 +4052,7 @@ function KjunButtonGroup({
|
|
|
3952
4052
|
// Disabled options dim their own labels; the selected value stays readable. The edge keeps it
|
|
3953
4053
|
// apart from the track when surface and secondary are close.
|
|
3954
4054
|
backgroundColor: colors.surface,
|
|
3955
|
-
borderWidth:
|
|
4055
|
+
borderWidth: tokens22.border.defaultWidth,
|
|
3956
4056
|
borderColor: colors.border
|
|
3957
4057
|
}
|
|
3958
4058
|
}
|
|
@@ -3980,22 +4080,22 @@ function KjunButtonGroup({
|
|
|
3980
4080
|
flexDirection: "row",
|
|
3981
4081
|
alignItems: "center",
|
|
3982
4082
|
justifyContent: "center",
|
|
3983
|
-
gap:
|
|
4083
|
+
gap: tokens22.dimension.value6,
|
|
3984
4084
|
flex: fullWidth ? 1 : void 0,
|
|
3985
|
-
minWidth:
|
|
3986
|
-
minHeight:
|
|
3987
|
-
height: Math.max(
|
|
3988
|
-
paddingHorizontal:
|
|
4085
|
+
minWidth: tokens22.native.minimumTouchTarget,
|
|
4086
|
+
minHeight: tokens22.native.minimumTouchTarget,
|
|
4087
|
+
height: Math.max(tokens22.native.minimumTouchTarget, tokens22.buttonGroup.heights[size] - 2 * padding),
|
|
4088
|
+
paddingHorizontal: tokens22.buttonGroup.itemPaddingX[size],
|
|
3989
4089
|
borderRadius: itemRadius,
|
|
3990
4090
|
backgroundColor: active && !motion.layout ? colors.surface : pressed && !active ? colors.hover : "transparent",
|
|
3991
|
-
opacity: blocked ?
|
|
4091
|
+
opacity: blocked ? tokens22.states.opacity.disabled : 1
|
|
3992
4092
|
}),
|
|
3993
4093
|
children: [
|
|
3994
4094
|
!!option.icon && /* @__PURE__ */ jsx23(
|
|
3995
4095
|
KjunIcon,
|
|
3996
4096
|
{
|
|
3997
4097
|
name: option.icon,
|
|
3998
|
-
size:
|
|
4098
|
+
size: tokens22.extensions.selection.iconSize,
|
|
3999
4099
|
color: active ? colors.text : colors.textSecondary
|
|
4000
4100
|
}
|
|
4001
4101
|
),
|
|
@@ -4031,7 +4131,7 @@ function KjunFilterGroup({
|
|
|
4031
4131
|
onChange
|
|
4032
4132
|
}) {
|
|
4033
4133
|
const { colors } = useKjunStyles();
|
|
4034
|
-
const wide = useWindowDimensions2().width >=
|
|
4134
|
+
const wide = useWindowDimensions2().width >= tokens22.responsive.selection, roomy = wide && finePointer();
|
|
4035
4135
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
4036
4136
|
const children = /* @__PURE__ */ jsx23(
|
|
4037
4137
|
View18,
|
|
@@ -4040,7 +4140,7 @@ function KjunFilterGroup({
|
|
|
4040
4140
|
style: {
|
|
4041
4141
|
flexDirection: "row",
|
|
4042
4142
|
flexWrap: scroll ? "nowrap" : "wrap",
|
|
4043
|
-
gap:
|
|
4143
|
+
gap: tokens22.dimension.value8
|
|
4044
4144
|
},
|
|
4045
4145
|
children: options.map((option) => {
|
|
4046
4146
|
const active = selected(option.value), blocked = disabled || option.disabled;
|
|
@@ -4057,9 +4157,9 @@ function KjunFilterGroup({
|
|
|
4057
4157
|
onChange == null ? void 0 : onChange(next);
|
|
4058
4158
|
},
|
|
4059
4159
|
style: {
|
|
4060
|
-
minHeight: roomy ? void 0 :
|
|
4160
|
+
minHeight: roomy ? void 0 : tokens22.native.minimumTouchTarget,
|
|
4061
4161
|
justifyContent: "center",
|
|
4062
|
-
opacity: blocked ?
|
|
4162
|
+
opacity: blocked ? tokens22.states.opacity.disabledStrong : 1
|
|
4063
4163
|
},
|
|
4064
4164
|
children: /* @__PURE__ */ jsxs13(
|
|
4065
4165
|
View18,
|
|
@@ -4068,12 +4168,12 @@ function KjunFilterGroup({
|
|
|
4068
4168
|
flexDirection: "row",
|
|
4069
4169
|
alignItems: "center",
|
|
4070
4170
|
justifyContent: "center",
|
|
4071
|
-
gap:
|
|
4072
|
-
minHeight: roomy ? void 0 :
|
|
4073
|
-
height: roomy ?
|
|
4074
|
-
paddingHorizontal: { xs:
|
|
4171
|
+
gap: tokens22.dimension.value4,
|
|
4172
|
+
minHeight: roomy ? void 0 : tokens22.extensions.selection.minimumHeight,
|
|
4173
|
+
height: roomy ? tokens22.button.heights[size] : Math.max(tokens22.extensions.selection.minimumHeight, tokens22.button.heights[size]),
|
|
4174
|
+
paddingHorizontal: { xs: tokens22.dimension.value8, sm: tokens22.dimension.value12, md: tokens22.dimension.value12, lg: tokens22.dimension.value14, xl: tokens22.dimension.value16 }[size],
|
|
4075
4175
|
// Corners follow the button scale with the height, so every size keeps the same shape.
|
|
4076
|
-
borderRadius:
|
|
4176
|
+
borderRadius: tokens22.button.radii[size],
|
|
4077
4177
|
backgroundColor: active ? colors.text : colors.secondary
|
|
4078
4178
|
},
|
|
4079
4179
|
children: [
|
|
@@ -4081,9 +4181,9 @@ function KjunFilterGroup({
|
|
|
4081
4181
|
View18,
|
|
4082
4182
|
{
|
|
4083
4183
|
style: {
|
|
4084
|
-
width:
|
|
4085
|
-
height:
|
|
4086
|
-
borderRadius:
|
|
4184
|
+
width: tokens22.extensions.selection.dotSize,
|
|
4185
|
+
height: tokens22.extensions.selection.dotSize,
|
|
4186
|
+
borderRadius: tokens22.radius.radius4,
|
|
4087
4187
|
backgroundColor: option.dot
|
|
4088
4188
|
}
|
|
4089
4189
|
}
|
|
@@ -4092,7 +4192,7 @@ function KjunFilterGroup({
|
|
|
4092
4192
|
KjunIcon,
|
|
4093
4193
|
{
|
|
4094
4194
|
name: option.icon,
|
|
4095
|
-
size:
|
|
4195
|
+
size: tokens22.extensions.selection.iconSize,
|
|
4096
4196
|
color: active ? colors.inverse : colors.textSecondary
|
|
4097
4197
|
}
|
|
4098
4198
|
),
|
|
@@ -4143,7 +4243,7 @@ function KjunFilterGroup({
|
|
|
4143
4243
|
}
|
|
4144
4244
|
|
|
4145
4245
|
// packages/native/src/textarea.tsx
|
|
4146
|
-
import { tokens as
|
|
4246
|
+
import { tokens as tokens23 } from "@kjun-ui/tokens";
|
|
4147
4247
|
import {
|
|
4148
4248
|
forwardRef as forwardRef4
|
|
4149
4249
|
} from "react";
|
|
@@ -4165,7 +4265,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4165
4265
|
onBlur,
|
|
4166
4266
|
...props
|
|
4167
4267
|
}, ref) {
|
|
4168
|
-
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec =
|
|
4268
|
+
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec = tokens23.input[size];
|
|
4169
4269
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
4170
4270
|
const surface = useFieldSurface(size, { disabled, readOnly: readonly || props.readOnly || props.editable === false, invalid });
|
|
4171
4271
|
return /* @__PURE__ */ jsx24(
|
|
@@ -4206,8 +4306,8 @@ var KjunTextarea = forwardRef4(
|
|
|
4206
4306
|
...inputTypeStyle(size),
|
|
4207
4307
|
...surface.style,
|
|
4208
4308
|
height: void 0,
|
|
4209
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
4210
|
-
paddingHorizontal: spec.padding -
|
|
4309
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * tokens23.border.controlWidth),
|
|
4310
|
+
paddingHorizontal: spec.padding - tokens23.border.controlWidth,
|
|
4211
4311
|
paddingVertical: spec.textareaPaddingY,
|
|
4212
4312
|
textAlignVertical: "top",
|
|
4213
4313
|
color: surface.ink
|
|
@@ -4220,7 +4320,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4220
4320
|
);
|
|
4221
4321
|
|
|
4222
4322
|
// packages/native/src/drawer.tsx
|
|
4223
|
-
import { tokens as
|
|
4323
|
+
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
4224
4324
|
import { useEffect as useEffect11, useState as useState16 } from "react";
|
|
4225
4325
|
import { Animated as Animated12, Keyboard } from "react-native";
|
|
4226
4326
|
|
|
@@ -4277,7 +4377,7 @@ function KjunDrawer({
|
|
|
4277
4377
|
onOpenChange,
|
|
4278
4378
|
title,
|
|
4279
4379
|
position = "right",
|
|
4280
|
-
width =
|
|
4380
|
+
width = tokens24.extensions.drawer.width,
|
|
4281
4381
|
closable = true,
|
|
4282
4382
|
closeOnOverlay = true,
|
|
4283
4383
|
closeOnEsc = true,
|
|
@@ -4301,13 +4401,13 @@ function KjunDrawer({
|
|
|
4301
4401
|
windowHeight: rootHeight || window2.height,
|
|
4302
4402
|
safeAreaTop: Math.max(0, safeAreaTop),
|
|
4303
4403
|
safeAreaBottom: Math.max(0, safeAreaBottom),
|
|
4304
|
-
gap:
|
|
4404
|
+
gap: tokens24.extensions.drawer.sheetGap,
|
|
4305
4405
|
keyboard,
|
|
4306
4406
|
maxHeight
|
|
4307
4407
|
});
|
|
4308
4408
|
const [panelHeight, setPanelHeight] = useState16(0);
|
|
4309
|
-
const motion = useNativePresence(open,
|
|
4310
|
-
const backdrop = useNativePresence(open,
|
|
4409
|
+
const motion = useNativePresence(open, tokens24.motion.layerEnter, tokens24.motion.layerExit, vertical || panelHeight > 0, 0, { enterEasing: motionEmphasized });
|
|
4410
|
+
const backdrop = useNativePresence(open, tokens24.motion.backdrop, tokens24.motion.backdropExit, true, 0, { fade: tokens24.motion.backdropExit });
|
|
4311
4411
|
const close = () => {
|
|
4312
4412
|
if (!open) return;
|
|
4313
4413
|
onOpenChange(false);
|
|
@@ -4372,10 +4472,10 @@ function KjunDrawer({
|
|
|
4372
4472
|
paddingTop: frame.paddingTop,
|
|
4373
4473
|
paddingBottom: frame.paddingBottom,
|
|
4374
4474
|
marginBottom: frame.lift,
|
|
4375
|
-
borderRadius:
|
|
4376
|
-
borderTopLeftRadius: position === "bottom" ?
|
|
4377
|
-
borderTopRightRadius: position === "bottom" ?
|
|
4378
|
-
boxShadow: directionalShadow(
|
|
4475
|
+
borderRadius: tokens24.extensions.drawer.radius,
|
|
4476
|
+
borderTopLeftRadius: position === "bottom" ? tokens24.extensions.drawer.bottomRadius : tokens24.extensions.drawer.radius,
|
|
4477
|
+
borderTopRightRadius: position === "bottom" ? tokens24.extensions.drawer.bottomRadius : tokens24.extensions.drawer.radius,
|
|
4478
|
+
boxShadow: directionalShadow(tokens24.extensions.drawer.elevation, position).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4379
4479
|
backgroundColor: colors.surface
|
|
4380
4480
|
},
|
|
4381
4481
|
children: [
|
|
@@ -4386,9 +4486,9 @@ function KjunDrawer({
|
|
|
4386
4486
|
flexDirection: "row",
|
|
4387
4487
|
alignItems: "center",
|
|
4388
4488
|
justifyContent: "space-between",
|
|
4389
|
-
paddingVertical:
|
|
4390
|
-
paddingHorizontal:
|
|
4391
|
-
borderBottomWidth:
|
|
4489
|
+
paddingVertical: tokens24.extensions.drawer.paddingY,
|
|
4490
|
+
paddingHorizontal: tokens24.extensions.drawer.paddingX,
|
|
4491
|
+
borderBottomWidth: tokens24.border.defaultWidth,
|
|
4392
4492
|
borderBottomColor: colors.border
|
|
4393
4493
|
},
|
|
4394
4494
|
children: [
|
|
@@ -4406,8 +4506,8 @@ function KjunDrawer({
|
|
|
4406
4506
|
variant: "ghost",
|
|
4407
4507
|
ariaLabel: m.close,
|
|
4408
4508
|
onPress: close,
|
|
4409
|
-
style: { borderRadius:
|
|
4410
|
-
children: /* @__PURE__ */ jsx25(KjunIcon, { name: "x", size:
|
|
4509
|
+
style: { borderRadius: tokens24.extensions.drawer.closeRadius, width: tokens24.extensions.drawer.closeSize, height: tokens24.extensions.drawer.closeSize, paddingHorizontal: 0, paddingVertical: 0 },
|
|
4510
|
+
children: /* @__PURE__ */ jsx25(KjunIcon, { name: "x", size: tokens24.extensions.drawer.closeIconSize })
|
|
4411
4511
|
}
|
|
4412
4512
|
)
|
|
4413
4513
|
]
|
|
@@ -4418,7 +4518,7 @@ function KjunDrawer({
|
|
|
4418
4518
|
{
|
|
4419
4519
|
keyboardShouldPersistTaps: "handled",
|
|
4420
4520
|
style: vertical ? { flex: 1 } : { flexGrow: 0, flexShrink: 1 },
|
|
4421
|
-
contentContainerStyle: { padding: noPadding ? 0 :
|
|
4521
|
+
contentContainerStyle: { padding: noPadding ? 0 : tokens24.extensions.drawer.bodyPadding },
|
|
4422
4522
|
children: content(children)
|
|
4423
4523
|
}
|
|
4424
4524
|
),
|
|
@@ -4426,9 +4526,9 @@ function KjunDrawer({
|
|
|
4426
4526
|
View19,
|
|
4427
4527
|
{
|
|
4428
4528
|
style: {
|
|
4429
|
-
paddingVertical:
|
|
4430
|
-
paddingHorizontal:
|
|
4431
|
-
borderTopWidth:
|
|
4529
|
+
paddingVertical: tokens24.extensions.drawer.paddingY,
|
|
4530
|
+
paddingHorizontal: tokens24.extensions.drawer.paddingX,
|
|
4531
|
+
borderTopWidth: tokens24.border.defaultWidth,
|
|
4432
4532
|
borderTopColor: colors.border
|
|
4433
4533
|
},
|
|
4434
4534
|
children: content(footer)
|
|
@@ -4445,7 +4545,7 @@ function KjunDrawer({
|
|
|
4445
4545
|
}
|
|
4446
4546
|
|
|
4447
4547
|
// packages/native/src/dropdown.tsx
|
|
4448
|
-
import { tokens as
|
|
4548
|
+
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
4449
4549
|
import {
|
|
4450
4550
|
Children as Children3,
|
|
4451
4551
|
Fragment as Fragment8,
|
|
@@ -4462,7 +4562,7 @@ import {
|
|
|
4462
4562
|
|
|
4463
4563
|
// packages/native/src/floating-panel.tsx
|
|
4464
4564
|
import { Animated as Animated13 } from "react-native";
|
|
4465
|
-
import { tokens as
|
|
4565
|
+
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
4466
4566
|
import {
|
|
4467
4567
|
cloneElement as cloneElement3,
|
|
4468
4568
|
isValidElement as isValidElement4,
|
|
@@ -4529,7 +4629,7 @@ function FloatingPanel({
|
|
|
4529
4629
|
const scroll = useRef17(null), viewport = useRef17(0);
|
|
4530
4630
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions4(), [anchored, setAnchored] = useState17(false), [sized, setSized] = useState17(false), [anchor, setAnchor] = useState17({ x: 0, y: 0, width: 0, height: 0 }), [panel, setPanel] = useState17({ width: 0, height: 0 });
|
|
4531
4631
|
const measurement = useRef17(0);
|
|
4532
|
-
const motion = useNativePresence(open, tooltip ?
|
|
4632
|
+
const motion = useNativePresence(open, tooltip ? tokens25.motion.tooltipEnter : tokens25.motion.popupEnter, tooltip ? tokens25.motion.tooltipExit : tokens25.motion.popupExit, anchored && sized);
|
|
4533
4633
|
const layer = useLayer(open, motion.present, tooltip ? "tooltip" : "popup", () => onOpenChange(false), triggerRef);
|
|
4534
4634
|
useLayoutEffect11(() => {
|
|
4535
4635
|
var _a;
|
|
@@ -4554,7 +4654,7 @@ function FloatingPanel({
|
|
|
4554
4654
|
var _a;
|
|
4555
4655
|
const row = reveal == null ? void 0 : reveal.current;
|
|
4556
4656
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
4557
|
-
const offset = row.y + row.height + (menu || field ?
|
|
4657
|
+
const offset = row.y + row.height + (menu || field ? tokens25.extensions.menu.padding : 0) - viewport.current;
|
|
4558
4658
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
4559
4659
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
4560
4660
|
useEffect12(() => {
|
|
@@ -4567,30 +4667,30 @@ function FloatingPanel({
|
|
|
4567
4667
|
if (tag) AccessibilityInfo3.setAccessibilityFocus(tag);
|
|
4568
4668
|
}
|
|
4569
4669
|
}, [open, anchored, sized, focusOnOpen]);
|
|
4570
|
-
const gap = field ?
|
|
4670
|
+
const gap = field ? tokens25.extensions.floating.fieldGap : tokens25.extensions.floating.anchorGap;
|
|
4571
4671
|
const contentSizedMenu = menu && !matchTriggerWidth;
|
|
4572
|
-
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 *
|
|
4573
|
-
const maximumWidth = Math.max(0, window2.width - 2 *
|
|
4672
|
+
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 * tokens25.extensions.floating.viewportInset), tokens25.extensions.tooltip.maxWidth);
|
|
4673
|
+
const maximumWidth = Math.max(0, window2.width - 2 * tokens25.extensions.floating.viewportInset);
|
|
4574
4674
|
const minimumPanelWidth = Math.min(
|
|
4575
4675
|
maximumWidth,
|
|
4576
|
-
Math.max(minimumWidth, menu || field ?
|
|
4676
|
+
Math.max(minimumWidth, menu || field ? tokens25.extensions.menu.minimumWidth : 0)
|
|
4577
4677
|
);
|
|
4578
4678
|
const width = tooltip ? Math.min(tooltipWidth, panel.width || tooltipWidth) : Math.min(
|
|
4579
4679
|
maximumWidth,
|
|
4580
|
-
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width :
|
|
4680
|
+
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width : tokens25.extensions.popover.width)
|
|
4581
4681
|
);
|
|
4582
|
-
const available = Math.min(maxHeight != null ? maxHeight : field ?
|
|
4682
|
+
const available = Math.min(maxHeight != null ? maxHeight : field ? tokens25.extensions.menu.listMaxHeight : tokens25.extensions.floating.maxHeight, window2.height - 2 * tokens25.extensions.floating.viewportInset), height = Math.min(panel.height + (header != null ? headerHeight : 0), available), roomAbove = anchor.y - gap - tokens25.extensions.floating.viewportInset, roomBelow = window2.height - anchor.y - anchor.height - gap - tokens25.extensions.floating.viewportInset, above = placement.startsWith("top") ? !(flip && height > roomAbove && roomBelow > roomAbove) : flip && height > roomBelow && roomAbove > roomBelow;
|
|
4583
4683
|
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;
|
|
4584
4684
|
if (placement === "left" || placement === "right") {
|
|
4585
4685
|
left = placement === "left" ? anchor.x - width - gap : anchor.x + anchor.width + gap;
|
|
4586
4686
|
top = anchor.y + (anchor.height - height) / 2;
|
|
4587
4687
|
}
|
|
4588
|
-
left = Math.max(
|
|
4589
|
-
top = Math.max(
|
|
4688
|
+
left = Math.max(tokens25.extensions.floating.viewportInset, Math.min(window2.width - width - tokens25.extensions.floating.viewportInset, left));
|
|
4689
|
+
top = Math.max(tokens25.extensions.floating.viewportInset, Math.min(window2.height - height - tokens25.extensions.floating.viewportInset, top));
|
|
4590
4690
|
if (layer.blocked) return null;
|
|
4591
4691
|
if (tooltip && Platform16.OS === "web") {
|
|
4592
4692
|
if (!motion.present) return null;
|
|
4593
|
-
const arrow =
|
|
4693
|
+
const arrow = tokens25.extensions.tooltip.arrowSize, corner = tokens25.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));
|
|
4594
4694
|
return /* @__PURE__ */ jsxs15(
|
|
4595
4695
|
Animated13.View,
|
|
4596
4696
|
{
|
|
@@ -4617,7 +4717,7 @@ function FloatingPanel({
|
|
|
4617
4717
|
borderRadius: corner,
|
|
4618
4718
|
overflow: "hidden",
|
|
4619
4719
|
backgroundColor: colors.chartTooltipBg,
|
|
4620
|
-
boxShadow: shadowLayers(
|
|
4720
|
+
boxShadow: shadowLayers(tokens25.extensions.tooltip.elevation, colors)
|
|
4621
4721
|
},
|
|
4622
4722
|
children
|
|
4623
4723
|
}
|
|
@@ -4679,8 +4779,8 @@ function FloatingPanel({
|
|
|
4679
4779
|
style: {
|
|
4680
4780
|
opacity: anchored && sized ? motion.opacity : 0,
|
|
4681
4781
|
transform: tooltip ? void 0 : [
|
|
4682
|
-
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ?
|
|
4683
|
-
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ?
|
|
4782
|
+
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ? tokens25.motionDistance.popup : placement === "right" ? -tokens25.motionDistance.popup : 0, 0] }) },
|
|
4783
|
+
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ? tokens25.motionDistance.popup : -tokens25.motionDistance.popup, 0] }) }
|
|
4684
4784
|
],
|
|
4685
4785
|
position: "absolute",
|
|
4686
4786
|
top,
|
|
@@ -4689,11 +4789,11 @@ function FloatingPanel({
|
|
|
4689
4789
|
minWidth: contentSizedMenu ? minimumPanelWidth : void 0,
|
|
4690
4790
|
maxWidth: tooltip ? tooltipWidth : maximumWidth,
|
|
4691
4791
|
maxHeight: available,
|
|
4692
|
-
borderRadius: popover ?
|
|
4693
|
-
borderWidth: popover ? 0 :
|
|
4792
|
+
borderRadius: popover ? tokens25.extensions.popover.radius : field ? tokens25.radius.radius12 : tokens25.extensions.menu.radius,
|
|
4793
|
+
borderWidth: popover ? 0 : tokens25.border.defaultWidth,
|
|
4694
4794
|
borderColor: colors.border,
|
|
4695
4795
|
backgroundColor: colors.surface,
|
|
4696
|
-
boxShadow: (tooltip ?
|
|
4796
|
+
boxShadow: (tooltip ? tokens25.extensions.tooltip.elevation : popover ? tokens25.extensions.popover.elevation : tokens25.extensions.menu.elevation).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4697
4797
|
overflow: "hidden"
|
|
4698
4798
|
},
|
|
4699
4799
|
children: [
|
|
@@ -4702,10 +4802,10 @@ function FloatingPanel({
|
|
|
4702
4802
|
{
|
|
4703
4803
|
onLayout: ({ nativeEvent: { layout } }) => setHeaderHeight(layout.height),
|
|
4704
4804
|
style: {
|
|
4705
|
-
paddingTop:
|
|
4706
|
-
paddingHorizontal:
|
|
4707
|
-
paddingBottom:
|
|
4708
|
-
borderBottomWidth:
|
|
4805
|
+
paddingTop: tokens25.extensions.popover.padding,
|
|
4806
|
+
paddingHorizontal: tokens25.extensions.popover.padding,
|
|
4807
|
+
paddingBottom: tokens25.extensions.popover.headerPaddingBottom,
|
|
4808
|
+
borderBottomWidth: tokens25.border.defaultWidth,
|
|
4709
4809
|
borderBottomColor: colors.divider
|
|
4710
4810
|
},
|
|
4711
4811
|
children: content(header, typeStyle("cardTitle"))
|
|
@@ -4720,7 +4820,7 @@ function FloatingPanel({
|
|
|
4720
4820
|
},
|
|
4721
4821
|
keyboardShouldPersistTaps: "handled",
|
|
4722
4822
|
style: { maxHeight: available - (header != null ? headerHeight : 0), flexShrink: 1 },
|
|
4723
|
-
contentContainerStyle: { padding: menu || field ?
|
|
4823
|
+
contentContainerStyle: { padding: menu || field ? tokens25.extensions.menu.padding : 0 },
|
|
4724
4824
|
onContentSizeChange: (width2, height2) => {
|
|
4725
4825
|
if (contentSizedMenu) return;
|
|
4726
4826
|
setSized(true);
|
|
@@ -4753,7 +4853,7 @@ import {
|
|
|
4753
4853
|
Platform as Platform17,
|
|
4754
4854
|
View as View21
|
|
4755
4855
|
} from "react-native";
|
|
4756
|
-
import { tokens as
|
|
4856
|
+
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
4757
4857
|
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4758
4858
|
function KjunPopover({
|
|
4759
4859
|
noPadding = false,
|
|
@@ -4802,7 +4902,7 @@ function KjunPopover({
|
|
|
4802
4902
|
ariaLabel,
|
|
4803
4903
|
header: header != null ? content(header, { ...typeStyle("cardTitle"), color: colors.text }) : void 0,
|
|
4804
4904
|
nonModal: !modal,
|
|
4805
|
-
children: /* @__PURE__ */ jsx27(View21, { style: { padding: noPadding ? 0 :
|
|
4905
|
+
children: /* @__PURE__ */ jsx27(View21, { style: { padding: noPadding ? 0 : tokens26.extensions.popover.padding, gap: noPadding ? 0 : tokens26.extensions.popover.gap }, children: content(
|
|
4806
4906
|
typeof children === "function" ? children(() => change(false)) : children,
|
|
4807
4907
|
Platform17.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : void 0
|
|
4808
4908
|
) })
|
|
@@ -4909,9 +5009,9 @@ function KjunTooltip({
|
|
|
4909
5009
|
View21,
|
|
4910
5010
|
{
|
|
4911
5011
|
style: {
|
|
4912
|
-
paddingVertical:
|
|
4913
|
-
paddingHorizontal:
|
|
4914
|
-
maxWidth:
|
|
5012
|
+
paddingVertical: tokens26.extensions.tooltip.paddingY,
|
|
5013
|
+
paddingHorizontal: tokens26.extensions.tooltip.paddingX,
|
|
5014
|
+
maxWidth: tokens26.extensions.tooltip.maxWidth,
|
|
4915
5015
|
backgroundColor: colors.chartTooltipBg
|
|
4916
5016
|
},
|
|
4917
5017
|
children: /* @__PURE__ */ jsx27(
|
|
@@ -5014,18 +5114,18 @@ function KjunDropdownItem({
|
|
|
5014
5114
|
style: ({ pressed }) => ({
|
|
5015
5115
|
flexDirection: "row",
|
|
5016
5116
|
alignItems: "center",
|
|
5017
|
-
gap:
|
|
5018
|
-
paddingVertical:
|
|
5019
|
-
paddingHorizontal:
|
|
5020
|
-
minHeight:
|
|
5021
|
-
borderRadius:
|
|
5117
|
+
gap: tokens27.dimension.value8,
|
|
5118
|
+
paddingVertical: tokens27.extensions.menu.optionPaddingY,
|
|
5119
|
+
paddingHorizontal: tokens27.extensions.menu.optionPaddingX,
|
|
5120
|
+
minHeight: tokens27.extensions.menu.optionHeight,
|
|
5121
|
+
borderRadius: tokens27.extensions.menu.optionRadius,
|
|
5022
5122
|
backgroundColor: selected ? colors.selectedBg : !disabled && (pressed || hovered) ? variant === "danger" ? colors.dangerBg : colors.hover : void 0,
|
|
5023
|
-
opacity: disabled ?
|
|
5123
|
+
opacity: disabled ? tokens27.states.opacity.disabled : 1
|
|
5024
5124
|
}),
|
|
5025
5125
|
children: [
|
|
5026
|
-
icon ? /* @__PURE__ */ jsx28(KjunIcon, { name: icon, size:
|
|
5027
|
-
/* @__PURE__ */ jsx28(View22, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize:
|
|
5028
|
-
selected !== null && /* @__PURE__ */ jsx28(View22, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ jsx28(KjunIcon, { name: "check", size:
|
|
5126
|
+
icon ? /* @__PURE__ */ jsx28(KjunIcon, { name: icon, size: tokens27.extensions.menu.iconSize, color: iconColor }) : reserveIcon && /* @__PURE__ */ jsx28(View22, { style: { width: tokens27.extensions.menu.iconSize }, accessible: false }),
|
|
5127
|
+
/* @__PURE__ */ jsx28(View22, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize: tokens27.extensions.menu.optionFontSize, lineHeight: tokens27.extensions.menu.optionLineHeight }) }),
|
|
5128
|
+
selected !== null && /* @__PURE__ */ jsx28(View22, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ jsx28(KjunIcon, { name: "check", size: tokens27.extensions.menu.iconSize, color: colors.brand }) })
|
|
5029
5129
|
]
|
|
5030
5130
|
}
|
|
5031
5131
|
);
|
|
@@ -5036,7 +5136,7 @@ function KjunDropdownDivider() {
|
|
|
5036
5136
|
View22,
|
|
5037
5137
|
{
|
|
5038
5138
|
role: "separator",
|
|
5039
|
-
style: { height:
|
|
5139
|
+
style: { height: tokens27.extensions.menu.dividerHeight, marginVertical: tokens27.dimension.value4, backgroundColor: colors.border }
|
|
5040
5140
|
}
|
|
5041
5141
|
);
|
|
5042
5142
|
}
|
|
@@ -5209,12 +5309,12 @@ function useComboboxModel({
|
|
|
5209
5309
|
}
|
|
5210
5310
|
|
|
5211
5311
|
// packages/native/src/combobox.tsx
|
|
5212
|
-
import { tokens as
|
|
5312
|
+
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5213
5313
|
import { useId as useId5, useRef as useRef20 } from "react";
|
|
5214
5314
|
import { Platform as Platform18, View as View24 } from "react-native";
|
|
5215
5315
|
|
|
5216
5316
|
// packages/native/src/select-options.tsx
|
|
5217
|
-
import { tokens as
|
|
5317
|
+
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5218
5318
|
import { View as View23 } from "react-native";
|
|
5219
5319
|
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5220
5320
|
function OptionRow({
|
|
@@ -5237,20 +5337,20 @@ function OptionRow({
|
|
|
5237
5337
|
onPress,
|
|
5238
5338
|
onLayout,
|
|
5239
5339
|
style: ({ pressed }) => ({
|
|
5240
|
-
borderRadius:
|
|
5241
|
-
minHeight:
|
|
5340
|
+
borderRadius: tokens28.radius.radius8,
|
|
5341
|
+
minHeight: tokens28.extensions.menu.optionHeight,
|
|
5242
5342
|
flexDirection: "row",
|
|
5243
5343
|
alignItems: "center",
|
|
5244
5344
|
justifyContent: "space-between",
|
|
5245
|
-
gap:
|
|
5246
|
-
paddingVertical:
|
|
5247
|
-
paddingHorizontal:
|
|
5345
|
+
gap: tokens28.dimension.value8,
|
|
5346
|
+
paddingVertical: tokens28.extensions.menu.optionPaddingY,
|
|
5347
|
+
paddingHorizontal: tokens28.extensions.menu.optionPaddingX,
|
|
5248
5348
|
backgroundColor: selected ? colors.selectedBg : pressed ? colors.hover : void 0,
|
|
5249
|
-
opacity: disabled ?
|
|
5349
|
+
opacity: disabled ? tokens28.states.opacity.disabled : 1
|
|
5250
5350
|
}),
|
|
5251
5351
|
children: [
|
|
5252
|
-
/* @__PURE__ */ jsx29(View23, { style: { flex: 1 }, children: content(children || label, { fontSize:
|
|
5253
|
-
selected && /* @__PURE__ */ jsx29(KjunIcon, { name: "check", size:
|
|
5352
|
+
/* @__PURE__ */ jsx29(View23, { style: { flex: 1 }, children: content(children || label, { fontSize: tokens28.extensions.menu.optionFontSize, lineHeight: tokens28.extensions.menu.optionLineHeight }) }),
|
|
5353
|
+
selected && /* @__PURE__ */ jsx29(KjunIcon, { name: "check", size: tokens28.extensions.menu.iconSize, color: colors.brand })
|
|
5254
5354
|
]
|
|
5255
5355
|
}
|
|
5256
5356
|
);
|
|
@@ -5388,8 +5488,8 @@ function SearchField({
|
|
|
5388
5488
|
View24,
|
|
5389
5489
|
{
|
|
5390
5490
|
style: {
|
|
5391
|
-
padding:
|
|
5392
|
-
borderBottomWidth:
|
|
5491
|
+
padding: tokens29.dimension.value8,
|
|
5492
|
+
borderBottomWidth: tokens29.border.defaultWidth,
|
|
5393
5493
|
borderBottomColor: colors.border
|
|
5394
5494
|
},
|
|
5395
5495
|
children: /* @__PURE__ */ jsx30(KjunInput, { ...inputProps, nativeID: searchId, autoFocus: true })
|
|
@@ -5397,13 +5497,13 @@ function SearchField({
|
|
|
5397
5497
|
),
|
|
5398
5498
|
loading ? (
|
|
5399
5499
|
// Centered like the Select loading row on every platform.
|
|
5400
|
-
/* @__PURE__ */ jsx30(View24, { style: { padding:
|
|
5500
|
+
/* @__PURE__ */ jsx30(View24, { style: { padding: tokens29.dimension.value12, alignItems: "center" }, children: /* @__PURE__ */ jsx30(KjunSpinner, { size: "sm", text: m.searching }) })
|
|
5401
5501
|
) : failed ? /* @__PURE__ */ jsx30(
|
|
5402
5502
|
KText,
|
|
5403
5503
|
{
|
|
5404
5504
|
accessibilityRole: "alert",
|
|
5405
5505
|
style: {
|
|
5406
|
-
padding:
|
|
5506
|
+
padding: tokens29.dimension.value12,
|
|
5407
5507
|
textAlign: "center",
|
|
5408
5508
|
color: colors.danger
|
|
5409
5509
|
},
|
|
@@ -5426,7 +5526,7 @@ function SearchField({
|
|
|
5426
5526
|
KText,
|
|
5427
5527
|
{
|
|
5428
5528
|
style: {
|
|
5429
|
-
padding:
|
|
5529
|
+
padding: tokens29.dimension.value12,
|
|
5430
5530
|
textAlign: "center",
|
|
5431
5531
|
color: colors.textTertiary
|
|
5432
5532
|
},
|
|
@@ -5440,7 +5540,7 @@ function SearchField({
|
|
|
5440
5540
|
}
|
|
5441
5541
|
|
|
5442
5542
|
// packages/native/src/date-picker.tsx
|
|
5443
|
-
import { tokens as
|
|
5543
|
+
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5444
5544
|
import { useRef as useRef21, useState as useState21 } from "react";
|
|
5445
5545
|
import { Platform as Platform19, View as View25 } from "react-native";
|
|
5446
5546
|
import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
@@ -5464,7 +5564,7 @@ function KjunDatePicker({
|
|
|
5464
5564
|
const scope = useKjunMessageScope();
|
|
5465
5565
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
5466
5566
|
const clear = clearable && !!value && !disabled;
|
|
5467
|
-
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState21(false), [month, setMonth] = useState21(() => displayMonth(value)), ref = useRef21(null), spec =
|
|
5567
|
+
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState21(false), [month, setMonth] = useState21(() => displayMonth(value)), ref = useRef21(null), spec = tokens30.input[size];
|
|
5468
5568
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open });
|
|
5469
5569
|
const year = month.getFullYear(), m = month.getMonth(), first = new Date(year, m, 1).getDay(), count = new Date(year, m + 1, 0).getDate();
|
|
5470
5570
|
const date = (day) => `${year}-${String(m + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
@@ -5472,7 +5572,7 @@ function KjunDatePicker({
|
|
|
5472
5572
|
/* @__PURE__ */ jsxs20(View25, { ref, collapsable: false, ...fieldTarget(() => {
|
|
5473
5573
|
setMonth(displayMonth(value));
|
|
5474
5574
|
setOpen(true);
|
|
5475
|
-
}, disabled), style: { minHeight:
|
|
5575
|
+
}, disabled), style: { minHeight: tokens30.native.minimumTouchTarget, justifyContent: "center" }, children: [
|
|
5476
5576
|
/* @__PURE__ */ jsxs20(
|
|
5477
5577
|
FieldPressable,
|
|
5478
5578
|
{
|
|
@@ -5498,7 +5598,7 @@ function KjunDatePicker({
|
|
|
5498
5598
|
},
|
|
5499
5599
|
style: {
|
|
5500
5600
|
...surface.style,
|
|
5501
|
-
paddingHorizontal: spec.padding -
|
|
5601
|
+
paddingHorizontal: spec.padding - tokens30.border.controlWidth,
|
|
5502
5602
|
flexDirection: "row",
|
|
5503
5603
|
alignItems: "center",
|
|
5504
5604
|
justifyContent: "space-between"
|
|
@@ -5541,9 +5641,9 @@ function KjunDatePicker({
|
|
|
5541
5641
|
triggerRef: ref,
|
|
5542
5642
|
placement: "bottom-start",
|
|
5543
5643
|
matchTriggerWidth: true,
|
|
5544
|
-
minimumWidth:
|
|
5644
|
+
minimumWidth: tokens30.extensions.calendar.minimumWidth,
|
|
5545
5645
|
ariaLabel: scope.messages.datePlaceholder,
|
|
5546
|
-
children: /* @__PURE__ */ jsxs20(View25, { style: { padding:
|
|
5646
|
+
children: /* @__PURE__ */ jsxs20(View25, { style: { padding: tokens30.dimension.value8 }, children: [
|
|
5547
5647
|
/* @__PURE__ */ jsxs20(
|
|
5548
5648
|
View25,
|
|
5549
5649
|
{
|
|
@@ -5584,7 +5684,7 @@ function KjunDatePicker({
|
|
|
5584
5684
|
style: {
|
|
5585
5685
|
width: "14.2857%",
|
|
5586
5686
|
textAlign: "center",
|
|
5587
|
-
paddingVertical:
|
|
5687
|
+
paddingVertical: tokens30.dimension.value8,
|
|
5588
5688
|
color: colors.textTertiary
|
|
5589
5689
|
},
|
|
5590
5690
|
children: day
|
|
@@ -5611,12 +5711,12 @@ function KjunDatePicker({
|
|
|
5611
5711
|
},
|
|
5612
5712
|
style: {
|
|
5613
5713
|
width: "14.2857%",
|
|
5614
|
-
minHeight:
|
|
5714
|
+
minHeight: tokens30.native.minimumTouchTarget,
|
|
5615
5715
|
alignItems: "center",
|
|
5616
5716
|
justifyContent: "center",
|
|
5617
|
-
borderRadius:
|
|
5717
|
+
borderRadius: tokens30.radius.radius6,
|
|
5618
5718
|
backgroundColor: v === value ? colors.brand : void 0,
|
|
5619
|
-
opacity: blocked ?
|
|
5719
|
+
opacity: blocked ? tokens30.states.opacity.disabledStrong : 1
|
|
5620
5720
|
},
|
|
5621
5721
|
children: /* @__PURE__ */ jsx31(
|
|
5622
5722
|
KText,
|
|
@@ -5817,17 +5917,17 @@ function KjunSearchInput({
|
|
|
5817
5917
|
}
|
|
5818
5918
|
|
|
5819
5919
|
// packages/native/src/select-control.tsx
|
|
5820
|
-
import { tokens as
|
|
5920
|
+
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5821
5921
|
import { useContext as useContext14, useEffect as useEffect18, useRef as useRef24 } from "react";
|
|
5822
5922
|
|
|
5823
5923
|
// packages/native/src/compound-control.tsx
|
|
5824
5924
|
import { createContext as createContext18 } from "react";
|
|
5825
5925
|
import { View as View26 } from "react-native";
|
|
5826
|
-
import { tokens as
|
|
5926
|
+
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
5827
5927
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5828
5928
|
var CompoundControlContext = createContext18(null);
|
|
5829
5929
|
function CompoundTarget({ children, square = false }) {
|
|
5830
|
-
const touch = finePointer() ? void 0 :
|
|
5930
|
+
const touch = finePointer() ? void 0 : tokens31.native.minimumTouchTarget;
|
|
5831
5931
|
return /* @__PURE__ */ jsx33(View26, { style: { minHeight: touch, minWidth: square ? touch : void 0, alignItems: "center", justifyContent: "center" }, children });
|
|
5832
5932
|
}
|
|
5833
5933
|
|
|
@@ -5900,7 +6000,7 @@ function KjunSelect({
|
|
|
5900
6000
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
5901
6001
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
5902
6002
|
const { open, query, limit, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
5903
|
-
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef24(null), spec =
|
|
6003
|
+
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef24(null), spec = tokens32.input[size];
|
|
5904
6004
|
const trigger = useRef24(null);
|
|
5905
6005
|
const compound = useContext14(CompoundControlContext);
|
|
5906
6006
|
useEffect18(() => {
|
|
@@ -5932,10 +6032,10 @@ function KjunSelect({
|
|
|
5932
6032
|
return /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
5933
6033
|
/* @__PURE__ */ jsxs21(View27, { ref, collapsable: false, ...fieldTarget(() => changeOpen(!open), disabled), style: {
|
|
5934
6034
|
position: "relative",
|
|
5935
|
-
minHeight:
|
|
6035
|
+
minHeight: tokens32.native.minimumTouchTarget,
|
|
5936
6036
|
justifyContent: "center",
|
|
5937
6037
|
// Inside a compound field the touch target overflows so the shared surface keeps its size height.
|
|
5938
|
-
...compound ? { marginVertical: Math.min(0, (spec.height -
|
|
6038
|
+
...compound ? { marginVertical: Math.min(0, (spec.height - tokens32.native.minimumTouchTarget) / 2) } : {}
|
|
5939
6039
|
}, children: [
|
|
5940
6040
|
/* @__PURE__ */ jsxs21(
|
|
5941
6041
|
FieldPressable,
|
|
@@ -5971,14 +6071,14 @@ function KjunSelect({
|
|
|
5971
6071
|
flexDirection: "row",
|
|
5972
6072
|
alignItems: "center",
|
|
5973
6073
|
justifyContent: "space-between",
|
|
5974
|
-
gap:
|
|
6074
|
+
gap: tokens32.dimension.value8,
|
|
5975
6075
|
...surface.style,
|
|
5976
|
-
paddingHorizontal: spec.padding -
|
|
5977
|
-
paddingRight: spec.padding -
|
|
5978
|
-
...compound ? { paddingHorizontal:
|
|
6076
|
+
paddingHorizontal: spec.padding - tokens32.border.controlWidth,
|
|
6077
|
+
paddingRight: spec.padding - tokens32.border.controlWidth,
|
|
6078
|
+
...compound ? { paddingHorizontal: tokens32.extensions.timePicker.segmentPadding, paddingRight: tokens32.extensions.timePicker.segmentPadding, paddingLeft: compound.leading ? spec.padding - tokens32.border.controlWidth : tokens32.extensions.timePicker.segmentPadding, gap: tokens32.extensions.timePicker.segmentPadding, backgroundColor: !disabled && (surface.active || surface.hovered) ? colors.hover : "transparent", borderColor: "transparent", outlineWidth: 0 } : {}
|
|
5979
6079
|
},
|
|
5980
6080
|
children: [
|
|
5981
|
-
/* @__PURE__ */ jsxs21(View27, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ?
|
|
6081
|
+
/* @__PURE__ */ jsxs21(View27, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ? tokens32.native.minimumTouchTarget + spec.affixGap : 0 }, children: [
|
|
5982
6082
|
compound && /* @__PURE__ */ jsx34(KText, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: { ...inputTypeStyle(size), fontVariant: ["tabular-nums"], opacity: 0 }, children: "00" }),
|
|
5983
6083
|
(renderSelected == null ? void 0 : renderSelected(selectedOption)) || /* @__PURE__ */ jsx34(KText, { numberOfLines: 1, style: {
|
|
5984
6084
|
...inputTypeStyle(size),
|
|
@@ -5990,7 +6090,7 @@ function KjunSelect({
|
|
|
5990
6090
|
KjunIcon,
|
|
5991
6091
|
{
|
|
5992
6092
|
name: "chevron-down",
|
|
5993
|
-
size: compound ?
|
|
6093
|
+
size: compound ? tokens32.extensions.timePicker.iconSize : spec.iconSize,
|
|
5994
6094
|
color: surface.icon
|
|
5995
6095
|
}
|
|
5996
6096
|
) })
|
|
@@ -6034,8 +6134,8 @@ function KjunSelect({
|
|
|
6034
6134
|
View27,
|
|
6035
6135
|
{
|
|
6036
6136
|
style: {
|
|
6037
|
-
padding:
|
|
6038
|
-
borderBottomWidth:
|
|
6137
|
+
padding: tokens32.dimension.value8,
|
|
6138
|
+
borderBottomWidth: tokens32.border.defaultWidth,
|
|
6039
6139
|
borderBottomColor: colors.border
|
|
6040
6140
|
},
|
|
6041
6141
|
children: /* @__PURE__ */ jsx34(
|
|
@@ -6055,7 +6155,7 @@ function KjunSelect({
|
|
|
6055
6155
|
)
|
|
6056
6156
|
}
|
|
6057
6157
|
),
|
|
6058
|
-
loading ? /* @__PURE__ */ jsx34(View27, { style: { padding:
|
|
6158
|
+
loading ? /* @__PURE__ */ jsx34(View27, { style: { padding: tokens32.dimension.value12 }, children: /* @__PURE__ */ jsx34(KjunSpinner, { size: "sm", text: m.searching }) }) : visible.map(({ option: o, key }, index) => /* @__PURE__ */ jsx34(
|
|
6059
6159
|
OptionRow,
|
|
6060
6160
|
{
|
|
6061
6161
|
selected: selected(o),
|
|
@@ -6077,7 +6177,7 @@ function KjunSelect({
|
|
|
6077
6177
|
KText,
|
|
6078
6178
|
{
|
|
6079
6179
|
style: {
|
|
6080
|
-
padding:
|
|
6180
|
+
padding: tokens32.dimension.value12,
|
|
6081
6181
|
textAlign: "center",
|
|
6082
6182
|
color: colors.textTertiary
|
|
6083
6183
|
},
|
|
@@ -6101,10 +6201,10 @@ function KjunSelect({
|
|
|
6101
6201
|
}
|
|
6102
6202
|
|
|
6103
6203
|
// packages/native/src/navigation.tsx
|
|
6104
|
-
import { tokens as
|
|
6204
|
+
import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
6105
6205
|
|
|
6106
6206
|
// packages/native/src/collapse.tsx
|
|
6107
|
-
import { tokens as
|
|
6207
|
+
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6108
6208
|
import { useLayoutEffect as useLayoutEffect13, useRef as useRef25, useState as useState25 } from "react";
|
|
6109
6209
|
import { Animated as Animated14, View as View28 } from "react-native";
|
|
6110
6210
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
@@ -6131,7 +6231,7 @@ function Collapse({ open, children }) {
|
|
|
6131
6231
|
finish();
|
|
6132
6232
|
} else {
|
|
6133
6233
|
setSettled(false);
|
|
6134
|
-
Animated14.timing(value, { toValue: target, duration:
|
|
6234
|
+
Animated14.timing(value, { toValue: target, duration: tokens33.motion.collapse, easing: motionOut, useNativeDriver: false }).start(({ finished }) => {
|
|
6135
6235
|
if (finished) finish();
|
|
6136
6236
|
});
|
|
6137
6237
|
}
|
|
@@ -6205,7 +6305,7 @@ import {
|
|
|
6205
6305
|
import { Animated as Animated16, View as View30, useWindowDimensions as useWindowDimensions5, Platform as Platform22 } from "react-native";
|
|
6206
6306
|
|
|
6207
6307
|
// packages/native/src/tabs.tsx
|
|
6208
|
-
import { tokens as
|
|
6308
|
+
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6209
6309
|
import { Children as Children4, createContext as createContext19, isValidElement as isValidElement7, useContext as useContext15, useCallback as useCallback5, useLayoutEffect as useLayoutEffect15, useRef as useRef28, useId as useId6, useState as useState27 } from "react";
|
|
6210
6310
|
import { Animated as Animated15, Platform as Platform21, ScrollView as ScrollView5, View as View29 } from "react-native";
|
|
6211
6311
|
|
|
@@ -6338,14 +6438,14 @@ function KjunTabs({
|
|
|
6338
6438
|
if (!onTabMenu || !tabs.some((tab) => tab.name === pressedMenu.current && !tab.disabled)) pressedMenu.current = null;
|
|
6339
6439
|
}, [tabs, onTabMenu]);
|
|
6340
6440
|
const panelNames = panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name);
|
|
6341
|
-
const geometry2 =
|
|
6441
|
+
const geometry2 = tokens34.extensions.tabs;
|
|
6342
6442
|
const underline = variant === "underline";
|
|
6343
6443
|
const [hoveredTab, setHoveredTab] = useState27(null);
|
|
6344
6444
|
const singleLine = Platform21.OS === "web" ? { whiteSpace: "nowrap" } : {};
|
|
6345
6445
|
const paddingX = !underline ? geometry2.pillsPaddingX : density === "compact" ? geometry2.compactPaddingX : geometry2.paddingX;
|
|
6346
6446
|
const height = density === "compact" ? geometry2.compactHeight : geometry2.height;
|
|
6347
|
-
const ringRoom =
|
|
6348
|
-
const slop = Math.max(0, (
|
|
6447
|
+
const ringRoom = tokens34.states.focus.width + tokens34.states.focus.offset;
|
|
6448
|
+
const slop = Math.max(0, (tokens34.native.minimumTouchTarget - height) / 2);
|
|
6349
6449
|
const roomX = underline ? ringRoom : 0, roomY = Math.max(underline ? ringRoom : 0, slop);
|
|
6350
6450
|
const selectedTab = tabs.find((tab) => tab.name === value);
|
|
6351
6451
|
const selection = useButtonGroupMotion(selectedTab ? { ...selectedTab, value: selectedTab.name } : void 0);
|
|
@@ -6404,7 +6504,7 @@ function KjunTabs({
|
|
|
6404
6504
|
transform: [{ translateX: selection.x }],
|
|
6405
6505
|
borderRadius: underline ? geometry2.indicatorHeight / 2 : geometry2.radius,
|
|
6406
6506
|
backgroundColor: variant === "underline" ? colors.brand : colors.active,
|
|
6407
|
-
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ?
|
|
6507
|
+
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ? tokens34.states.opacity.disabled : 1
|
|
6408
6508
|
}
|
|
6409
6509
|
}
|
|
6410
6510
|
),
|
|
@@ -6464,7 +6564,7 @@ function KjunTabs({
|
|
|
6464
6564
|
borderRadius: geometry2.radius,
|
|
6465
6565
|
// Pills answer hover with the hover surface, like ButtonGroup and Web.
|
|
6466
6566
|
backgroundColor: !underline && !active && !tab.disabled && hoveredTab === tab.name ? colors.hover : void 0,
|
|
6467
|
-
opacity: tab.disabled ?
|
|
6567
|
+
opacity: tab.disabled ? tokens34.states.opacity.disabled : 1
|
|
6468
6568
|
},
|
|
6469
6569
|
children: [
|
|
6470
6570
|
!!tab.icon && /* @__PURE__ */ jsx36(
|
|
@@ -6559,7 +6659,7 @@ function KjunAccordion({
|
|
|
6559
6659
|
View30,
|
|
6560
6660
|
{
|
|
6561
6661
|
style: {
|
|
6562
|
-
borderRadius:
|
|
6662
|
+
borderRadius: tokens35.extensions.accordion.radius,
|
|
6563
6663
|
overflow: "hidden",
|
|
6564
6664
|
backgroundColor: tone === "muted" ? colors.secondary : colors.surface
|
|
6565
6665
|
},
|
|
@@ -6577,8 +6677,8 @@ function KjunAccordionItem({
|
|
|
6577
6677
|
children
|
|
6578
6678
|
}) {
|
|
6579
6679
|
const { colors } = useKjunStyles(), group = useContext16(AccordionContext), id = "kjun-" + useId7(), [own, setOwn] = useState28(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
6580
|
-
const rotation = useMotionValue(open ? 1 : 0,
|
|
6581
|
-
const geometry2 =
|
|
6680
|
+
const rotation = useMotionValue(open ? 1 : 0, tokens35.motion.collapse, void 0, void 0, true);
|
|
6681
|
+
const geometry2 = tokens35.extensions.accordion;
|
|
6582
6682
|
const [hovered, setHovered] = useState28(false);
|
|
6583
6683
|
const wrapping = Platform22.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
6584
6684
|
useEffect20(() => {
|
|
@@ -6591,7 +6691,7 @@ function KjunAccordionItem({
|
|
|
6591
6691
|
nativeID: id + "-heading",
|
|
6592
6692
|
accessibilityRole: "button",
|
|
6593
6693
|
focusRingInset: true,
|
|
6594
|
-
focusRingRadius:
|
|
6694
|
+
focusRingRadius: tokens35.extensions.accordion.radius,
|
|
6595
6695
|
accessibilityLabel: title,
|
|
6596
6696
|
accessibilityState: { expanded: open, disabled },
|
|
6597
6697
|
disabled,
|
|
@@ -6607,7 +6707,7 @@ function KjunAccordionItem({
|
|
|
6607
6707
|
paddingVertical: geometry2.headerPaddingY,
|
|
6608
6708
|
paddingHorizontal: geometry2.paddingX,
|
|
6609
6709
|
backgroundColor: !disabled && (pressed || hovered) ? colors.hover : void 0,
|
|
6610
|
-
opacity: disabled ?
|
|
6710
|
+
opacity: disabled ? tokens35.states.opacity.disabled : 1
|
|
6611
6711
|
}),
|
|
6612
6712
|
children: [
|
|
6613
6713
|
/* @__PURE__ */ jsx37(View30, { style: { flex: 1, minWidth: 0 }, children: content(header || title, { ...typeStyle("control"), ...wrapping }) }),
|
|
@@ -6642,11 +6742,11 @@ function KjunBreadcrumb({
|
|
|
6642
6742
|
flexDirection: "row",
|
|
6643
6743
|
alignItems: "center",
|
|
6644
6744
|
flexWrap: "wrap",
|
|
6645
|
-
gap:
|
|
6745
|
+
gap: tokens35.dimension.value8
|
|
6646
6746
|
},
|
|
6647
6747
|
children: items2.map((item, i) => {
|
|
6648
|
-
const label = /* @__PURE__ */ jsxs23(View30, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6649
|
-
!!item.icon && /* @__PURE__ */ jsx37(KjunIcon, { name: item.icon, size:
|
|
6748
|
+
const label = /* @__PURE__ */ jsxs23(View30, { style: { flexDirection: "row", alignItems: "center", gap: tokens35.dimension.value4 }, children: [
|
|
6749
|
+
!!item.icon && /* @__PURE__ */ jsx37(KjunIcon, { name: item.icon, size: tokens35.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
6650
6750
|
/* @__PURE__ */ jsx37(
|
|
6651
6751
|
KText,
|
|
6652
6752
|
{
|
|
@@ -6663,7 +6763,7 @@ function KjunBreadcrumb({
|
|
|
6663
6763
|
KjunIcon,
|
|
6664
6764
|
{
|
|
6665
6765
|
name: "chevron-right",
|
|
6666
|
-
size:
|
|
6766
|
+
size: tokens35.extensions.breadcrumb.separatorSize,
|
|
6667
6767
|
color: colors.textTertiary
|
|
6668
6768
|
}
|
|
6669
6769
|
),
|
|
@@ -6673,7 +6773,7 @@ function KjunBreadcrumb({
|
|
|
6673
6773
|
{
|
|
6674
6774
|
accessibilityRole: "link",
|
|
6675
6775
|
onPress: () => onNavigate == null ? void 0 : onNavigate(item),
|
|
6676
|
-
style: { minHeight:
|
|
6776
|
+
style: { minHeight: tokens35.native.minimumTouchTarget, justifyContent: "center" },
|
|
6677
6777
|
children: label
|
|
6678
6778
|
}
|
|
6679
6779
|
) : label
|
|
@@ -6702,7 +6802,7 @@ function KjunPagination({
|
|
|
6702
6802
|
const m = useKjunMessages();
|
|
6703
6803
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions5(), current = Math.max(1, Math.min(totalPages, (_a = currentPage != null ? currentPage : page) != null ? _a : 1));
|
|
6704
6804
|
if (totalPages <= 1 && !showSizeSelector && !(showInfo && totalRows > 0)) return null;
|
|
6705
|
-
const compact = window2.width <
|
|
6805
|
+
const compact = window2.width < tokens35.responsive.pagination;
|
|
6706
6806
|
const change = (v) => {
|
|
6707
6807
|
if (v < 1 || v > totalPages || v === current) return;
|
|
6708
6808
|
onPageChange == null ? void 0 : onPageChange(v);
|
|
@@ -6718,12 +6818,12 @@ function KjunPagination({
|
|
|
6718
6818
|
]);
|
|
6719
6819
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
6720
6820
|
const pageButtonStyle = {
|
|
6721
|
-
width: Math.max(
|
|
6722
|
-
height: Math.max(
|
|
6723
|
-
borderRadius:
|
|
6821
|
+
width: Math.max(tokens35.extensions.pagination.itemSize, tokens35.native.minimumTouchTarget),
|
|
6822
|
+
height: Math.max(tokens35.extensions.pagination.itemSize, tokens35.native.minimumTouchTarget),
|
|
6823
|
+
borderRadius: tokens35.extensions.pagination.radius,
|
|
6724
6824
|
paddingHorizontal: 0
|
|
6725
6825
|
};
|
|
6726
|
-
const arrowSize = (_b = Object.keys(
|
|
6826
|
+
const arrowSize = (_b = Object.keys(tokens35.button.iconSizes).find((size) => tokens35.button.iconSizes[size] === tokens35.extensions.pagination.iconSize)) != null ? _b : "sm";
|
|
6727
6827
|
const button = (target, label, icon) => /* @__PURE__ */ jsx37(
|
|
6728
6828
|
KjunButton,
|
|
6729
6829
|
{
|
|
@@ -6744,9 +6844,9 @@ function KjunPagination({
|
|
|
6744
6844
|
flexDirection: compact ? "column" : "row",
|
|
6745
6845
|
alignItems: compact ? "stretch" : "center",
|
|
6746
6846
|
justifyContent: "space-between",
|
|
6747
|
-
gap:
|
|
6748
|
-
padding:
|
|
6749
|
-
borderTopWidth:
|
|
6847
|
+
gap: tokens35.extensions.pagination.gap,
|
|
6848
|
+
padding: tokens35.extensions.pagination.padding,
|
|
6849
|
+
borderTopWidth: tokens35.border.defaultWidth,
|
|
6750
6850
|
borderTopColor: colors.border
|
|
6751
6851
|
},
|
|
6752
6852
|
children: [
|
|
@@ -6757,11 +6857,11 @@ function KjunPagination({
|
|
|
6757
6857
|
style: {
|
|
6758
6858
|
flexDirection: "row",
|
|
6759
6859
|
alignItems: "center",
|
|
6760
|
-
gap:
|
|
6860
|
+
gap: tokens35.extensions.pagination.itemGap,
|
|
6761
6861
|
flexWrap: "wrap"
|
|
6762
6862
|
},
|
|
6763
6863
|
children: [
|
|
6764
|
-
showSizeSelector && /* @__PURE__ */ jsx37(View30, { style: { minWidth:
|
|
6864
|
+
showSizeSelector && /* @__PURE__ */ jsx37(View30, { style: { minWidth: tokens35.extensions.pagination.selectorMinimumWidth }, children: /* @__PURE__ */ jsx37(
|
|
6765
6865
|
KjunSelect,
|
|
6766
6866
|
{
|
|
6767
6867
|
size: "sm",
|
|
@@ -6778,10 +6878,10 @@ function KjunPagination({
|
|
|
6778
6878
|
}
|
|
6779
6879
|
}
|
|
6780
6880
|
) }),
|
|
6781
|
-
totalPages > 1 && /* @__PURE__ */ jsxs23(View30, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6881
|
+
totalPages > 1 && /* @__PURE__ */ jsxs23(View30, { style: { flexDirection: "row", alignItems: "center", gap: tokens35.extensions.pagination.itemGap, marginLeft: compact ? "auto" : void 0 }, children: [
|
|
6782
6882
|
!compact && showFirstLast && button(1, m.firstPage, "chevrons-left"),
|
|
6783
6883
|
button(current - 1, m.previousPage, "chevron-left"),
|
|
6784
|
-
compact ? /* @__PURE__ */ jsxs23(KText, { style: { paddingHorizontal:
|
|
6884
|
+
compact ? /* @__PURE__ */ jsxs23(KText, { style: { paddingHorizontal: tokens35.extensions.pagination.labelPaddingX, color: colors.text, fontVariant: ["tabular-nums"] }, children: [
|
|
6785
6885
|
/* @__PURE__ */ jsx37(KText, { style: { fontWeight: typeStyle("control").fontWeight }, children: current }),
|
|
6786
6886
|
" / ",
|
|
6787
6887
|
totalPages
|
|
@@ -6811,7 +6911,7 @@ function KjunPagination({
|
|
|
6811
6911
|
}
|
|
6812
6912
|
|
|
6813
6913
|
// packages/native/src/actions.tsx
|
|
6814
|
-
import { tokens as
|
|
6914
|
+
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
6815
6915
|
import { useContext as useContext17, useEffect as useEffect21, useRef as useRef29, useState as useState29 } from "react";
|
|
6816
6916
|
import { Platform as Platform23, ScrollView as ScrollView7, View as View31 } from "react-native";
|
|
6817
6917
|
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
@@ -6832,7 +6932,7 @@ function KjunIconToggle({
|
|
|
6832
6932
|
}) {
|
|
6833
6933
|
const { colors } = useKjunStyles();
|
|
6834
6934
|
const navigation = useContext17(TopNavigationContext);
|
|
6835
|
-
const box = navigation ? navigation.controlSize : size === "xs" ?
|
|
6935
|
+
const box = navigation ? navigation.controlSize : size === "xs" ? tokens36.extensions.iconToggle.compactSize : tokens36.extensions.iconToggle.sizes[size];
|
|
6836
6936
|
return /* @__PURE__ */ jsx38(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ jsx38(
|
|
6837
6937
|
AccessiblePressable,
|
|
6838
6938
|
{
|
|
@@ -6858,24 +6958,24 @@ function KjunIconToggle({
|
|
|
6858
6958
|
...Platform23.OS === "web" ? { pointerEvents: "auto" } : {},
|
|
6859
6959
|
// The touch target stays 44pt; the visible square follows the icon-toggle scale.
|
|
6860
6960
|
alignSelf: "flex-start",
|
|
6861
|
-
minWidth: Math.max(
|
|
6862
|
-
minHeight: Math.max(
|
|
6961
|
+
minWidth: Math.max(tokens36.native.minimumTouchTarget, box),
|
|
6962
|
+
minHeight: Math.max(tokens36.native.minimumTouchTarget, box),
|
|
6863
6963
|
alignItems: "center",
|
|
6864
6964
|
justifyContent: "center",
|
|
6865
6965
|
...navigation ? { width: navigation.controlSize, height: navigation.controlSize, flexShrink: 0 } : {},
|
|
6866
|
-
borderRadius:
|
|
6966
|
+
borderRadius: tokens36.extensions.iconToggle.radii[size],
|
|
6867
6967
|
// Loading blocks presses but stays legible; only disabled dims.
|
|
6868
|
-
opacity: disabled ?
|
|
6968
|
+
opacity: disabled ? tokens36.states.opacity.disabled : 1,
|
|
6869
6969
|
transform: [{ scale: pressed ? 0.94 : 1 }]
|
|
6870
6970
|
}),
|
|
6871
6971
|
children: ({ pressed, hovered }) => {
|
|
6872
6972
|
var _a;
|
|
6873
|
-
return /* @__PURE__ */ jsx38(View31, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius:
|
|
6973
|
+
return /* @__PURE__ */ jsx38(View31, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius: tokens36.extensions.iconToggle.radii[size], backgroundColor: !disabled && !loading && (pressed || hovered) ? colors.hover : "transparent" }, children: loading ? navigation ? /* @__PURE__ */ jsx38(KjunIcon, { name: "loader-2", spin: true, size: navigation.iconSize }) : /* @__PURE__ */ jsx38(KjunSpinner, { size: "sm" }) : /* @__PURE__ */ jsx38(
|
|
6874
6974
|
KjunIcon,
|
|
6875
6975
|
{
|
|
6876
6976
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
6877
6977
|
filled: active,
|
|
6878
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
6978
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens36.button.iconSizes[size],
|
|
6879
6979
|
color: active ? activeColor != null ? activeColor : colors.brand : hovered && !disabled && !loading ? colors.textSecondary : inactiveColor != null ? inactiveColor : colors.textTertiary
|
|
6880
6980
|
}
|
|
6881
6981
|
) });
|
|
@@ -6936,24 +7036,24 @@ function KjunCopyButton({
|
|
|
6936
7036
|
},
|
|
6937
7037
|
style: ({ pressed }) => ({
|
|
6938
7038
|
alignSelf: "flex-start",
|
|
6939
|
-
minWidth:
|
|
6940
|
-
minHeight:
|
|
7039
|
+
minWidth: tokens36.native.minimumTouchTarget,
|
|
7040
|
+
minHeight: tokens36.native.minimumTouchTarget,
|
|
6941
7041
|
alignItems: "center",
|
|
6942
7042
|
justifyContent: "center",
|
|
6943
7043
|
flexDirection: "row",
|
|
6944
|
-
gap:
|
|
6945
|
-
paddingHorizontal: { xs:
|
|
6946
|
-
paddingVertical: { xs:
|
|
6947
|
-
borderRadius:
|
|
7044
|
+
gap: tokens36.dimension.value6,
|
|
7045
|
+
paddingHorizontal: { xs: tokens36.dimension.value2, sm: tokens36.dimension.value8, md: tokens36.dimension.value12 }[size],
|
|
7046
|
+
paddingVertical: { xs: tokens36.dimension.value2, sm: tokens36.dimension.value4, md: tokens36.dimension.value6 }[size],
|
|
7047
|
+
borderRadius: tokens36.radius.radius6,
|
|
6948
7048
|
backgroundColor: pressed && !inline ? colors.hover : void 0,
|
|
6949
|
-
opacity: disabled ?
|
|
7049
|
+
opacity: disabled ? tokens36.states.opacity.disabled : 1
|
|
6950
7050
|
}),
|
|
6951
7051
|
children: [
|
|
6952
7052
|
/* @__PURE__ */ jsx38(
|
|
6953
7053
|
KjunIcon,
|
|
6954
7054
|
{
|
|
6955
7055
|
name: copied ? "check" : "copy",
|
|
6956
|
-
size:
|
|
7056
|
+
size: tokens36.button.iconSizes[size],
|
|
6957
7057
|
color: copied ? colors.success : colors.textSecondary
|
|
6958
7058
|
}
|
|
6959
7059
|
),
|
|
@@ -7028,12 +7128,12 @@ function KjunExternalLink({
|
|
|
7028
7128
|
accessibilityRole: "link",
|
|
7029
7129
|
accessibilityLabel: name ? name + m.newWindow : void 0,
|
|
7030
7130
|
onPress: () => openUrl(url),
|
|
7031
|
-
style: { alignSelf: "flex-start", minHeight:
|
|
7131
|
+
style: { alignSelf: "flex-start", minHeight: tokens36.native.minimumTouchTarget, justifyContent: "center" },
|
|
7032
7132
|
children: mode === "text" ? (
|
|
7033
7133
|
// Like Web, text links show the new-window cue after the text.
|
|
7034
|
-
/* @__PURE__ */ jsxs24(View31, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
7134
|
+
/* @__PURE__ */ jsxs24(View31, { style: { flexDirection: "row", alignItems: "center", gap: tokens36.dimension.value4 }, children: [
|
|
7035
7135
|
body,
|
|
7036
|
-
/* @__PURE__ */ jsx38(KjunIcon, { name: "external-link", size:
|
|
7136
|
+
/* @__PURE__ */ jsx38(KjunIcon, { name: "external-link", size: tokens36.iconSizes.small, color: colors.text })
|
|
7037
7137
|
] })
|
|
7038
7138
|
) : body
|
|
7039
7139
|
}
|
|
@@ -7053,7 +7153,7 @@ function KjunScrollFade({ children }) {
|
|
|
7053
7153
|
|
|
7054
7154
|
// packages/native/src/data-state.tsx
|
|
7055
7155
|
import {
|
|
7056
|
-
tokens as
|
|
7156
|
+
tokens as tokens37,
|
|
7057
7157
|
advanceQueryDisplay,
|
|
7058
7158
|
initialQueryDisplay,
|
|
7059
7159
|
queryDisplayStatus
|
|
@@ -7116,7 +7216,7 @@ function KjunDataState({
|
|
|
7116
7216
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
7117
7217
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
7118
7218
|
retryText != null ? retryText : retryText = m.retry;
|
|
7119
|
-
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 =
|
|
7219
|
+
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 = tokens37.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
7120
7220
|
const { colors } = useKjunStyles();
|
|
7121
7221
|
return /* @__PURE__ */ jsxs25(
|
|
7122
7222
|
View32,
|
|
@@ -7131,13 +7231,13 @@ function KjunDataState({
|
|
|
7131
7231
|
style: {
|
|
7132
7232
|
alignSelf: "flex-end",
|
|
7133
7233
|
maxWidth: "100%",
|
|
7134
|
-
marginBottom:
|
|
7234
|
+
marginBottom: tokens37.dimension.value12,
|
|
7135
7235
|
flexDirection: "row",
|
|
7136
7236
|
alignItems: "center",
|
|
7137
|
-
gap:
|
|
7138
|
-
paddingVertical:
|
|
7139
|
-
paddingHorizontal:
|
|
7140
|
-
borderRadius:
|
|
7237
|
+
gap: tokens37.dimension.value6,
|
|
7238
|
+
paddingVertical: tokens37.dimension.value4,
|
|
7239
|
+
paddingHorizontal: tokens37.dimension.value8,
|
|
7240
|
+
borderRadius: tokens37.radius.radius12,
|
|
7141
7241
|
backgroundColor: colors.surface
|
|
7142
7242
|
},
|
|
7143
7243
|
children: [
|
|
@@ -7153,7 +7253,7 @@ function KjunDataState({
|
|
|
7153
7253
|
"aria-hidden": revealed ? void 0 : true,
|
|
7154
7254
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
7155
7255
|
style: { paddingVertical: loadingPadding === "none" ? 0 : padding, opacity: revealed ? void 0 : 0 },
|
|
7156
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx39(View32, { style: { gap:
|
|
7256
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx39(View32, { style: { gap: tokens37.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx39(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ jsxs25(View32, { style: { alignItems: "center", gap: tokens37.dimension.value12 }, children: [
|
|
7157
7257
|
/* @__PURE__ */ jsx39(KjunSpinner, { size: "md" }),
|
|
7158
7258
|
/* @__PURE__ */ jsx39(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
7159
7259
|
] }))
|
|
@@ -7172,12 +7272,12 @@ function KjunDataState({
|
|
|
7172
7272
|
right: 0,
|
|
7173
7273
|
opacity: 0,
|
|
7174
7274
|
...Platform24.OS === "web" ? { visibility: "hidden" } : {}
|
|
7175
|
-
} : { opacity: query.loading && !state.usesQueryState ?
|
|
7275
|
+
} : { opacity: query.loading && !state.usesQueryState ? tokens37.states.opacity.pending : 1 },
|
|
7176
7276
|
children: content(children)
|
|
7177
7277
|
},
|
|
7178
7278
|
"content"
|
|
7179
7279
|
),
|
|
7180
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ jsx39(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx39(View32, { style: { marginTop:
|
|
7280
|
+
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ jsx39(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx39(View32, { style: { marginTop: tokens37.dimension.value12 }, children: /* @__PURE__ */ jsx39(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ jsx39(KjunButton, { variant: "secondary", onPress: onRetry, children: retryText }), children: m.refreshError(String(visibleRefreshError)) }) }) })
|
|
7181
7281
|
]
|
|
7182
7282
|
}
|
|
7183
7283
|
);
|
|
@@ -7185,7 +7285,7 @@ function KjunDataState({
|
|
|
7185
7285
|
function BoundaryDescription() {
|
|
7186
7286
|
const m = useKjunMessages();
|
|
7187
7287
|
const { colors } = useKjunStyles();
|
|
7188
|
-
return /* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...
|
|
7288
|
+
return /* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...tokens37.typography.caption, fontSizePx: tokens37.extensions.state.descriptionSize }), color: colors.textSecondary, textAlign: "center" }, children: m.retryHint });
|
|
7189
7289
|
}
|
|
7190
7290
|
var KjunErrorBoundary = class extends Component {
|
|
7191
7291
|
constructor() {
|
|
@@ -7205,13 +7305,13 @@ var KjunErrorBoundary = class extends Component {
|
|
|
7205
7305
|
{
|
|
7206
7306
|
style: {
|
|
7207
7307
|
alignItems: "center",
|
|
7208
|
-
paddingVertical:
|
|
7209
|
-
paddingHorizontal:
|
|
7210
|
-
gap:
|
|
7308
|
+
paddingVertical: tokens37.dimension.value64,
|
|
7309
|
+
paddingHorizontal: tokens37.dimension.value24,
|
|
7310
|
+
gap: tokens37.dimension.value16
|
|
7211
7311
|
},
|
|
7212
7312
|
children: [
|
|
7213
|
-
/* @__PURE__ */ jsxs25(View32, { style: { gap:
|
|
7214
|
-
/* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...
|
|
7313
|
+
/* @__PURE__ */ jsxs25(View32, { style: { gap: tokens37.dimension.value8, alignItems: "center" }, children: [
|
|
7314
|
+
/* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...tokens37.typography.sectionTitle, fontSizePx: tokens37.extensions.state.titleSize }), textAlign: "center" }, children: this.props.fallbackMessage || this.context.messages.somethingWentWrong }),
|
|
7215
7315
|
/* @__PURE__ */ jsx39(BoundaryDescription, {})
|
|
7216
7316
|
] }),
|
|
7217
7317
|
/* @__PURE__ */ jsx39(
|
|
@@ -7234,7 +7334,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
7234
7334
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
7235
7335
|
|
|
7236
7336
|
// packages/native/src/skeletons.tsx
|
|
7237
|
-
import { tokens as
|
|
7337
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7238
7338
|
import { useEffect as useEffect23, useRef as useRef30, useState as useState33 } from "react";
|
|
7239
7339
|
import { Animated as Animated17, Platform as Platform25, View as View34, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
7240
7340
|
import Svg5, { Path as Path4 } from "react-native-svg";
|
|
@@ -7258,12 +7358,12 @@ function chartSkeletonKind(kind) {
|
|
|
7258
7358
|
}
|
|
7259
7359
|
|
|
7260
7360
|
// packages/native/src/market-skeleton.tsx
|
|
7261
|
-
import { tokens as
|
|
7361
|
+
import { tokens as tokens40 } from "@kjun-ui/tokens";
|
|
7262
7362
|
import { ScrollView as ScrollView8, View as View33 } from "react-native";
|
|
7263
7363
|
|
|
7264
7364
|
// shared/package-runtime/market-layout.ts
|
|
7265
|
-
import { tokens as
|
|
7266
|
-
var marketGeometry =
|
|
7365
|
+
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
7366
|
+
var marketGeometry = tokens38.extensions.marketTable;
|
|
7267
7367
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
7268
7368
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
7269
7369
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -7281,33 +7381,33 @@ function nativeMarketLayout(columns, showActions, containerWidth) {
|
|
|
7281
7381
|
}
|
|
7282
7382
|
|
|
7283
7383
|
// packages/native/src/market-layout.ts
|
|
7284
|
-
import { tokens as
|
|
7384
|
+
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
7285
7385
|
import { useState as useState32 } from "react";
|
|
7286
7386
|
function useMarketLayout(columns, showActions) {
|
|
7287
7387
|
const [containerWidth, setContainerWidth] = useState32(0);
|
|
7288
7388
|
const onLayout = (event) => setContainerWidth(event.nativeEvent.layout.width);
|
|
7289
7389
|
return { ...nativeMarketLayout(columns, showActions, containerWidth), onLayout };
|
|
7290
7390
|
}
|
|
7291
|
-
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth:
|
|
7292
|
-
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth:
|
|
7391
|
+
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth: tokens39.border.defaultWidth };
|
|
7392
|
+
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth: tokens39.border.defaultWidth };
|
|
7293
7393
|
|
|
7294
7394
|
// packages/native/src/market-skeleton.tsx
|
|
7295
7395
|
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7296
7396
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false }) {
|
|
7297
7397
|
const { colors } = useKjunStyles();
|
|
7298
7398
|
const cols = normalizeMarketColumns(columns), layout = useMarketLayout(cols, showActions);
|
|
7299
|
-
const actions = { width: marketGeometry.actionsWidth, paddingVertical:
|
|
7399
|
+
const actions = { width: marketGeometry.actionsWidth, paddingVertical: tokens40.dimension.value12, paddingHorizontal: tokens40.dimension.value4, justifyContent: "center", alignItems: "center" };
|
|
7300
7400
|
return /* @__PURE__ */ jsx40(ScrollView8, { horizontal: true, onLayout: layout.onLayout, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: /* @__PURE__ */ jsxs26(View33, { style: { width: layout.width }, children: [
|
|
7301
7401
|
/* @__PURE__ */ jsxs26(View33, { style: { ...marketHeaderStyle, borderBottomColor: colors.border }, children: [
|
|
7302
|
-
showActions && /* @__PURE__ */ jsx40(View33, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width:
|
|
7303
|
-
cols.map((col, i) => /* @__PURE__ */ jsx40(View33, { style: { width: layout.widths[i], padding:
|
|
7402
|
+
showActions && /* @__PURE__ */ jsx40(View33, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: tokens40.extensions.marketTable.actionSkeletonWidth, height: tokens40.extensions.marketTable.headerSkeletonHeight }) }),
|
|
7403
|
+
cols.map((col, i) => /* @__PURE__ */ jsx40(View33, { style: { width: layout.widths[i], padding: tokens40.dimension.value12, justifyContent: "center" }, children: /* @__PURE__ */ jsx40(KText, { style: { ...typeStyle("meta"), color: colors.textTertiary, textAlign: col.align }, children: col.label }) }, col.key || i))
|
|
7304
7404
|
] }),
|
|
7305
7405
|
Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ jsxs26(View33, { style: { ...marketRowStyle, borderBottomColor: colors.border }, children: [
|
|
7306
|
-
showActions && /* @__PURE__ */ jsx40(View33, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width:
|
|
7307
|
-
cols.map((col, i) => /* @__PURE__ */ jsx40(View33, { style: { width: layout.widths[i], paddingVertical:
|
|
7308
|
-
/* @__PURE__ */ jsx40(View33, { style: { height:
|
|
7309
|
-
/* @__PURE__ */ jsx40(View33, { style: { height:
|
|
7310
|
-
] }) : /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width:
|
|
7406
|
+
showActions && /* @__PURE__ */ jsx40(View33, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: tokens40.extensions.marketTable.actionSkeletonWidth, height: tokens40.extensions.financial.priceSkeletonHeight }) }),
|
|
7407
|
+
cols.map((col, i) => /* @__PURE__ */ jsx40(View33, { style: { width: layout.widths[i], paddingVertical: tokens40.dimension.value14, paddingHorizontal: tokens40.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__ */ jsxs26(View33, { style: { gap: tokens40.dimension.value2 }, children: [
|
|
7408
|
+
/* @__PURE__ */ jsx40(View33, { style: { height: tokens40.typography.body.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: "80%", height: tokens40.extensions.skeleton.lineHeights.md }) }),
|
|
7409
|
+
/* @__PURE__ */ jsx40(View33, { style: { height: tokens40.typography.caption.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: "60%", height: tokens40.extensions.skeleton.lineHeights.sm }) })
|
|
7410
|
+
] }) : /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: tokens40.extensions.financial.priceSkeletonWidth, height: tokens40.extensions.financial.priceSkeletonHeight }) }, col.key || i))
|
|
7311
7411
|
] }, row))
|
|
7312
7412
|
] }) });
|
|
7313
7413
|
}
|
|
@@ -7318,11 +7418,11 @@ function KjunListSkeleton({
|
|
|
7318
7418
|
rows = 8,
|
|
7319
7419
|
variant = "market",
|
|
7320
7420
|
avatar = true,
|
|
7321
|
-
avatarSize =
|
|
7421
|
+
avatarSize = tokens41.extensions.skeleton.listAvatarSize,
|
|
7322
7422
|
quote = true
|
|
7323
7423
|
}) {
|
|
7324
7424
|
const { colors } = useKjunStyles();
|
|
7325
|
-
const market = variant === "market", narrow = useWindowDimensions6().width <
|
|
7425
|
+
const market = variant === "market", narrow = useWindowDimensions6().width < tokens41.responsive.market;
|
|
7326
7426
|
const slots = market ? [typeStyle(narrow ? "input" : "label").lineHeight, typeStyle(narrow ? "body" : "caption").lineHeight] : null;
|
|
7327
7427
|
const slot = (index, child) => slots ? /* @__PURE__ */ jsx41(View34, { style: { height: slots[index], justifyContent: "center" }, children: child }) : child;
|
|
7328
7428
|
return /* @__PURE__ */ jsx41(
|
|
@@ -7336,29 +7436,29 @@ function KjunListSkeleton({
|
|
|
7336
7436
|
style: {
|
|
7337
7437
|
flexDirection: "row",
|
|
7338
7438
|
alignItems: "center",
|
|
7339
|
-
gap:
|
|
7340
|
-
minHeight: market ? narrow ?
|
|
7341
|
-
paddingVertical: market ? narrow ?
|
|
7342
|
-
paddingHorizontal: market ? narrow ?
|
|
7343
|
-
borderBottomWidth:
|
|
7439
|
+
gap: tokens41.extensions.skeleton.gap,
|
|
7440
|
+
minHeight: market ? narrow ? tokens41.extensions.marketList.minimumHeight : void 0 : tokens41.extensions.skeleton.listHeights[variant],
|
|
7441
|
+
paddingVertical: market ? narrow ? tokens41.dimension.value14 : tokens41.dimension.value16 : tokens41.extensions.skeleton.list[variant].paddingY,
|
|
7442
|
+
paddingHorizontal: market ? narrow ? tokens41.dimension.value20 : tokens41.dimension.value16 : tokens41.extensions.skeleton.list[variant].paddingX,
|
|
7443
|
+
borderBottomWidth: tokens41.border.defaultWidth,
|
|
7344
7444
|
borderBottomColor: colors.border
|
|
7345
7445
|
},
|
|
7346
7446
|
children: [
|
|
7347
7447
|
avatar && /* @__PURE__ */ jsx41(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
7348
|
-
/* @__PURE__ */ jsxs27(View34, { style: { flex: 1, minWidth: 0, gap: market ?
|
|
7448
|
+
/* @__PURE__ */ jsxs27(View34, { style: { flex: 1, minWidth: 0, gap: market ? tokens41.dimension.value2 : tokens41.extensions.skeleton.detailGap }, children: [
|
|
7349
7449
|
slot(0, /* @__PURE__ */ jsx41(
|
|
7350
7450
|
KjunSkeleton,
|
|
7351
7451
|
{
|
|
7352
7452
|
type: "block",
|
|
7353
|
-
height:
|
|
7453
|
+
height: tokens41.extensions.skeleton.lineHeights.md,
|
|
7354
7454
|
width: i % 2 ? "80%" : "65%"
|
|
7355
7455
|
}
|
|
7356
7456
|
)),
|
|
7357
|
-
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7457
|
+
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens41.extensions.skeleton.lineHeights.sm, width: "50%" }))
|
|
7358
7458
|
] }),
|
|
7359
|
-
quote && /* @__PURE__ */ jsxs27(View34, { style: { alignItems: "flex-end", gap: market ?
|
|
7360
|
-
slot(0, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7361
|
-
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7459
|
+
quote && /* @__PURE__ */ jsxs27(View34, { style: { alignItems: "flex-end", gap: market ? tokens41.dimension.value2 : tokens41.extensions.skeleton.detailGap }, children: [
|
|
7460
|
+
slot(0, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens41.extensions.skeleton.quoteHeight, width: tokens41.extensions.skeleton.quoteWidth })),
|
|
7461
|
+
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens41.extensions.skeleton.lineHeights.sm, width: tokens41.extensions.skeleton.detailWidth }))
|
|
7362
7462
|
] })
|
|
7363
7463
|
]
|
|
7364
7464
|
},
|
|
@@ -7375,7 +7475,7 @@ function KjunFormSkeleton({
|
|
|
7375
7475
|
}) {
|
|
7376
7476
|
const { colors } = useKjunStyles();
|
|
7377
7477
|
const window2 = useWindowDimensions6();
|
|
7378
|
-
const twoColumns = columns === 2 && window2.width >=
|
|
7478
|
+
const twoColumns = columns === 2 && window2.width >= tokens41.responsive.formColumns;
|
|
7379
7479
|
return /* @__PURE__ */ jsx41(
|
|
7380
7480
|
View34,
|
|
7381
7481
|
{
|
|
@@ -7384,13 +7484,13 @@ function KjunFormSkeleton({
|
|
|
7384
7484
|
style: {
|
|
7385
7485
|
flexDirection: twoColumns ? "row" : "column",
|
|
7386
7486
|
flexWrap: twoColumns ? "wrap" : "nowrap",
|
|
7387
|
-
gap:
|
|
7487
|
+
gap: tokens41.extensions.skeleton.formGap
|
|
7388
7488
|
},
|
|
7389
7489
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs27(
|
|
7390
7490
|
View34,
|
|
7391
7491
|
{
|
|
7392
7492
|
style: {
|
|
7393
|
-
gap:
|
|
7493
|
+
gap: tokens41.extensions.skeleton.fieldGap,
|
|
7394
7494
|
minWidth: 0,
|
|
7395
7495
|
flexBasis: twoColumns ? "45%" : void 0,
|
|
7396
7496
|
flexGrow: 1
|
|
@@ -7398,13 +7498,13 @@ function KjunFormSkeleton({
|
|
|
7398
7498
|
children: [
|
|
7399
7499
|
field ? /* @__PURE__ */ jsx41(KText, { style: { color: colors.text, ...typeStyle("label") }, children: typeof field === "string" ? field : field.label }) : (
|
|
7400
7500
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
7401
|
-
/* @__PURE__ */ jsx41(View34, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7501
|
+
/* @__PURE__ */ jsx41(View34, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens41.extensions.skeleton.formLabelHeight, width: tokens41.extensions.skeleton.formLabelWidth }) })
|
|
7402
7502
|
),
|
|
7403
|
-
/* @__PURE__ */ jsx41(View34, { style: { borderRadius:
|
|
7503
|
+
/* @__PURE__ */ jsx41(View34, { style: { borderRadius: tokens41.input[size].radius, overflow: "hidden" }, children: /* @__PURE__ */ jsx41(
|
|
7404
7504
|
KjunSkeleton,
|
|
7405
7505
|
{
|
|
7406
7506
|
type: "block",
|
|
7407
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
7507
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? tokens41.input[size].lineHeight * 3 + tokens41.input[size].textareaPaddingY * 2 + 2 * tokens41.border.controlWidth : tokens41.input[size].height
|
|
7408
7508
|
}
|
|
7409
7509
|
) })
|
|
7410
7510
|
]
|
|
@@ -7417,7 +7517,7 @@ function KjunFormSkeleton({
|
|
|
7417
7517
|
var chartPart = (name) => Platform25.OS === "web" ? { dataSet: { kjunChartPart: name } } : {};
|
|
7418
7518
|
function KjunChartSkeleton({
|
|
7419
7519
|
kind: requestedKind = "frame",
|
|
7420
|
-
height =
|
|
7520
|
+
height = tokens41.extensions.chartSkeleton.height,
|
|
7421
7521
|
loadingText,
|
|
7422
7522
|
skeleton = true,
|
|
7423
7523
|
loadingDelay = 0,
|
|
@@ -7426,13 +7526,13 @@ function KjunChartSkeleton({
|
|
|
7426
7526
|
}) {
|
|
7427
7527
|
const m = useKjunMessages();
|
|
7428
7528
|
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
7429
|
-
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef30(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState33(0), thickness =
|
|
7529
|
+
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef30(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState33(0), thickness = tokens41.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" };
|
|
7430
7530
|
useEffect23(() => {
|
|
7431
7531
|
if (reduced || !skeleton) return;
|
|
7432
7532
|
const loop = Animated17.loop(
|
|
7433
7533
|
Animated17.sequence([
|
|
7434
|
-
Animated17.timing(opacity, { toValue: 0.55, duration:
|
|
7435
|
-
Animated17.timing(opacity, { toValue: 1, duration:
|
|
7534
|
+
Animated17.timing(opacity, { toValue: 0.55, duration: tokens41.motion.shimmer / 2, useNativeDriver: true }),
|
|
7535
|
+
Animated17.timing(opacity, { toValue: 1, duration: tokens41.motion.shimmer / 2, useNativeDriver: true })
|
|
7436
7536
|
])
|
|
7437
7537
|
);
|
|
7438
7538
|
loop.start();
|
|
@@ -7449,7 +7549,7 @@ function KjunChartSkeleton({
|
|
|
7449
7549
|
"aria-hidden": revealed ? void 0 : true,
|
|
7450
7550
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
7451
7551
|
...Platform25.OS === "web" ? { dataSet: { kjunChartKind: kind, skeleton: skeleton ? void 0 : "false" } } : {},
|
|
7452
|
-
children: !skeleton ? /* @__PURE__ */ jsxs27(View34, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap:
|
|
7552
|
+
children: !skeleton ? /* @__PURE__ */ jsxs27(View34, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap: tokens41.dimension.value12 }, children: [
|
|
7453
7553
|
/* @__PURE__ */ jsx41(View34, { ...hidden, children: /* @__PURE__ */ jsx41(KjunSpinner, { size: "md" }) }),
|
|
7454
7554
|
!!loadingText && /* @__PURE__ */ jsx41(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
7455
7555
|
] }) : /* @__PURE__ */ jsxs27(Fragment13, { children: [
|
|
@@ -7458,21 +7558,21 @@ function KjunChartSkeleton({
|
|
|
7458
7558
|
{
|
|
7459
7559
|
...chartPart("donut"),
|
|
7460
7560
|
...hidden,
|
|
7461
|
-
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius:
|
|
7561
|
+
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius: tokens41.radius.radius9999 }
|
|
7462
7562
|
}
|
|
7463
|
-
) : kind === "matrix" ? /* @__PURE__ */ jsx41(View34, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap:
|
|
7563
|
+
) : kind === "matrix" ? /* @__PURE__ */ jsx41(View34, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap: tokens41.dimension.value4 }, children: Array.from({ length: rowCount }, (_, row) => /* @__PURE__ */ jsx41(View34, { style: { flex: 1, flexDirection: "row", gap: tokens41.dimension.value4 }, children: Array.from({ length: columnCount }, (_2, column) => /* @__PURE__ */ jsx41(
|
|
7464
7564
|
View34,
|
|
7465
7565
|
{
|
|
7466
7566
|
...chartPart("cell"),
|
|
7467
7567
|
style: {
|
|
7468
7568
|
flex: 1,
|
|
7469
|
-
borderRadius:
|
|
7569
|
+
borderRadius: tokens41.extensions.skeleton.lineRadius,
|
|
7470
7570
|
backgroundColor: colors.skeleton,
|
|
7471
|
-
opacity: chartMatrixMuted(row, column) ?
|
|
7571
|
+
opacity: chartMatrixMuted(row, column) ? tokens41.states.opacity.pending : 1
|
|
7472
7572
|
}
|
|
7473
7573
|
},
|
|
7474
7574
|
column
|
|
7475
|
-
)) }, row)) }) : /* @__PURE__ */ jsx41(View34, { ...chartPart("plot"), ...hidden, style: { alignSelf: "stretch", flex: 1 }, children: /* @__PURE__ */ jsx41(Svg5, { viewBox: chartFrameViewBox, preserveAspectRatio: "none", width: "100%", height: "100%", children: /* @__PURE__ */ jsx41(Path4, { d: chartFramePath, fill: "none", stroke: colors.chartGrid, strokeWidth:
|
|
7575
|
+
)) }, row)) }) : /* @__PURE__ */ jsx41(View34, { ...chartPart("plot"), ...hidden, style: { alignSelf: "stretch", flex: 1 }, children: /* @__PURE__ */ jsx41(Svg5, { viewBox: chartFrameViewBox, preserveAspectRatio: "none", width: "100%", height: "100%", children: /* @__PURE__ */ jsx41(Path4, { d: chartFramePath, fill: "none", stroke: colors.chartGrid, strokeWidth: tokens41.border.defaultWidth, vectorEffect: "non-scaling-stroke" }) }) }),
|
|
7476
7576
|
!!loadingText && /* @__PURE__ */ jsx41(
|
|
7477
7577
|
View34,
|
|
7478
7578
|
{
|
|
@@ -7486,10 +7586,10 @@ function KjunChartSkeleton({
|
|
|
7486
7586
|
{
|
|
7487
7587
|
style: {
|
|
7488
7588
|
...typeStyle("body"),
|
|
7489
|
-
paddingHorizontal:
|
|
7490
|
-
paddingVertical:
|
|
7491
|
-
borderRadius:
|
|
7492
|
-
borderWidth: kind === "donut" ? 0 :
|
|
7589
|
+
paddingHorizontal: tokens41.dimension.value12,
|
|
7590
|
+
paddingVertical: tokens41.dimension.value4,
|
|
7591
|
+
borderRadius: tokens41.radius.radius6,
|
|
7592
|
+
borderWidth: kind === "donut" ? 0 : tokens41.border.defaultWidth,
|
|
7493
7593
|
borderColor: colors.chartGrid,
|
|
7494
7594
|
backgroundColor: colors.surface,
|
|
7495
7595
|
color: colors.textSecondary,
|
|
@@ -7507,7 +7607,7 @@ function KjunChartSkeleton({
|
|
|
7507
7607
|
}
|
|
7508
7608
|
|
|
7509
7609
|
// packages/native/src/financial-display.tsx
|
|
7510
|
-
import { deviationLevel, tokens as
|
|
7610
|
+
import { deviationLevel, tokens as tokens44 } from "@kjun-ui/tokens";
|
|
7511
7611
|
import { useId as useId8 } from "react";
|
|
7512
7612
|
import {
|
|
7513
7613
|
View as View36
|
|
@@ -7522,13 +7622,13 @@ import Svg6, {
|
|
|
7522
7622
|
} from "react-native-svg";
|
|
7523
7623
|
|
|
7524
7624
|
// packages/native/src/number-display.tsx
|
|
7525
|
-
import { tokens as
|
|
7625
|
+
import { tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7526
7626
|
|
|
7527
7627
|
// shared/package-runtime/use-number-motion.ts
|
|
7528
7628
|
import { useLayoutEffect as useLayoutEffect16, useRef as useRef31, useState as useState34 } from "react";
|
|
7529
7629
|
|
|
7530
7630
|
// shared/package-runtime/number-motion.ts
|
|
7531
|
-
import { tokens as
|
|
7631
|
+
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7532
7632
|
function createNumberMotion(apply) {
|
|
7533
7633
|
let frame = 0, revision = 0, current = 0;
|
|
7534
7634
|
let previous;
|
|
@@ -7559,7 +7659,7 @@ function createNumberMotion(apply) {
|
|
|
7559
7659
|
if (from === target) return;
|
|
7560
7660
|
const tick = (now) => {
|
|
7561
7661
|
if (version !== revision) return;
|
|
7562
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
7662
|
+
const progress = Math.min(1, Math.max(0, (now - started) / tokens42.motion.number));
|
|
7563
7663
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
7564
7664
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
7565
7665
|
};
|
|
@@ -7648,7 +7748,7 @@ function KjunFreshness({
|
|
|
7648
7748
|
KjunTooltip,
|
|
7649
7749
|
{
|
|
7650
7750
|
content: (source === "close" ? scope.messages.noRealtimeQuote : scope.messages.realtimeDelayed) + (fetchedAt ? " \xB7 " + ((formatter == null ? void 0 : formatter(fetchedAt)) || formatRelativeTime(fetchedAt, void 0, scope)) : ""),
|
|
7651
|
-
children: /* @__PURE__ */ jsx42(AccessiblePressable, { accessibilityLabel: label, focusRingRadius:
|
|
7751
|
+
children: /* @__PURE__ */ jsx42(AccessiblePressable, { accessibilityLabel: label, focusRingRadius: tokens43.extensions.badge.radius, children: /* @__PURE__ */ jsx42(KjunBadge, { variant: "warning", size: "xs", children: label }) })
|
|
7652
7752
|
}
|
|
7653
7753
|
) : null;
|
|
7654
7754
|
}
|
|
@@ -7662,11 +7762,11 @@ function KjunPriceCell({
|
|
|
7662
7762
|
fromPrevious = true
|
|
7663
7763
|
}) {
|
|
7664
7764
|
const { colors } = useKjunStyles(), quoteType = useContext18(MarketQuoteTypeContext);
|
|
7665
|
-
return value == null ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height:
|
|
7765
|
+
return value == null ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens43.extensions.financial.priceSkeletonHeight, width: tokens43.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs28(View35, { style: { flexDirection: "row", alignItems: "center", gap: tokens43.extensions.financial.affixGap }, children: [
|
|
7666
7766
|
/* @__PURE__ */ jsx42(
|
|
7667
7767
|
View35,
|
|
7668
7768
|
{
|
|
7669
|
-
style: quoteType ? void 0 : { paddingVertical:
|
|
7769
|
+
style: quoteType ? void 0 : { paddingVertical: tokens43.extensions.financial.pillPaddingY, paddingHorizontal: tokens43.extensions.financial.pillPaddingX, borderRadius: tokens43.radius.radius9999 },
|
|
7670
7770
|
children: /* @__PURE__ */ jsx42(
|
|
7671
7771
|
KjunAnimatedNumber,
|
|
7672
7772
|
{
|
|
@@ -7705,14 +7805,14 @@ function KjunSignedValue({
|
|
|
7705
7805
|
flexDirection: "row",
|
|
7706
7806
|
alignItems: "center",
|
|
7707
7807
|
alignSelf: "flex-start",
|
|
7708
|
-
gap:
|
|
7709
|
-
paddingVertical: tone === "pill" ?
|
|
7710
|
-
paddingHorizontal: tone === "pill" ?
|
|
7711
|
-
borderRadius:
|
|
7808
|
+
gap: tokens43.extensions.financial.affixGap,
|
|
7809
|
+
paddingVertical: tone === "pill" ? tokens43.extensions.financial.pillPaddingY : 0,
|
|
7810
|
+
paddingHorizontal: tone === "pill" ? tokens43.extensions.financial.pillPaddingX : 0,
|
|
7811
|
+
borderRadius: tokens43.extensions.financial.pillRadius,
|
|
7712
7812
|
backgroundColor: tone === "pill" && !stale && !loading && n !== null ? domainColor(domainColors, role + "Bg") : void 0
|
|
7713
7813
|
},
|
|
7714
7814
|
children: [
|
|
7715
|
-
loading ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", width:
|
|
7815
|
+
loading ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", width: tokens43.extensions.financial.signedSkeletonWidth, height: tokens43.extensions.financial.signedSkeletonHeight }) : /* @__PURE__ */ jsx42(
|
|
7716
7816
|
KText,
|
|
7717
7817
|
{
|
|
7718
7818
|
style: {
|
|
@@ -7734,7 +7834,7 @@ function KjunSignedValue({
|
|
|
7734
7834
|
|
|
7735
7835
|
// packages/native/src/financial-display.tsx
|
|
7736
7836
|
import { Fragment as Fragment14, jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7737
|
-
var deviationFill = { neutral: 1, low:
|
|
7837
|
+
var deviationFill = { neutral: 1, low: tokens44.states.opacity.deviationLow, medium: tokens44.states.opacity.deviationMedium, strong: tokens44.states.opacity.deviationStrong };
|
|
7738
7838
|
function KjunDeviation({
|
|
7739
7839
|
value,
|
|
7740
7840
|
variant = "pill",
|
|
@@ -7755,7 +7855,7 @@ function KjunDeviation({
|
|
|
7755
7855
|
flexDirection: "row",
|
|
7756
7856
|
alignItems: "center",
|
|
7757
7857
|
justifyContent: "flex-end",
|
|
7758
|
-
gap:
|
|
7858
|
+
gap: tokens44.extensions.financial.badgeGap
|
|
7759
7859
|
},
|
|
7760
7860
|
children: [
|
|
7761
7861
|
/* @__PURE__ */ jsx43(
|
|
@@ -7774,22 +7874,22 @@ function KjunDeviation({
|
|
|
7774
7874
|
}, children: label })
|
|
7775
7875
|
}
|
|
7776
7876
|
),
|
|
7777
|
-
!signal && /* @__PURE__ */ jsx43(View36, { style: { width:
|
|
7877
|
+
!signal && /* @__PURE__ */ jsx43(View36, { style: { width: tokens44.extensions.financial.warningIconSize, flexShrink: 0 } }),
|
|
7778
7878
|
signal && /* @__PURE__ */ jsx43(Fragment14, { children: /* @__PURE__ */ jsx43(View36, { style: { alignSelf: "center" }, children: /* @__PURE__ */ jsx43(KjunTooltip, { content: m.deviationWarning(signalThreshold), children: /* @__PURE__ */ jsx43(
|
|
7779
7879
|
AccessiblePressable,
|
|
7780
7880
|
{
|
|
7781
7881
|
accessibilityRole: "image",
|
|
7782
7882
|
accessibilityLabel: m.arbitrage,
|
|
7783
7883
|
focusRingInset: true,
|
|
7784
|
-
focusRingRadius:
|
|
7884
|
+
focusRingRadius: tokens44.radius.radius4,
|
|
7785
7885
|
style: {
|
|
7786
|
-
width:
|
|
7787
|
-
height:
|
|
7788
|
-
margin: (
|
|
7886
|
+
width: tokens44.extensions.financial.warningTargetSize,
|
|
7887
|
+
height: tokens44.extensions.financial.warningTargetSize,
|
|
7888
|
+
margin: (tokens44.extensions.financial.warningIconSize - tokens44.extensions.financial.warningTargetSize) / 2,
|
|
7789
7889
|
alignItems: "center",
|
|
7790
7890
|
justifyContent: "center"
|
|
7791
7891
|
},
|
|
7792
|
-
children: /* @__PURE__ */ jsx43(KjunIcon, { name: "alert-triangle", size:
|
|
7892
|
+
children: /* @__PURE__ */ jsx43(KjunIcon, { name: "alert-triangle", size: tokens44.extensions.financial.warningIconSize, color: colors.warning })
|
|
7793
7893
|
}
|
|
7794
7894
|
) }) }) })
|
|
7795
7895
|
]
|
|
@@ -7801,9 +7901,9 @@ function KjunDeviation({
|
|
|
7801
7901
|
style: {
|
|
7802
7902
|
alignSelf: "flex-start",
|
|
7803
7903
|
position: "relative",
|
|
7804
|
-
borderRadius:
|
|
7805
|
-
paddingVertical: variant === "pill" ?
|
|
7806
|
-
paddingHorizontal: variant === "pill" ?
|
|
7904
|
+
borderRadius: tokens44.extensions.financial.cellRadius,
|
|
7905
|
+
paddingVertical: variant === "pill" ? tokens44.extensions.financial.pillPaddingY : 0,
|
|
7906
|
+
paddingHorizontal: variant === "pill" ? tokens44.extensions.financial.pillPaddingX : 0
|
|
7807
7907
|
},
|
|
7808
7908
|
children: [
|
|
7809
7909
|
variant === "pill" && /* @__PURE__ */ jsx43(
|
|
@@ -7813,7 +7913,7 @@ function KjunDeviation({
|
|
|
7813
7913
|
style: {
|
|
7814
7914
|
position: "absolute",
|
|
7815
7915
|
inset: 0,
|
|
7816
|
-
borderRadius:
|
|
7916
|
+
borderRadius: tokens44.extensions.financial.cellRadius,
|
|
7817
7917
|
backgroundColor: neutral ? colors.secondary : color,
|
|
7818
7918
|
opacity: deviationFill[level]
|
|
7819
7919
|
}
|
|
@@ -7854,9 +7954,9 @@ function KjunHeatmapCell({
|
|
|
7854
7954
|
style: {
|
|
7855
7955
|
position: "relative",
|
|
7856
7956
|
alignSelf: "flex-start",
|
|
7857
|
-
paddingVertical:
|
|
7858
|
-
paddingHorizontal:
|
|
7859
|
-
borderRadius:
|
|
7957
|
+
paddingVertical: tokens44.extensions.financial.pillPaddingY,
|
|
7958
|
+
paddingHorizontal: tokens44.extensions.financial.pillPaddingX,
|
|
7959
|
+
borderRadius: tokens44.extensions.financial.cellRadius
|
|
7860
7960
|
},
|
|
7861
7961
|
children: [
|
|
7862
7962
|
/* @__PURE__ */ jsx43(
|
|
@@ -7866,10 +7966,10 @@ function KjunHeatmapCell({
|
|
|
7866
7966
|
style: {
|
|
7867
7967
|
position: "absolute",
|
|
7868
7968
|
inset: 0,
|
|
7869
|
-
borderRadius:
|
|
7969
|
+
borderRadius: tokens44.extensions.financial.cellRadius,
|
|
7870
7970
|
// A zero cell keeps its shape on the neutral fill; any other value starts from a visible minimum.
|
|
7871
7971
|
backgroundColor: magnitude ? background : colors.secondary,
|
|
7872
|
-
opacity: magnitude ?
|
|
7972
|
+
opacity: magnitude ? tokens44.states.opacity.heatMinimum + (tokens44.states.opacity.heatMaximum - tokens44.states.opacity.heatMinimum) * magnitude : 1
|
|
7873
7973
|
}
|
|
7874
7974
|
}
|
|
7875
7975
|
),
|
|
@@ -7887,7 +7987,7 @@ function KjunProgressCell({
|
|
|
7887
7987
|
showLabel = true,
|
|
7888
7988
|
color = "auto",
|
|
7889
7989
|
customColor,
|
|
7890
|
-
height =
|
|
7990
|
+
height = tokens44.extensions.financial.progressHeight
|
|
7891
7991
|
}) {
|
|
7892
7992
|
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;
|
|
7893
7993
|
return /* @__PURE__ */ jsxs29(
|
|
@@ -7896,8 +7996,8 @@ function KjunProgressCell({
|
|
|
7896
7996
|
style: {
|
|
7897
7997
|
flexDirection: "row",
|
|
7898
7998
|
alignItems: "center",
|
|
7899
|
-
gap:
|
|
7900
|
-
minWidth:
|
|
7999
|
+
gap: tokens44.extensions.financial.progressGap,
|
|
8000
|
+
minWidth: tokens44.extensions.financial.progressMinimumWidth
|
|
7901
8001
|
},
|
|
7902
8002
|
children: [
|
|
7903
8003
|
/* @__PURE__ */ jsx43(
|
|
@@ -7907,7 +8007,7 @@ function KjunProgressCell({
|
|
|
7907
8007
|
height,
|
|
7908
8008
|
flex: 1,
|
|
7909
8009
|
backgroundColor: colors.tertiary,
|
|
7910
|
-
borderRadius:
|
|
8010
|
+
borderRadius: tokens44.extensions.financial.progressRadius,
|
|
7911
8011
|
overflow: "hidden"
|
|
7912
8012
|
},
|
|
7913
8013
|
children: /* @__PURE__ */ jsx43(
|
|
@@ -7916,7 +8016,7 @@ function KjunProgressCell({
|
|
|
7916
8016
|
style: {
|
|
7917
8017
|
width: `${percent}%`,
|
|
7918
8018
|
height: "100%",
|
|
7919
|
-
borderRadius:
|
|
8019
|
+
borderRadius: tokens44.extensions.financial.progressRadius,
|
|
7920
8020
|
backgroundColor: color === "custom" ? customColor : colors[role]
|
|
7921
8021
|
}
|
|
7922
8022
|
}
|
|
@@ -7929,7 +8029,7 @@ function KjunProgressCell({
|
|
|
7929
8029
|
style: {
|
|
7930
8030
|
...typeStyle("caption"),
|
|
7931
8031
|
color: colors.textSecondary,
|
|
7932
|
-
minWidth:
|
|
8032
|
+
minWidth: tokens44.extensions.financial.progressLabelWidth,
|
|
7933
8033
|
textAlign: "right",
|
|
7934
8034
|
fontFamily: numericFontFamily || fontFamily,
|
|
7935
8035
|
fontVariant: ["tabular-nums"]
|
|
@@ -7950,7 +8050,7 @@ function KjunCollectionMark({
|
|
|
7950
8050
|
size = "md"
|
|
7951
8051
|
}) {
|
|
7952
8052
|
const { colors, domainColors } = useKjunStyles();
|
|
7953
|
-
const box =
|
|
8053
|
+
const box = tokens44.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens44.extensions.financial.heartMarkSizes[size] : box;
|
|
7954
8054
|
return /* @__PURE__ */ jsx43(View36, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", overflow: "visible" }, children: /* @__PURE__ */ jsx43(
|
|
7955
8055
|
KjunIcon,
|
|
7956
8056
|
{
|
|
@@ -7982,8 +8082,8 @@ function KjunExecutionStatusBadge({
|
|
|
7982
8082
|
}
|
|
7983
8083
|
function KjunSparkline({
|
|
7984
8084
|
data = [],
|
|
7985
|
-
width =
|
|
7986
|
-
height =
|
|
8085
|
+
width = tokens44.extensions.financial.sparklineWidth,
|
|
8086
|
+
height = tokens44.extensions.financial.sparklineHeight,
|
|
7987
8087
|
color,
|
|
7988
8088
|
semantic = "price",
|
|
7989
8089
|
fill = true,
|
|
@@ -8174,7 +8274,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
8174
8274
|
}
|
|
8175
8275
|
|
|
8176
8276
|
// packages/native/src/table-toolbar.tsx
|
|
8177
|
-
import { tokens as
|
|
8277
|
+
import { tokens as tokens45 } from "@kjun-ui/tokens";
|
|
8178
8278
|
import { View as View37 } from "react-native";
|
|
8179
8279
|
import { Fragment as Fragment15, jsx as jsx44, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8180
8280
|
function TableToolbar({
|
|
@@ -8194,12 +8294,12 @@ function TableToolbar({
|
|
|
8194
8294
|
const toolbarStyle = {
|
|
8195
8295
|
flexDirection: "row",
|
|
8196
8296
|
alignItems: "center",
|
|
8197
|
-
gap:
|
|
8297
|
+
gap: tokens45.dimension.value8,
|
|
8198
8298
|
flexWrap: "wrap",
|
|
8199
|
-
paddingVertical:
|
|
8200
|
-
paddingHorizontal:
|
|
8299
|
+
paddingVertical: tokens45.dimension.value8,
|
|
8300
|
+
paddingHorizontal: tokens45.dimension.value12,
|
|
8201
8301
|
backgroundColor: colors.secondary,
|
|
8202
|
-
borderBottomWidth:
|
|
8302
|
+
borderBottomWidth: tokens45.border.defaultWidth,
|
|
8203
8303
|
borderBottomColor: colors.border
|
|
8204
8304
|
};
|
|
8205
8305
|
return /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
@@ -8227,7 +8327,7 @@ function TableToolbar({
|
|
|
8227
8327
|
),
|
|
8228
8328
|
(searchable || toolbar) && // Like Web: the search toolbar sits on the surface so the filled search field stands out from it.
|
|
8229
8329
|
/* @__PURE__ */ jsxs30(View37, { style: { ...toolbarStyle, backgroundColor: colors.surface }, children: [
|
|
8230
|
-
searchable && /* @__PURE__ */ jsx44(View37, { style: { width:
|
|
8330
|
+
searchable && /* @__PURE__ */ jsx44(View37, { style: { width: tokens45.table.searchWidth, maxWidth: "100%" }, children: /* @__PURE__ */ jsx44(
|
|
8231
8331
|
KjunInput,
|
|
8232
8332
|
{
|
|
8233
8333
|
size: "sm",
|
|
@@ -8245,7 +8345,7 @@ function TableToolbar({
|
|
|
8245
8345
|
}
|
|
8246
8346
|
|
|
8247
8347
|
// packages/native/src/table-grid.tsx
|
|
8248
|
-
import { tokens as
|
|
8348
|
+
import { tokens as tokens46 } from "@kjun-ui/tokens";
|
|
8249
8349
|
import { Fragment as Fragment16, useId as useId9, useState as useState37 } from "react";
|
|
8250
8350
|
import Svg7, { Defs as Defs3, LinearGradient as LinearGradient3, Rect as Rect3, Stop as Stop3 } from "react-native-svg";
|
|
8251
8351
|
import { ScrollView as ScrollView9, View as View38 } from "react-native";
|
|
@@ -8253,7 +8353,7 @@ import { jsx as jsx45, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
|
8253
8353
|
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable }) {
|
|
8254
8354
|
const m = useKjunMessages();
|
|
8255
8355
|
const { colors } = useKjunStyles();
|
|
8256
|
-
const geometry2 =
|
|
8356
|
+
const geometry2 = tokens46.table;
|
|
8257
8357
|
const [scroll, setScroll] = useState37({ viewport: 0, x: 0 }), fadeId = "kjun-table-fade-" + useId9().replace(/[^a-z0-9]/gi, "");
|
|
8258
8358
|
const cellPadding = geometry2.cellPadding[compact ? "compact" : "regular"];
|
|
8259
8359
|
const width = (col) => typeof col.width === "number" ? col.width : typeof col.width === "string" && /^\d+(px)?$/.test(col.width) ? parseFloat(col.width) : geometry2.columnWidth;
|
|
@@ -8286,7 +8386,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8286
8386
|
style: {
|
|
8287
8387
|
flexDirection: "row",
|
|
8288
8388
|
backgroundColor: colors.tableHeaderBg,
|
|
8289
|
-
borderBottomWidth:
|
|
8389
|
+
borderBottomWidth: tokens46.border.defaultWidth,
|
|
8290
8390
|
borderBottomColor: colors.border
|
|
8291
8391
|
},
|
|
8292
8392
|
children: [
|
|
@@ -8310,13 +8410,13 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8310
8410
|
onPress: () => state.sortColumn(col),
|
|
8311
8411
|
style: {
|
|
8312
8412
|
width: width(col),
|
|
8313
|
-
minHeight:
|
|
8413
|
+
minHeight: tokens46.native.minimumTouchTarget,
|
|
8314
8414
|
paddingVertical: geometry2.headerPadding.y,
|
|
8315
8415
|
paddingHorizontal: geometry2.headerPadding.x,
|
|
8316
8416
|
flexDirection: "row",
|
|
8317
8417
|
alignItems: "center",
|
|
8318
8418
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
8319
|
-
gap:
|
|
8419
|
+
gap: tokens46.dimension.value4
|
|
8320
8420
|
},
|
|
8321
8421
|
children: [
|
|
8322
8422
|
/* @__PURE__ */ jsx45(
|
|
@@ -8333,7 +8433,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8333
8433
|
KjunIcon,
|
|
8334
8434
|
{
|
|
8335
8435
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
8336
|
-
size:
|
|
8436
|
+
size: tokens46.table.sortIconSize,
|
|
8337
8437
|
color: colors.text
|
|
8338
8438
|
}
|
|
8339
8439
|
)
|
|
@@ -8360,7 +8460,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8360
8460
|
{
|
|
8361
8461
|
type: "block",
|
|
8362
8462
|
height: geometry2.skeletonHeight,
|
|
8363
|
-
width: col.key === "actions" ?
|
|
8463
|
+
width: col.key === "actions" ? tokens46.table.actionColumnWidth : "75%"
|
|
8364
8464
|
}
|
|
8365
8465
|
)
|
|
8366
8466
|
},
|
|
@@ -8376,7 +8476,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8376
8476
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8377
8477
|
style: ({ pressed }) => ({
|
|
8378
8478
|
flexDirection: "row",
|
|
8379
|
-
borderBottomWidth:
|
|
8479
|
+
borderBottomWidth: tokens46.border.defaultWidth,
|
|
8380
8480
|
borderBottomColor: colors.border,
|
|
8381
8481
|
backgroundColor: pressed && hoverable ? colors.tableRowHover : striped && i % 2 ? colors.secondary : void 0
|
|
8382
8482
|
}),
|
|
@@ -8436,7 +8536,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8436
8536
|
)
|
|
8437
8537
|
}
|
|
8438
8538
|
),
|
|
8439
|
-
fade && /* @__PURE__ */ jsx45(View38, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
8539
|
+
fade && /* @__PURE__ */ jsx45(View38, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: tokens46.extensions.scrollFade.width }, children: /* @__PURE__ */ jsxs31(Svg7, { width: "100%", height: "100%", children: [
|
|
8440
8540
|
/* @__PURE__ */ jsx45(Defs3, { children: /* @__PURE__ */ jsxs31(LinearGradient3, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
8441
8541
|
/* @__PURE__ */ jsx45(Stop3, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
8442
8542
|
/* @__PURE__ */ jsx45(Stop3, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -8447,14 +8547,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8447
8547
|
}
|
|
8448
8548
|
|
|
8449
8549
|
// packages/native/src/table-view.tsx
|
|
8450
|
-
import { tokens as
|
|
8550
|
+
import { tokens as tokens48 } from "@kjun-ui/tokens";
|
|
8451
8551
|
import {
|
|
8452
8552
|
View as View40,
|
|
8453
8553
|
useWindowDimensions as useWindowDimensions7
|
|
8454
8554
|
} from "react-native";
|
|
8455
8555
|
|
|
8456
8556
|
// packages/native/src/table-cards.tsx
|
|
8457
|
-
import { tokens as
|
|
8557
|
+
import { tokens as tokens47 } from "@kjun-ui/tokens";
|
|
8458
8558
|
import {
|
|
8459
8559
|
View as View39
|
|
8460
8560
|
} from "react-native";
|
|
@@ -8480,7 +8580,7 @@ function TableCards({
|
|
|
8480
8580
|
return /* @__PURE__ */ jsxs32(
|
|
8481
8581
|
View39,
|
|
8482
8582
|
{
|
|
8483
|
-
style: { gap:
|
|
8583
|
+
style: { gap: tokens47.extensions.tableCard.gap, padding: tokens47.extensions.tableCard.listPadding, opacity: skeletonHidden ? 0 : void 0 },
|
|
8484
8584
|
"aria-hidden": skeletonHidden || void 0,
|
|
8485
8585
|
children: [
|
|
8486
8586
|
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsx46(KjunSkeleton, { type: "card" }, i)) : state.rows.map((row, i) => /* @__PURE__ */ jsxs32(
|
|
@@ -8489,10 +8589,10 @@ function TableCards({
|
|
|
8489
8589
|
accessible: false,
|
|
8490
8590
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8491
8591
|
style: ({ pressed }) => ({
|
|
8492
|
-
padding:
|
|
8493
|
-
borderWidth:
|
|
8592
|
+
padding: tokens47.extensions.tableCard.padding,
|
|
8593
|
+
borderWidth: tokens47.border.defaultWidth,
|
|
8494
8594
|
borderColor: colors.border,
|
|
8495
|
-
borderRadius:
|
|
8595
|
+
borderRadius: tokens47.extensions.tableCard.radius,
|
|
8496
8596
|
backgroundColor: pressed ? colors.hover : colors.background
|
|
8497
8597
|
}),
|
|
8498
8598
|
children: [
|
|
@@ -8502,8 +8602,8 @@ function TableCards({
|
|
|
8502
8602
|
style: {
|
|
8503
8603
|
flexDirection: "row",
|
|
8504
8604
|
alignItems: "center",
|
|
8505
|
-
gap:
|
|
8506
|
-
marginBottom:
|
|
8605
|
+
gap: tokens47.extensions.tableCard.gap,
|
|
8606
|
+
marginBottom: tokens47.dimension.value8
|
|
8507
8607
|
},
|
|
8508
8608
|
children: [
|
|
8509
8609
|
/* @__PURE__ */ jsxs32(
|
|
@@ -8513,7 +8613,7 @@ function TableCards({
|
|
|
8513
8613
|
flexDirection: "row",
|
|
8514
8614
|
flex: 1,
|
|
8515
8615
|
alignItems: "center",
|
|
8516
|
-
gap:
|
|
8616
|
+
gap: tokens47.extensions.tableCard.gap,
|
|
8517
8617
|
minWidth: 0
|
|
8518
8618
|
},
|
|
8519
8619
|
children: [
|
|
@@ -8522,8 +8622,8 @@ function TableCards({
|
|
|
8522
8622
|
]
|
|
8523
8623
|
}
|
|
8524
8624
|
),
|
|
8525
|
-
badges.length ? /* @__PURE__ */ jsx46(View39, { style: { flexDirection: "row", gap:
|
|
8526
|
-
inline.length > 0 && /* @__PURE__ */ jsx46(View39, { style: { flexDirection: "row", gap:
|
|
8625
|
+
badges.length ? /* @__PURE__ */ jsx46(View39, { style: { flexDirection: "row", gap: tokens47.extensions.tableCard.fieldGap }, children: badges.map((col) => /* @__PURE__ */ jsx46(View39, { children: cell(col, row, i) }, col.key)) }) : subtitle ? cell(subtitle, row, i) : null,
|
|
8626
|
+
inline.length > 0 && /* @__PURE__ */ jsx46(View39, { style: { flexDirection: "row", gap: tokens47.extensions.tableCard.fieldGap }, children: inline.map((col) => /* @__PURE__ */ jsx46(View39, { children: cell(col, row, i) }, col.key)) })
|
|
8527
8627
|
]
|
|
8528
8628
|
}
|
|
8529
8629
|
),
|
|
@@ -8533,10 +8633,10 @@ function TableCards({
|
|
|
8533
8633
|
View39,
|
|
8534
8634
|
{
|
|
8535
8635
|
style: {
|
|
8536
|
-
borderTopWidth: index ?
|
|
8636
|
+
borderTopWidth: index ? tokens47.border.defaultWidth : 0,
|
|
8537
8637
|
borderTopColor: colors.border,
|
|
8538
|
-
paddingTop: index ?
|
|
8539
|
-
marginTop: index ?
|
|
8638
|
+
paddingTop: index ? tokens47.dimension.value12 : 0,
|
|
8639
|
+
marginTop: index ? tokens47.dimension.value12 : 0
|
|
8540
8640
|
},
|
|
8541
8641
|
children: [
|
|
8542
8642
|
!!section.label && /* @__PURE__ */ jsx46(
|
|
@@ -8545,7 +8645,7 @@ function TableCards({
|
|
|
8545
8645
|
style: {
|
|
8546
8646
|
...typeStyle("controlSmall"),
|
|
8547
8647
|
color: colors.textTertiary,
|
|
8548
|
-
marginBottom:
|
|
8648
|
+
marginBottom: tokens47.dimension.value6
|
|
8549
8649
|
},
|
|
8550
8650
|
children: section.label
|
|
8551
8651
|
}
|
|
@@ -8556,7 +8656,7 @@ function TableCards({
|
|
|
8556
8656
|
style: {
|
|
8557
8657
|
flexDirection: "row",
|
|
8558
8658
|
flexWrap: "wrap",
|
|
8559
|
-
gap: section.layout === "metrics" ?
|
|
8659
|
+
gap: section.layout === "metrics" ? tokens47.extensions.tableCard.gap : tokens47.extensions.tableCard.metricGap
|
|
8560
8660
|
},
|
|
8561
8661
|
children: cols.map((col) => /* @__PURE__ */ jsxs32(
|
|
8562
8662
|
View39,
|
|
@@ -8565,7 +8665,7 @@ function TableCards({
|
|
|
8565
8665
|
flexBasis: col.fullWidthInCard || section.layout === "stack" ? "100%" : section.layout === "metrics" ? "30%" : "47%",
|
|
8566
8666
|
flexGrow: 1,
|
|
8567
8667
|
minWidth: 0,
|
|
8568
|
-
gap:
|
|
8668
|
+
gap: tokens47.extensions.tableCard.valueGap
|
|
8569
8669
|
},
|
|
8570
8670
|
children: [
|
|
8571
8671
|
/* @__PURE__ */ jsx46(
|
|
@@ -8596,10 +8696,10 @@ function TableCards({
|
|
|
8596
8696
|
View39,
|
|
8597
8697
|
{
|
|
8598
8698
|
style: {
|
|
8599
|
-
borderTopWidth:
|
|
8699
|
+
borderTopWidth: tokens47.border.defaultWidth,
|
|
8600
8700
|
borderTopColor: colors.border,
|
|
8601
|
-
paddingTop:
|
|
8602
|
-
marginTop:
|
|
8701
|
+
paddingTop: tokens47.dimension.value8,
|
|
8702
|
+
marginTop: tokens47.dimension.value4
|
|
8603
8703
|
},
|
|
8604
8704
|
children: content(renderExpand == null ? void 0 : renderExpand(row, i))
|
|
8605
8705
|
}
|
|
@@ -8608,10 +8708,10 @@ function TableCards({
|
|
|
8608
8708
|
View39,
|
|
8609
8709
|
{
|
|
8610
8710
|
style: {
|
|
8611
|
-
borderTopWidth:
|
|
8711
|
+
borderTopWidth: tokens47.border.defaultWidth,
|
|
8612
8712
|
borderTopColor: colors.border,
|
|
8613
|
-
paddingTop:
|
|
8614
|
-
marginTop:
|
|
8713
|
+
paddingTop: tokens47.dimension.value8,
|
|
8714
|
+
marginTop: tokens47.dimension.value8,
|
|
8615
8715
|
alignItems: "flex-end"
|
|
8616
8716
|
},
|
|
8617
8717
|
children: /* @__PURE__ */ jsx46(View39, { style: { alignSelf: "flex-end" }, children: cell(actions, row, i) })
|
|
@@ -8621,7 +8721,7 @@ function TableCards({
|
|
|
8621
8721
|
},
|
|
8622
8722
|
state.key(row, i)
|
|
8623
8723
|
)),
|
|
8624
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx46(View39, { style: { padding:
|
|
8724
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx46(View39, { style: { padding: tokens47.extensions.tableCard.emptyPadding, alignItems: "center" }, children: content(emptyContent || emptyText, {
|
|
8625
8725
|
color: colors.textTertiary
|
|
8626
8726
|
}) })
|
|
8627
8727
|
]
|
|
@@ -8658,7 +8758,7 @@ function KjunTable(props) {
|
|
|
8658
8758
|
onRowClick,
|
|
8659
8759
|
onRetry
|
|
8660
8760
|
} = props;
|
|
8661
|
-
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = useWindowDimensions7().width <
|
|
8761
|
+
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = useWindowDimensions7().width < tokens48.table.mobileBreakpoint;
|
|
8662
8762
|
const layout = tablePresentation(props, mobile);
|
|
8663
8763
|
const { card, visible } = layout;
|
|
8664
8764
|
const cell = (col, row, index, role) => {
|
|
@@ -8670,9 +8770,9 @@ function KjunTable(props) {
|
|
|
8670
8770
|
{
|
|
8671
8771
|
style: {
|
|
8672
8772
|
alignSelf: "flex-start",
|
|
8673
|
-
paddingVertical:
|
|
8674
|
-
paddingHorizontal:
|
|
8675
|
-
borderRadius:
|
|
8773
|
+
paddingVertical: tokens48.dimension.value2,
|
|
8774
|
+
paddingHorizontal: tokens48.dimension.value8,
|
|
8775
|
+
borderRadius: tokens48.radius.radius4,
|
|
8676
8776
|
backgroundColor: role2 ? domainColor(domainColors, role2 + "Bg") : void 0
|
|
8677
8777
|
},
|
|
8678
8778
|
children: content(body, {
|
|
@@ -8775,7 +8875,7 @@ function KpiNumberLine({ prefix, suffix, prefixGap, suffixGap, style, unitStyle,
|
|
|
8775
8875
|
}
|
|
8776
8876
|
|
|
8777
8877
|
// packages/native/src/kpi-hero.tsx
|
|
8778
|
-
import { tokens as
|
|
8878
|
+
import { tokens as tokens49 } from "@kjun-ui/tokens";
|
|
8779
8879
|
import {
|
|
8780
8880
|
View as View42,
|
|
8781
8881
|
useWindowDimensions as useWindowDimensions8
|
|
@@ -8808,8 +8908,8 @@ function KjunKpiHero(props) {
|
|
|
8808
8908
|
deltaFormatter,
|
|
8809
8909
|
renderSecondary
|
|
8810
8910
|
} = props;
|
|
8811
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = useWindowDimensions8().width, mobile = windowWidth <=
|
|
8812
|
-
const geometry2 =
|
|
8911
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = useWindowDimensions8().width, mobile = windowWidth <= tokens49.responsive.kpiHero, small = size === "sm", numberRole = small ? "displaySm" : mobile ? "displayMd" : "displayLg", font = typeStyle(numberRole).fontSize, unitStyle = typeStyle(small ? "numberSm" : mobile ? "numberMd" : "numberLg");
|
|
8912
|
+
const geometry2 = tokens49.extensions.kpiHero;
|
|
8813
8913
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8814
8914
|
const numeric2 = {
|
|
8815
8915
|
fontFamily: numericFontFamily || fontFamily,
|
|
@@ -8821,7 +8921,7 @@ function KjunKpiHero(props) {
|
|
|
8821
8921
|
);
|
|
8822
8922
|
const delta = (v, kind, style) => {
|
|
8823
8923
|
if (deltaFormatter) return /* @__PURE__ */ jsx49(KText, { style, children: deltaFormatter(v, kind) });
|
|
8824
|
-
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap =
|
|
8924
|
+
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap = tokens49.extensions.financial.affixGap, number = new Intl.NumberFormat(void 0, {
|
|
8825
8925
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
8826
8926
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
8827
8927
|
}).format(Math.abs(v));
|
|
@@ -8924,11 +9024,11 @@ function KjunKpiHero(props) {
|
|
|
8924
9024
|
gap: small && mobile ? geometry2.smallMobileGap : spec.secondaryGap,
|
|
8925
9025
|
marginTop: spec.secondaryMargin,
|
|
8926
9026
|
paddingTop: spec.secondaryPadding,
|
|
8927
|
-
borderTopWidth:
|
|
9027
|
+
borderTopWidth: tokens49.border.defaultWidth,
|
|
8928
9028
|
borderTopColor: colors.border
|
|
8929
9029
|
},
|
|
8930
9030
|
children: secondary.map((item, i) => {
|
|
8931
|
-
const columns = mobile && !small && windowWidth <=
|
|
9031
|
+
const columns = mobile && !small && windowWidth <= tokens49.responsive.kpiHeroSecondary && secondary.length >= 3 ? 2 : 0;
|
|
8932
9032
|
const first = columns ? i % columns === 0 : i === 0;
|
|
8933
9033
|
const last = columns ? i % columns === columns - 1 || i === secondary.length - 1 : i === secondary.length - 1;
|
|
8934
9034
|
return /* @__PURE__ */ jsxs35(
|
|
@@ -8939,7 +9039,7 @@ function KjunKpiHero(props) {
|
|
|
8939
9039
|
minWidth: 0,
|
|
8940
9040
|
paddingLeft: first ? 0 : geometry2.itemPadding,
|
|
8941
9041
|
paddingRight: last ? 0 : geometry2.itemPadding,
|
|
8942
|
-
borderLeftWidth: first ? 0 :
|
|
9042
|
+
borderLeftWidth: first ? 0 : tokens49.border.defaultWidth,
|
|
8943
9043
|
borderLeftColor: colors.border
|
|
8944
9044
|
} : { minWidth: 0, maxWidth: "100%", flexShrink: 1 },
|
|
8945
9045
|
children: [
|
|
@@ -9004,7 +9104,7 @@ function KjunKpiHero(props) {
|
|
|
9004
9104
|
}
|
|
9005
9105
|
|
|
9006
9106
|
// packages/native/src/kpi-row.tsx
|
|
9007
|
-
import { tokens as
|
|
9107
|
+
import { tokens as tokens50 } from "@kjun-ui/tokens";
|
|
9008
9108
|
import { useState as useState38 } from "react";
|
|
9009
9109
|
import {
|
|
9010
9110
|
View as View43,
|
|
@@ -9020,8 +9120,8 @@ function KjunKpiRow({
|
|
|
9020
9120
|
onItemClick,
|
|
9021
9121
|
renderValue
|
|
9022
9122
|
}) {
|
|
9023
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = useWindowDimensions9().width <=
|
|
9024
|
-
const geometry2 =
|
|
9123
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = useWindowDimensions9().width <= tokens50.responsive.kpiRow, small = size === "sm", summary = mobileSummary && mobile && !small;
|
|
9124
|
+
const geometry2 = tokens50.extensions.kpiRow;
|
|
9025
9125
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
9026
9126
|
const [width, setWidth] = useState38(0);
|
|
9027
9127
|
const paddingX = summary ? geometry2.summary.paddingX : spec.paddingX;
|
|
@@ -9100,8 +9200,8 @@ function KjunKpiRow({
|
|
|
9100
9200
|
minWidth: 0,
|
|
9101
9201
|
paddingVertical: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingY : spec.itemPaddingY,
|
|
9102
9202
|
paddingHorizontal: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingX : spec.itemPaddingX,
|
|
9103
|
-
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ?
|
|
9104
|
-
borderTopWidth: mobile && !small && !summary && i >= 2 ?
|
|
9203
|
+
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ? tokens50.border.defaultWidth : 0 : i ? tokens50.border.defaultWidth : 0,
|
|
9204
|
+
borderTopWidth: mobile && !small && !summary && i >= 2 ? tokens50.border.defaultWidth : 0,
|
|
9105
9205
|
borderColor: colors.border,
|
|
9106
9206
|
borderRadius: item.clickable ? geometry2.itemRadius : 0,
|
|
9107
9207
|
flexDirection: sub ? "row" : "column",
|
|
@@ -9144,7 +9244,7 @@ function KjunKpiRow({
|
|
|
9144
9244
|
summary && seg.label && /* @__PURE__ */ jsx50(
|
|
9145
9245
|
KText,
|
|
9146
9246
|
{
|
|
9147
|
-
style: { ...typeStyle("caption"), marginRight: sub ?
|
|
9247
|
+
style: { ...typeStyle("caption"), marginRight: sub ? tokens50.dimension.value4 : 0, color: colors.textTertiary },
|
|
9148
9248
|
children: seg.label
|
|
9149
9249
|
}
|
|
9150
9250
|
),
|
|
@@ -9238,7 +9338,7 @@ function KjunKpiRow({
|
|
|
9238
9338
|
}
|
|
9239
9339
|
|
|
9240
9340
|
// packages/native/src/market-cards.tsx
|
|
9241
|
-
import { tokens as
|
|
9341
|
+
import { tokens as tokens52 } from "@kjun-ui/tokens";
|
|
9242
9342
|
import { ScrollView as ScrollView10, View as View45 } from "react-native";
|
|
9243
9343
|
|
|
9244
9344
|
// shared/package-runtime/market-cards.ts
|
|
@@ -9304,7 +9404,7 @@ function useMarketCards(props) {
|
|
|
9304
9404
|
}
|
|
9305
9405
|
|
|
9306
9406
|
// packages/native/src/market-parts.tsx
|
|
9307
|
-
import { tokens as
|
|
9407
|
+
import { tokens as tokens51 } from "@kjun-ui/tokens";
|
|
9308
9408
|
import { View as View44, useWindowDimensions as useWindowDimensions10 } from "react-native";
|
|
9309
9409
|
import { Fragment as Fragment18, jsx as jsx51, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9310
9410
|
function MarketIdentity({
|
|
@@ -9314,7 +9414,7 @@ function MarketIdentity({
|
|
|
9314
9414
|
compact = false
|
|
9315
9415
|
}) {
|
|
9316
9416
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9317
|
-
const { colors } = useKjunStyles(), mobile = useWindowDimensions10().width <
|
|
9417
|
+
const { colors } = useKjunStyles(), mobile = useWindowDimensions10().width < tokens51.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");
|
|
9318
9418
|
const body = /* @__PURE__ */ jsxs37(Fragment18, { children: [
|
|
9319
9419
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
9320
9420
|
/* @__PURE__ */ jsxs37(View44, { style: { flex: 1, minWidth: 0 }, children: [
|
|
@@ -9324,7 +9424,7 @@ function MarketIdentity({
|
|
|
9324
9424
|
style: {
|
|
9325
9425
|
flexDirection: "row",
|
|
9326
9426
|
alignItems: "center",
|
|
9327
|
-
gap:
|
|
9427
|
+
gap: tokens51.dimension.value4,
|
|
9328
9428
|
minWidth: 0
|
|
9329
9429
|
},
|
|
9330
9430
|
children: [
|
|
@@ -9346,7 +9446,7 @@ function MarketIdentity({
|
|
|
9346
9446
|
]
|
|
9347
9447
|
}
|
|
9348
9448
|
),
|
|
9349
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */ jsx51(View44, { style: { marginTop:
|
|
9449
|
+
(meta || props.renderSubMeta) && /* @__PURE__ */ jsx51(View44, { style: { marginTop: tokens51.dimension.value2 }, children: ((_i = props.renderSubMeta) == null ? void 0 : _i.call(props, row)) || /* @__PURE__ */ jsx51(
|
|
9350
9450
|
KText,
|
|
9351
9451
|
{
|
|
9352
9452
|
numberOfLines: 1,
|
|
@@ -9408,9 +9508,9 @@ function MarketFooter({
|
|
|
9408
9508
|
flexWrap: "wrap",
|
|
9409
9509
|
alignItems: "center",
|
|
9410
9510
|
justifyContent: "space-between",
|
|
9411
|
-
gap:
|
|
9412
|
-
paddingVertical:
|
|
9413
|
-
paddingHorizontal:
|
|
9511
|
+
gap: tokens51.dimension.value8,
|
|
9512
|
+
paddingVertical: tokens51.dimension.value12,
|
|
9513
|
+
paddingHorizontal: tokens51.dimension.value16
|
|
9414
9514
|
},
|
|
9415
9515
|
children: [
|
|
9416
9516
|
/* @__PURE__ */ jsx51(KText, { style: { ...typeStyle("caption"), color: colors.textTertiary }, children: calculatedAt ? m.lastUpdated + (((_a = props.formatDate) == null ? void 0 : _a.call(props, calculatedAt)) || calculatedAt) : footerNote }),
|
|
@@ -9456,9 +9556,9 @@ function KjunMarketCards(props) {
|
|
|
9456
9556
|
showsHorizontalScrollIndicator: false,
|
|
9457
9557
|
contentContainerStyle: {
|
|
9458
9558
|
flexDirection: "row",
|
|
9459
|
-
gap:
|
|
9460
|
-
paddingVertical:
|
|
9461
|
-
paddingHorizontal:
|
|
9559
|
+
gap: tokens52.dimension.value8,
|
|
9560
|
+
paddingVertical: tokens52.dimension.value10,
|
|
9561
|
+
paddingHorizontal: tokens52.dimension.value16
|
|
9462
9562
|
},
|
|
9463
9563
|
children: state.pills.map((pill) => /* @__PURE__ */ jsxs38(
|
|
9464
9564
|
AccessiblePressable,
|
|
@@ -9467,14 +9567,14 @@ function KjunMarketCards(props) {
|
|
|
9467
9567
|
accessibilityLabel: pill.label,
|
|
9468
9568
|
accessibilityState: { selected: state.key === pill.key },
|
|
9469
9569
|
onPress: () => state.select(pill.key),
|
|
9470
|
-
hitSlop: { top: (
|
|
9570
|
+
hitSlop: { top: (tokens52.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * tokens52.dimension.value8) / 2, bottom: (tokens52.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * tokens52.dimension.value8) / 2 },
|
|
9471
9571
|
style: {
|
|
9472
9572
|
flexDirection: "row",
|
|
9473
9573
|
alignItems: "center",
|
|
9474
|
-
gap:
|
|
9475
|
-
paddingVertical:
|
|
9476
|
-
paddingHorizontal:
|
|
9477
|
-
borderRadius:
|
|
9574
|
+
gap: tokens52.dimension.value4,
|
|
9575
|
+
paddingVertical: tokens52.dimension.value8,
|
|
9576
|
+
paddingHorizontal: tokens52.dimension.value16,
|
|
9577
|
+
borderRadius: tokens52.radius.radius9999,
|
|
9478
9578
|
backgroundColor: state.key === pill.key ? colors.brand : colors.secondary
|
|
9479
9579
|
},
|
|
9480
9580
|
children: [
|
|
@@ -9510,7 +9610,7 @@ function KjunMarketCards(props) {
|
|
|
9510
9610
|
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx52(KjunListSkeleton, { variant: "compact" }),
|
|
9511
9611
|
emptyContent: /* @__PURE__ */ jsx52(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
9512
9612
|
children: /* @__PURE__ */ jsxs38(View45, { children: [
|
|
9513
|
-
state.pill && /* @__PURE__ */ jsx52(KText, { style: { textAlign: "right", paddingHorizontal:
|
|
9613
|
+
state.pill && /* @__PURE__ */ jsx52(KText, { style: { textAlign: "right", paddingHorizontal: tokens52.dimension.value16, paddingVertical: tokens52.dimension.value8, ...typeStyle("caption"), color: colors.textSecondary }, children: state.pill.label }),
|
|
9514
9614
|
rows.map((row, i) => {
|
|
9515
9615
|
var _a, _b, _c;
|
|
9516
9616
|
return /* @__PURE__ */ jsxs38(
|
|
@@ -9525,22 +9625,22 @@ function KjunMarketCards(props) {
|
|
|
9525
9625
|
flexDirection: "row",
|
|
9526
9626
|
alignItems: "center",
|
|
9527
9627
|
justifyContent: "space-between",
|
|
9528
|
-
paddingVertical:
|
|
9529
|
-
paddingHorizontal:
|
|
9530
|
-
borderBottomWidth:
|
|
9628
|
+
paddingVertical: tokens52.dimension.value10,
|
|
9629
|
+
paddingHorizontal: tokens52.dimension.value16,
|
|
9630
|
+
borderBottomWidth: tokens52.border.defaultWidth,
|
|
9531
9631
|
borderBottomColor: colors.border,
|
|
9532
9632
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9533
9633
|
}),
|
|
9534
9634
|
children: [
|
|
9535
9635
|
/* @__PURE__ */ jsx52(MarketIdentity, { row, props, compact: true }),
|
|
9536
|
-
/* @__PURE__ */ jsx52(View45, { style: { marginLeft:
|
|
9636
|
+
/* @__PURE__ */ jsx52(View45, { style: { marginLeft: tokens52.dimension.value12, alignItems: "flex-end" }, children: ((_b = state.pill) == null ? void 0 : _b.format) === "sparkline" ? /* @__PURE__ */ jsx52(
|
|
9537
9637
|
KjunSparkline,
|
|
9538
9638
|
{
|
|
9539
9639
|
data: getValue(row, state.key) || [],
|
|
9540
|
-
width:
|
|
9541
|
-
height:
|
|
9640
|
+
width: tokens52.extensions.marketTable.sparklineWidth,
|
|
9641
|
+
height: tokens52.extensions.marketTable.sparklineHeight
|
|
9542
9642
|
}
|
|
9543
|
-
) : state.pill ? /* @__PURE__ */ jsx52(Fragment19, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height:
|
|
9643
|
+
) : state.pill ? /* @__PURE__ */ jsx52(Fragment19, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height: tokens52.extensions.marketTable.valueSkeletonHeight, width: tokens52.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ jsx52(
|
|
9544
9644
|
KjunSignedValue,
|
|
9545
9645
|
{
|
|
9546
9646
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -9548,14 +9648,14 @@ function KjunMarketCards(props) {
|
|
|
9548
9648
|
stale: !!getValue(row, "stale"),
|
|
9549
9649
|
tone: "pill"
|
|
9550
9650
|
}
|
|
9551
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height:
|
|
9651
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height: tokens52.extensions.financial.priceSkeletonHeight, width: tokens52.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs38(
|
|
9552
9652
|
View45,
|
|
9553
9653
|
{
|
|
9554
9654
|
style: {
|
|
9555
9655
|
flexDirection: "row",
|
|
9556
9656
|
alignItems: "center",
|
|
9557
9657
|
justifyContent: "flex-end",
|
|
9558
|
-
gap:
|
|
9658
|
+
gap: tokens52.dimension.value4
|
|
9559
9659
|
},
|
|
9560
9660
|
children: [
|
|
9561
9661
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
@@ -9592,7 +9692,7 @@ function KjunMarketCards(props) {
|
|
|
9592
9692
|
}
|
|
9593
9693
|
|
|
9594
9694
|
// packages/native/src/market-list.tsx
|
|
9595
|
-
import { tokens as
|
|
9695
|
+
import { tokens as tokens53 } from "@kjun-ui/tokens";
|
|
9596
9696
|
import { View as View46, useWindowDimensions as useWindowDimensions11 } from "react-native";
|
|
9597
9697
|
import { jsx as jsx53, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9598
9698
|
var changeWeight = { fontWeight: typeStyle("label").fontWeight };
|
|
@@ -9610,7 +9710,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9610
9710
|
closingPrice = false,
|
|
9611
9711
|
emptyMessage = m.noItems,
|
|
9612
9712
|
emptySubMessage = ""
|
|
9613
|
-
} = props, { colors } = useKjunStyles(), mobile = useWindowDimensions11().width <
|
|
9713
|
+
} = props, { colors } = useKjunStyles(), mobile = useWindowDimensions11().width < tokens53.responsive.market;
|
|
9614
9714
|
return /* @__PURE__ */ jsxs39(View46, { children: [
|
|
9615
9715
|
/* @__PURE__ */ jsx53(
|
|
9616
9716
|
KjunDataState,
|
|
@@ -9636,11 +9736,11 @@ function KjunMarketSimpleList(props) {
|
|
|
9636
9736
|
flexDirection: "row",
|
|
9637
9737
|
alignItems: "center",
|
|
9638
9738
|
justifyContent: "space-between",
|
|
9639
|
-
paddingVertical: mobile ?
|
|
9640
|
-
paddingHorizontal: mobile ?
|
|
9739
|
+
paddingVertical: mobile ? tokens53.dimension.value14 : tokens53.dimension.value16,
|
|
9740
|
+
paddingHorizontal: mobile ? tokens53.dimension.value20 : tokens53.dimension.value16,
|
|
9641
9741
|
// Like Web, the minimum height belongs to the narrow layout only.
|
|
9642
|
-
minHeight: mobile ?
|
|
9643
|
-
borderBottomWidth:
|
|
9742
|
+
minHeight: mobile ? tokens53.extensions.marketList.minimumHeight : void 0,
|
|
9743
|
+
borderBottomWidth: tokens53.border.defaultWidth,
|
|
9644
9744
|
borderBottomColor: colors.border,
|
|
9645
9745
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9646
9746
|
}),
|
|
@@ -9650,8 +9750,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9650
9750
|
View46,
|
|
9651
9751
|
{
|
|
9652
9752
|
style: {
|
|
9653
|
-
marginLeft:
|
|
9654
|
-
minWidth: mobile ?
|
|
9753
|
+
marginLeft: tokens53.dimension.value12,
|
|
9754
|
+
minWidth: mobile ? tokens53.extensions.marketList.mobileQuoteMinimumWidth : void 0,
|
|
9655
9755
|
maxWidth: "50%",
|
|
9656
9756
|
alignItems: "flex-end"
|
|
9657
9757
|
},
|
|
@@ -9673,8 +9773,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9673
9773
|
flexWrap: "wrap",
|
|
9674
9774
|
alignItems: "center",
|
|
9675
9775
|
justifyContent: "flex-end",
|
|
9676
|
-
gap:
|
|
9677
|
-
marginTop:
|
|
9776
|
+
gap: tokens53.dimension.value6,
|
|
9777
|
+
marginTop: tokens53.dimension.value2
|
|
9678
9778
|
},
|
|
9679
9779
|
children: [
|
|
9680
9780
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
@@ -9686,7 +9786,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9686
9786
|
fetchedAt
|
|
9687
9787
|
}
|
|
9688
9788
|
)),
|
|
9689
|
-
changeLoading(row) ? /* @__PURE__ */ jsx53(KjunSkeleton, { type: "block", height:
|
|
9789
|
+
changeLoading(row) ? /* @__PURE__ */ jsx53(KjunSkeleton, { type: "block", height: tokens53.extensions.marketList.changeSkeletonHeight, width: tokens53.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ jsx53(
|
|
9690
9790
|
KjunSignedValue,
|
|
9691
9791
|
{
|
|
9692
9792
|
value: change,
|
|
@@ -9720,7 +9820,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9720
9820
|
}
|
|
9721
9821
|
|
|
9722
9822
|
// packages/native/src/market-panel.tsx
|
|
9723
|
-
import { tokens as
|
|
9823
|
+
import { tokens as tokens54 } from "@kjun-ui/tokens";
|
|
9724
9824
|
import { View as View47 } from "react-native";
|
|
9725
9825
|
import { jsx as jsx54, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9726
9826
|
function KjunMarketListPanel({
|
|
@@ -9734,8 +9834,8 @@ function KjunMarketListPanel({
|
|
|
9734
9834
|
View47,
|
|
9735
9835
|
{
|
|
9736
9836
|
style: {
|
|
9737
|
-
marginTop:
|
|
9738
|
-
borderTopWidth:
|
|
9837
|
+
marginTop: tokens54.dimension.value16,
|
|
9838
|
+
borderTopWidth: tokens54.border.defaultWidth,
|
|
9739
9839
|
borderTopColor: colors.border
|
|
9740
9840
|
},
|
|
9741
9841
|
children
|
|
@@ -9745,7 +9845,7 @@ function KjunMarketListPanel({
|
|
|
9745
9845
|
}
|
|
9746
9846
|
|
|
9747
9847
|
// packages/native/src/market-table.tsx
|
|
9748
|
-
import { tokens as
|
|
9848
|
+
import { tokens as tokens55 } from "@kjun-ui/tokens";
|
|
9749
9849
|
import { useId as useId10, useState as useState40 } from "react";
|
|
9750
9850
|
import { ScrollView as ScrollView11, View as View48 } from "react-native";
|
|
9751
9851
|
import Svg8, { Defs as Defs4, LinearGradient as LinearGradient4, Rect as Rect4, Stop as Stop4 } from "react-native-svg";
|
|
@@ -9773,7 +9873,7 @@ function KjunMarketTable(props) {
|
|
|
9773
9873
|
const render = (row, col) => {
|
|
9774
9874
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
9775
9875
|
if (cellLoading(row, col))
|
|
9776
|
-
return /* @__PURE__ */ jsx55(KjunSkeleton, { type: "block", height:
|
|
9876
|
+
return /* @__PURE__ */ jsx55(KjunSkeleton, { type: "block", height: tokens55.extensions.marketTable.valueSkeletonHeight, width: tokens55.extensions.marketTable.valueSkeletonWidth });
|
|
9777
9877
|
if (renderCell) return content(renderCell(row, col));
|
|
9778
9878
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
9779
9879
|
return /* @__PURE__ */ jsx55(MarketIdentity, { row, props, table: true });
|
|
@@ -9782,8 +9882,8 @@ function KjunMarketTable(props) {
|
|
|
9782
9882
|
KjunSparkline,
|
|
9783
9883
|
{
|
|
9784
9884
|
data: Array.isArray(value) ? value : [],
|
|
9785
|
-
width:
|
|
9786
|
-
height:
|
|
9885
|
+
width: tokens55.extensions.marketTable.sparklineWidth,
|
|
9886
|
+
height: tokens55.extensions.marketTable.sparklineHeight
|
|
9787
9887
|
}
|
|
9788
9888
|
);
|
|
9789
9889
|
if (col.type === "price")
|
|
@@ -9841,7 +9941,7 @@ function KjunMarketTable(props) {
|
|
|
9841
9941
|
onLayout: layout.onLayout,
|
|
9842
9942
|
style: {
|
|
9843
9943
|
backgroundColor: embedded ? void 0 : colors.surface,
|
|
9844
|
-
borderRadius: embedded ? 0 :
|
|
9944
|
+
borderRadius: embedded ? 0 : tokens55.radius.radius12
|
|
9845
9945
|
},
|
|
9846
9946
|
children: [
|
|
9847
9947
|
/* @__PURE__ */ jsx55(
|
|
@@ -9881,13 +9981,13 @@ function KjunMarketTable(props) {
|
|
|
9881
9981
|
{
|
|
9882
9982
|
style: {
|
|
9883
9983
|
width: marketGeometry.actionsWidth,
|
|
9884
|
-
paddingVertical:
|
|
9885
|
-
paddingHorizontal:
|
|
9984
|
+
paddingVertical: tokens55.dimension.value12,
|
|
9985
|
+
paddingHorizontal: tokens55.dimension.value4,
|
|
9886
9986
|
flexDirection: "row",
|
|
9887
9987
|
alignItems: "center",
|
|
9888
9988
|
justifyContent: "center"
|
|
9889
9989
|
},
|
|
9890
|
-
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ jsx55(View48, { style: { width: Math.max(
|
|
9990
|
+
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ jsx55(View48, { style: { width: Math.max(tokens55.native.minimumTouchTarget, tokens55.extensions.iconToggle.sizes.xs), alignItems: "center" }, children: /* @__PURE__ */ jsx55(KjunCollectionMark, { kind, size: "md" }) }, kind))
|
|
9891
9991
|
}
|
|
9892
9992
|
),
|
|
9893
9993
|
columns.map((col, columnIndex) => /* @__PURE__ */ jsxs41(
|
|
@@ -9902,11 +10002,11 @@ function KjunMarketTable(props) {
|
|
|
9902
10002
|
},
|
|
9903
10003
|
style: {
|
|
9904
10004
|
width: layout.widths[columnIndex],
|
|
9905
|
-
padding:
|
|
10005
|
+
padding: tokens55.dimension.value12,
|
|
9906
10006
|
flexDirection: "row",
|
|
9907
10007
|
alignItems: "center",
|
|
9908
10008
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
9909
|
-
gap:
|
|
10009
|
+
gap: tokens55.dimension.value4
|
|
9910
10010
|
},
|
|
9911
10011
|
children: [
|
|
9912
10012
|
/* @__PURE__ */ jsx55(
|
|
@@ -9923,7 +10023,7 @@ function KjunMarketTable(props) {
|
|
|
9923
10023
|
KjunIcon,
|
|
9924
10024
|
{
|
|
9925
10025
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
9926
|
-
size:
|
|
10026
|
+
size: tokens55.extensions.marketTable.sortIconSize,
|
|
9927
10027
|
color: sortKey === col.key ? colors.brand : colors.textTertiary
|
|
9928
10028
|
}
|
|
9929
10029
|
)
|
|
@@ -9958,8 +10058,8 @@ function KjunMarketTable(props) {
|
|
|
9958
10058
|
{
|
|
9959
10059
|
style: {
|
|
9960
10060
|
width: marketGeometry.actionsWidth,
|
|
9961
|
-
paddingVertical:
|
|
9962
|
-
paddingHorizontal:
|
|
10061
|
+
paddingVertical: tokens55.dimension.value12,
|
|
10062
|
+
paddingHorizontal: tokens55.dimension.value4,
|
|
9963
10063
|
flexDirection: "row",
|
|
9964
10064
|
alignItems: "center",
|
|
9965
10065
|
justifyContent: "center"
|
|
@@ -10003,8 +10103,8 @@ function KjunMarketTable(props) {
|
|
|
10003
10103
|
{
|
|
10004
10104
|
style: {
|
|
10005
10105
|
width: layout.widths[columnIndex],
|
|
10006
|
-
paddingVertical:
|
|
10007
|
-
paddingHorizontal:
|
|
10106
|
+
paddingVertical: tokens55.dimension.value14,
|
|
10107
|
+
paddingHorizontal: tokens55.dimension.value12,
|
|
10008
10108
|
justifyContent: "center",
|
|
10009
10109
|
alignItems: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : void 0
|
|
10010
10110
|
},
|
|
@@ -10030,7 +10130,7 @@ function KjunMarketTable(props) {
|
|
|
10030
10130
|
] })
|
|
10031
10131
|
}
|
|
10032
10132
|
),
|
|
10033
|
-
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ jsx55(View48, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
10133
|
+
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ jsx55(View48, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: tokens55.extensions.scrollFade.width }, children: /* @__PURE__ */ jsxs41(Svg8, { width: "100%", height: "100%", children: [
|
|
10034
10134
|
/* @__PURE__ */ jsx55(Defs4, { children: /* @__PURE__ */ jsxs41(LinearGradient4, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
10035
10135
|
/* @__PURE__ */ jsx55(Stop4, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
10036
10136
|
/* @__PURE__ */ jsx55(Stop4, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -10047,50 +10147,61 @@ function KjunMarketTable(props) {
|
|
|
10047
10147
|
}
|
|
10048
10148
|
|
|
10049
10149
|
// packages/native/src/list.tsx
|
|
10050
|
-
import { tokens as
|
|
10150
|
+
import { tokens as tokens56 } from "@kjun-ui/tokens";
|
|
10051
10151
|
import { Children as Children5, createContext as createContext22, useContext as useContext19 } from "react";
|
|
10052
10152
|
import { View as View49, Platform as Platform26 } from "react-native";
|
|
10053
10153
|
import { Fragment as Fragment20, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
10054
10154
|
var ListRowContext = createContext22({ divider: true, compact: false });
|
|
10055
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onPress }) {
|
|
10155
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress }) {
|
|
10056
10156
|
const { colors } = useKjunStyles(), { divider, compact } = useContext19(ListRowContext);
|
|
10057
10157
|
const parts = /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
10058
10158
|
hasContent(leading) && /* @__PURE__ */ jsx56(View49, { children: content(leading) }),
|
|
10059
10159
|
/* @__PURE__ */ jsxs42(View49, { style: { flex: 1, minWidth: 0 }, children: [
|
|
10060
|
-
/* @__PURE__ */ jsx56(KText, { style: { ...typeStyle("label") }, children: title }),
|
|
10061
|
-
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop:
|
|
10160
|
+
/* @__PURE__ */ jsx56(KText, { style: { ...typeStyle("label"), ...destructive ? { color: colors.danger } : {} }, children: title }),
|
|
10161
|
+
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens56.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
10062
10162
|
] }),
|
|
10063
|
-
hasContent(trailing) && /* @__PURE__ */ jsx56(View49, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
10163
|
+
hasContent(trailing) && /* @__PURE__ */ jsx56(View49, { style: { maxWidth: "35%" }, children: content(trailing) }),
|
|
10164
|
+
chevron && /* @__PURE__ */ jsx56(View49, { accessible: false, importantForAccessibility: "no-hide-descendants", accessibilityElementsHidden: true, children: /* @__PURE__ */ jsx56(KjunIcon, { name: "chevron-right", size: tokens56.iconSizes.default, color: colors.textTertiary }) })
|
|
10064
10165
|
] });
|
|
10065
|
-
const style = { flex: 1, minWidth: 0, minHeight: compact ?
|
|
10066
|
-
return /* @__PURE__ */ jsxs42(View49, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap:
|
|
10067
|
-
onPress || href ? /* @__PURE__ */ jsx56(AccessiblePressable, { ...Platform26.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ?
|
|
10068
|
-
hasContent(actions) && /* @__PURE__ */ jsx56(View49, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform26.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap:
|
|
10166
|
+
const style = { flex: 1, minWidth: 0, minHeight: compact ? tokens56.extensions.list.compactMinimumHeight : tokens56.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: tokens56.extensions.list.gap, padding: tokens56.extensions.list.padding, ...compact ? { paddingVertical: tokens56.extensions.list.compactPaddingY } : {} };
|
|
10167
|
+
return /* @__PURE__ */ jsxs42(View49, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: tokens56.extensions.list.gap, borderBottomWidth: divider ? tokens56.border.defaultWidth : 0, borderBottomColor: colors.divider }, children: [
|
|
10168
|
+
onPress || href ? /* @__PURE__ */ jsx56(AccessiblePressable, { ...Platform26.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ? tokens56.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ jsx56(View49, { style, children: parts }),
|
|
10169
|
+
hasContent(actions) && /* @__PURE__ */ jsx56(View49, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform26.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens56.extensions.list.actionsGap, paddingRight: tokens56.extensions.list.actionsPadding, opacity: disabled ? tokens56.states.opacity.disabled : 1 }, children: content(actions) })
|
|
10069
10170
|
] });
|
|
10070
10171
|
}
|
|
10071
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
10172
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
10072
10173
|
const { colors } = useKjunStyles();
|
|
10073
|
-
return /* @__PURE__ */ jsxs42(View49, { style: { minWidth: 0, backgroundColor: colors.surface }, children: [
|
|
10074
|
-
!!(title || description || actions) && /* @__PURE__ */ jsxs42(View49, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
10174
|
+
return /* @__PURE__ */ jsxs42(View49, { style: { minWidth: 0, backgroundColor: surface ? colors.surface : "transparent" }, children: [
|
|
10175
|
+
!!(title || description || actions) && /* @__PURE__ */ jsxs42(View49, { style: { flexDirection: "row", alignItems: "center", gap: tokens56.extensions.list.gap, padding: tokens56.extensions.list.padding }, children: [
|
|
10075
10176
|
/* @__PURE__ */ jsxs42(View49, { style: { flex: 1 }, children: [
|
|
10076
10177
|
!!title && /* @__PURE__ */ jsx56(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
10077
|
-
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop:
|
|
10178
|
+
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens56.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
10078
10179
|
] }),
|
|
10079
10180
|
content(actions)
|
|
10080
10181
|
] }),
|
|
10081
10182
|
/* @__PURE__ */ jsx56(View49, { role: "list", accessibilityLabel: ariaLabel || title, children: Children5.toArray(children).map((row, i, rows) => /* @__PURE__ */ jsx56(ListRowContext.Provider, { value: { divider: divider && i < rows.length - 1, compact: density === "compact" }, children: row }, i)) })
|
|
10082
10183
|
] });
|
|
10083
10184
|
}
|
|
10185
|
+
function KjunListItem({ children }) {
|
|
10186
|
+
const { colors } = useKjunStyles(), { divider, compact } = useContext19(ListRowContext);
|
|
10187
|
+
return /* @__PURE__ */ jsx56(View49, { role: "listitem", style: {
|
|
10188
|
+
padding: tokens56.extensions.list.padding,
|
|
10189
|
+
...compact ? { paddingVertical: tokens56.extensions.list.compactPaddingY } : {},
|
|
10190
|
+
borderBottomWidth: divider ? tokens56.border.defaultWidth : 0,
|
|
10191
|
+
borderBottomColor: colors.divider,
|
|
10192
|
+
minWidth: 0
|
|
10193
|
+
}, children: content(children) });
|
|
10194
|
+
}
|
|
10084
10195
|
|
|
10085
10196
|
// packages/native/src/app-navigation.tsx
|
|
10086
|
-
import { tokens as
|
|
10197
|
+
import { tokens as tokens57 } from "@kjun-ui/tokens";
|
|
10087
10198
|
import { Children as Children6, Fragment as Fragment21, isValidElement as isValidElement8, useState as useState41 } from "react";
|
|
10088
10199
|
import { View as View50, Platform as Platform27 } from "react-native";
|
|
10089
10200
|
import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
10090
10201
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
10091
10202
|
const { colors } = useKjunStyles();
|
|
10092
|
-
const geometry2 =
|
|
10093
|
-
const titleInset = Math.max(0, (geometry2.controlSize -
|
|
10203
|
+
const geometry2 = tokens57.extensions.topNavigation;
|
|
10204
|
+
const titleInset = Math.max(0, (geometry2.controlSize - tokens57.typography.sectionTitle.lineHeightPx) / 2);
|
|
10094
10205
|
const wrapping = Platform27.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
10095
10206
|
const edgeInset = (geometry2.controlSize - geometry2.iconSize) / 2;
|
|
10096
10207
|
const [iconEdges, setIconEdges] = useState41({ leading: false, trailing: false });
|
|
@@ -10114,13 +10225,13 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
10114
10225
|
const m = useKjunMessages();
|
|
10115
10226
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
10116
10227
|
const { colors } = useKjunStyles();
|
|
10117
|
-
const geometry2 =
|
|
10228
|
+
const geometry2 = tokens57.extensions.bottomNavigation;
|
|
10118
10229
|
const hasIcons = items2.some((item) => item.icon);
|
|
10119
10230
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
10120
10231
|
return /* @__PURE__ */ jsx57(View50, { role: "navigation", accessibilityLabel: ariaLabel, style: { flexShrink: 0, flexDirection: "row", backgroundColor: colors.surface, paddingBottom: Math.max(0, safeAreaBottom) }, children: items2.map((item) => {
|
|
10121
10232
|
const selected = item.key === value;
|
|
10122
10233
|
const ink = selected ? colors.brand : colors.textSecondary;
|
|
10123
|
-
const ring =
|
|
10234
|
+
const ring = tokens57.border.controlWidth;
|
|
10124
10235
|
const badge = item.badge != null && /* @__PURE__ */ jsx57(View50, { pointerEvents: "none", "aria-hidden": true, style: {
|
|
10125
10236
|
position: "absolute",
|
|
10126
10237
|
top: -geometry2.badgeOffset - ring,
|
|
@@ -10155,7 +10266,7 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
10155
10266
|
gap: geometry2.itemGap,
|
|
10156
10267
|
paddingHorizontal: geometry2.itemPaddingX,
|
|
10157
10268
|
paddingVertical: geometry2.itemPaddingY,
|
|
10158
|
-
opacity: item.disabled ?
|
|
10269
|
+
opacity: item.disabled ? tokens57.states.opacity.disabled : 1
|
|
10159
10270
|
},
|
|
10160
10271
|
children: [
|
|
10161
10272
|
hasIcons && /* @__PURE__ */ jsxs43(View50, { style: { width: geometry2.iconSize, height: geometry2.iconSize, flexShrink: 0 }, children: [
|
|
@@ -10176,8 +10287,8 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
10176
10287
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
10177
10288
|
const { colors } = useKjunStyles();
|
|
10178
10289
|
const [width, setWidth] = useState41(0);
|
|
10179
|
-
const geometry2 =
|
|
10180
|
-
const wide = width >=
|
|
10290
|
+
const geometry2 = tokens57.extensions.navigation;
|
|
10291
|
+
const wide = width >= tokens57.responsive.bottomAction + geometry2.padding * 2;
|
|
10181
10292
|
const wrapping = Platform27.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
10182
10293
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
10183
10294
|
return /* @__PURE__ */ jsx57(BottomActionBarContext.Provider, { value: !wide, children: /* @__PURE__ */ jsxs43(View50, { onLayout: (event) => setWidth(event.nativeEvent.layout.width), style: {
|
|
@@ -10197,52 +10308,53 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
10197
10308
|
}
|
|
10198
10309
|
|
|
10199
10310
|
// packages/native/src/media.tsx
|
|
10200
|
-
import { useRef as useRef35, useState as useState42 } from "react";
|
|
10311
|
+
import { createContext as createContext23, useContext as useContext20, useRef as useRef35, useState as useState42 } from "react";
|
|
10201
10312
|
import { Image, View as View51 } from "react-native";
|
|
10202
|
-
import { tokens as
|
|
10313
|
+
import { tokens as tokens58 } from "@kjun-ui/tokens";
|
|
10203
10314
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
10315
|
+
var ImageBackgroundContext = createContext23(void 0);
|
|
10204
10316
|
function KjunImage({ src, source, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, onLoad, onError }) {
|
|
10205
|
-
const { colors } = useKjunStyles();
|
|
10317
|
+
const { colors } = useKjunStyles(), background = useContext20(ImageBackgroundContext);
|
|
10206
10318
|
const request = JSON.stringify(source != null ? source : src), current = useRef35({ request, version: 0 });
|
|
10207
10319
|
if (current.current.request !== request) current.current = { request, version: current.current.version + 1 };
|
|
10208
10320
|
const version = current.current.version;
|
|
10209
10321
|
const [failed, setFailed] = useState42(null);
|
|
10210
10322
|
const missing = !source && !src;
|
|
10211
|
-
return /* @__PURE__ */ jsx58(View51, { 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__ */ jsx58(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: () => {
|
|
10323
|
+
return /* @__PURE__ */ jsx58(View51, { 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__ */ jsx58(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: () => {
|
|
10212
10324
|
if (version === current.current.version) onLoad == null ? void 0 : onLoad();
|
|
10213
10325
|
}, onError: () => {
|
|
10214
10326
|
if (version === current.current.version) {
|
|
10215
10327
|
setFailed(version);
|
|
10216
10328
|
onError == null ? void 0 : onError();
|
|
10217
10329
|
}
|
|
10218
|
-
} }, version) : /* @__PURE__ */ jsx58(View51, { 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__ */ jsx58(KjunIcon, { name: "image", size:
|
|
10330
|
+
} }, version) : /* @__PURE__ */ jsx58(View51, { 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__ */ jsx58(KjunIcon, { name: "image", size: tokens58.extensions.image.fallbackIconSize, color: colors.textSecondary }), { color: colors.textSecondary, fontWeight: typeStyle("control").fontWeight, textAlign: "center" }) }) });
|
|
10219
10331
|
}
|
|
10220
|
-
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
10332
|
+
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
10221
10333
|
const m = useKjunMessages();
|
|
10222
10334
|
const { colors } = useKjunStyles(), initial = Array.from(name.trim())[0];
|
|
10223
|
-
return /* @__PURE__ */ jsx58(View51, { style: { width:
|
|
10335
|
+
return /* @__PURE__ */ jsx58(View51, { style: { width: tokens58.extensions.avatar[size], height: tokens58.extensions.avatar[size], borderRadius: shape === "circle" ? tokens58.radius.radius9999 : tokens58.radius.radius8, overflow: "hidden", flexShrink: 0 }, children: /* @__PURE__ */ jsx58(ImageBackgroundContext.Provider, { value: color, children: /* @__PURE__ */ jsx58(KjunImage, { src, source, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : initial ? /* @__PURE__ */ jsx58(KText, { style: { ...typeStyle(size === "sm" ? "control" : size === "lg" ? "sectionTitle" : "input"), fontWeight: typeStyle("control").fontWeight, color: textColor != null ? textColor : colors.textSecondary }, children: initial.toLocaleUpperCase() }) : /* @__PURE__ */ jsx58(KjunIcon, { name: "user", size: tokens58.extensions.avatar.fallbackIconSizes[size], color: textColor }), onLoad, onError }) }) });
|
|
10224
10336
|
}
|
|
10225
10337
|
|
|
10226
10338
|
// packages/native/src/chip.tsx
|
|
10227
10339
|
import { View as View52 } from "react-native";
|
|
10228
|
-
import { tokens as
|
|
10340
|
+
import { tokens as tokens59 } from "@kjun-ui/tokens";
|
|
10229
10341
|
import { jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10230
10342
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
10231
10343
|
const m = useKjunMessages();
|
|
10232
10344
|
const { colors } = useKjunStyles();
|
|
10233
|
-
return /* @__PURE__ */ jsxs44(View52, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap:
|
|
10234
|
-
!!icon && /* @__PURE__ */ jsx59(KjunIcon, { name: icon, size:
|
|
10235
|
-
/* @__PURE__ */ jsx59(KText, { style: { ...typeStyle(
|
|
10236
|
-
removable && /* @__PURE__ */ jsx59(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width:
|
|
10345
|
+
return /* @__PURE__ */ jsxs44(View52, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: tokens59.extensions.chip.gap, minHeight: removable ? tokens59.extensions.chip.nativeRemoveSize : tokens59.extensions.chip[size], paddingVertical: removable ? 0 : tokens59.extensions.chip.paddingY, paddingLeft: tokens59.extensions.chip.paddingX, paddingRight: removable ? 0 : tokens59.extensions.chip.paddingX, borderRadius: tokens59.extensions.chip.radius, backgroundColor: colors.secondary, opacity: disabled ? tokens59.states.opacity.disabled : 1 }, children: [
|
|
10346
|
+
!!icon && /* @__PURE__ */ jsx59(KjunIcon, { name: icon, size: tokens59.extensions.chip.iconSizes[size] }),
|
|
10347
|
+
/* @__PURE__ */ jsx59(KText, { style: { ...typeStyle(tokens59.extensions.chip.typography[size]), flexShrink: 1, minWidth: 0 }, children: label }),
|
|
10348
|
+
removable && /* @__PURE__ */ jsx59(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width: tokens59.extensions.chip.nativeRemoveSize, height: tokens59.extensions.chip.nativeRemoveSize, borderRadius: tokens59.extensions.chip.radius, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx59(KjunIcon, { name: "x", size: tokens59.extensions.chip.removeIconSizes[size] }) })
|
|
10237
10349
|
] });
|
|
10238
10350
|
}
|
|
10239
10351
|
|
|
10240
10352
|
// packages/native/src/fab.tsx
|
|
10241
|
-
import { tokens as
|
|
10353
|
+
import { tokens as tokens60 } from "@kjun-ui/tokens";
|
|
10242
10354
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
10243
10355
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onPress }) {
|
|
10244
10356
|
const { colors } = useKjunStyles();
|
|
10245
|
-
const { size, inset, iconSize } =
|
|
10357
|
+
const { size, inset, iconSize } = tokens60.extensions.fab;
|
|
10246
10358
|
return /* @__PURE__ */ jsx60(
|
|
10247
10359
|
AccessiblePressable,
|
|
10248
10360
|
{
|
|
@@ -10255,15 +10367,15 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10255
10367
|
position: "absolute",
|
|
10256
10368
|
right: inset,
|
|
10257
10369
|
bottom: inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom),
|
|
10258
|
-
zIndex:
|
|
10370
|
+
zIndex: tokens60.layers.page.navigation,
|
|
10259
10371
|
width: size,
|
|
10260
10372
|
height: size,
|
|
10261
10373
|
borderRadius: size / 2,
|
|
10262
10374
|
alignItems: "center",
|
|
10263
10375
|
justifyContent: "center",
|
|
10264
10376
|
backgroundColor: pressed ? colors.brandActive : colors.brand,
|
|
10265
|
-
opacity: disabled ?
|
|
10266
|
-
boxShadow: shadowLayers(
|
|
10377
|
+
opacity: disabled ? tokens60.states.opacity.disabled : 1,
|
|
10378
|
+
boxShadow: shadowLayers(tokens60.elevation.floating, colors)
|
|
10267
10379
|
}),
|
|
10268
10380
|
children: /* @__PURE__ */ jsx60(KjunIcon, { name: icon, size: iconSize, color: colors.onBrand })
|
|
10269
10381
|
}
|
|
@@ -10273,10 +10385,10 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10273
10385
|
// packages/native/src/range-input.tsx
|
|
10274
10386
|
import { useEffect as useEffect27, useMemo as useMemo3, useRef as useRef36, useState as useState43 } from "react";
|
|
10275
10387
|
import { PanResponder, Platform as Platform28, Pressable as Pressable3, View as View53 } from "react-native";
|
|
10276
|
-
import { tokens as
|
|
10388
|
+
import { tokens as tokens61, createSliderDomain, sliderKey } from "@kjun-ui/tokens";
|
|
10277
10389
|
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10278
|
-
var geometry =
|
|
10279
|
-
var targetSize =
|
|
10390
|
+
var geometry = tokens61.extensions.slider;
|
|
10391
|
+
var targetSize = tokens61.native.minimumTouchTarget;
|
|
10280
10392
|
var trackFocus = { tabIndex: -1 };
|
|
10281
10393
|
function RangeInput({
|
|
10282
10394
|
value,
|
|
@@ -10376,10 +10488,10 @@ function RangeInput({
|
|
|
10376
10488
|
View53,
|
|
10377
10489
|
{
|
|
10378
10490
|
style: {
|
|
10379
|
-
minWidth:
|
|
10491
|
+
minWidth: tokens61.extensions.slider.minimumWidth,
|
|
10380
10492
|
width: "100%",
|
|
10381
|
-
gap:
|
|
10382
|
-
opacity: blocked ?
|
|
10493
|
+
gap: tokens61.dimension.value4,
|
|
10494
|
+
opacity: blocked ? tokens61.states.opacity.disabled : 1
|
|
10383
10495
|
},
|
|
10384
10496
|
children: [
|
|
10385
10497
|
/* @__PURE__ */ jsxs45(
|
|
@@ -10389,7 +10501,7 @@ function RangeInput({
|
|
|
10389
10501
|
flexDirection: "row",
|
|
10390
10502
|
alignItems: "baseline",
|
|
10391
10503
|
justifyContent: "space-between",
|
|
10392
|
-
gap:
|
|
10504
|
+
gap: tokens61.dimension.value12,
|
|
10393
10505
|
minWidth: 0
|
|
10394
10506
|
},
|
|
10395
10507
|
children: [
|
|
@@ -10450,7 +10562,7 @@ function RangeInput({
|
|
|
10450
10562
|
{
|
|
10451
10563
|
style: {
|
|
10452
10564
|
height: geometry.track,
|
|
10453
|
-
borderRadius:
|
|
10565
|
+
borderRadius: tokens61.radius.radius9999,
|
|
10454
10566
|
backgroundColor: colors.border
|
|
10455
10567
|
}
|
|
10456
10568
|
}
|
|
@@ -10465,7 +10577,7 @@ function RangeInput({
|
|
|
10465
10577
|
position: "absolute",
|
|
10466
10578
|
top: (targetSize - geometry.track) / 2,
|
|
10467
10579
|
height: geometry.track,
|
|
10468
|
-
borderRadius:
|
|
10580
|
+
borderRadius: tokens61.radius.radius9999,
|
|
10469
10581
|
left: pct(values.length === 2 ? percent(values[0]) : 0),
|
|
10470
10582
|
width: pct(
|
|
10471
10583
|
percent(values[values.length - 1]) - (values.length === 2 ? percent(values[0]) : 0)
|
|
@@ -10541,14 +10653,14 @@ function RangeInput({
|
|
|
10541
10653
|
style: {
|
|
10542
10654
|
width: geometry.thumb,
|
|
10543
10655
|
height: geometry.thumb,
|
|
10544
|
-
borderRadius:
|
|
10545
|
-
borderWidth:
|
|
10656
|
+
borderRadius: tokens61.radius.radius9999,
|
|
10657
|
+
borderWidth: tokens61.border.controlWidth,
|
|
10546
10658
|
borderColor: !blocked && dragging === index ? colors.brandActive : !blocked && hovered === index ? colors.brandHover : colors.brand,
|
|
10547
10659
|
backgroundColor: colors.surface,
|
|
10548
10660
|
...Platform28.OS === "web" && !blocked && focused === index ? {
|
|
10549
10661
|
outlineStyle: "solid",
|
|
10550
|
-
outlineWidth:
|
|
10551
|
-
outlineOffset:
|
|
10662
|
+
outlineWidth: tokens61.states.focus.width,
|
|
10663
|
+
outlineOffset: tokens61.states.focus.choiceOffset,
|
|
10552
10664
|
outlineColor: colors.focusRing
|
|
10553
10665
|
} : {}
|
|
10554
10666
|
}
|
|
@@ -10574,7 +10686,7 @@ function KjunRangeSlider(props) {
|
|
|
10574
10686
|
// packages/native/src/quantity-stepper.tsx
|
|
10575
10687
|
import { useEffect as useEffect28, useRef as useRef37, useState as useState44 } from "react";
|
|
10576
10688
|
import { Platform as Platform29, View as View54 } from "react-native";
|
|
10577
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
10689
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens62 } from "@kjun-ui/tokens";
|
|
10578
10690
|
|
|
10579
10691
|
// shared/package-runtime/component-icons.ts
|
|
10580
10692
|
import minus from "@kjun-ui/icons/icons/minus";
|
|
@@ -10588,9 +10700,9 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10588
10700
|
const field = useKjunField();
|
|
10589
10701
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
10590
10702
|
const labelledBy = !ariaLabel && (field == null ? void 0 : field.label) && !field.labelHidden ? field.id + "-label" : void 0;
|
|
10591
|
-
const geometry2 =
|
|
10592
|
-
const buttonStyle = { width:
|
|
10593
|
-
const outer =
|
|
10703
|
+
const geometry2 = tokens62.extensions.compound;
|
|
10704
|
+
const buttonStyle = { width: tokens62.input[size].height, paddingHorizontal: 0 };
|
|
10705
|
+
const outer = tokens62.input[size].radius;
|
|
10594
10706
|
const decreaseStyle = { ...buttonStyle, borderRadius: 0, borderTopLeftRadius: outer, borderBottomLeftRadius: outer };
|
|
10595
10707
|
const increaseStyle = { ...buttonStyle, borderRadius: 0, borderTopRightRadius: outer, borderBottomRightRadius: outer };
|
|
10596
10708
|
const domain = createNumberDomain({ min, max, step, precision }), valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
@@ -10678,12 +10790,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10678
10790
|
input.removeEventListener("compositionend", end);
|
|
10679
10791
|
};
|
|
10680
10792
|
}, []);
|
|
10681
|
-
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height:
|
|
10793
|
+
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: tokens62.input[size].height, marginTop: -tokens62.input[size].height / 2, borderRadius: surface.spec.radius };
|
|
10682
10794
|
const hug = Platform29.OS === "web" && !block ? { width: "fit-content" } : {};
|
|
10683
10795
|
return /* @__PURE__ */ jsx62(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs46(View54, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
|
|
10684
10796
|
/* @__PURE__ */ jsx62(View54, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
|
|
10685
10797
|
/* @__PURE__ */ jsx62(CompoundTarget, { square: true, children: /* @__PURE__ */ jsx62(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: m.decreaseQuantity, disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
|
|
10686
|
-
/* @__PURE__ */ jsx62(View54, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 :
|
|
10798
|
+
/* @__PURE__ */ jsx62(View54, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : tokens62.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
|
|
10687
10799
|
var _a;
|
|
10688
10800
|
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
10689
10801
|
}, blocked), children: /* @__PURE__ */ jsx62(
|
|
@@ -10712,23 +10824,23 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10712
10824
|
},
|
|
10713
10825
|
onSubmitEditing: Platform29.OS === "web" ? void 0 : commit,
|
|
10714
10826
|
...Platform29.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 },
|
|
10715
|
-
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 -
|
|
10827
|
+
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 - tokens62.border.controlWidth, paddingVertical: 0 }
|
|
10716
10828
|
}
|
|
10717
10829
|
) }),
|
|
10718
10830
|
/* @__PURE__ */ jsx62(CompoundTarget, { square: true, children: /* @__PURE__ */ jsx62(KjunButton, { size, style: increaseStyle, variant: "ghost", ariaLabel: m.increaseQuantity, disabled: blocked || max !== void 0 && value >= max, onPress: () => move(1), prefixIcon: "plus" }) }),
|
|
10719
|
-
(invalid || surface.active) && /* @__PURE__ */ jsx62(View54, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ?
|
|
10831
|
+
(invalid || surface.active) && /* @__PURE__ */ jsx62(View54, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ? tokens62.border.controlWidth : tokens62.states.focus.width, borderColor: invalid ? colors.danger : colors.focusRing } })
|
|
10720
10832
|
] }) });
|
|
10721
10833
|
}
|
|
10722
10834
|
|
|
10723
10835
|
// packages/native/src/time-picker.tsx
|
|
10724
10836
|
import { Fragment as Fragment22, useEffect as useEffect29, useId as useId11, useMemo as useMemo4, useRef as useRef38, useState as useState45 } from "react";
|
|
10725
10837
|
import { View as View55 } from "react-native";
|
|
10726
|
-
import { createTimeDomain, tokens as
|
|
10838
|
+
import { createTimeDomain, tokens as tokens63 } from "@kjun-ui/tokens";
|
|
10727
10839
|
import { jsx as jsx63, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10728
10840
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
10729
10841
|
const m = useKjunMessages();
|
|
10730
10842
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
10731
|
-
const geometry2 =
|
|
10843
|
+
const geometry2 = tokens63.extensions.timePicker, spec = tokens63.input[size];
|
|
10732
10844
|
const { colors } = useKjunStyles();
|
|
10733
10845
|
const first = useRef38(null);
|
|
10734
10846
|
const [focused, setFocused] = useState45(false), [opened, setOpened] = useState45(null);
|
|
@@ -10752,12 +10864,12 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10752
10864
|
if (typeof next === "number") change(domain.select(value, index, next));
|
|
10753
10865
|
}, 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 }) }) }) })
|
|
10754
10866
|
] }, label)) }),
|
|
10755
|
-
clearable && value !== null && /* @__PURE__ */ jsx63(View55, { style: { marginVertical: Math.min(0, (spec.height -
|
|
10867
|
+
clearable && value !== null && /* @__PURE__ */ jsx63(View55, { style: { marginVertical: Math.min(0, (spec.height - tokens63.native.minimumTouchTarget) / 2) }, children: /* @__PURE__ */ jsx63(FieldClear, { size, label: m.clearValue(ariaLabel), disabled: disabled || !valid, onPress: () => {
|
|
10756
10868
|
var _a;
|
|
10757
10869
|
change(null);
|
|
10758
10870
|
(_a = first.current) == null ? void 0 : _a.focus();
|
|
10759
10871
|
} }) }),
|
|
10760
|
-
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx63(View55, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ?
|
|
10872
|
+
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx63(View55, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? tokens63.border.controlWidth : tokens63.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
10761
10873
|
] });
|
|
10762
10874
|
}
|
|
10763
10875
|
export {
|
|
@@ -10806,6 +10918,7 @@ export {
|
|
|
10806
10918
|
KjunInput,
|
|
10807
10919
|
KjunKpiHero,
|
|
10808
10920
|
KjunKpiRow,
|
|
10921
|
+
KjunListItem,
|
|
10809
10922
|
KjunListRow,
|
|
10810
10923
|
KjunListSection,
|
|
10811
10924
|
KjunListSkeleton,
|
|
@@ -10845,6 +10958,7 @@ export {
|
|
|
10845
10958
|
KjunTimePicker,
|
|
10846
10959
|
KjunTooltip,
|
|
10847
10960
|
KjunTopNavigation,
|
|
10961
|
+
createKjunFeedback,
|
|
10848
10962
|
kjunMessagesEn,
|
|
10849
10963
|
kjunMessagesKo,
|
|
10850
10964
|
useKjunFeedback,
|