@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.js
CHANGED
|
@@ -2155,7 +2155,11 @@ function KjunCard({
|
|
|
2155
2155
|
border = false,
|
|
2156
2156
|
dividers = false,
|
|
2157
2157
|
children,
|
|
2158
|
-
style
|
|
2158
|
+
style,
|
|
2159
|
+
pressable = false,
|
|
2160
|
+
disabled = false,
|
|
2161
|
+
ariaLabel,
|
|
2162
|
+
onPress
|
|
2159
2163
|
}) {
|
|
2160
2164
|
const { colors } = useKjunStyles();
|
|
2161
2165
|
const id = "kjun-" + useId4().replace(/[^a-z0-9]/gi, "");
|
|
@@ -2166,7 +2170,7 @@ function KjunCard({
|
|
|
2166
2170
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
2167
2171
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
2168
2172
|
const hasBody = hasContent(children), hasFooter = hasContent(footer), hasMedia = hasContent(media);
|
|
2169
|
-
|
|
2173
|
+
const base = [
|
|
2170
2174
|
{
|
|
2171
2175
|
minWidth: 0,
|
|
2172
2176
|
borderRadius: corner,
|
|
@@ -2175,7 +2179,8 @@ function KjunCard({
|
|
|
2175
2179
|
},
|
|
2176
2180
|
Platform11.OS === "web" && surface === "glass" ? { backdropFilter: `blur(${tokens10.card.glassBlur}px)` } : {},
|
|
2177
2181
|
style
|
|
2178
|
-
]
|
|
2182
|
+
];
|
|
2183
|
+
const parts = /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
2179
2184
|
paint.gradientEnd && /* @__PURE__ */ jsx14(View8, { pointerEvents: "none", style: { position: "absolute", inset: 0, borderRadius: corner, overflow: "hidden" }, children: /* @__PURE__ */ jsxs5(Svg2, { width: "100%", height: "100%", children: [
|
|
2180
2185
|
/* @__PURE__ */ jsx14(Defs, { children: /* @__PURE__ */ jsxs5(LinearGradient, { id, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
2181
2186
|
/* @__PURE__ */ jsx14(Stop, { offset: "0", stopColor: colors[paint.background] }),
|
|
@@ -2218,6 +2223,18 @@ function KjunCard({
|
|
|
2218
2223
|
boxShadow: [{ offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: tokens10.card.borderWidth, inset: true, color: borderColor }]
|
|
2219
2224
|
} })
|
|
2220
2225
|
] });
|
|
2226
|
+
return pressable ? /* @__PURE__ */ jsx14(
|
|
2227
|
+
AccessiblePressable,
|
|
2228
|
+
{
|
|
2229
|
+
accessibilityRole: "button",
|
|
2230
|
+
accessibilityLabel: ariaLabel != null ? ariaLabel : title,
|
|
2231
|
+
accessibilityState: { disabled },
|
|
2232
|
+
disabled,
|
|
2233
|
+
onPress,
|
|
2234
|
+
style: ({ pressed }) => [base, pressed ? { transform: [{ scale: 0.99 }] } : null, disabled ? { opacity: tokens10.states.opacity.disabled } : null],
|
|
2235
|
+
children: parts
|
|
2236
|
+
}
|
|
2237
|
+
) : /* @__PURE__ */ jsx14(View8, { style: base, children: parts });
|
|
2221
2238
|
}
|
|
2222
2239
|
|
|
2223
2240
|
// shared/package-runtime/alert-live.ts
|
|
@@ -2228,7 +2245,7 @@ function alertRole(tone, live) {
|
|
|
2228
2245
|
}
|
|
2229
2246
|
|
|
2230
2247
|
// packages/native/src/display-primitives.tsx
|
|
2231
|
-
import { tokens as
|
|
2248
|
+
import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
2232
2249
|
import { useContext as useContext10, useEffect as useEffect5, useRef as useRef6, useState as useState9 } from "react";
|
|
2233
2250
|
import {
|
|
2234
2251
|
Animated as Animated5,
|
|
@@ -2238,6 +2255,25 @@ import {
|
|
|
2238
2255
|
View as View9
|
|
2239
2256
|
} from "react-native";
|
|
2240
2257
|
import Svg3, { Circle as Circle2, Path as Path2 } from "react-native-svg";
|
|
2258
|
+
|
|
2259
|
+
// shared/package-runtime/progress-circle.ts
|
|
2260
|
+
import { tokens as tokens11 } from "@kjun-ui/tokens";
|
|
2261
|
+
function progressCircle(size, percentage) {
|
|
2262
|
+
const { size: diameter, stroke } = tokens11.extensions.progress.circle[size];
|
|
2263
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
2264
|
+
return {
|
|
2265
|
+
diameter,
|
|
2266
|
+
stroke,
|
|
2267
|
+
radius,
|
|
2268
|
+
centre: diameter / 2,
|
|
2269
|
+
circumference,
|
|
2270
|
+
offset: circumference * (1 - percentage / 100),
|
|
2271
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
2272
|
+
showsPercentage: size !== "sm"
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
// packages/native/src/display-primitives.tsx
|
|
2241
2277
|
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2242
2278
|
var badgeLayoutKeys = /* @__PURE__ */ new Set([
|
|
2243
2279
|
"alignSelf",
|
|
@@ -2277,10 +2313,10 @@ function BadgeView({
|
|
|
2277
2313
|
dot = false,
|
|
2278
2314
|
children,
|
|
2279
2315
|
style,
|
|
2280
|
-
dotSize =
|
|
2316
|
+
dotSize = tokens12.extensions.badge.dotSize
|
|
2281
2317
|
}) {
|
|
2282
2318
|
const { colors, domainColors } = useKjunStyles();
|
|
2283
|
-
const { x, y } =
|
|
2319
|
+
const { x, y } = tokens12.extensions.badge.padding[size];
|
|
2284
2320
|
const type = typeStyle(size === "xl" ? "controlLarge" : size === "lg" ? "control" : "controlSmall");
|
|
2285
2321
|
const neutral = variant === "default" || variant === "secondary";
|
|
2286
2322
|
const financial = variant.startsWith("price-");
|
|
@@ -2298,10 +2334,10 @@ function BadgeView({
|
|
|
2298
2334
|
maxWidth: "100%",
|
|
2299
2335
|
minWidth: 0,
|
|
2300
2336
|
flexShrink: 1,
|
|
2301
|
-
gap:
|
|
2337
|
+
gap: tokens12.extensions.badge.gap,
|
|
2302
2338
|
paddingHorizontal: x,
|
|
2303
2339
|
paddingVertical: y,
|
|
2304
|
-
borderRadius:
|
|
2340
|
+
borderRadius: tokens12.extensions.badge.radius,
|
|
2305
2341
|
backgroundColor: background
|
|
2306
2342
|
},
|
|
2307
2343
|
inner
|
|
@@ -2339,7 +2375,7 @@ function KjunEmpty({
|
|
|
2339
2375
|
const m = useKjunMessages();
|
|
2340
2376
|
text != null ? text : text = m.noData;
|
|
2341
2377
|
const { colors } = useKjunStyles();
|
|
2342
|
-
const spec =
|
|
2378
|
+
const spec = tokens12.extensions.empty;
|
|
2343
2379
|
const stateContent = useContext10(DataStateContentContext);
|
|
2344
2380
|
return /* @__PURE__ */ jsxs6(
|
|
2345
2381
|
View9,
|
|
@@ -2347,7 +2383,7 @@ function KjunEmpty({
|
|
|
2347
2383
|
style: {
|
|
2348
2384
|
alignItems: "center",
|
|
2349
2385
|
justifyContent: "center",
|
|
2350
|
-
paddingVertical: stateContent === "empty" ? 0 :
|
|
2386
|
+
paddingVertical: stateContent === "empty" ? 0 : tokens12.dimension.value32
|
|
2351
2387
|
},
|
|
2352
2388
|
children: [
|
|
2353
2389
|
!!icon && /* @__PURE__ */ jsx15(View9, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ jsx15(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
@@ -2380,7 +2416,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2380
2416
|
const loop = Animated5.loop(
|
|
2381
2417
|
Animated5.timing(rotation, {
|
|
2382
2418
|
toValue: 1,
|
|
2383
|
-
duration:
|
|
2419
|
+
duration: tokens12.motion.spin,
|
|
2384
2420
|
easing: Easing3.linear,
|
|
2385
2421
|
useNativeDriver: Platform12.OS !== "web"
|
|
2386
2422
|
})
|
|
@@ -2391,8 +2427,8 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2391
2427
|
rotation.setValue(0);
|
|
2392
2428
|
};
|
|
2393
2429
|
}, [reduced, rotation]);
|
|
2394
|
-
const dimension =
|
|
2395
|
-
const stroke =
|
|
2430
|
+
const dimension = tokens12.extensions.spinner.sizes[size];
|
|
2431
|
+
const stroke = tokens12.extensions.spinner.strokeWidths[size] * 24 / dimension;
|
|
2396
2432
|
return /* @__PURE__ */ jsxs6(
|
|
2397
2433
|
View9,
|
|
2398
2434
|
{
|
|
@@ -2446,7 +2482,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2446
2482
|
)
|
|
2447
2483
|
}
|
|
2448
2484
|
),
|
|
2449
|
-
!!text && /* @__PURE__ */ jsx15(KText, { style: { marginLeft:
|
|
2485
|
+
!!text && /* @__PURE__ */ jsx15(KText, { style: { marginLeft: tokens12.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2450
2486
|
]
|
|
2451
2487
|
}
|
|
2452
2488
|
);
|
|
@@ -2467,8 +2503,8 @@ function KjunAlert({
|
|
|
2467
2503
|
const [visible, setVisible] = useState9(true);
|
|
2468
2504
|
if (!visible) return null;
|
|
2469
2505
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
2470
|
-
const geometry2 =
|
|
2471
|
-
const lineHeight =
|
|
2506
|
+
const geometry2 = tokens12.extensions.alert;
|
|
2507
|
+
const lineHeight = tokens12.typography[small ? "controlSmall" : "control"].lineHeightPx;
|
|
2472
2508
|
const titled = hasContent(title);
|
|
2473
2509
|
const closeSize = small ? geometry2.sm.closeSize : geometry2.closeSize;
|
|
2474
2510
|
const pick = (suffix) => tone === "primary" ? suffix === "Bg" ? colors.brandSubtleBg : suffix === "Light" ? colors.brandLight : colors.brand : colors[tone + suffix];
|
|
@@ -2479,11 +2515,11 @@ function KjunAlert({
|
|
|
2479
2515
|
style: {
|
|
2480
2516
|
flexDirection: "row",
|
|
2481
2517
|
alignItems: "flex-start",
|
|
2482
|
-
gap:
|
|
2483
|
-
borderWidth:
|
|
2484
|
-
borderRadius:
|
|
2485
|
-
paddingVertical:
|
|
2486
|
-
paddingHorizontal:
|
|
2518
|
+
gap: tokens12.extensions.alert[small ? "sm" : "md"].gap,
|
|
2519
|
+
borderWidth: tokens12.border.defaultWidth,
|
|
2520
|
+
borderRadius: tokens12.extensions.alert.radius,
|
|
2521
|
+
paddingVertical: tokens12.extensions.alert[small ? "sm" : "md"].paddingY,
|
|
2522
|
+
paddingHorizontal: tokens12.extensions.alert[small ? "sm" : "md"].paddingX,
|
|
2487
2523
|
backgroundColor: pick("Bg"),
|
|
2488
2524
|
borderColor: pick("Light")
|
|
2489
2525
|
},
|
|
@@ -2498,7 +2534,7 @@ function KjunAlert({
|
|
|
2498
2534
|
warning: "alert-triangle",
|
|
2499
2535
|
danger: "alert-circle"
|
|
2500
2536
|
}[tone],
|
|
2501
|
-
size:
|
|
2537
|
+
size: tokens12.extensions.alert.iconSizes[small ? "sm" : "md"],
|
|
2502
2538
|
color: pick("Accent")
|
|
2503
2539
|
}
|
|
2504
2540
|
) }),
|
|
@@ -2515,7 +2551,7 @@ function KjunAlert({
|
|
|
2515
2551
|
{
|
|
2516
2552
|
accessibilityRole: "button",
|
|
2517
2553
|
accessibilityLabel: m.close,
|
|
2518
|
-
hitSlop: Math.max(0, (
|
|
2554
|
+
hitSlop: Math.max(0, (tokens12.native.minimumTouchTarget - closeSize) / 2),
|
|
2519
2555
|
style: ({ pressed, hovered }) => ({
|
|
2520
2556
|
width: closeSize,
|
|
2521
2557
|
height: closeSize,
|
|
@@ -2553,11 +2589,58 @@ function KjunProgress({
|
|
|
2553
2589
|
variant = "primary",
|
|
2554
2590
|
showLabel = false,
|
|
2555
2591
|
label,
|
|
2556
|
-
subLabel
|
|
2592
|
+
subLabel,
|
|
2593
|
+
shape = "bar"
|
|
2557
2594
|
}) {
|
|
2558
2595
|
const m = useKjunMessages();
|
|
2559
|
-
const { colors } = useKjunStyles();
|
|
2596
|
+
const { colors, numericFontFamily, fontFamily } = useKjunStyles();
|
|
2560
2597
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2598
|
+
const name = typeof label === "string" ? label : m.progress, color = variant === "primary" ? colors.brand : colors[variant];
|
|
2599
|
+
const semantics = {
|
|
2600
|
+
accessibilityRole: "progressbar",
|
|
2601
|
+
accessibilityLabel: name,
|
|
2602
|
+
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2603
|
+
"aria-valuemin": 0,
|
|
2604
|
+
"aria-valuemax": 100,
|
|
2605
|
+
"aria-valuenow": percentage
|
|
2606
|
+
};
|
|
2607
|
+
if (shape === "circle") {
|
|
2608
|
+
const c = progressCircle(size, percentage);
|
|
2609
|
+
return /* @__PURE__ */ jsxs6(View9, { style: { alignSelf: "flex-start", alignItems: "center" }, children: [
|
|
2610
|
+
/* @__PURE__ */ jsxs6(View9, { ...semantics, style: { width: c.diameter, height: c.diameter, alignItems: "center", justifyContent: "center" }, children: [
|
|
2611
|
+
/* @__PURE__ */ jsxs6(Svg3, { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, style: StyleSheet4.absoluteFill, children: [
|
|
2612
|
+
/* @__PURE__ */ jsx15(Circle2, { cx: c.centre, cy: c.centre, r: c.radius, stroke: colors.secondary, strokeWidth: c.stroke, fill: "none" }),
|
|
2613
|
+
percentage > 0 && /* @__PURE__ */ jsx15(
|
|
2614
|
+
Circle2,
|
|
2615
|
+
{
|
|
2616
|
+
cx: c.centre,
|
|
2617
|
+
cy: c.centre,
|
|
2618
|
+
r: c.radius,
|
|
2619
|
+
stroke: color,
|
|
2620
|
+
strokeWidth: c.stroke,
|
|
2621
|
+
fill: "none",
|
|
2622
|
+
strokeLinecap: "round",
|
|
2623
|
+
strokeDasharray: c.circumference,
|
|
2624
|
+
strokeDashoffset: c.offset,
|
|
2625
|
+
rotation: -90,
|
|
2626
|
+
origin: `${c.centre}, ${c.centre}`
|
|
2627
|
+
}
|
|
2628
|
+
)
|
|
2629
|
+
] }),
|
|
2630
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ jsxs6(KText, { style: {
|
|
2631
|
+
...typeStyle(size === "lg" ? "numberMd" : "meta"),
|
|
2632
|
+
fontFamily: numericFontFamily || fontFamily,
|
|
2633
|
+
fontVariant: ["tabular-nums"],
|
|
2634
|
+
color: colors.text
|
|
2635
|
+
}, children: [
|
|
2636
|
+
percentage,
|
|
2637
|
+
"%"
|
|
2638
|
+
] })
|
|
2639
|
+
] }),
|
|
2640
|
+
content(label, { ...typeStyle("caption"), marginTop: tokens12.dimension.value8, color: colors.textSecondary, textAlign: "center" }),
|
|
2641
|
+
content(subLabel, { ...typeStyle("caption"), marginTop: tokens12.dimension.value4, color: colors.textTertiary, textAlign: "center" })
|
|
2642
|
+
] });
|
|
2643
|
+
}
|
|
2561
2644
|
return /* @__PURE__ */ jsxs6(View9, { children: [
|
|
2562
2645
|
!!(label || showLabel) && /* @__PURE__ */ jsxs6(
|
|
2563
2646
|
View9,
|
|
@@ -2565,7 +2648,7 @@ function KjunProgress({
|
|
|
2565
2648
|
style: {
|
|
2566
2649
|
flexDirection: "row",
|
|
2567
2650
|
justifyContent: "space-between",
|
|
2568
|
-
marginBottom:
|
|
2651
|
+
marginBottom: tokens12.dimension.value8
|
|
2569
2652
|
},
|
|
2570
2653
|
children: [
|
|
2571
2654
|
content(label, {
|
|
@@ -2591,13 +2674,11 @@ function KjunProgress({
|
|
|
2591
2674
|
/* @__PURE__ */ jsx15(
|
|
2592
2675
|
View9,
|
|
2593
2676
|
{
|
|
2594
|
-
|
|
2595
|
-
accessibilityLabel: typeof label === "string" ? label : m.progress,
|
|
2596
|
-
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2677
|
+
...semantics,
|
|
2597
2678
|
style: {
|
|
2598
|
-
height:
|
|
2679
|
+
height: tokens12.extensions.progress.heights[size],
|
|
2599
2680
|
backgroundColor: colors.secondary,
|
|
2600
|
-
borderRadius:
|
|
2681
|
+
borderRadius: tokens12.radius.radius9999,
|
|
2601
2682
|
overflow: "hidden"
|
|
2602
2683
|
},
|
|
2603
2684
|
children: /* @__PURE__ */ jsx15(
|
|
@@ -2606,8 +2687,8 @@ function KjunProgress({
|
|
|
2606
2687
|
style: {
|
|
2607
2688
|
width: `${percentage}%`,
|
|
2608
2689
|
height: "100%",
|
|
2609
|
-
borderRadius:
|
|
2610
|
-
backgroundColor:
|
|
2690
|
+
borderRadius: tokens12.radius.radius9999,
|
|
2691
|
+
backgroundColor: color
|
|
2611
2692
|
}
|
|
2612
2693
|
}
|
|
2613
2694
|
)
|
|
@@ -2615,14 +2696,14 @@ function KjunProgress({
|
|
|
2615
2696
|
),
|
|
2616
2697
|
content(subLabel, {
|
|
2617
2698
|
...typeStyle("caption"),
|
|
2618
|
-
marginTop:
|
|
2699
|
+
marginTop: tokens12.dimension.value4,
|
|
2619
2700
|
color: colors.textTertiary
|
|
2620
2701
|
})
|
|
2621
2702
|
] });
|
|
2622
2703
|
}
|
|
2623
2704
|
|
|
2624
2705
|
// packages/native/src/skeleton-base.tsx
|
|
2625
|
-
import { tokens as
|
|
2706
|
+
import { tokens as tokens13 } from "@kjun-ui/tokens";
|
|
2626
2707
|
import { useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
2627
2708
|
import {
|
|
2628
2709
|
Animated as Animated6,
|
|
@@ -2645,12 +2726,12 @@ function KjunSkeleton({
|
|
|
2645
2726
|
Animated6.sequence([
|
|
2646
2727
|
Animated6.timing(opacity, {
|
|
2647
2728
|
toValue: 0.6,
|
|
2648
|
-
duration:
|
|
2729
|
+
duration: tokens13.motion.shimmer / 2,
|
|
2649
2730
|
useNativeDriver: false
|
|
2650
2731
|
}),
|
|
2651
2732
|
Animated6.timing(opacity, {
|
|
2652
2733
|
toValue: 1,
|
|
2653
|
-
duration:
|
|
2734
|
+
duration: tokens13.motion.shimmer / 2,
|
|
2654
2735
|
useNativeDriver: false
|
|
2655
2736
|
})
|
|
2656
2737
|
])
|
|
@@ -2669,18 +2750,18 @@ function KjunSkeleton({
|
|
|
2669
2750
|
width: w,
|
|
2670
2751
|
height: h,
|
|
2671
2752
|
backgroundColor: shimmer,
|
|
2672
|
-
borderRadius:
|
|
2753
|
+
borderRadius: tokens13.extensions.skeleton.lineRadius,
|
|
2673
2754
|
...extra
|
|
2674
2755
|
}
|
|
2675
2756
|
}
|
|
2676
2757
|
);
|
|
2677
2758
|
const count = (n) => Array.from({ length: Math.max(0, Math.floor(n)) }, (_, i) => i + 1);
|
|
2678
|
-
const line = (w, key, h =
|
|
2759
|
+
const line = (w, key, h = tokens13.extensions.skeleton.lineHeights.md) => /* @__PURE__ */ jsx16(View10, { style: { marginBottom: key === rows ? 0 : tokens13.extensions.skeleton.gap }, children: block(w, h) }, key);
|
|
2679
2760
|
const frame = {
|
|
2680
|
-
padding:
|
|
2681
|
-
borderWidth:
|
|
2761
|
+
padding: tokens13.extensions.skeleton.padding,
|
|
2762
|
+
borderWidth: tokens13.border.defaultWidth,
|
|
2682
2763
|
borderColor: colors.border,
|
|
2683
|
-
borderRadius:
|
|
2764
|
+
borderRadius: tokens13.extensions.skeleton.radius,
|
|
2684
2765
|
backgroundColor: colors.background
|
|
2685
2766
|
};
|
|
2686
2767
|
return /* @__PURE__ */ jsxs7(
|
|
@@ -2696,7 +2777,7 @@ function KjunSkeleton({
|
|
|
2696
2777
|
i
|
|
2697
2778
|
)
|
|
2698
2779
|
),
|
|
2699
|
-
type === "avatar" && block(width ||
|
|
2780
|
+
type === "avatar" && block(width || tokens13.extensions.skeleton.avatarSize, height || tokens13.extensions.skeleton.avatarSize, { borderRadius: rounded ? tokens13.radius.radius9999 : tokens13.extensions.skeleton.blockRadius }),
|
|
2700
2781
|
type === "card" && /* @__PURE__ */ jsxs7(View10, { style: frame, children: [
|
|
2701
2782
|
/* @__PURE__ */ jsxs7(
|
|
2702
2783
|
View10,
|
|
@@ -2704,19 +2785,19 @@ function KjunSkeleton({
|
|
|
2704
2785
|
style: {
|
|
2705
2786
|
flexDirection: "row",
|
|
2706
2787
|
alignItems: "center",
|
|
2707
|
-
gap:
|
|
2708
|
-
marginBottom:
|
|
2788
|
+
gap: tokens13.extensions.skeleton.gap,
|
|
2789
|
+
marginBottom: tokens13.dimension.value16
|
|
2709
2790
|
},
|
|
2710
2791
|
children: [
|
|
2711
|
-
block(
|
|
2712
|
-
/* @__PURE__ */ jsxs7(View10, { style: { flex: 1, gap:
|
|
2792
|
+
block(tokens13.extensions.skeleton.cardAvatarSize, tokens13.extensions.skeleton.cardAvatarSize, { borderRadius: tokens13.radius.radius9999 }),
|
|
2793
|
+
/* @__PURE__ */ jsxs7(View10, { style: { flex: 1, gap: tokens13.dimension.value8 }, children: [
|
|
2713
2794
|
block("60%"),
|
|
2714
|
-
block("40%",
|
|
2795
|
+
block("40%", tokens13.extensions.skeleton.lineHeights.sm)
|
|
2715
2796
|
] })
|
|
2716
2797
|
]
|
|
2717
2798
|
}
|
|
2718
2799
|
),
|
|
2719
|
-
/* @__PURE__ */ jsxs7(View10, { style: { gap:
|
|
2800
|
+
/* @__PURE__ */ jsxs7(View10, { style: { gap: tokens13.dimension.value10 }, children: [
|
|
2720
2801
|
block("100%"),
|
|
2721
2802
|
block("80%"),
|
|
2722
2803
|
block("60%")
|
|
@@ -2726,9 +2807,9 @@ function KjunSkeleton({
|
|
|
2726
2807
|
View10,
|
|
2727
2808
|
{
|
|
2728
2809
|
style: {
|
|
2729
|
-
borderWidth:
|
|
2810
|
+
borderWidth: tokens13.border.defaultWidth,
|
|
2730
2811
|
borderColor: colors.border,
|
|
2731
|
-
borderRadius:
|
|
2812
|
+
borderRadius: tokens13.extensions.skeleton.blockRadius,
|
|
2732
2813
|
overflow: "hidden"
|
|
2733
2814
|
},
|
|
2734
2815
|
children: [0, ...count(rows)].map((row) => /* @__PURE__ */ jsx16(
|
|
@@ -2737,7 +2818,7 @@ function KjunSkeleton({
|
|
|
2737
2818
|
style: {
|
|
2738
2819
|
flexDirection: "row",
|
|
2739
2820
|
backgroundColor: row === 0 ? colors.secondary : void 0,
|
|
2740
|
-
borderBottomWidth: row === rows ? 0 :
|
|
2821
|
+
borderBottomWidth: row === rows ? 0 : tokens13.border.defaultWidth,
|
|
2741
2822
|
borderBottomColor: colors.border
|
|
2742
2823
|
},
|
|
2743
2824
|
children: count(columns).map((col) => /* @__PURE__ */ jsx16(
|
|
@@ -2745,8 +2826,8 @@ function KjunSkeleton({
|
|
|
2745
2826
|
{
|
|
2746
2827
|
style: {
|
|
2747
2828
|
flex: 1,
|
|
2748
|
-
paddingVertical:
|
|
2749
|
-
paddingHorizontal:
|
|
2829
|
+
paddingVertical: tokens13.dimension.value12,
|
|
2830
|
+
paddingHorizontal: tokens13.dimension.value16
|
|
2750
2831
|
},
|
|
2751
2832
|
children: block(
|
|
2752
2833
|
row === 0 ? "70%" : [
|
|
@@ -2756,7 +2837,7 @@ function KjunSkeleton({
|
|
|
2756
2837
|
"75%",
|
|
2757
2838
|
"85%"
|
|
2758
2839
|
][(row + col) % 5],
|
|
2759
|
-
|
|
2840
|
+
tokens13.extensions.skeleton.tableLineHeight
|
|
2760
2841
|
)
|
|
2761
2842
|
},
|
|
2762
2843
|
col
|
|
@@ -2778,16 +2859,16 @@ function KjunSkeleton({
|
|
|
2778
2859
|
}
|
|
2779
2860
|
],
|
|
2780
2861
|
children: [
|
|
2781
|
-
/* @__PURE__ */ jsxs7(View10, { style: { flex: 1, gap:
|
|
2782
|
-
block("40%",
|
|
2783
|
-
block("60%",
|
|
2784
|
-
block("30%",
|
|
2862
|
+
/* @__PURE__ */ jsxs7(View10, { style: { flex: 1, gap: tokens13.dimension.value8 }, children: [
|
|
2863
|
+
block("40%", tokens13.extensions.skeleton.lineHeights.sm),
|
|
2864
|
+
block("60%", tokens13.extensions.skeleton.lineHeights.lg),
|
|
2865
|
+
block("30%", tokens13.extensions.skeleton.lineHeights.sm)
|
|
2785
2866
|
] }),
|
|
2786
|
-
block(
|
|
2867
|
+
block(tokens13.extensions.skeleton.statWidth, tokens13.extensions.skeleton.statHeight)
|
|
2787
2868
|
]
|
|
2788
2869
|
}
|
|
2789
2870
|
),
|
|
2790
|
-
type === "block" && block(width || "100%", height != null ? height :
|
|
2871
|
+
type === "block" && block(width || "100%", height != null ? height : tokens13.extensions.skeleton.blockHeight, { borderRadius: tokens13.extensions.skeleton.blockRadius })
|
|
2791
2872
|
]
|
|
2792
2873
|
}
|
|
2793
2874
|
);
|
|
@@ -2796,7 +2877,7 @@ function KjunSkeleton({
|
|
|
2796
2877
|
// packages/native/src/layout-primitives.tsx
|
|
2797
2878
|
import { Children as Children2, Fragment as Fragment4, cloneElement as cloneElement2, isValidElement as isValidElement3 } from "react";
|
|
2798
2879
|
import { View as View11 } from "react-native";
|
|
2799
|
-
import { tokens as
|
|
2880
|
+
import { tokens as tokens14 } from "@kjun-ui/tokens";
|
|
2800
2881
|
|
|
2801
2882
|
// shared/package-runtime/layout-primitives.ts
|
|
2802
2883
|
var titleVariants = ["pageTitle", "sectionTitle", "cardTitle"];
|
|
@@ -2805,7 +2886,17 @@ var isNumericVariant = (variant) => numeric.test(variant);
|
|
|
2805
2886
|
|
|
2806
2887
|
// packages/native/src/layout-primitives.tsx
|
|
2807
2888
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2808
|
-
var toneRole = {
|
|
2889
|
+
var toneRole = {
|
|
2890
|
+
default: "text",
|
|
2891
|
+
secondary: "textSecondary",
|
|
2892
|
+
tertiary: "textTertiary",
|
|
2893
|
+
disabled: "textDisabled",
|
|
2894
|
+
brand: "brand",
|
|
2895
|
+
danger: "danger",
|
|
2896
|
+
success: "success",
|
|
2897
|
+
warning: "warning",
|
|
2898
|
+
inverse: "onBrand"
|
|
2899
|
+
};
|
|
2809
2900
|
var textAlign = { start: "left", center: "center", end: "right" };
|
|
2810
2901
|
function KjunText({ variant = "body", tone = "default", align, maxLines, style, children }) {
|
|
2811
2902
|
const { colors, fontFamily, numericFontFamily } = useKjunStyles();
|
|
@@ -2833,46 +2924,51 @@ function flatten(children, path = "") {
|
|
|
2833
2924
|
return isValidElement3(child) && child.type === Fragment4 ? flatten(child.props.children, `${key}.`) : [[key, child]];
|
|
2834
2925
|
});
|
|
2835
2926
|
}
|
|
2836
|
-
function items(children) {
|
|
2927
|
+
function items(children, childAlign) {
|
|
2837
2928
|
return flatten(children).map(([key, child]) => {
|
|
2838
2929
|
if (typeof child === "string" || typeof child === "number") return /* @__PURE__ */ jsx17(KText, { children: child }, key);
|
|
2839
2930
|
if (isValidElement3(child) && child.type === KjunFormGroup) {
|
|
2840
2931
|
const group = child;
|
|
2841
2932
|
return cloneElement2(group, { key, style: [{ marginBottom: 0 }, group.props.style] });
|
|
2842
2933
|
}
|
|
2934
|
+
if (childAlign && isValidElement3(child) && (child.type === KjunButton || child.type === KjunBadge)) {
|
|
2935
|
+
const control = child;
|
|
2936
|
+
return cloneElement2(control, { key, style: [{ alignSelf: childAlign }, control.props.style] });
|
|
2937
|
+
}
|
|
2843
2938
|
return isValidElement3(child) ? cloneElement2(child, { key }) : child;
|
|
2844
2939
|
});
|
|
2845
2940
|
}
|
|
2941
|
+
var followed = (align) => align && align !== "stretch" ? crossAxis[align] : void 0;
|
|
2846
2942
|
var stackGap = {
|
|
2847
2943
|
none: 0,
|
|
2848
|
-
sm:
|
|
2849
|
-
md:
|
|
2850
|
-
lg:
|
|
2851
|
-
"section-sm":
|
|
2852
|
-
"section-md":
|
|
2853
|
-
"section-lg":
|
|
2944
|
+
sm: tokens14.space.stack.sm,
|
|
2945
|
+
md: tokens14.space.stack.md,
|
|
2946
|
+
lg: tokens14.space.stack.lg,
|
|
2947
|
+
"section-sm": tokens14.space.section.sm,
|
|
2948
|
+
"section-md": tokens14.space.section.md,
|
|
2949
|
+
"section-lg": tokens14.space.section.lg
|
|
2854
2950
|
};
|
|
2855
2951
|
var inlineGap = {
|
|
2856
2952
|
none: 0,
|
|
2857
|
-
xs:
|
|
2858
|
-
sm:
|
|
2859
|
-
md:
|
|
2860
|
-
lg:
|
|
2953
|
+
xs: tokens14.space.inline.xs,
|
|
2954
|
+
sm: tokens14.space.inline.sm,
|
|
2955
|
+
md: tokens14.space.inline.md,
|
|
2956
|
+
lg: tokens14.space.inline.lg
|
|
2861
2957
|
};
|
|
2862
2958
|
var crossAxis = { stretch: "stretch", start: "flex-start", center: "center", end: "flex-end", baseline: "baseline" };
|
|
2863
2959
|
var mainAxis = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
|
|
2864
|
-
function KjunStack({ gap = "md", align
|
|
2865
|
-
return /* @__PURE__ */ jsx17(View11, { style: [{ flexDirection: "column", alignItems: crossAxis[align], gap: stackGap[gap], minWidth: 0 }, style], children: items(children) });
|
|
2960
|
+
function KjunStack({ gap = "md", align, style, children }) {
|
|
2961
|
+
return /* @__PURE__ */ jsx17(View11, { style: [{ flexDirection: "column", alignItems: crossAxis[align != null ? align : "stretch"], gap: stackGap[gap], minWidth: 0 }, style], children: items(children, followed(align)) });
|
|
2866
2962
|
}
|
|
2867
|
-
function KjunInline({ gap = "sm", align
|
|
2963
|
+
function KjunInline({ gap = "sm", align, justify = "start", wrap = true, style, children }) {
|
|
2868
2964
|
return /* @__PURE__ */ jsx17(View11, { style: [{
|
|
2869
2965
|
flexDirection: "row",
|
|
2870
2966
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
2871
|
-
alignItems: crossAxis[align],
|
|
2967
|
+
alignItems: crossAxis[align != null ? align : "center"],
|
|
2872
2968
|
justifyContent: mainAxis[justify],
|
|
2873
2969
|
gap: inlineGap[gap],
|
|
2874
2970
|
minWidth: 0
|
|
2875
|
-
}, style], children: items(children) });
|
|
2971
|
+
}, style], children: items(children, followed(align)) });
|
|
2876
2972
|
}
|
|
2877
2973
|
|
|
2878
2974
|
// shared/package-runtime/feedback-dialog.ts
|
|
@@ -2924,7 +3020,7 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2924
3020
|
}
|
|
2925
3021
|
|
|
2926
3022
|
// shared/package-runtime/feedback-motion.ts
|
|
2927
|
-
import { tokens as
|
|
3023
|
+
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
2928
3024
|
import { useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState11 } from "react";
|
|
2929
3025
|
function usePresentedToasts(toasts, reduced) {
|
|
2930
3026
|
const [items2, setItems] = useState11([]);
|
|
@@ -2942,7 +3038,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
2942
3038
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
2943
3039
|
removals.current.delete(item.toast.id);
|
|
2944
3040
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
2945
|
-
},
|
|
3041
|
+
}, tokens15.motion.toastExit));
|
|
2946
3042
|
}
|
|
2947
3043
|
return next;
|
|
2948
3044
|
});
|
|
@@ -2964,7 +3060,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
2964
3060
|
setRequest(current);
|
|
2965
3061
|
return;
|
|
2966
3062
|
}
|
|
2967
|
-
const timer = setTimeout(() => setRequest(current),
|
|
3063
|
+
const timer = setTimeout(() => setRequest(current), tokens15.motion.layerExit);
|
|
2968
3064
|
return () => clearTimeout(timer);
|
|
2969
3065
|
}, [current, request, reduced]);
|
|
2970
3066
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -2980,7 +3076,7 @@ function useOptionalKjunFeedback() {
|
|
|
2980
3076
|
// packages/native/src/toast-stack.tsx
|
|
2981
3077
|
import { useLayoutEffect as useLayoutEffect5, useRef as useRef11 } from "react";
|
|
2982
3078
|
import { Animated as Animated8, Platform as Platform13, View as View13 } from "react-native";
|
|
2983
|
-
import { tokens as
|
|
3079
|
+
import { tokens as tokens17 } from "@kjun-ui/tokens";
|
|
2984
3080
|
|
|
2985
3081
|
// shared/package-runtime/elevation.ts
|
|
2986
3082
|
function directionalShadow(layers, direction) {
|
|
@@ -2995,7 +3091,7 @@ function shadowLayers(layers, colors) {
|
|
|
2995
3091
|
}
|
|
2996
3092
|
|
|
2997
3093
|
// packages/native/src/toast.tsx
|
|
2998
|
-
import { tokens as
|
|
3094
|
+
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
2999
3095
|
import { useEffect as useEffect7, useRef as useRef10 } from "react";
|
|
3000
3096
|
import { Animated as Animated7, View as View12 } from "react-native";
|
|
3001
3097
|
import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
@@ -3039,7 +3135,7 @@ function ToastView({
|
|
|
3039
3135
|
accessible: false,
|
|
3040
3136
|
onHoverIn: () => controller.pauseToast(toast.id, reasons.hover),
|
|
3041
3137
|
onHoverOut: () => controller.resumeToast(toast.id, reasons.hover),
|
|
3042
|
-
style: { width: "100%", maxWidth:
|
|
3138
|
+
style: { width: "100%", maxWidth: tokens16.extensions.toast.maxWidth, alignSelf: "flex-end" },
|
|
3043
3139
|
children: /* @__PURE__ */ jsxs8(
|
|
3044
3140
|
View12,
|
|
3045
3141
|
{
|
|
@@ -3048,19 +3144,19 @@ function ToastView({
|
|
|
3048
3144
|
style: {
|
|
3049
3145
|
flexDirection: "row",
|
|
3050
3146
|
alignItems: toast.title ? "flex-start" : "center",
|
|
3051
|
-
gap:
|
|
3052
|
-
padding:
|
|
3053
|
-
borderRadius:
|
|
3147
|
+
gap: tokens16.extensions.toast.gap,
|
|
3148
|
+
padding: tokens16.extensions.toast.padding,
|
|
3149
|
+
borderRadius: tokens16.extensions.toast.radius,
|
|
3054
3150
|
backgroundColor: colors.surface,
|
|
3055
|
-
boxShadow: shadowLayers(
|
|
3056
|
-
borderWidth:
|
|
3151
|
+
boxShadow: shadowLayers(tokens16.extensions.toast.elevation, colors),
|
|
3152
|
+
borderWidth: tokens16.border.defaultWidth,
|
|
3057
3153
|
borderColor: colors.border,
|
|
3058
3154
|
overflow: "hidden"
|
|
3059
3155
|
},
|
|
3060
3156
|
children: [
|
|
3061
3157
|
/* @__PURE__ */ jsx18(KjunIcon, { name: icon, color: colors[`${tone}Accent`] }),
|
|
3062
3158
|
/* @__PURE__ */ jsxs8(View12, { style: { flex: 1, minWidth: 0 }, children: [
|
|
3063
|
-
!!toast.title && /* @__PURE__ */ jsx18(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom:
|
|
3159
|
+
!!toast.title && /* @__PURE__ */ jsx18(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: tokens16.extensions.toast.titleGap }, children: toast.title }),
|
|
3064
3160
|
/* @__PURE__ */ jsx18(KText, { style: { color: colors.textSecondary }, children: toast.message }),
|
|
3065
3161
|
toast.action && /* @__PURE__ */ jsx18(
|
|
3066
3162
|
AccessiblePressable,
|
|
@@ -3078,7 +3174,7 @@ function ToastView({
|
|
|
3078
3174
|
dismiss();
|
|
3079
3175
|
}
|
|
3080
3176
|
},
|
|
3081
|
-
style: { minHeight:
|
|
3177
|
+
style: { minHeight: tokens16.native.minimumTouchTarget, justifyContent: "center", marginTop: tokens16.extensions.toast.actionGap },
|
|
3082
3178
|
children: /* @__PURE__ */ jsx18(
|
|
3083
3179
|
KText,
|
|
3084
3180
|
{
|
|
@@ -3100,11 +3196,11 @@ function ToastView({
|
|
|
3100
3196
|
onBlur: () => controller.resumeToast(toast.id, reasons.focus),
|
|
3101
3197
|
onPress: dismiss,
|
|
3102
3198
|
style: {
|
|
3103
|
-
minWidth: Math.max(
|
|
3104
|
-
minHeight: Math.max(
|
|
3199
|
+
minWidth: Math.max(tokens16.extensions.toast.closeSize, tokens16.native.minimumTouchTarget),
|
|
3200
|
+
minHeight: Math.max(tokens16.extensions.toast.closeSize, tokens16.native.minimumTouchTarget),
|
|
3105
3201
|
alignItems: "center",
|
|
3106
3202
|
justifyContent: "center",
|
|
3107
|
-
borderRadius:
|
|
3203
|
+
borderRadius: tokens16.extensions.toast.closeRadius
|
|
3108
3204
|
},
|
|
3109
3205
|
children: /* @__PURE__ */ jsx18(KjunIcon, { name: "x", color: colors.textTertiary })
|
|
3110
3206
|
}
|
|
@@ -3117,7 +3213,7 @@ function ToastView({
|
|
|
3117
3213
|
position: "absolute",
|
|
3118
3214
|
bottom: 0,
|
|
3119
3215
|
left: 0,
|
|
3120
|
-
height:
|
|
3216
|
+
height: tokens16.extensions.toast.progressHeight,
|
|
3121
3217
|
width: progress.interpolate({
|
|
3122
3218
|
inputRange: [0, 1],
|
|
3123
3219
|
outputRange: ["0%", "100%"]
|
|
@@ -3140,8 +3236,8 @@ function useToastReflow(_root, _reduced) {
|
|
|
3140
3236
|
// packages/native/src/toast-stack.tsx
|
|
3141
3237
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
3142
3238
|
function ToastSlot({ item, controller, boxes }) {
|
|
3143
|
-
const born = useRef11(Math.min(
|
|
3144
|
-
const motion = useNativePresence(!item.exiting,
|
|
3239
|
+
const born = useRef11(Math.min(tokens17.motion.toastEnter, Date.now() - item.born)).current;
|
|
3240
|
+
const motion = useNativePresence(!item.exiting, tokens17.motion.toastEnter - born, tokens17.motion.toastExit, true, born / tokens17.motion.toastEnter);
|
|
3145
3241
|
const offset = useRef11(new Animated8.Value(0)).current;
|
|
3146
3242
|
const box = boxes.get(item.toast.id);
|
|
3147
3243
|
useLayoutEffect5(() => {
|
|
@@ -3162,7 +3258,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3162
3258
|
boxes.set(item.toast.id, next);
|
|
3163
3259
|
if (old && old.y !== next.y && !motion.reduced) offset.stopAnimation((current) => {
|
|
3164
3260
|
offset.setValue(current + old.y - next.y);
|
|
3165
|
-
Animated8.timing(offset, { toValue: 0, duration:
|
|
3261
|
+
Animated8.timing(offset, { toValue: 0, duration: tokens17.motion.toastMove, easing: motionOut, useNativeDriver: nativeDriver }).start();
|
|
3166
3262
|
});
|
|
3167
3263
|
},
|
|
3168
3264
|
style: { transform: [{ translateY: offset }], ...item.exiting && box ? {
|
|
@@ -3179,7 +3275,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3179
3275
|
accessibilityElementsHidden: item.exiting,
|
|
3180
3276
|
importantForAccessibility: item.exiting ? "no-hide-descendants" : "auto",
|
|
3181
3277
|
...item.exiting ? { inert: true } : {},
|
|
3182
|
-
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-
|
|
3278
|
+
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-tokens17.motionDistance.toast, 0] }) }] },
|
|
3183
3279
|
children: /* @__PURE__ */ jsx19(ToastView, { toast: item.toast, controller })
|
|
3184
3280
|
}
|
|
3185
3281
|
)
|
|
@@ -3195,10 +3291,10 @@ function ToastStack({ items: items2, controller }) {
|
|
|
3195
3291
|
for (const id of boxes.keys()) if (!items2.some((item) => item.toast.id === id)) boxes.delete(id);
|
|
3196
3292
|
return /* @__PURE__ */ jsx19(View13, { ref: root, pointerEvents: "box-none", style: {
|
|
3197
3293
|
position: "absolute",
|
|
3198
|
-
top:
|
|
3199
|
-
right:
|
|
3200
|
-
left:
|
|
3201
|
-
gap:
|
|
3294
|
+
top: tokens17.extensions.toast.inset,
|
|
3295
|
+
right: tokens17.extensions.toast.inset,
|
|
3296
|
+
left: tokens17.extensions.toast.inset,
|
|
3297
|
+
gap: tokens17.extensions.toast.stackGap,
|
|
3202
3298
|
minHeight: items2.some((item) => item.exiting) ? Math.max(0, ...[...boxes.values()].map((box) => box.y + box.height)) : void 0,
|
|
3203
3299
|
zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast")
|
|
3204
3300
|
}, children: items2.map((item) => /* @__PURE__ */ jsx19(ToastSlot, { item, controller, boxes }, item.toast.id)) });
|
|
@@ -3206,8 +3302,9 @@ function ToastStack({ items: items2, controller }) {
|
|
|
3206
3302
|
|
|
3207
3303
|
// packages/native/src/feedback.tsx
|
|
3208
3304
|
import {
|
|
3209
|
-
tokens as
|
|
3210
|
-
createFeedbackController
|
|
3305
|
+
tokens as tokens18,
|
|
3306
|
+
createFeedbackController,
|
|
3307
|
+
feedbackControllerOf
|
|
3211
3308
|
} from "@kjun-ui/tokens";
|
|
3212
3309
|
import {
|
|
3213
3310
|
useCallback as useCallback3,
|
|
@@ -3217,6 +3314,7 @@ import {
|
|
|
3217
3314
|
useSyncExternalStore as useSyncExternalStore2
|
|
3218
3315
|
} from "react";
|
|
3219
3316
|
import { View as View14 } from "react-native";
|
|
3317
|
+
import { createKjunFeedback } from "@kjun-ui/tokens";
|
|
3220
3318
|
import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3221
3319
|
function useKjunFeedback() {
|
|
3222
3320
|
const value = useOptionalKjunFeedback();
|
|
@@ -3248,7 +3346,7 @@ function FeedbackDialog({
|
|
|
3248
3346
|
onConfirm: submit,
|
|
3249
3347
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
3250
3348
|
children: [
|
|
3251
|
-
!!options.message && /* @__PURE__ */ jsx20(KText, { style: { marginBottom:
|
|
3349
|
+
!!options.message && /* @__PURE__ */ jsx20(KText, { style: { marginBottom: tokens18.dimension.value16 }, children: options.message }),
|
|
3252
3350
|
request.kind === "prompt" && /* @__PURE__ */ jsx20(
|
|
3253
3351
|
KjunInput,
|
|
3254
3352
|
{
|
|
@@ -3265,8 +3363,10 @@ function FeedbackDialog({
|
|
|
3265
3363
|
}
|
|
3266
3364
|
);
|
|
3267
3365
|
}
|
|
3268
|
-
function KjunFeedbackProvider({ children, style }) {
|
|
3269
|
-
const [
|
|
3366
|
+
function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
3367
|
+
const [owned] = useState12(() => controllerProp ? void 0 : createFeedbackController());
|
|
3368
|
+
const controller = controllerProp ? feedbackControllerOf(controllerProp) : owned;
|
|
3369
|
+
useEffect8(() => controller.attach(), [controller]);
|
|
3270
3370
|
const life = useRef12(0);
|
|
3271
3371
|
const snapshot = useSyncExternalStore2(
|
|
3272
3372
|
controller.subscribe,
|
|
@@ -3280,7 +3380,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3280
3380
|
const version = ++life.current;
|
|
3281
3381
|
return () => {
|
|
3282
3382
|
queueMicrotask(() => {
|
|
3283
|
-
if (life.current === version) controller.dispose();
|
|
3383
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
3284
3384
|
});
|
|
3285
3385
|
};
|
|
3286
3386
|
}, [controller]);
|
|
@@ -3315,7 +3415,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3315
3415
|
|
|
3316
3416
|
// packages/native/src/choice-controls.tsx
|
|
3317
3417
|
import { Animated as Animated9 } from "react-native";
|
|
3318
|
-
import { tokens as
|
|
3418
|
+
import { tokens as tokens19 } from "@kjun-ui/tokens";
|
|
3319
3419
|
import {
|
|
3320
3420
|
createContext as createContext16,
|
|
3321
3421
|
useContext as useContext12,
|
|
@@ -3338,7 +3438,7 @@ function KjunCheckbox({
|
|
|
3338
3438
|
onValueChange,
|
|
3339
3439
|
onChange
|
|
3340
3440
|
}) {
|
|
3341
|
-
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension =
|
|
3441
|
+
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension = tokens19.extensions.checkbox.sizes[size];
|
|
3342
3442
|
return /* @__PURE__ */ jsxs10(
|
|
3343
3443
|
AccessiblePressable,
|
|
3344
3444
|
{
|
|
@@ -3357,8 +3457,8 @@ function KjunCheckbox({
|
|
|
3357
3457
|
flexDirection: "row",
|
|
3358
3458
|
alignItems: "center",
|
|
3359
3459
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3360
|
-
minHeight: finePointer() ?
|
|
3361
|
-
opacity: disabled ?
|
|
3460
|
+
minHeight: finePointer() ? tokens19.extensions.choice.minimumHeight : tokens19.native.minimumTouchTarget,
|
|
3461
|
+
opacity: disabled ? tokens19.states.opacity.disabled : pressed ? tokens19.states.opacity.pressed : 1
|
|
3362
3462
|
}),
|
|
3363
3463
|
children: [
|
|
3364
3464
|
/* @__PURE__ */ jsx21(
|
|
@@ -3369,8 +3469,8 @@ function KjunCheckbox({
|
|
|
3369
3469
|
justifyContent: "center",
|
|
3370
3470
|
width: dimension,
|
|
3371
3471
|
height: dimension,
|
|
3372
|
-
borderRadius:
|
|
3373
|
-
borderWidth:
|
|
3472
|
+
borderRadius: tokens19.extensions.checkbox.radii[size],
|
|
3473
|
+
borderWidth: tokens19.border.controlWidth,
|
|
3374
3474
|
// Same boundary roles as Radio: strong while enabled, secondary once disabled.
|
|
3375
3475
|
borderColor: checked ? colors.brand : disabled ? colors.borderSecondary : colors.borderStrong,
|
|
3376
3476
|
backgroundColor: checked ? colors.brand : colors.surface
|
|
@@ -3379,14 +3479,14 @@ function KjunCheckbox({
|
|
|
3379
3479
|
KjunIcon,
|
|
3380
3480
|
{
|
|
3381
3481
|
name: "check",
|
|
3382
|
-
size:
|
|
3482
|
+
size: tokens19.extensions.checkbox.iconSizes[size],
|
|
3383
3483
|
color: colors.onBrand
|
|
3384
3484
|
}
|
|
3385
3485
|
)
|
|
3386
3486
|
}
|
|
3387
3487
|
),
|
|
3388
3488
|
!!(children || label) && content(children || label, {
|
|
3389
|
-
marginLeft:
|
|
3489
|
+
marginLeft: tokens19.extensions.checkbox.labelGap,
|
|
3390
3490
|
...typeStyle("label")
|
|
3391
3491
|
})
|
|
3392
3492
|
]
|
|
@@ -3402,7 +3502,7 @@ function useControlFocus(disabled) {
|
|
|
3402
3502
|
onFocus: (event) => setFocused(focusVisible(event.currentTarget)),
|
|
3403
3503
|
onBlur: () => setFocused(false)
|
|
3404
3504
|
},
|
|
3405
|
-
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth:
|
|
3505
|
+
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth: tokens19.states.focus.width, outlineOffset: tokens19.states.focus.choiceOffset, outlineColor: colors.focusRing } : {}
|
|
3406
3506
|
};
|
|
3407
3507
|
}
|
|
3408
3508
|
function KjunSwitch({
|
|
@@ -3417,10 +3517,10 @@ function KjunSwitch({
|
|
|
3417
3517
|
onChange
|
|
3418
3518
|
}) {
|
|
3419
3519
|
const { colors } = useKjunStyles();
|
|
3420
|
-
const width =
|
|
3421
|
-
const height =
|
|
3422
|
-
const thumb = height - 2 *
|
|
3423
|
-
const offScale = (thumb - 2 *
|
|
3520
|
+
const width = tokens19.extensions.switch.widths[size];
|
|
3521
|
+
const height = tokens19.extensions.switch.heights[size];
|
|
3522
|
+
const thumb = height - 2 * tokens19.extensions.switch.padding;
|
|
3523
|
+
const offScale = (thumb - 2 * tokens19.border.controlWidth) / thumb;
|
|
3424
3524
|
const offset = width - height;
|
|
3425
3525
|
const motion = useMotionValue(value ? 1 : 0);
|
|
3426
3526
|
const focus = useControlFocus(disabled);
|
|
@@ -3449,8 +3549,8 @@ function KjunSwitch({
|
|
|
3449
3549
|
flexDirection: "row",
|
|
3450
3550
|
alignItems: "center",
|
|
3451
3551
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3452
|
-
minHeight: finePointer() ?
|
|
3453
|
-
opacity: disabled ?
|
|
3552
|
+
minHeight: finePointer() ? tokens19.extensions.choice.minimumHeight : tokens19.native.minimumTouchTarget,
|
|
3553
|
+
opacity: disabled ? tokens19.states.opacity.disabled : 1
|
|
3454
3554
|
},
|
|
3455
3555
|
children: [
|
|
3456
3556
|
/* @__PURE__ */ jsxs10(
|
|
@@ -3459,8 +3559,8 @@ function KjunSwitch({
|
|
|
3459
3559
|
style: {
|
|
3460
3560
|
width,
|
|
3461
3561
|
height,
|
|
3462
|
-
padding:
|
|
3463
|
-
borderRadius:
|
|
3562
|
+
padding: tokens19.extensions.switch.padding,
|
|
3563
|
+
borderRadius: tokens19.extensions.switch.radius,
|
|
3464
3564
|
backgroundColor: trackColor,
|
|
3465
3565
|
...focus.ring
|
|
3466
3566
|
},
|
|
@@ -3472,8 +3572,8 @@ function KjunSwitch({
|
|
|
3472
3572
|
style: {
|
|
3473
3573
|
position: "absolute",
|
|
3474
3574
|
inset: 0,
|
|
3475
|
-
borderRadius:
|
|
3476
|
-
borderWidth:
|
|
3575
|
+
borderRadius: tokens19.extensions.switch.radius,
|
|
3576
|
+
borderWidth: tokens19.border.controlWidth,
|
|
3477
3577
|
// Hover turns the boundary to brand, like Checkbox on Web.
|
|
3478
3578
|
borderColor: hovered && !disabled ? colors.brand : offRole,
|
|
3479
3579
|
opacity: motion.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })
|
|
@@ -3486,7 +3586,7 @@ function KjunSwitch({
|
|
|
3486
3586
|
style: {
|
|
3487
3587
|
width: thumb,
|
|
3488
3588
|
height: thumb,
|
|
3489
|
-
borderRadius:
|
|
3589
|
+
borderRadius: tokens19.extensions.switch.radius,
|
|
3490
3590
|
backgroundColor: thumbColor,
|
|
3491
3591
|
transform: [
|
|
3492
3592
|
{ translateX: motion.interpolate({ inputRange: [0, 1], outputRange: [0, offset] }) },
|
|
@@ -3498,11 +3598,11 @@ function KjunSwitch({
|
|
|
3498
3598
|
]
|
|
3499
3599
|
}
|
|
3500
3600
|
),
|
|
3501
|
-
description ? /* @__PURE__ */ jsxs10(View15, { style: { marginLeft:
|
|
3601
|
+
description ? /* @__PURE__ */ jsxs10(View15, { style: { marginLeft: tokens19.extensions.switch.labelGap, flexShrink: 1, minWidth: 0 }, children: [
|
|
3502
3602
|
!!(children || label) && content(children || label, typeStyle("label")),
|
|
3503
|
-
/* @__PURE__ */ jsx21(KText, { style: { ...typeStyle("caption"), marginTop:
|
|
3603
|
+
/* @__PURE__ */ jsx21(KText, { style: { ...typeStyle("caption"), marginTop: tokens19.dimension.value4, color: colors.textSecondary }, children: description })
|
|
3504
3604
|
] }) : !!(children || label) && content(children || label, {
|
|
3505
|
-
marginLeft:
|
|
3605
|
+
marginLeft: tokens19.extensions.switch.labelGap,
|
|
3506
3606
|
...typeStyle("label")
|
|
3507
3607
|
})
|
|
3508
3608
|
]
|
|
@@ -3521,7 +3621,7 @@ function KjunRadio({
|
|
|
3521
3621
|
onChange
|
|
3522
3622
|
}) {
|
|
3523
3623
|
const group = useContext12(RadioContext), { colors } = useKjunStyles(), selected = (group ? group.value : value) === val;
|
|
3524
|
-
const geometry2 =
|
|
3624
|
+
const geometry2 = tokens19.extensions.radio;
|
|
3525
3625
|
const [hovered, setHovered] = useState13(false);
|
|
3526
3626
|
useEffect9(() => {
|
|
3527
3627
|
if (disabled) setHovered(false);
|
|
@@ -3548,8 +3648,8 @@ function KjunRadio({
|
|
|
3548
3648
|
flexDirection: "row",
|
|
3549
3649
|
alignItems: "center",
|
|
3550
3650
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3551
|
-
minHeight: finePointer() ?
|
|
3552
|
-
opacity: disabled ?
|
|
3651
|
+
minHeight: finePointer() ? tokens19.extensions.choice.minimumHeight : tokens19.native.minimumTouchTarget,
|
|
3652
|
+
opacity: disabled ? tokens19.states.opacity.disabled : 1
|
|
3553
3653
|
},
|
|
3554
3654
|
children: ({ pressed }) => /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3555
3655
|
/* @__PURE__ */ jsx21(
|
|
@@ -3559,7 +3659,7 @@ function KjunRadio({
|
|
|
3559
3659
|
width: geometry2.size,
|
|
3560
3660
|
height: geometry2.size,
|
|
3561
3661
|
borderWidth: geometry2.borderWidth,
|
|
3562
|
-
borderRadius:
|
|
3662
|
+
borderRadius: tokens19.radius.radius9999,
|
|
3563
3663
|
alignItems: "center",
|
|
3564
3664
|
justifyContent: "center",
|
|
3565
3665
|
borderColor: disabled ? selected ? colors.brand : colors.borderSecondary : pressed ? colors.brandActive : hovered ? colors.brandHover : selected ? colors.brand : colors.borderStrong,
|
|
@@ -3571,7 +3671,7 @@ function KjunRadio({
|
|
|
3571
3671
|
style: {
|
|
3572
3672
|
width: geometry2.dot,
|
|
3573
3673
|
height: geometry2.dot,
|
|
3574
|
-
borderRadius:
|
|
3674
|
+
borderRadius: tokens19.radius.radius9999,
|
|
3575
3675
|
backgroundColor: colors.brand
|
|
3576
3676
|
}
|
|
3577
3677
|
}
|
|
@@ -3616,7 +3716,7 @@ function KjunRadioGroup({
|
|
|
3616
3716
|
style: {
|
|
3617
3717
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
3618
3718
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
3619
|
-
gap: direction === "vertical" ?
|
|
3719
|
+
gap: direction === "vertical" ? tokens19.dimension.value8 : tokens19.dimension.value16
|
|
3620
3720
|
},
|
|
3621
3721
|
children: children || options.map((option) => /* @__PURE__ */ jsx21(
|
|
3622
3722
|
KjunRadio,
|
|
@@ -3634,7 +3734,7 @@ function KjunRadioGroup({
|
|
|
3634
3734
|
}
|
|
3635
3735
|
|
|
3636
3736
|
// packages/native/src/selection-groups.tsx
|
|
3637
|
-
import { tokens as
|
|
3737
|
+
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
3638
3738
|
import { useLayoutEffect as useLayoutEffect7, useRef as useRef15 } from "react";
|
|
3639
3739
|
import {
|
|
3640
3740
|
Animated as Animated11,
|
|
@@ -3646,9 +3746,9 @@ import {
|
|
|
3646
3746
|
// packages/native/src/button-group-motion.tsx
|
|
3647
3747
|
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState14 } from "react";
|
|
3648
3748
|
import { Animated as Animated10, Easing as Easing4, StyleSheet as StyleSheet5, View as View16 } from "react-native";
|
|
3649
|
-
import { tokens as
|
|
3749
|
+
import { tokens as tokens20 } from "@kjun-ui/tokens";
|
|
3650
3750
|
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3651
|
-
var curve =
|
|
3751
|
+
var curve = tokens20.motion.easeOut.match(/-?\d*\.?\d+/g).map(Number);
|
|
3652
3752
|
var easing = Easing4.bezier(...curve);
|
|
3653
3753
|
var sameBox = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3654
3754
|
function useButtonGroupMotion(selected) {
|
|
@@ -3675,8 +3775,8 @@ function useButtonGroupMotion(selected) {
|
|
|
3675
3775
|
width.stopAnimation();
|
|
3676
3776
|
if (old && old.value !== selected.value && !reduced) {
|
|
3677
3777
|
Animated10.parallel([
|
|
3678
|
-
Animated10.timing(x, { toValue: layout.x, duration:
|
|
3679
|
-
Animated10.timing(width, { toValue: layout.width, duration:
|
|
3778
|
+
Animated10.timing(x, { toValue: layout.x, duration: tokens20.motion.indicator, easing, useNativeDriver: false }),
|
|
3779
|
+
Animated10.timing(width, { toValue: layout.width, duration: tokens20.motion.indicator, easing, useNativeDriver: false })
|
|
3680
3780
|
]).start();
|
|
3681
3781
|
} else {
|
|
3682
3782
|
x.setValue(layout.x);
|
|
@@ -3697,7 +3797,7 @@ function ButtonGroupLabel({ label, active, size, reduced }) {
|
|
|
3697
3797
|
useEffect10(() => {
|
|
3698
3798
|
progress.stopAnimation();
|
|
3699
3799
|
if (reduced || !interpolate) progress.setValue(active ? 1 : 0);
|
|
3700
|
-
else Animated10.timing(progress, { toValue: active ? 1 : 0, duration:
|
|
3800
|
+
else Animated10.timing(progress, { toValue: active ? 1 : 0, duration: tokens20.motion.indicator, easing, useNativeDriver: false }).start();
|
|
3701
3801
|
return () => progress.stopAnimation();
|
|
3702
3802
|
}, [active, reduced, interpolate, progress]);
|
|
3703
3803
|
const resolveFont = useResolveFont();
|
|
@@ -3739,8 +3839,8 @@ function KjunButtonGroup({
|
|
|
3739
3839
|
const { colors } = useKjunStyles();
|
|
3740
3840
|
const selected = options.find((option) => option.value === value);
|
|
3741
3841
|
const motion = useButtonGroupMotion(selected);
|
|
3742
|
-
const padding =
|
|
3743
|
-
const itemRadius =
|
|
3842
|
+
const padding = tokens21.buttonGroup.padding[size];
|
|
3843
|
+
const itemRadius = tokens21.buttonGroup.itemRadii[size];
|
|
3744
3844
|
const itemRefs = useRef15(/* @__PURE__ */ new Map());
|
|
3745
3845
|
const { updateLayout } = motion;
|
|
3746
3846
|
useLayoutEffect7(() => {
|
|
@@ -3766,7 +3866,7 @@ function KjunButtonGroup({
|
|
|
3766
3866
|
style: {
|
|
3767
3867
|
flexDirection: "row",
|
|
3768
3868
|
padding,
|
|
3769
|
-
borderRadius:
|
|
3869
|
+
borderRadius: tokens21.buttonGroup.radii[size],
|
|
3770
3870
|
backgroundColor: colors.secondary,
|
|
3771
3871
|
flexGrow: fullWidth ? 1 : 0
|
|
3772
3872
|
},
|
|
@@ -3790,7 +3890,7 @@ function KjunButtonGroup({
|
|
|
3790
3890
|
// Disabled options dim their own labels; the selected value stays readable. The edge keeps it
|
|
3791
3891
|
// apart from the track when surface and secondary are close.
|
|
3792
3892
|
backgroundColor: colors.surface,
|
|
3793
|
-
borderWidth:
|
|
3893
|
+
borderWidth: tokens21.border.defaultWidth,
|
|
3794
3894
|
borderColor: colors.border
|
|
3795
3895
|
}
|
|
3796
3896
|
}
|
|
@@ -3818,22 +3918,22 @@ function KjunButtonGroup({
|
|
|
3818
3918
|
flexDirection: "row",
|
|
3819
3919
|
alignItems: "center",
|
|
3820
3920
|
justifyContent: "center",
|
|
3821
|
-
gap:
|
|
3921
|
+
gap: tokens21.dimension.value6,
|
|
3822
3922
|
flex: fullWidth ? 1 : void 0,
|
|
3823
|
-
minWidth:
|
|
3824
|
-
minHeight:
|
|
3825
|
-
height: Math.max(
|
|
3826
|
-
paddingHorizontal:
|
|
3923
|
+
minWidth: tokens21.native.minimumTouchTarget,
|
|
3924
|
+
minHeight: tokens21.native.minimumTouchTarget,
|
|
3925
|
+
height: Math.max(tokens21.native.minimumTouchTarget, tokens21.buttonGroup.heights[size] - 2 * padding),
|
|
3926
|
+
paddingHorizontal: tokens21.buttonGroup.itemPaddingX[size],
|
|
3827
3927
|
borderRadius: itemRadius,
|
|
3828
3928
|
backgroundColor: active && !motion.layout ? colors.surface : pressed && !active ? colors.hover : "transparent",
|
|
3829
|
-
opacity: blocked ?
|
|
3929
|
+
opacity: blocked ? tokens21.states.opacity.disabled : 1
|
|
3830
3930
|
}),
|
|
3831
3931
|
children: [
|
|
3832
3932
|
!!option.icon && /* @__PURE__ */ jsx23(
|
|
3833
3933
|
KjunIcon,
|
|
3834
3934
|
{
|
|
3835
3935
|
name: option.icon,
|
|
3836
|
-
size:
|
|
3936
|
+
size: tokens21.extensions.selection.iconSize,
|
|
3837
3937
|
color: active ? colors.text : colors.textSecondary
|
|
3838
3938
|
}
|
|
3839
3939
|
),
|
|
@@ -3869,7 +3969,7 @@ function KjunFilterGroup({
|
|
|
3869
3969
|
onChange
|
|
3870
3970
|
}) {
|
|
3871
3971
|
const { colors } = useKjunStyles();
|
|
3872
|
-
const wide = useWindowDimensions2().width >=
|
|
3972
|
+
const wide = useWindowDimensions2().width >= tokens21.responsive.selection, roomy = wide && finePointer();
|
|
3873
3973
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
3874
3974
|
const children = /* @__PURE__ */ jsx23(
|
|
3875
3975
|
View17,
|
|
@@ -3878,7 +3978,7 @@ function KjunFilterGroup({
|
|
|
3878
3978
|
style: {
|
|
3879
3979
|
flexDirection: "row",
|
|
3880
3980
|
flexWrap: scroll ? "nowrap" : "wrap",
|
|
3881
|
-
gap:
|
|
3981
|
+
gap: tokens21.dimension.value8
|
|
3882
3982
|
},
|
|
3883
3983
|
children: options.map((option) => {
|
|
3884
3984
|
const active = selected(option.value), blocked = disabled || option.disabled;
|
|
@@ -3895,9 +3995,9 @@ function KjunFilterGroup({
|
|
|
3895
3995
|
onChange == null ? void 0 : onChange(next);
|
|
3896
3996
|
},
|
|
3897
3997
|
style: {
|
|
3898
|
-
minHeight: roomy ? void 0 :
|
|
3998
|
+
minHeight: roomy ? void 0 : tokens21.native.minimumTouchTarget,
|
|
3899
3999
|
justifyContent: "center",
|
|
3900
|
-
opacity: blocked ?
|
|
4000
|
+
opacity: blocked ? tokens21.states.opacity.disabledStrong : 1
|
|
3901
4001
|
},
|
|
3902
4002
|
children: /* @__PURE__ */ jsxs12(
|
|
3903
4003
|
View17,
|
|
@@ -3906,12 +4006,12 @@ function KjunFilterGroup({
|
|
|
3906
4006
|
flexDirection: "row",
|
|
3907
4007
|
alignItems: "center",
|
|
3908
4008
|
justifyContent: "center",
|
|
3909
|
-
gap:
|
|
3910
|
-
minHeight: roomy ? void 0 :
|
|
3911
|
-
height: roomy ?
|
|
3912
|
-
paddingHorizontal: { xs:
|
|
4009
|
+
gap: tokens21.dimension.value4,
|
|
4010
|
+
minHeight: roomy ? void 0 : tokens21.extensions.selection.minimumHeight,
|
|
4011
|
+
height: roomy ? tokens21.button.heights[size] : Math.max(tokens21.extensions.selection.minimumHeight, tokens21.button.heights[size]),
|
|
4012
|
+
paddingHorizontal: { xs: tokens21.dimension.value8, sm: tokens21.dimension.value12, md: tokens21.dimension.value12, lg: tokens21.dimension.value14, xl: tokens21.dimension.value16 }[size],
|
|
3913
4013
|
// Corners follow the button scale with the height, so every size keeps the same shape.
|
|
3914
|
-
borderRadius:
|
|
4014
|
+
borderRadius: tokens21.button.radii[size],
|
|
3915
4015
|
backgroundColor: active ? colors.text : colors.secondary
|
|
3916
4016
|
},
|
|
3917
4017
|
children: [
|
|
@@ -3919,9 +4019,9 @@ function KjunFilterGroup({
|
|
|
3919
4019
|
View17,
|
|
3920
4020
|
{
|
|
3921
4021
|
style: {
|
|
3922
|
-
width:
|
|
3923
|
-
height:
|
|
3924
|
-
borderRadius:
|
|
4022
|
+
width: tokens21.extensions.selection.dotSize,
|
|
4023
|
+
height: tokens21.extensions.selection.dotSize,
|
|
4024
|
+
borderRadius: tokens21.radius.radius4,
|
|
3925
4025
|
backgroundColor: option.dot
|
|
3926
4026
|
}
|
|
3927
4027
|
}
|
|
@@ -3930,7 +4030,7 @@ function KjunFilterGroup({
|
|
|
3930
4030
|
KjunIcon,
|
|
3931
4031
|
{
|
|
3932
4032
|
name: option.icon,
|
|
3933
|
-
size:
|
|
4033
|
+
size: tokens21.extensions.selection.iconSize,
|
|
3934
4034
|
color: active ? colors.inverse : colors.textSecondary
|
|
3935
4035
|
}
|
|
3936
4036
|
),
|
|
@@ -3981,7 +4081,7 @@ function KjunFilterGroup({
|
|
|
3981
4081
|
}
|
|
3982
4082
|
|
|
3983
4083
|
// packages/native/src/textarea.tsx
|
|
3984
|
-
import { tokens as
|
|
4084
|
+
import { tokens as tokens22 } from "@kjun-ui/tokens";
|
|
3985
4085
|
import {
|
|
3986
4086
|
forwardRef as forwardRef4
|
|
3987
4087
|
} from "react";
|
|
@@ -4003,7 +4103,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4003
4103
|
onBlur,
|
|
4004
4104
|
...props
|
|
4005
4105
|
}, ref) {
|
|
4006
|
-
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec =
|
|
4106
|
+
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec = tokens22.input[size];
|
|
4007
4107
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
4008
4108
|
const surface = useFieldSurface(size, { disabled, readOnly: readonly || props.readOnly || props.editable === false, invalid });
|
|
4009
4109
|
return /* @__PURE__ */ jsx24(
|
|
@@ -4044,8 +4144,8 @@ var KjunTextarea = forwardRef4(
|
|
|
4044
4144
|
...inputTypeStyle(size),
|
|
4045
4145
|
...surface.style,
|
|
4046
4146
|
height: void 0,
|
|
4047
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
4048
|
-
paddingHorizontal: spec.padding -
|
|
4147
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * tokens22.border.controlWidth),
|
|
4148
|
+
paddingHorizontal: spec.padding - tokens22.border.controlWidth,
|
|
4049
4149
|
paddingVertical: spec.textareaPaddingY,
|
|
4050
4150
|
textAlignVertical: "top",
|
|
4051
4151
|
color: surface.ink
|
|
@@ -4058,7 +4158,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4058
4158
|
);
|
|
4059
4159
|
|
|
4060
4160
|
// packages/native/src/drawer.tsx
|
|
4061
|
-
import { tokens as
|
|
4161
|
+
import { tokens as tokens23 } from "@kjun-ui/tokens";
|
|
4062
4162
|
import { useEffect as useEffect11, useState as useState15 } from "react";
|
|
4063
4163
|
import { Animated as Animated12, Keyboard } from "react-native";
|
|
4064
4164
|
|
|
@@ -4115,7 +4215,7 @@ function KjunDrawer({
|
|
|
4115
4215
|
onOpenChange,
|
|
4116
4216
|
title,
|
|
4117
4217
|
position = "right",
|
|
4118
|
-
width =
|
|
4218
|
+
width = tokens23.extensions.drawer.width,
|
|
4119
4219
|
closable = true,
|
|
4120
4220
|
closeOnOverlay = true,
|
|
4121
4221
|
closeOnEsc = true,
|
|
@@ -4139,13 +4239,13 @@ function KjunDrawer({
|
|
|
4139
4239
|
windowHeight: rootHeight || window2.height,
|
|
4140
4240
|
safeAreaTop: Math.max(0, safeAreaTop),
|
|
4141
4241
|
safeAreaBottom: Math.max(0, safeAreaBottom),
|
|
4142
|
-
gap:
|
|
4242
|
+
gap: tokens23.extensions.drawer.sheetGap,
|
|
4143
4243
|
keyboard,
|
|
4144
4244
|
maxHeight
|
|
4145
4245
|
});
|
|
4146
4246
|
const [panelHeight, setPanelHeight] = useState15(0);
|
|
4147
|
-
const motion = useNativePresence(open,
|
|
4148
|
-
const backdrop = useNativePresence(open,
|
|
4247
|
+
const motion = useNativePresence(open, tokens23.motion.layerEnter, tokens23.motion.layerExit, vertical || panelHeight > 0, 0, { enterEasing: motionEmphasized });
|
|
4248
|
+
const backdrop = useNativePresence(open, tokens23.motion.backdrop, tokens23.motion.backdropExit, true, 0, { fade: tokens23.motion.backdropExit });
|
|
4149
4249
|
const close = () => {
|
|
4150
4250
|
if (!open) return;
|
|
4151
4251
|
onOpenChange(false);
|
|
@@ -4210,10 +4310,10 @@ function KjunDrawer({
|
|
|
4210
4310
|
paddingTop: frame.paddingTop,
|
|
4211
4311
|
paddingBottom: frame.paddingBottom,
|
|
4212
4312
|
marginBottom: frame.lift,
|
|
4213
|
-
borderRadius:
|
|
4214
|
-
borderTopLeftRadius: position === "bottom" ?
|
|
4215
|
-
borderTopRightRadius: position === "bottom" ?
|
|
4216
|
-
boxShadow: directionalShadow(
|
|
4313
|
+
borderRadius: tokens23.extensions.drawer.radius,
|
|
4314
|
+
borderTopLeftRadius: position === "bottom" ? tokens23.extensions.drawer.bottomRadius : tokens23.extensions.drawer.radius,
|
|
4315
|
+
borderTopRightRadius: position === "bottom" ? tokens23.extensions.drawer.bottomRadius : tokens23.extensions.drawer.radius,
|
|
4316
|
+
boxShadow: directionalShadow(tokens23.extensions.drawer.elevation, position).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4217
4317
|
backgroundColor: colors.surface
|
|
4218
4318
|
},
|
|
4219
4319
|
children: [
|
|
@@ -4224,9 +4324,9 @@ function KjunDrawer({
|
|
|
4224
4324
|
flexDirection: "row",
|
|
4225
4325
|
alignItems: "center",
|
|
4226
4326
|
justifyContent: "space-between",
|
|
4227
|
-
paddingVertical:
|
|
4228
|
-
paddingHorizontal:
|
|
4229
|
-
borderBottomWidth:
|
|
4327
|
+
paddingVertical: tokens23.extensions.drawer.paddingY,
|
|
4328
|
+
paddingHorizontal: tokens23.extensions.drawer.paddingX,
|
|
4329
|
+
borderBottomWidth: tokens23.border.defaultWidth,
|
|
4230
4330
|
borderBottomColor: colors.border
|
|
4231
4331
|
},
|
|
4232
4332
|
children: [
|
|
@@ -4244,8 +4344,8 @@ function KjunDrawer({
|
|
|
4244
4344
|
variant: "ghost",
|
|
4245
4345
|
ariaLabel: m.close,
|
|
4246
4346
|
onPress: close,
|
|
4247
|
-
style: { borderRadius:
|
|
4248
|
-
children: /* @__PURE__ */ jsx25(KjunIcon, { name: "x", size:
|
|
4347
|
+
style: { borderRadius: tokens23.extensions.drawer.closeRadius, width: tokens23.extensions.drawer.closeSize, height: tokens23.extensions.drawer.closeSize, paddingHorizontal: 0, paddingVertical: 0 },
|
|
4348
|
+
children: /* @__PURE__ */ jsx25(KjunIcon, { name: "x", size: tokens23.extensions.drawer.closeIconSize })
|
|
4249
4349
|
}
|
|
4250
4350
|
)
|
|
4251
4351
|
]
|
|
@@ -4256,7 +4356,7 @@ function KjunDrawer({
|
|
|
4256
4356
|
{
|
|
4257
4357
|
keyboardShouldPersistTaps: "handled",
|
|
4258
4358
|
style: vertical ? { flex: 1 } : { flexGrow: 0, flexShrink: 1 },
|
|
4259
|
-
contentContainerStyle: { padding: noPadding ? 0 :
|
|
4359
|
+
contentContainerStyle: { padding: noPadding ? 0 : tokens23.extensions.drawer.bodyPadding },
|
|
4260
4360
|
children: content(children)
|
|
4261
4361
|
}
|
|
4262
4362
|
),
|
|
@@ -4264,9 +4364,9 @@ function KjunDrawer({
|
|
|
4264
4364
|
View18,
|
|
4265
4365
|
{
|
|
4266
4366
|
style: {
|
|
4267
|
-
paddingVertical:
|
|
4268
|
-
paddingHorizontal:
|
|
4269
|
-
borderTopWidth:
|
|
4367
|
+
paddingVertical: tokens23.extensions.drawer.paddingY,
|
|
4368
|
+
paddingHorizontal: tokens23.extensions.drawer.paddingX,
|
|
4369
|
+
borderTopWidth: tokens23.border.defaultWidth,
|
|
4270
4370
|
borderTopColor: colors.border
|
|
4271
4371
|
},
|
|
4272
4372
|
children: content(footer)
|
|
@@ -4283,7 +4383,7 @@ function KjunDrawer({
|
|
|
4283
4383
|
}
|
|
4284
4384
|
|
|
4285
4385
|
// packages/native/src/dropdown.tsx
|
|
4286
|
-
import { tokens as
|
|
4386
|
+
import { tokens as tokens26 } from "@kjun-ui/tokens";
|
|
4287
4387
|
import {
|
|
4288
4388
|
Children as Children3,
|
|
4289
4389
|
Fragment as Fragment7,
|
|
@@ -4300,7 +4400,7 @@ import {
|
|
|
4300
4400
|
|
|
4301
4401
|
// packages/native/src/floating-panel.tsx
|
|
4302
4402
|
import { Animated as Animated13 } from "react-native";
|
|
4303
|
-
import { tokens as
|
|
4403
|
+
import { tokens as tokens24 } from "@kjun-ui/tokens";
|
|
4304
4404
|
import {
|
|
4305
4405
|
cloneElement as cloneElement3,
|
|
4306
4406
|
isValidElement as isValidElement4,
|
|
@@ -4367,7 +4467,7 @@ function FloatingPanel({
|
|
|
4367
4467
|
const scroll = useRef16(null), viewport = useRef16(0);
|
|
4368
4468
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions4(), [anchored, setAnchored] = useState16(false), [sized, setSized] = useState16(false), [anchor, setAnchor] = useState16({ x: 0, y: 0, width: 0, height: 0 }), [panel, setPanel] = useState16({ width: 0, height: 0 });
|
|
4369
4469
|
const measurement = useRef16(0);
|
|
4370
|
-
const motion = useNativePresence(open, tooltip ?
|
|
4470
|
+
const motion = useNativePresence(open, tooltip ? tokens24.motion.tooltipEnter : tokens24.motion.popupEnter, tooltip ? tokens24.motion.tooltipExit : tokens24.motion.popupExit, anchored && sized);
|
|
4371
4471
|
const layer = useLayer(open, motion.present, tooltip ? "tooltip" : "popup", () => onOpenChange(false), triggerRef);
|
|
4372
4472
|
useLayoutEffect8(() => {
|
|
4373
4473
|
var _a;
|
|
@@ -4392,7 +4492,7 @@ function FloatingPanel({
|
|
|
4392
4492
|
var _a;
|
|
4393
4493
|
const row = reveal == null ? void 0 : reveal.current;
|
|
4394
4494
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
4395
|
-
const offset = row.y + row.height + (menu || field ?
|
|
4495
|
+
const offset = row.y + row.height + (menu || field ? tokens24.extensions.menu.padding : 0) - viewport.current;
|
|
4396
4496
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
4397
4497
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
4398
4498
|
useEffect12(() => {
|
|
@@ -4405,30 +4505,30 @@ function FloatingPanel({
|
|
|
4405
4505
|
if (tag) AccessibilityInfo3.setAccessibilityFocus(tag);
|
|
4406
4506
|
}
|
|
4407
4507
|
}, [open, anchored, sized, focusOnOpen]);
|
|
4408
|
-
const gap = field ?
|
|
4508
|
+
const gap = field ? tokens24.extensions.floating.fieldGap : tokens24.extensions.floating.anchorGap;
|
|
4409
4509
|
const contentSizedMenu = menu && !matchTriggerWidth;
|
|
4410
|
-
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 *
|
|
4411
|
-
const maximumWidth = Math.max(0, window2.width - 2 *
|
|
4510
|
+
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 * tokens24.extensions.floating.viewportInset), tokens24.extensions.tooltip.maxWidth);
|
|
4511
|
+
const maximumWidth = Math.max(0, window2.width - 2 * tokens24.extensions.floating.viewportInset);
|
|
4412
4512
|
const minimumPanelWidth = Math.min(
|
|
4413
4513
|
maximumWidth,
|
|
4414
|
-
Math.max(minimumWidth, menu || field ?
|
|
4514
|
+
Math.max(minimumWidth, menu || field ? tokens24.extensions.menu.minimumWidth : 0)
|
|
4415
4515
|
);
|
|
4416
4516
|
const width = tooltip ? Math.min(tooltipWidth, panel.width || tooltipWidth) : Math.min(
|
|
4417
4517
|
maximumWidth,
|
|
4418
|
-
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width :
|
|
4518
|
+
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width : tokens24.extensions.popover.width)
|
|
4419
4519
|
);
|
|
4420
|
-
const available = Math.min(maxHeight != null ? maxHeight : field ?
|
|
4520
|
+
const available = Math.min(maxHeight != null ? maxHeight : field ? tokens24.extensions.menu.listMaxHeight : tokens24.extensions.floating.maxHeight, window2.height - 2 * tokens24.extensions.floating.viewportInset), height = Math.min(panel.height + (header != null ? headerHeight : 0), available), roomAbove = anchor.y - gap - tokens24.extensions.floating.viewportInset, roomBelow = window2.height - anchor.y - anchor.height - gap - tokens24.extensions.floating.viewportInset, above = placement.startsWith("top") ? !(flip && height > roomAbove && roomBelow > roomAbove) : flip && height > roomBelow && roomAbove > roomBelow;
|
|
4421
4521
|
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;
|
|
4422
4522
|
if (placement === "left" || placement === "right") {
|
|
4423
4523
|
left = placement === "left" ? anchor.x - width - gap : anchor.x + anchor.width + gap;
|
|
4424
4524
|
top = anchor.y + (anchor.height - height) / 2;
|
|
4425
4525
|
}
|
|
4426
|
-
left = Math.max(
|
|
4427
|
-
top = Math.max(
|
|
4526
|
+
left = Math.max(tokens24.extensions.floating.viewportInset, Math.min(window2.width - width - tokens24.extensions.floating.viewportInset, left));
|
|
4527
|
+
top = Math.max(tokens24.extensions.floating.viewportInset, Math.min(window2.height - height - tokens24.extensions.floating.viewportInset, top));
|
|
4428
4528
|
if (layer.blocked) return null;
|
|
4429
4529
|
if (tooltip && Platform16.OS === "web") {
|
|
4430
4530
|
if (!motion.present) return null;
|
|
4431
|
-
const arrow =
|
|
4531
|
+
const arrow = tokens24.extensions.tooltip.arrowSize, corner = tokens24.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));
|
|
4432
4532
|
return /* @__PURE__ */ jsxs14(
|
|
4433
4533
|
Animated13.View,
|
|
4434
4534
|
{
|
|
@@ -4455,7 +4555,7 @@ function FloatingPanel({
|
|
|
4455
4555
|
borderRadius: corner,
|
|
4456
4556
|
overflow: "hidden",
|
|
4457
4557
|
backgroundColor: colors.chartTooltipBg,
|
|
4458
|
-
boxShadow: shadowLayers(
|
|
4558
|
+
boxShadow: shadowLayers(tokens24.extensions.tooltip.elevation, colors)
|
|
4459
4559
|
},
|
|
4460
4560
|
children
|
|
4461
4561
|
}
|
|
@@ -4517,8 +4617,8 @@ function FloatingPanel({
|
|
|
4517
4617
|
style: {
|
|
4518
4618
|
opacity: anchored && sized ? motion.opacity : 0,
|
|
4519
4619
|
transform: tooltip ? void 0 : [
|
|
4520
|
-
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ?
|
|
4521
|
-
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ?
|
|
4620
|
+
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ? tokens24.motionDistance.popup : placement === "right" ? -tokens24.motionDistance.popup : 0, 0] }) },
|
|
4621
|
+
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ? tokens24.motionDistance.popup : -tokens24.motionDistance.popup, 0] }) }
|
|
4522
4622
|
],
|
|
4523
4623
|
position: "absolute",
|
|
4524
4624
|
top,
|
|
@@ -4527,11 +4627,11 @@ function FloatingPanel({
|
|
|
4527
4627
|
minWidth: contentSizedMenu ? minimumPanelWidth : void 0,
|
|
4528
4628
|
maxWidth: tooltip ? tooltipWidth : maximumWidth,
|
|
4529
4629
|
maxHeight: available,
|
|
4530
|
-
borderRadius: popover ?
|
|
4531
|
-
borderWidth: popover ? 0 :
|
|
4630
|
+
borderRadius: popover ? tokens24.extensions.popover.radius : field ? tokens24.radius.radius12 : tokens24.extensions.menu.radius,
|
|
4631
|
+
borderWidth: popover ? 0 : tokens24.border.defaultWidth,
|
|
4532
4632
|
borderColor: colors.border,
|
|
4533
4633
|
backgroundColor: colors.surface,
|
|
4534
|
-
boxShadow: (tooltip ?
|
|
4634
|
+
boxShadow: (tooltip ? tokens24.extensions.tooltip.elevation : popover ? tokens24.extensions.popover.elevation : tokens24.extensions.menu.elevation).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4535
4635
|
overflow: "hidden"
|
|
4536
4636
|
},
|
|
4537
4637
|
children: [
|
|
@@ -4540,10 +4640,10 @@ function FloatingPanel({
|
|
|
4540
4640
|
{
|
|
4541
4641
|
onLayout: ({ nativeEvent: { layout } }) => setHeaderHeight(layout.height),
|
|
4542
4642
|
style: {
|
|
4543
|
-
paddingTop:
|
|
4544
|
-
paddingHorizontal:
|
|
4545
|
-
paddingBottom:
|
|
4546
|
-
borderBottomWidth:
|
|
4643
|
+
paddingTop: tokens24.extensions.popover.padding,
|
|
4644
|
+
paddingHorizontal: tokens24.extensions.popover.padding,
|
|
4645
|
+
paddingBottom: tokens24.extensions.popover.headerPaddingBottom,
|
|
4646
|
+
borderBottomWidth: tokens24.border.defaultWidth,
|
|
4547
4647
|
borderBottomColor: colors.divider
|
|
4548
4648
|
},
|
|
4549
4649
|
children: content(header, typeStyle("cardTitle"))
|
|
@@ -4558,7 +4658,7 @@ function FloatingPanel({
|
|
|
4558
4658
|
},
|
|
4559
4659
|
keyboardShouldPersistTaps: "handled",
|
|
4560
4660
|
style: { maxHeight: available - (header != null ? headerHeight : 0), flexShrink: 1 },
|
|
4561
|
-
contentContainerStyle: { padding: menu || field ?
|
|
4661
|
+
contentContainerStyle: { padding: menu || field ? tokens24.extensions.menu.padding : 0 },
|
|
4562
4662
|
onContentSizeChange: (width2, height2) => {
|
|
4563
4663
|
if (contentSizedMenu) return;
|
|
4564
4664
|
setSized(true);
|
|
@@ -4591,7 +4691,7 @@ import {
|
|
|
4591
4691
|
Platform as Platform17,
|
|
4592
4692
|
View as View20
|
|
4593
4693
|
} from "react-native";
|
|
4594
|
-
import { tokens as
|
|
4694
|
+
import { tokens as tokens25 } from "@kjun-ui/tokens";
|
|
4595
4695
|
import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4596
4696
|
function KjunPopover({
|
|
4597
4697
|
noPadding = false,
|
|
@@ -4640,7 +4740,7 @@ function KjunPopover({
|
|
|
4640
4740
|
ariaLabel,
|
|
4641
4741
|
header: header != null ? content(header, { ...typeStyle("cardTitle"), color: colors.text }) : void 0,
|
|
4642
4742
|
nonModal: !modal,
|
|
4643
|
-
children: /* @__PURE__ */ jsx27(View20, { style: { padding: noPadding ? 0 :
|
|
4743
|
+
children: /* @__PURE__ */ jsx27(View20, { style: { padding: noPadding ? 0 : tokens25.extensions.popover.padding, gap: noPadding ? 0 : tokens25.extensions.popover.gap }, children: content(
|
|
4644
4744
|
typeof children === "function" ? children(() => change(false)) : children,
|
|
4645
4745
|
Platform17.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : void 0
|
|
4646
4746
|
) })
|
|
@@ -4747,9 +4847,9 @@ function KjunTooltip({
|
|
|
4747
4847
|
View20,
|
|
4748
4848
|
{
|
|
4749
4849
|
style: {
|
|
4750
|
-
paddingVertical:
|
|
4751
|
-
paddingHorizontal:
|
|
4752
|
-
maxWidth:
|
|
4850
|
+
paddingVertical: tokens25.extensions.tooltip.paddingY,
|
|
4851
|
+
paddingHorizontal: tokens25.extensions.tooltip.paddingX,
|
|
4852
|
+
maxWidth: tokens25.extensions.tooltip.maxWidth,
|
|
4753
4853
|
backgroundColor: colors.chartTooltipBg
|
|
4754
4854
|
},
|
|
4755
4855
|
children: /* @__PURE__ */ jsx27(
|
|
@@ -4852,18 +4952,18 @@ function KjunDropdownItem({
|
|
|
4852
4952
|
style: ({ pressed }) => ({
|
|
4853
4953
|
flexDirection: "row",
|
|
4854
4954
|
alignItems: "center",
|
|
4855
|
-
gap:
|
|
4856
|
-
paddingVertical:
|
|
4857
|
-
paddingHorizontal:
|
|
4858
|
-
minHeight:
|
|
4859
|
-
borderRadius:
|
|
4955
|
+
gap: tokens26.dimension.value8,
|
|
4956
|
+
paddingVertical: tokens26.extensions.menu.optionPaddingY,
|
|
4957
|
+
paddingHorizontal: tokens26.extensions.menu.optionPaddingX,
|
|
4958
|
+
minHeight: tokens26.extensions.menu.optionHeight,
|
|
4959
|
+
borderRadius: tokens26.extensions.menu.optionRadius,
|
|
4860
4960
|
backgroundColor: selected ? colors.selectedBg : !disabled && (pressed || hovered) ? variant === "danger" ? colors.dangerBg : colors.hover : void 0,
|
|
4861
|
-
opacity: disabled ?
|
|
4961
|
+
opacity: disabled ? tokens26.states.opacity.disabled : 1
|
|
4862
4962
|
}),
|
|
4863
4963
|
children: [
|
|
4864
|
-
icon ? /* @__PURE__ */ jsx28(KjunIcon, { name: icon, size:
|
|
4865
|
-
/* @__PURE__ */ jsx28(View21, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize:
|
|
4866
|
-
selected !== null && /* @__PURE__ */ jsx28(View21, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ jsx28(KjunIcon, { name: "check", size:
|
|
4964
|
+
icon ? /* @__PURE__ */ jsx28(KjunIcon, { name: icon, size: tokens26.extensions.menu.iconSize, color: iconColor }) : reserveIcon && /* @__PURE__ */ jsx28(View21, { style: { width: tokens26.extensions.menu.iconSize }, accessible: false }),
|
|
4965
|
+
/* @__PURE__ */ jsx28(View21, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize: tokens26.extensions.menu.optionFontSize, lineHeight: tokens26.extensions.menu.optionLineHeight }) }),
|
|
4966
|
+
selected !== null && /* @__PURE__ */ jsx28(View21, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ jsx28(KjunIcon, { name: "check", size: tokens26.extensions.menu.iconSize, color: colors.brand }) })
|
|
4867
4967
|
]
|
|
4868
4968
|
}
|
|
4869
4969
|
);
|
|
@@ -4874,7 +4974,7 @@ function KjunDropdownDivider() {
|
|
|
4874
4974
|
View21,
|
|
4875
4975
|
{
|
|
4876
4976
|
role: "separator",
|
|
4877
|
-
style: { height:
|
|
4977
|
+
style: { height: tokens26.extensions.menu.dividerHeight, marginVertical: tokens26.dimension.value4, backgroundColor: colors.border }
|
|
4878
4978
|
}
|
|
4879
4979
|
);
|
|
4880
4980
|
}
|
|
@@ -5047,12 +5147,12 @@ function useComboboxModel({
|
|
|
5047
5147
|
}
|
|
5048
5148
|
|
|
5049
5149
|
// packages/native/src/combobox.tsx
|
|
5050
|
-
import { tokens as
|
|
5150
|
+
import { tokens as tokens28 } from "@kjun-ui/tokens";
|
|
5051
5151
|
import { useId as useId5, useRef as useRef19 } from "react";
|
|
5052
5152
|
import { Platform as Platform18, View as View23 } from "react-native";
|
|
5053
5153
|
|
|
5054
5154
|
// packages/native/src/select-options.tsx
|
|
5055
|
-
import { tokens as
|
|
5155
|
+
import { tokens as tokens27 } from "@kjun-ui/tokens";
|
|
5056
5156
|
import { View as View22 } from "react-native";
|
|
5057
5157
|
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5058
5158
|
function OptionRow({
|
|
@@ -5075,20 +5175,20 @@ function OptionRow({
|
|
|
5075
5175
|
onPress,
|
|
5076
5176
|
onLayout,
|
|
5077
5177
|
style: ({ pressed }) => ({
|
|
5078
|
-
borderRadius:
|
|
5079
|
-
minHeight:
|
|
5178
|
+
borderRadius: tokens27.radius.radius8,
|
|
5179
|
+
minHeight: tokens27.extensions.menu.optionHeight,
|
|
5080
5180
|
flexDirection: "row",
|
|
5081
5181
|
alignItems: "center",
|
|
5082
5182
|
justifyContent: "space-between",
|
|
5083
|
-
gap:
|
|
5084
|
-
paddingVertical:
|
|
5085
|
-
paddingHorizontal:
|
|
5183
|
+
gap: tokens27.dimension.value8,
|
|
5184
|
+
paddingVertical: tokens27.extensions.menu.optionPaddingY,
|
|
5185
|
+
paddingHorizontal: tokens27.extensions.menu.optionPaddingX,
|
|
5086
5186
|
backgroundColor: selected ? colors.selectedBg : pressed ? colors.hover : void 0,
|
|
5087
|
-
opacity: disabled ?
|
|
5187
|
+
opacity: disabled ? tokens27.states.opacity.disabled : 1
|
|
5088
5188
|
}),
|
|
5089
5189
|
children: [
|
|
5090
|
-
/* @__PURE__ */ jsx29(View22, { style: { flex: 1 }, children: content(children || label, { fontSize:
|
|
5091
|
-
selected && /* @__PURE__ */ jsx29(KjunIcon, { name: "check", size:
|
|
5190
|
+
/* @__PURE__ */ jsx29(View22, { style: { flex: 1 }, children: content(children || label, { fontSize: tokens27.extensions.menu.optionFontSize, lineHeight: tokens27.extensions.menu.optionLineHeight }) }),
|
|
5191
|
+
selected && /* @__PURE__ */ jsx29(KjunIcon, { name: "check", size: tokens27.extensions.menu.iconSize, color: colors.brand })
|
|
5092
5192
|
]
|
|
5093
5193
|
}
|
|
5094
5194
|
);
|
|
@@ -5226,8 +5326,8 @@ function SearchField({
|
|
|
5226
5326
|
View23,
|
|
5227
5327
|
{
|
|
5228
5328
|
style: {
|
|
5229
|
-
padding:
|
|
5230
|
-
borderBottomWidth:
|
|
5329
|
+
padding: tokens28.dimension.value8,
|
|
5330
|
+
borderBottomWidth: tokens28.border.defaultWidth,
|
|
5231
5331
|
borderBottomColor: colors.border
|
|
5232
5332
|
},
|
|
5233
5333
|
children: /* @__PURE__ */ jsx30(KjunInput, { ...inputProps, nativeID: searchId, autoFocus: true })
|
|
@@ -5235,13 +5335,13 @@ function SearchField({
|
|
|
5235
5335
|
),
|
|
5236
5336
|
loading ? (
|
|
5237
5337
|
// Centered like the Select loading row on every platform.
|
|
5238
|
-
/* @__PURE__ */ jsx30(View23, { style: { padding:
|
|
5338
|
+
/* @__PURE__ */ jsx30(View23, { style: { padding: tokens28.dimension.value12, alignItems: "center" }, children: /* @__PURE__ */ jsx30(KjunSpinner, { size: "sm", text: m.searching }) })
|
|
5239
5339
|
) : failed ? /* @__PURE__ */ jsx30(
|
|
5240
5340
|
KText,
|
|
5241
5341
|
{
|
|
5242
5342
|
accessibilityRole: "alert",
|
|
5243
5343
|
style: {
|
|
5244
|
-
padding:
|
|
5344
|
+
padding: tokens28.dimension.value12,
|
|
5245
5345
|
textAlign: "center",
|
|
5246
5346
|
color: colors.danger
|
|
5247
5347
|
},
|
|
@@ -5264,7 +5364,7 @@ function SearchField({
|
|
|
5264
5364
|
KText,
|
|
5265
5365
|
{
|
|
5266
5366
|
style: {
|
|
5267
|
-
padding:
|
|
5367
|
+
padding: tokens28.dimension.value12,
|
|
5268
5368
|
textAlign: "center",
|
|
5269
5369
|
color: colors.textTertiary
|
|
5270
5370
|
},
|
|
@@ -5278,7 +5378,7 @@ function SearchField({
|
|
|
5278
5378
|
}
|
|
5279
5379
|
|
|
5280
5380
|
// packages/native/src/date-picker.tsx
|
|
5281
|
-
import { tokens as
|
|
5381
|
+
import { tokens as tokens29 } from "@kjun-ui/tokens";
|
|
5282
5382
|
import { useRef as useRef20, useState as useState20 } from "react";
|
|
5283
5383
|
import { Platform as Platform19, View as View24 } from "react-native";
|
|
5284
5384
|
import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -5302,7 +5402,7 @@ function KjunDatePicker({
|
|
|
5302
5402
|
const scope = useKjunMessageScope();
|
|
5303
5403
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
5304
5404
|
const clear = clearable && !!value && !disabled;
|
|
5305
|
-
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState20(false), [month, setMonth] = useState20(() => displayMonth(value)), ref = useRef20(null), spec =
|
|
5405
|
+
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = useState20(false), [month, setMonth] = useState20(() => displayMonth(value)), ref = useRef20(null), spec = tokens29.input[size];
|
|
5306
5406
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open });
|
|
5307
5407
|
const year = month.getFullYear(), m = month.getMonth(), first = new Date(year, m, 1).getDay(), count = new Date(year, m + 1, 0).getDate();
|
|
5308
5408
|
const date = (day) => `${year}-${String(m + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
@@ -5310,7 +5410,7 @@ function KjunDatePicker({
|
|
|
5310
5410
|
/* @__PURE__ */ jsxs19(View24, { ref, collapsable: false, ...fieldTarget(() => {
|
|
5311
5411
|
setMonth(displayMonth(value));
|
|
5312
5412
|
setOpen(true);
|
|
5313
|
-
}, disabled), style: { minHeight:
|
|
5413
|
+
}, disabled), style: { minHeight: tokens29.native.minimumTouchTarget, justifyContent: "center" }, children: [
|
|
5314
5414
|
/* @__PURE__ */ jsxs19(
|
|
5315
5415
|
FieldPressable,
|
|
5316
5416
|
{
|
|
@@ -5336,7 +5436,7 @@ function KjunDatePicker({
|
|
|
5336
5436
|
},
|
|
5337
5437
|
style: {
|
|
5338
5438
|
...surface.style,
|
|
5339
|
-
paddingHorizontal: spec.padding -
|
|
5439
|
+
paddingHorizontal: spec.padding - tokens29.border.controlWidth,
|
|
5340
5440
|
flexDirection: "row",
|
|
5341
5441
|
alignItems: "center",
|
|
5342
5442
|
justifyContent: "space-between"
|
|
@@ -5379,9 +5479,9 @@ function KjunDatePicker({
|
|
|
5379
5479
|
triggerRef: ref,
|
|
5380
5480
|
placement: "bottom-start",
|
|
5381
5481
|
matchTriggerWidth: true,
|
|
5382
|
-
minimumWidth:
|
|
5482
|
+
minimumWidth: tokens29.extensions.calendar.minimumWidth,
|
|
5383
5483
|
ariaLabel: scope.messages.datePlaceholder,
|
|
5384
|
-
children: /* @__PURE__ */ jsxs19(View24, { style: { padding:
|
|
5484
|
+
children: /* @__PURE__ */ jsxs19(View24, { style: { padding: tokens29.dimension.value8 }, children: [
|
|
5385
5485
|
/* @__PURE__ */ jsxs19(
|
|
5386
5486
|
View24,
|
|
5387
5487
|
{
|
|
@@ -5422,7 +5522,7 @@ function KjunDatePicker({
|
|
|
5422
5522
|
style: {
|
|
5423
5523
|
width: "14.2857%",
|
|
5424
5524
|
textAlign: "center",
|
|
5425
|
-
paddingVertical:
|
|
5525
|
+
paddingVertical: tokens29.dimension.value8,
|
|
5426
5526
|
color: colors.textTertiary
|
|
5427
5527
|
},
|
|
5428
5528
|
children: day
|
|
@@ -5449,12 +5549,12 @@ function KjunDatePicker({
|
|
|
5449
5549
|
},
|
|
5450
5550
|
style: {
|
|
5451
5551
|
width: "14.2857%",
|
|
5452
|
-
minHeight:
|
|
5552
|
+
minHeight: tokens29.native.minimumTouchTarget,
|
|
5453
5553
|
alignItems: "center",
|
|
5454
5554
|
justifyContent: "center",
|
|
5455
|
-
borderRadius:
|
|
5555
|
+
borderRadius: tokens29.radius.radius6,
|
|
5456
5556
|
backgroundColor: v === value ? colors.brand : void 0,
|
|
5457
|
-
opacity: blocked ?
|
|
5557
|
+
opacity: blocked ? tokens29.states.opacity.disabledStrong : 1
|
|
5458
5558
|
},
|
|
5459
5559
|
children: /* @__PURE__ */ jsx31(
|
|
5460
5560
|
KText,
|
|
@@ -5655,17 +5755,17 @@ function KjunSearchInput({
|
|
|
5655
5755
|
}
|
|
5656
5756
|
|
|
5657
5757
|
// packages/native/src/select-control.tsx
|
|
5658
|
-
import { tokens as
|
|
5758
|
+
import { tokens as tokens31 } from "@kjun-ui/tokens";
|
|
5659
5759
|
import { useContext as useContext14, useEffect as useEffect18, useRef as useRef23 } from "react";
|
|
5660
5760
|
|
|
5661
5761
|
// packages/native/src/compound-control.tsx
|
|
5662
5762
|
import { createContext as createContext18 } from "react";
|
|
5663
5763
|
import { View as View25 } from "react-native";
|
|
5664
|
-
import { tokens as
|
|
5764
|
+
import { tokens as tokens30 } from "@kjun-ui/tokens";
|
|
5665
5765
|
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
5666
5766
|
var CompoundControlContext = createContext18(null);
|
|
5667
5767
|
function CompoundTarget({ children, square = false }) {
|
|
5668
|
-
const touch = finePointer() ? void 0 :
|
|
5768
|
+
const touch = finePointer() ? void 0 : tokens30.native.minimumTouchTarget;
|
|
5669
5769
|
return /* @__PURE__ */ jsx33(View25, { style: { minHeight: touch, minWidth: square ? touch : void 0, alignItems: "center", justifyContent: "center" }, children });
|
|
5670
5770
|
}
|
|
5671
5771
|
|
|
@@ -5738,7 +5838,7 @@ function KjunSelect({
|
|
|
5738
5838
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
5739
5839
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
5740
5840
|
const { open, query, limit, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
5741
|
-
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef23(null), spec =
|
|
5841
|
+
const { colors } = useKjunStyles(), field = useKjunField(), ref = useRef23(null), spec = tokens31.input[size];
|
|
5742
5842
|
const trigger = useRef23(null);
|
|
5743
5843
|
const compound = useContext14(CompoundControlContext);
|
|
5744
5844
|
useEffect18(() => {
|
|
@@ -5770,10 +5870,10 @@ function KjunSelect({
|
|
|
5770
5870
|
return /* @__PURE__ */ jsxs20(Fragment10, { children: [
|
|
5771
5871
|
/* @__PURE__ */ jsxs20(View26, { ref, collapsable: false, ...fieldTarget(() => changeOpen(!open), disabled), style: {
|
|
5772
5872
|
position: "relative",
|
|
5773
|
-
minHeight:
|
|
5873
|
+
minHeight: tokens31.native.minimumTouchTarget,
|
|
5774
5874
|
justifyContent: "center",
|
|
5775
5875
|
// Inside a compound field the touch target overflows so the shared surface keeps its size height.
|
|
5776
|
-
...compound ? { marginVertical: Math.min(0, (spec.height -
|
|
5876
|
+
...compound ? { marginVertical: Math.min(0, (spec.height - tokens31.native.minimumTouchTarget) / 2) } : {}
|
|
5777
5877
|
}, children: [
|
|
5778
5878
|
/* @__PURE__ */ jsxs20(
|
|
5779
5879
|
FieldPressable,
|
|
@@ -5809,14 +5909,14 @@ function KjunSelect({
|
|
|
5809
5909
|
flexDirection: "row",
|
|
5810
5910
|
alignItems: "center",
|
|
5811
5911
|
justifyContent: "space-between",
|
|
5812
|
-
gap:
|
|
5912
|
+
gap: tokens31.dimension.value8,
|
|
5813
5913
|
...surface.style,
|
|
5814
|
-
paddingHorizontal: spec.padding -
|
|
5815
|
-
paddingRight: spec.padding -
|
|
5816
|
-
...compound ? { paddingHorizontal:
|
|
5914
|
+
paddingHorizontal: spec.padding - tokens31.border.controlWidth,
|
|
5915
|
+
paddingRight: spec.padding - tokens31.border.controlWidth,
|
|
5916
|
+
...compound ? { paddingHorizontal: tokens31.extensions.timePicker.segmentPadding, paddingRight: tokens31.extensions.timePicker.segmentPadding, paddingLeft: compound.leading ? spec.padding - tokens31.border.controlWidth : tokens31.extensions.timePicker.segmentPadding, gap: tokens31.extensions.timePicker.segmentPadding, backgroundColor: !disabled && (surface.active || surface.hovered) ? colors.hover : "transparent", borderColor: "transparent", outlineWidth: 0 } : {}
|
|
5817
5917
|
},
|
|
5818
5918
|
children: [
|
|
5819
|
-
/* @__PURE__ */ jsxs20(View26, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ?
|
|
5919
|
+
/* @__PURE__ */ jsxs20(View26, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ? tokens31.native.minimumTouchTarget + spec.affixGap : 0 }, children: [
|
|
5820
5920
|
compound && /* @__PURE__ */ jsx34(KText, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: { ...inputTypeStyle(size), fontVariant: ["tabular-nums"], opacity: 0 }, children: "00" }),
|
|
5821
5921
|
(renderSelected == null ? void 0 : renderSelected(selectedOption)) || /* @__PURE__ */ jsx34(KText, { numberOfLines: 1, style: {
|
|
5822
5922
|
...inputTypeStyle(size),
|
|
@@ -5828,7 +5928,7 @@ function KjunSelect({
|
|
|
5828
5928
|
KjunIcon,
|
|
5829
5929
|
{
|
|
5830
5930
|
name: "chevron-down",
|
|
5831
|
-
size: compound ?
|
|
5931
|
+
size: compound ? tokens31.extensions.timePicker.iconSize : spec.iconSize,
|
|
5832
5932
|
color: surface.icon
|
|
5833
5933
|
}
|
|
5834
5934
|
) })
|
|
@@ -5872,8 +5972,8 @@ function KjunSelect({
|
|
|
5872
5972
|
View26,
|
|
5873
5973
|
{
|
|
5874
5974
|
style: {
|
|
5875
|
-
padding:
|
|
5876
|
-
borderBottomWidth:
|
|
5975
|
+
padding: tokens31.dimension.value8,
|
|
5976
|
+
borderBottomWidth: tokens31.border.defaultWidth,
|
|
5877
5977
|
borderBottomColor: colors.border
|
|
5878
5978
|
},
|
|
5879
5979
|
children: /* @__PURE__ */ jsx34(
|
|
@@ -5893,7 +5993,7 @@ function KjunSelect({
|
|
|
5893
5993
|
)
|
|
5894
5994
|
}
|
|
5895
5995
|
),
|
|
5896
|
-
loading ? /* @__PURE__ */ jsx34(View26, { style: { padding:
|
|
5996
|
+
loading ? /* @__PURE__ */ jsx34(View26, { style: { padding: tokens31.dimension.value12 }, children: /* @__PURE__ */ jsx34(KjunSpinner, { size: "sm", text: m.searching }) }) : visible.map(({ option: o, key }, index) => /* @__PURE__ */ jsx34(
|
|
5897
5997
|
OptionRow,
|
|
5898
5998
|
{
|
|
5899
5999
|
selected: selected(o),
|
|
@@ -5915,7 +6015,7 @@ function KjunSelect({
|
|
|
5915
6015
|
KText,
|
|
5916
6016
|
{
|
|
5917
6017
|
style: {
|
|
5918
|
-
padding:
|
|
6018
|
+
padding: tokens31.dimension.value12,
|
|
5919
6019
|
textAlign: "center",
|
|
5920
6020
|
color: colors.textTertiary
|
|
5921
6021
|
},
|
|
@@ -5939,10 +6039,10 @@ function KjunSelect({
|
|
|
5939
6039
|
}
|
|
5940
6040
|
|
|
5941
6041
|
// packages/native/src/navigation.tsx
|
|
5942
|
-
import { tokens as
|
|
6042
|
+
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
5943
6043
|
|
|
5944
6044
|
// packages/native/src/collapse.tsx
|
|
5945
|
-
import { tokens as
|
|
6045
|
+
import { tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5946
6046
|
import { useLayoutEffect as useLayoutEffect10, useRef as useRef24, useState as useState24 } from "react";
|
|
5947
6047
|
import { Animated as Animated14, View as View27 } from "react-native";
|
|
5948
6048
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
@@ -5969,7 +6069,7 @@ function Collapse({ open, children }) {
|
|
|
5969
6069
|
finish();
|
|
5970
6070
|
} else {
|
|
5971
6071
|
setSettled(false);
|
|
5972
|
-
Animated14.timing(value, { toValue: target, duration:
|
|
6072
|
+
Animated14.timing(value, { toValue: target, duration: tokens32.motion.collapse, easing: motionOut, useNativeDriver: false }).start(({ finished }) => {
|
|
5973
6073
|
if (finished) finish();
|
|
5974
6074
|
});
|
|
5975
6075
|
}
|
|
@@ -6043,7 +6143,7 @@ import {
|
|
|
6043
6143
|
import { Animated as Animated16, View as View29, useWindowDimensions as useWindowDimensions5, Platform as Platform22 } from "react-native";
|
|
6044
6144
|
|
|
6045
6145
|
// packages/native/src/tabs.tsx
|
|
6046
|
-
import { tokens as
|
|
6146
|
+
import { tokens as tokens33 } from "@kjun-ui/tokens";
|
|
6047
6147
|
import { Children as Children4, createContext as createContext19, isValidElement as isValidElement7, useContext as useContext15, useCallback as useCallback5, useLayoutEffect as useLayoutEffect11, useRef as useRef26, useId as useId6, useState as useState26 } from "react";
|
|
6048
6148
|
import { Animated as Animated15, Platform as Platform21, ScrollView as ScrollView5, View as View28 } from "react-native";
|
|
6049
6149
|
|
|
@@ -6083,14 +6183,14 @@ function KjunTabs({
|
|
|
6083
6183
|
if (!onTabMenu || !tabs.some((tab) => tab.name === pressedMenu.current && !tab.disabled)) pressedMenu.current = null;
|
|
6084
6184
|
}, [tabs, onTabMenu]);
|
|
6085
6185
|
const panelNames = panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name);
|
|
6086
|
-
const geometry2 =
|
|
6186
|
+
const geometry2 = tokens33.extensions.tabs;
|
|
6087
6187
|
const underline = variant === "underline";
|
|
6088
6188
|
const [hoveredTab, setHoveredTab] = useState26(null);
|
|
6089
6189
|
const singleLine = Platform21.OS === "web" ? { whiteSpace: "nowrap" } : {};
|
|
6090
6190
|
const paddingX = !underline ? geometry2.pillsPaddingX : density === "compact" ? geometry2.compactPaddingX : geometry2.paddingX;
|
|
6091
6191
|
const height = density === "compact" ? geometry2.compactHeight : geometry2.height;
|
|
6092
|
-
const ringRoom =
|
|
6093
|
-
const slop = Math.max(0, (
|
|
6192
|
+
const ringRoom = tokens33.states.focus.width + tokens33.states.focus.offset;
|
|
6193
|
+
const slop = Math.max(0, (tokens33.native.minimumTouchTarget - height) / 2);
|
|
6094
6194
|
const roomX = underline ? ringRoom : 0, roomY = Math.max(underline ? ringRoom : 0, slop);
|
|
6095
6195
|
const selectedTab = tabs.find((tab) => tab.name === value);
|
|
6096
6196
|
const selection = useButtonGroupMotion(selectedTab ? { ...selectedTab, value: selectedTab.name } : void 0);
|
|
@@ -6149,7 +6249,7 @@ function KjunTabs({
|
|
|
6149
6249
|
transform: [{ translateX: selection.x }],
|
|
6150
6250
|
borderRadius: underline ? geometry2.indicatorHeight / 2 : geometry2.radius,
|
|
6151
6251
|
backgroundColor: variant === "underline" ? colors.brand : colors.active,
|
|
6152
|
-
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ?
|
|
6252
|
+
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ? tokens33.states.opacity.disabled : 1
|
|
6153
6253
|
}
|
|
6154
6254
|
}
|
|
6155
6255
|
),
|
|
@@ -6209,7 +6309,7 @@ function KjunTabs({
|
|
|
6209
6309
|
borderRadius: geometry2.radius,
|
|
6210
6310
|
// Pills answer hover with the hover surface, like ButtonGroup and Web.
|
|
6211
6311
|
backgroundColor: !underline && !active && !tab.disabled && hoveredTab === tab.name ? colors.hover : void 0,
|
|
6212
|
-
opacity: tab.disabled ?
|
|
6312
|
+
opacity: tab.disabled ? tokens33.states.opacity.disabled : 1
|
|
6213
6313
|
},
|
|
6214
6314
|
children: [
|
|
6215
6315
|
!!tab.icon && /* @__PURE__ */ jsx36(
|
|
@@ -6304,7 +6404,7 @@ function KjunAccordion({
|
|
|
6304
6404
|
View29,
|
|
6305
6405
|
{
|
|
6306
6406
|
style: {
|
|
6307
|
-
borderRadius:
|
|
6407
|
+
borderRadius: tokens34.extensions.accordion.radius,
|
|
6308
6408
|
overflow: "hidden",
|
|
6309
6409
|
backgroundColor: tone === "muted" ? colors.secondary : colors.surface
|
|
6310
6410
|
},
|
|
@@ -6322,8 +6422,8 @@ function KjunAccordionItem({
|
|
|
6322
6422
|
children
|
|
6323
6423
|
}) {
|
|
6324
6424
|
const { colors } = useKjunStyles(), group = useContext16(AccordionContext), id = "kjun-" + useId7(), [own, setOwn] = useState27(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
6325
|
-
const rotation = useMotionValue(open ? 1 : 0,
|
|
6326
|
-
const geometry2 =
|
|
6425
|
+
const rotation = useMotionValue(open ? 1 : 0, tokens34.motion.collapse, void 0, void 0, true);
|
|
6426
|
+
const geometry2 = tokens34.extensions.accordion;
|
|
6327
6427
|
const [hovered, setHovered] = useState27(false);
|
|
6328
6428
|
const wrapping = Platform22.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
6329
6429
|
useEffect20(() => {
|
|
@@ -6336,7 +6436,7 @@ function KjunAccordionItem({
|
|
|
6336
6436
|
nativeID: id + "-heading",
|
|
6337
6437
|
accessibilityRole: "button",
|
|
6338
6438
|
focusRingInset: true,
|
|
6339
|
-
focusRingRadius:
|
|
6439
|
+
focusRingRadius: tokens34.extensions.accordion.radius,
|
|
6340
6440
|
accessibilityLabel: title,
|
|
6341
6441
|
accessibilityState: { expanded: open, disabled },
|
|
6342
6442
|
disabled,
|
|
@@ -6352,7 +6452,7 @@ function KjunAccordionItem({
|
|
|
6352
6452
|
paddingVertical: geometry2.headerPaddingY,
|
|
6353
6453
|
paddingHorizontal: geometry2.paddingX,
|
|
6354
6454
|
backgroundColor: !disabled && (pressed || hovered) ? colors.hover : void 0,
|
|
6355
|
-
opacity: disabled ?
|
|
6455
|
+
opacity: disabled ? tokens34.states.opacity.disabled : 1
|
|
6356
6456
|
}),
|
|
6357
6457
|
children: [
|
|
6358
6458
|
/* @__PURE__ */ jsx37(View29, { style: { flex: 1, minWidth: 0 }, children: content(header || title, { ...typeStyle("control"), ...wrapping }) }),
|
|
@@ -6387,11 +6487,11 @@ function KjunBreadcrumb({
|
|
|
6387
6487
|
flexDirection: "row",
|
|
6388
6488
|
alignItems: "center",
|
|
6389
6489
|
flexWrap: "wrap",
|
|
6390
|
-
gap:
|
|
6490
|
+
gap: tokens34.dimension.value8
|
|
6391
6491
|
},
|
|
6392
6492
|
children: items2.map((item, i) => {
|
|
6393
|
-
const label = /* @__PURE__ */ jsxs22(View29, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6394
|
-
!!item.icon && /* @__PURE__ */ jsx37(KjunIcon, { name: item.icon, size:
|
|
6493
|
+
const label = /* @__PURE__ */ jsxs22(View29, { style: { flexDirection: "row", alignItems: "center", gap: tokens34.dimension.value4 }, children: [
|
|
6494
|
+
!!item.icon && /* @__PURE__ */ jsx37(KjunIcon, { name: item.icon, size: tokens34.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
6395
6495
|
/* @__PURE__ */ jsx37(
|
|
6396
6496
|
KText,
|
|
6397
6497
|
{
|
|
@@ -6408,7 +6508,7 @@ function KjunBreadcrumb({
|
|
|
6408
6508
|
KjunIcon,
|
|
6409
6509
|
{
|
|
6410
6510
|
name: "chevron-right",
|
|
6411
|
-
size:
|
|
6511
|
+
size: tokens34.extensions.breadcrumb.separatorSize,
|
|
6412
6512
|
color: colors.textTertiary
|
|
6413
6513
|
}
|
|
6414
6514
|
),
|
|
@@ -6418,7 +6518,7 @@ function KjunBreadcrumb({
|
|
|
6418
6518
|
{
|
|
6419
6519
|
accessibilityRole: "link",
|
|
6420
6520
|
onPress: () => onNavigate == null ? void 0 : onNavigate(item),
|
|
6421
|
-
style: { minHeight:
|
|
6521
|
+
style: { minHeight: tokens34.native.minimumTouchTarget, justifyContent: "center" },
|
|
6422
6522
|
children: label
|
|
6423
6523
|
}
|
|
6424
6524
|
) : label
|
|
@@ -6447,7 +6547,7 @@ function KjunPagination({
|
|
|
6447
6547
|
const m = useKjunMessages();
|
|
6448
6548
|
const { colors } = useKjunStyles(), window2 = useWindowDimensions5(), current = Math.max(1, Math.min(totalPages, (_a = currentPage != null ? currentPage : page) != null ? _a : 1));
|
|
6449
6549
|
if (totalPages <= 1 && !showSizeSelector && !(showInfo && totalRows > 0)) return null;
|
|
6450
|
-
const compact = window2.width <
|
|
6550
|
+
const compact = window2.width < tokens34.responsive.pagination;
|
|
6451
6551
|
const change = (v) => {
|
|
6452
6552
|
if (v < 1 || v > totalPages || v === current) return;
|
|
6453
6553
|
onPageChange == null ? void 0 : onPageChange(v);
|
|
@@ -6463,12 +6563,12 @@ function KjunPagination({
|
|
|
6463
6563
|
]);
|
|
6464
6564
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
6465
6565
|
const pageButtonStyle = {
|
|
6466
|
-
width: Math.max(
|
|
6467
|
-
height: Math.max(
|
|
6468
|
-
borderRadius:
|
|
6566
|
+
width: Math.max(tokens34.extensions.pagination.itemSize, tokens34.native.minimumTouchTarget),
|
|
6567
|
+
height: Math.max(tokens34.extensions.pagination.itemSize, tokens34.native.minimumTouchTarget),
|
|
6568
|
+
borderRadius: tokens34.extensions.pagination.radius,
|
|
6469
6569
|
paddingHorizontal: 0
|
|
6470
6570
|
};
|
|
6471
|
-
const arrowSize = (_b = Object.keys(
|
|
6571
|
+
const arrowSize = (_b = Object.keys(tokens34.button.iconSizes).find((size) => tokens34.button.iconSizes[size] === tokens34.extensions.pagination.iconSize)) != null ? _b : "sm";
|
|
6472
6572
|
const button = (target, label, icon) => /* @__PURE__ */ jsx37(
|
|
6473
6573
|
KjunButton,
|
|
6474
6574
|
{
|
|
@@ -6489,9 +6589,9 @@ function KjunPagination({
|
|
|
6489
6589
|
flexDirection: compact ? "column" : "row",
|
|
6490
6590
|
alignItems: compact ? "stretch" : "center",
|
|
6491
6591
|
justifyContent: "space-between",
|
|
6492
|
-
gap:
|
|
6493
|
-
padding:
|
|
6494
|
-
borderTopWidth:
|
|
6592
|
+
gap: tokens34.extensions.pagination.gap,
|
|
6593
|
+
padding: tokens34.extensions.pagination.padding,
|
|
6594
|
+
borderTopWidth: tokens34.border.defaultWidth,
|
|
6495
6595
|
borderTopColor: colors.border
|
|
6496
6596
|
},
|
|
6497
6597
|
children: [
|
|
@@ -6502,11 +6602,11 @@ function KjunPagination({
|
|
|
6502
6602
|
style: {
|
|
6503
6603
|
flexDirection: "row",
|
|
6504
6604
|
alignItems: "center",
|
|
6505
|
-
gap:
|
|
6605
|
+
gap: tokens34.extensions.pagination.itemGap,
|
|
6506
6606
|
flexWrap: "wrap"
|
|
6507
6607
|
},
|
|
6508
6608
|
children: [
|
|
6509
|
-
showSizeSelector && /* @__PURE__ */ jsx37(View29, { style: { minWidth:
|
|
6609
|
+
showSizeSelector && /* @__PURE__ */ jsx37(View29, { style: { minWidth: tokens34.extensions.pagination.selectorMinimumWidth }, children: /* @__PURE__ */ jsx37(
|
|
6510
6610
|
KjunSelect,
|
|
6511
6611
|
{
|
|
6512
6612
|
size: "sm",
|
|
@@ -6523,10 +6623,10 @@ function KjunPagination({
|
|
|
6523
6623
|
}
|
|
6524
6624
|
}
|
|
6525
6625
|
) }),
|
|
6526
|
-
totalPages > 1 && /* @__PURE__ */ jsxs22(View29, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6626
|
+
totalPages > 1 && /* @__PURE__ */ jsxs22(View29, { style: { flexDirection: "row", alignItems: "center", gap: tokens34.extensions.pagination.itemGap, marginLeft: compact ? "auto" : void 0 }, children: [
|
|
6527
6627
|
!compact && showFirstLast && button(1, m.firstPage, "chevrons-left"),
|
|
6528
6628
|
button(current - 1, m.previousPage, "chevron-left"),
|
|
6529
|
-
compact ? /* @__PURE__ */ jsxs22(KText, { style: { paddingHorizontal:
|
|
6629
|
+
compact ? /* @__PURE__ */ jsxs22(KText, { style: { paddingHorizontal: tokens34.extensions.pagination.labelPaddingX, color: colors.text, fontVariant: ["tabular-nums"] }, children: [
|
|
6530
6630
|
/* @__PURE__ */ jsx37(KText, { style: { fontWeight: typeStyle("control").fontWeight }, children: current }),
|
|
6531
6631
|
" / ",
|
|
6532
6632
|
totalPages
|
|
@@ -6556,7 +6656,7 @@ function KjunPagination({
|
|
|
6556
6656
|
}
|
|
6557
6657
|
|
|
6558
6658
|
// packages/native/src/actions.tsx
|
|
6559
|
-
import { tokens as
|
|
6659
|
+
import { tokens as tokens35 } from "@kjun-ui/tokens";
|
|
6560
6660
|
import { useContext as useContext17, useEffect as useEffect21, useRef as useRef27, useState as useState28 } from "react";
|
|
6561
6661
|
import { Platform as Platform23, ScrollView as ScrollView7, View as View30 } from "react-native";
|
|
6562
6662
|
import { jsx as jsx38, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -6577,7 +6677,7 @@ function KjunIconToggle({
|
|
|
6577
6677
|
}) {
|
|
6578
6678
|
const { colors } = useKjunStyles();
|
|
6579
6679
|
const navigation = useContext17(TopNavigationContext);
|
|
6580
|
-
const box = navigation ? navigation.controlSize : size === "xs" ?
|
|
6680
|
+
const box = navigation ? navigation.controlSize : size === "xs" ? tokens35.extensions.iconToggle.compactSize : tokens35.extensions.iconToggle.sizes[size];
|
|
6581
6681
|
return /* @__PURE__ */ jsx38(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ jsx38(
|
|
6582
6682
|
AccessiblePressable,
|
|
6583
6683
|
{
|
|
@@ -6603,24 +6703,24 @@ function KjunIconToggle({
|
|
|
6603
6703
|
...Platform23.OS === "web" ? { pointerEvents: "auto" } : {},
|
|
6604
6704
|
// The touch target stays 44pt; the visible square follows the icon-toggle scale.
|
|
6605
6705
|
alignSelf: "flex-start",
|
|
6606
|
-
minWidth: Math.max(
|
|
6607
|
-
minHeight: Math.max(
|
|
6706
|
+
minWidth: Math.max(tokens35.native.minimumTouchTarget, box),
|
|
6707
|
+
minHeight: Math.max(tokens35.native.minimumTouchTarget, box),
|
|
6608
6708
|
alignItems: "center",
|
|
6609
6709
|
justifyContent: "center",
|
|
6610
6710
|
...navigation ? { width: navigation.controlSize, height: navigation.controlSize, flexShrink: 0 } : {},
|
|
6611
|
-
borderRadius:
|
|
6711
|
+
borderRadius: tokens35.extensions.iconToggle.radii[size],
|
|
6612
6712
|
// Loading blocks presses but stays legible; only disabled dims.
|
|
6613
|
-
opacity: disabled ?
|
|
6713
|
+
opacity: disabled ? tokens35.states.opacity.disabled : 1,
|
|
6614
6714
|
transform: [{ scale: pressed ? 0.94 : 1 }]
|
|
6615
6715
|
}),
|
|
6616
6716
|
children: ({ pressed, hovered }) => {
|
|
6617
6717
|
var _a;
|
|
6618
|
-
return /* @__PURE__ */ jsx38(View30, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius:
|
|
6718
|
+
return /* @__PURE__ */ jsx38(View30, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius: tokens35.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(
|
|
6619
6719
|
KjunIcon,
|
|
6620
6720
|
{
|
|
6621
6721
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
6622
6722
|
filled: active,
|
|
6623
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
6723
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : tokens35.button.iconSizes[size],
|
|
6624
6724
|
color: active ? activeColor != null ? activeColor : colors.brand : hovered && !disabled && !loading ? colors.textSecondary : inactiveColor != null ? inactiveColor : colors.textTertiary
|
|
6625
6725
|
}
|
|
6626
6726
|
) });
|
|
@@ -6681,24 +6781,24 @@ function KjunCopyButton({
|
|
|
6681
6781
|
},
|
|
6682
6782
|
style: ({ pressed }) => ({
|
|
6683
6783
|
alignSelf: "flex-start",
|
|
6684
|
-
minWidth:
|
|
6685
|
-
minHeight:
|
|
6784
|
+
minWidth: tokens35.native.minimumTouchTarget,
|
|
6785
|
+
minHeight: tokens35.native.minimumTouchTarget,
|
|
6686
6786
|
alignItems: "center",
|
|
6687
6787
|
justifyContent: "center",
|
|
6688
6788
|
flexDirection: "row",
|
|
6689
|
-
gap:
|
|
6690
|
-
paddingHorizontal: { xs:
|
|
6691
|
-
paddingVertical: { xs:
|
|
6692
|
-
borderRadius:
|
|
6789
|
+
gap: tokens35.dimension.value6,
|
|
6790
|
+
paddingHorizontal: { xs: tokens35.dimension.value2, sm: tokens35.dimension.value8, md: tokens35.dimension.value12 }[size],
|
|
6791
|
+
paddingVertical: { xs: tokens35.dimension.value2, sm: tokens35.dimension.value4, md: tokens35.dimension.value6 }[size],
|
|
6792
|
+
borderRadius: tokens35.radius.radius6,
|
|
6693
6793
|
backgroundColor: pressed && !inline ? colors.hover : void 0,
|
|
6694
|
-
opacity: disabled ?
|
|
6794
|
+
opacity: disabled ? tokens35.states.opacity.disabled : 1
|
|
6695
6795
|
}),
|
|
6696
6796
|
children: [
|
|
6697
6797
|
/* @__PURE__ */ jsx38(
|
|
6698
6798
|
KjunIcon,
|
|
6699
6799
|
{
|
|
6700
6800
|
name: copied ? "check" : "copy",
|
|
6701
|
-
size:
|
|
6801
|
+
size: tokens35.button.iconSizes[size],
|
|
6702
6802
|
color: copied ? colors.success : colors.textSecondary
|
|
6703
6803
|
}
|
|
6704
6804
|
),
|
|
@@ -6773,12 +6873,12 @@ function KjunExternalLink({
|
|
|
6773
6873
|
accessibilityRole: "link",
|
|
6774
6874
|
accessibilityLabel: name ? name + m.newWindow : void 0,
|
|
6775
6875
|
onPress: () => openUrl(url),
|
|
6776
|
-
style: { alignSelf: "flex-start", minHeight:
|
|
6876
|
+
style: { alignSelf: "flex-start", minHeight: tokens35.native.minimumTouchTarget, justifyContent: "center" },
|
|
6777
6877
|
children: mode === "text" ? (
|
|
6778
6878
|
// Like Web, text links show the new-window cue after the text.
|
|
6779
|
-
/* @__PURE__ */ jsxs23(View30, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6879
|
+
/* @__PURE__ */ jsxs23(View30, { style: { flexDirection: "row", alignItems: "center", gap: tokens35.dimension.value4 }, children: [
|
|
6780
6880
|
body,
|
|
6781
|
-
/* @__PURE__ */ jsx38(KjunIcon, { name: "external-link", size:
|
|
6881
|
+
/* @__PURE__ */ jsx38(KjunIcon, { name: "external-link", size: tokens35.iconSizes.small, color: colors.text })
|
|
6782
6882
|
] })
|
|
6783
6883
|
) : body
|
|
6784
6884
|
}
|
|
@@ -6798,7 +6898,7 @@ function KjunScrollFade({ children }) {
|
|
|
6798
6898
|
|
|
6799
6899
|
// packages/native/src/data-state.tsx
|
|
6800
6900
|
import {
|
|
6801
|
-
tokens as
|
|
6901
|
+
tokens as tokens36,
|
|
6802
6902
|
advanceQueryDisplay,
|
|
6803
6903
|
initialQueryDisplay,
|
|
6804
6904
|
queryDisplayStatus
|
|
@@ -6861,7 +6961,7 @@ function KjunDataState({
|
|
|
6861
6961
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
6862
6962
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
6863
6963
|
retryText != null ? retryText : retryText = m.retry;
|
|
6864
|
-
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 =
|
|
6964
|
+
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 = tokens36.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
6865
6965
|
const { colors } = useKjunStyles();
|
|
6866
6966
|
return /* @__PURE__ */ jsxs24(
|
|
6867
6967
|
View31,
|
|
@@ -6876,13 +6976,13 @@ function KjunDataState({
|
|
|
6876
6976
|
style: {
|
|
6877
6977
|
alignSelf: "flex-end",
|
|
6878
6978
|
maxWidth: "100%",
|
|
6879
|
-
marginBottom:
|
|
6979
|
+
marginBottom: tokens36.dimension.value12,
|
|
6880
6980
|
flexDirection: "row",
|
|
6881
6981
|
alignItems: "center",
|
|
6882
|
-
gap:
|
|
6883
|
-
paddingVertical:
|
|
6884
|
-
paddingHorizontal:
|
|
6885
|
-
borderRadius:
|
|
6982
|
+
gap: tokens36.dimension.value6,
|
|
6983
|
+
paddingVertical: tokens36.dimension.value4,
|
|
6984
|
+
paddingHorizontal: tokens36.dimension.value8,
|
|
6985
|
+
borderRadius: tokens36.radius.radius12,
|
|
6886
6986
|
backgroundColor: colors.surface
|
|
6887
6987
|
},
|
|
6888
6988
|
children: [
|
|
@@ -6898,7 +6998,7 @@ function KjunDataState({
|
|
|
6898
6998
|
"aria-hidden": revealed ? void 0 : true,
|
|
6899
6999
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
6900
7000
|
style: { paddingVertical: loadingPadding === "none" ? 0 : padding, opacity: revealed ? void 0 : 0 },
|
|
6901
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx39(View31, { style: { gap:
|
|
7001
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ jsx39(View31, { style: { gap: tokens36.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx39(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ jsxs24(View31, { style: { alignItems: "center", gap: tokens36.dimension.value12 }, children: [
|
|
6902
7002
|
/* @__PURE__ */ jsx39(KjunSpinner, { size: "md" }),
|
|
6903
7003
|
/* @__PURE__ */ jsx39(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
6904
7004
|
] }))
|
|
@@ -6917,12 +7017,12 @@ function KjunDataState({
|
|
|
6917
7017
|
right: 0,
|
|
6918
7018
|
opacity: 0,
|
|
6919
7019
|
...Platform24.OS === "web" ? { visibility: "hidden" } : {}
|
|
6920
|
-
} : { opacity: query.loading && !state.usesQueryState ?
|
|
7020
|
+
} : { opacity: query.loading && !state.usesQueryState ? tokens36.states.opacity.pending : 1 },
|
|
6921
7021
|
children: content(children)
|
|
6922
7022
|
},
|
|
6923
7023
|
"content"
|
|
6924
7024
|
),
|
|
6925
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ jsx39(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx39(View31, { style: { marginTop:
|
|
7025
|
+
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ jsx39(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ jsx39(View31, { style: { marginTop: tokens36.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)) }) }) })
|
|
6926
7026
|
]
|
|
6927
7027
|
}
|
|
6928
7028
|
);
|
|
@@ -6930,7 +7030,7 @@ function KjunDataState({
|
|
|
6930
7030
|
function BoundaryDescription() {
|
|
6931
7031
|
const m = useKjunMessages();
|
|
6932
7032
|
const { colors } = useKjunStyles();
|
|
6933
|
-
return /* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...
|
|
7033
|
+
return /* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...tokens36.typography.caption, fontSizePx: tokens36.extensions.state.descriptionSize }), color: colors.textSecondary, textAlign: "center" }, children: m.retryHint });
|
|
6934
7034
|
}
|
|
6935
7035
|
var KjunErrorBoundary = class extends Component {
|
|
6936
7036
|
constructor() {
|
|
@@ -6950,13 +7050,13 @@ var KjunErrorBoundary = class extends Component {
|
|
|
6950
7050
|
{
|
|
6951
7051
|
style: {
|
|
6952
7052
|
alignItems: "center",
|
|
6953
|
-
paddingVertical:
|
|
6954
|
-
paddingHorizontal:
|
|
6955
|
-
gap:
|
|
7053
|
+
paddingVertical: tokens36.dimension.value64,
|
|
7054
|
+
paddingHorizontal: tokens36.dimension.value24,
|
|
7055
|
+
gap: tokens36.dimension.value16
|
|
6956
7056
|
},
|
|
6957
7057
|
children: [
|
|
6958
|
-
/* @__PURE__ */ jsxs24(View31, { style: { gap:
|
|
6959
|
-
/* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...
|
|
7058
|
+
/* @__PURE__ */ jsxs24(View31, { style: { gap: tokens36.dimension.value8, alignItems: "center" }, children: [
|
|
7059
|
+
/* @__PURE__ */ jsx39(KText, { style: { ...typeStyle({ ...tokens36.typography.sectionTitle, fontSizePx: tokens36.extensions.state.titleSize }), textAlign: "center" }, children: this.props.fallbackMessage || this.context.messages.somethingWentWrong }),
|
|
6960
7060
|
/* @__PURE__ */ jsx39(BoundaryDescription, {})
|
|
6961
7061
|
] }),
|
|
6962
7062
|
/* @__PURE__ */ jsx39(
|
|
@@ -6979,7 +7079,7 @@ var KjunErrorBoundary = class extends Component {
|
|
|
6979
7079
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
6980
7080
|
|
|
6981
7081
|
// packages/native/src/skeletons.tsx
|
|
6982
|
-
import { tokens as
|
|
7082
|
+
import { tokens as tokens40 } from "@kjun-ui/tokens";
|
|
6983
7083
|
import { useEffect as useEffect23, useRef as useRef28, useState as useState32 } from "react";
|
|
6984
7084
|
import { Animated as Animated17, Platform as Platform25, View as View33, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
6985
7085
|
import Svg5, { Path as Path4 } from "react-native-svg";
|
|
@@ -7003,12 +7103,12 @@ function chartSkeletonKind(kind) {
|
|
|
7003
7103
|
}
|
|
7004
7104
|
|
|
7005
7105
|
// packages/native/src/market-skeleton.tsx
|
|
7006
|
-
import { tokens as
|
|
7106
|
+
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
7007
7107
|
import { ScrollView as ScrollView8, View as View32 } from "react-native";
|
|
7008
7108
|
|
|
7009
7109
|
// shared/package-runtime/market-layout.ts
|
|
7010
|
-
import { tokens as
|
|
7011
|
-
var marketGeometry =
|
|
7110
|
+
import { tokens as tokens37 } from "@kjun-ui/tokens";
|
|
7111
|
+
var marketGeometry = tokens37.extensions.marketTable;
|
|
7012
7112
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
7013
7113
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
7014
7114
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -7026,33 +7126,33 @@ function nativeMarketLayout(columns, showActions, containerWidth) {
|
|
|
7026
7126
|
}
|
|
7027
7127
|
|
|
7028
7128
|
// packages/native/src/market-layout.ts
|
|
7029
|
-
import { tokens as
|
|
7129
|
+
import { tokens as tokens38 } from "@kjun-ui/tokens";
|
|
7030
7130
|
import { useState as useState31 } from "react";
|
|
7031
7131
|
function useMarketLayout(columns, showActions) {
|
|
7032
7132
|
const [containerWidth, setContainerWidth] = useState31(0);
|
|
7033
7133
|
const onLayout = (event) => setContainerWidth(event.nativeEvent.layout.width);
|
|
7034
7134
|
return { ...nativeMarketLayout(columns, showActions, containerWidth), onLayout };
|
|
7035
7135
|
}
|
|
7036
|
-
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth:
|
|
7037
|
-
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth:
|
|
7136
|
+
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth: tokens38.border.defaultWidth };
|
|
7137
|
+
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth: tokens38.border.defaultWidth };
|
|
7038
7138
|
|
|
7039
7139
|
// packages/native/src/market-skeleton.tsx
|
|
7040
7140
|
import { jsx as jsx40, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7041
7141
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false }) {
|
|
7042
7142
|
const { colors } = useKjunStyles();
|
|
7043
7143
|
const cols = normalizeMarketColumns(columns), layout = useMarketLayout(cols, showActions);
|
|
7044
|
-
const actions = { width: marketGeometry.actionsWidth, paddingVertical:
|
|
7144
|
+
const actions = { width: marketGeometry.actionsWidth, paddingVertical: tokens39.dimension.value12, paddingHorizontal: tokens39.dimension.value4, justifyContent: "center", alignItems: "center" };
|
|
7045
7145
|
return /* @__PURE__ */ jsx40(ScrollView8, { horizontal: true, onLayout: layout.onLayout, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: /* @__PURE__ */ jsxs25(View32, { style: { width: layout.width }, children: [
|
|
7046
7146
|
/* @__PURE__ */ jsxs25(View32, { style: { ...marketHeaderStyle, borderBottomColor: colors.border }, children: [
|
|
7047
|
-
showActions && /* @__PURE__ */ jsx40(View32, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width:
|
|
7048
|
-
cols.map((col, i) => /* @__PURE__ */ jsx40(View32, { style: { width: layout.widths[i], padding:
|
|
7147
|
+
showActions && /* @__PURE__ */ jsx40(View32, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: tokens39.extensions.marketTable.actionSkeletonWidth, height: tokens39.extensions.marketTable.headerSkeletonHeight }) }),
|
|
7148
|
+
cols.map((col, i) => /* @__PURE__ */ jsx40(View32, { style: { width: layout.widths[i], padding: tokens39.dimension.value12, justifyContent: "center" }, children: /* @__PURE__ */ jsx40(KText, { style: { ...typeStyle("meta"), color: colors.textTertiary, textAlign: col.align }, children: col.label }) }, col.key || i))
|
|
7049
7149
|
] }),
|
|
7050
7150
|
Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ jsxs25(View32, { style: { ...marketRowStyle, borderBottomColor: colors.border }, children: [
|
|
7051
|
-
showActions && /* @__PURE__ */ jsx40(View32, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width:
|
|
7052
|
-
cols.map((col, i) => /* @__PURE__ */ jsx40(View32, { style: { width: layout.widths[i], paddingVertical:
|
|
7053
|
-
/* @__PURE__ */ jsx40(View32, { style: { height:
|
|
7054
|
-
/* @__PURE__ */ jsx40(View32, { style: { height:
|
|
7055
|
-
] }) : /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width:
|
|
7151
|
+
showActions && /* @__PURE__ */ jsx40(View32, { style: actions, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: tokens39.extensions.marketTable.actionSkeletonWidth, height: tokens39.extensions.financial.priceSkeletonHeight }) }),
|
|
7152
|
+
cols.map((col, i) => /* @__PURE__ */ jsx40(View32, { style: { width: layout.widths[i], paddingVertical: tokens39.dimension.value14, paddingHorizontal: tokens39.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__ */ jsxs25(View32, { style: { gap: tokens39.dimension.value2 }, children: [
|
|
7153
|
+
/* @__PURE__ */ jsx40(View32, { style: { height: tokens39.typography.body.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: "80%", height: tokens39.extensions.skeleton.lineHeights.md }) }),
|
|
7154
|
+
/* @__PURE__ */ jsx40(View32, { style: { height: tokens39.typography.caption.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: "60%", height: tokens39.extensions.skeleton.lineHeights.sm }) })
|
|
7155
|
+
] }) : /* @__PURE__ */ jsx40(KjunSkeleton, { type: "block", width: tokens39.extensions.financial.priceSkeletonWidth, height: tokens39.extensions.financial.priceSkeletonHeight }) }, col.key || i))
|
|
7056
7156
|
] }, row))
|
|
7057
7157
|
] }) });
|
|
7058
7158
|
}
|
|
@@ -7063,11 +7163,11 @@ function KjunListSkeleton({
|
|
|
7063
7163
|
rows = 8,
|
|
7064
7164
|
variant = "market",
|
|
7065
7165
|
avatar = true,
|
|
7066
|
-
avatarSize =
|
|
7166
|
+
avatarSize = tokens40.extensions.skeleton.listAvatarSize,
|
|
7067
7167
|
quote = true
|
|
7068
7168
|
}) {
|
|
7069
7169
|
const { colors } = useKjunStyles();
|
|
7070
|
-
const market = variant === "market", narrow = useWindowDimensions6().width <
|
|
7170
|
+
const market = variant === "market", narrow = useWindowDimensions6().width < tokens40.responsive.market;
|
|
7071
7171
|
const slots = market ? [typeStyle(narrow ? "input" : "label").lineHeight, typeStyle(narrow ? "body" : "caption").lineHeight] : null;
|
|
7072
7172
|
const slot = (index, child) => slots ? /* @__PURE__ */ jsx41(View33, { style: { height: slots[index], justifyContent: "center" }, children: child }) : child;
|
|
7073
7173
|
return /* @__PURE__ */ jsx41(
|
|
@@ -7081,29 +7181,29 @@ function KjunListSkeleton({
|
|
|
7081
7181
|
style: {
|
|
7082
7182
|
flexDirection: "row",
|
|
7083
7183
|
alignItems: "center",
|
|
7084
|
-
gap:
|
|
7085
|
-
minHeight: market ? narrow ?
|
|
7086
|
-
paddingVertical: market ? narrow ?
|
|
7087
|
-
paddingHorizontal: market ? narrow ?
|
|
7088
|
-
borderBottomWidth:
|
|
7184
|
+
gap: tokens40.extensions.skeleton.gap,
|
|
7185
|
+
minHeight: market ? narrow ? tokens40.extensions.marketList.minimumHeight : void 0 : tokens40.extensions.skeleton.listHeights[variant],
|
|
7186
|
+
paddingVertical: market ? narrow ? tokens40.dimension.value14 : tokens40.dimension.value16 : tokens40.extensions.skeleton.list[variant].paddingY,
|
|
7187
|
+
paddingHorizontal: market ? narrow ? tokens40.dimension.value20 : tokens40.dimension.value16 : tokens40.extensions.skeleton.list[variant].paddingX,
|
|
7188
|
+
borderBottomWidth: tokens40.border.defaultWidth,
|
|
7089
7189
|
borderBottomColor: colors.border
|
|
7090
7190
|
},
|
|
7091
7191
|
children: [
|
|
7092
7192
|
avatar && /* @__PURE__ */ jsx41(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
7093
|
-
/* @__PURE__ */ jsxs26(View33, { style: { flex: 1, minWidth: 0, gap: market ?
|
|
7193
|
+
/* @__PURE__ */ jsxs26(View33, { style: { flex: 1, minWidth: 0, gap: market ? tokens40.dimension.value2 : tokens40.extensions.skeleton.detailGap }, children: [
|
|
7094
7194
|
slot(0, /* @__PURE__ */ jsx41(
|
|
7095
7195
|
KjunSkeleton,
|
|
7096
7196
|
{
|
|
7097
7197
|
type: "block",
|
|
7098
|
-
height:
|
|
7198
|
+
height: tokens40.extensions.skeleton.lineHeights.md,
|
|
7099
7199
|
width: i % 2 ? "80%" : "65%"
|
|
7100
7200
|
}
|
|
7101
7201
|
)),
|
|
7102
|
-
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7202
|
+
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens40.extensions.skeleton.lineHeights.sm, width: "50%" }))
|
|
7103
7203
|
] }),
|
|
7104
|
-
quote && /* @__PURE__ */ jsxs26(View33, { style: { alignItems: "flex-end", gap: market ?
|
|
7105
|
-
slot(0, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7106
|
-
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7204
|
+
quote && /* @__PURE__ */ jsxs26(View33, { style: { alignItems: "flex-end", gap: market ? tokens40.dimension.value2 : tokens40.extensions.skeleton.detailGap }, children: [
|
|
7205
|
+
slot(0, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens40.extensions.skeleton.quoteHeight, width: tokens40.extensions.skeleton.quoteWidth })),
|
|
7206
|
+
slot(1, /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens40.extensions.skeleton.lineHeights.sm, width: tokens40.extensions.skeleton.detailWidth }))
|
|
7107
7207
|
] })
|
|
7108
7208
|
]
|
|
7109
7209
|
},
|
|
@@ -7120,7 +7220,7 @@ function KjunFormSkeleton({
|
|
|
7120
7220
|
}) {
|
|
7121
7221
|
const { colors } = useKjunStyles();
|
|
7122
7222
|
const window2 = useWindowDimensions6();
|
|
7123
|
-
const twoColumns = columns === 2 && window2.width >=
|
|
7223
|
+
const twoColumns = columns === 2 && window2.width >= tokens40.responsive.formColumns;
|
|
7124
7224
|
return /* @__PURE__ */ jsx41(
|
|
7125
7225
|
View33,
|
|
7126
7226
|
{
|
|
@@ -7129,13 +7229,13 @@ function KjunFormSkeleton({
|
|
|
7129
7229
|
style: {
|
|
7130
7230
|
flexDirection: twoColumns ? "row" : "column",
|
|
7131
7231
|
flexWrap: twoColumns ? "wrap" : "nowrap",
|
|
7132
|
-
gap:
|
|
7232
|
+
gap: tokens40.extensions.skeleton.formGap
|
|
7133
7233
|
},
|
|
7134
7234
|
children: fields.map((field, i) => /* @__PURE__ */ jsxs26(
|
|
7135
7235
|
View33,
|
|
7136
7236
|
{
|
|
7137
7237
|
style: {
|
|
7138
|
-
gap:
|
|
7238
|
+
gap: tokens40.extensions.skeleton.fieldGap,
|
|
7139
7239
|
minWidth: 0,
|
|
7140
7240
|
flexBasis: twoColumns ? "45%" : void 0,
|
|
7141
7241
|
flexGrow: 1
|
|
@@ -7143,13 +7243,13 @@ function KjunFormSkeleton({
|
|
|
7143
7243
|
children: [
|
|
7144
7244
|
field ? /* @__PURE__ */ jsx41(KText, { style: { color: colors.text, ...typeStyle("label") }, children: typeof field === "string" ? field : field.label }) : (
|
|
7145
7245
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
7146
|
-
/* @__PURE__ */ jsx41(View33, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height:
|
|
7246
|
+
/* @__PURE__ */ jsx41(View33, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ jsx41(KjunSkeleton, { type: "block", height: tokens40.extensions.skeleton.formLabelHeight, width: tokens40.extensions.skeleton.formLabelWidth }) })
|
|
7147
7247
|
),
|
|
7148
|
-
/* @__PURE__ */ jsx41(View33, { style: { borderRadius:
|
|
7248
|
+
/* @__PURE__ */ jsx41(View33, { style: { borderRadius: tokens40.input[size].radius, overflow: "hidden" }, children: /* @__PURE__ */ jsx41(
|
|
7149
7249
|
KjunSkeleton,
|
|
7150
7250
|
{
|
|
7151
7251
|
type: "block",
|
|
7152
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
7252
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? tokens40.input[size].lineHeight * 3 + tokens40.input[size].textareaPaddingY * 2 + 2 * tokens40.border.controlWidth : tokens40.input[size].height
|
|
7153
7253
|
}
|
|
7154
7254
|
) })
|
|
7155
7255
|
]
|
|
@@ -7162,7 +7262,7 @@ function KjunFormSkeleton({
|
|
|
7162
7262
|
var chartPart = (name) => Platform25.OS === "web" ? { dataSet: { kjunChartPart: name } } : {};
|
|
7163
7263
|
function KjunChartSkeleton({
|
|
7164
7264
|
kind: requestedKind = "frame",
|
|
7165
|
-
height =
|
|
7265
|
+
height = tokens40.extensions.chartSkeleton.height,
|
|
7166
7266
|
loadingText,
|
|
7167
7267
|
skeleton = true,
|
|
7168
7268
|
loadingDelay = 0,
|
|
@@ -7171,13 +7271,13 @@ function KjunChartSkeleton({
|
|
|
7171
7271
|
}) {
|
|
7172
7272
|
const m = useKjunMessages();
|
|
7173
7273
|
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
7174
|
-
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef28(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState32(0), thickness =
|
|
7274
|
+
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = useRef28(new Animated17.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = useState32(0), thickness = tokens40.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" };
|
|
7175
7275
|
useEffect23(() => {
|
|
7176
7276
|
if (reduced || !skeleton) return;
|
|
7177
7277
|
const loop = Animated17.loop(
|
|
7178
7278
|
Animated17.sequence([
|
|
7179
|
-
Animated17.timing(opacity, { toValue: 0.55, duration:
|
|
7180
|
-
Animated17.timing(opacity, { toValue: 1, duration:
|
|
7279
|
+
Animated17.timing(opacity, { toValue: 0.55, duration: tokens40.motion.shimmer / 2, useNativeDriver: true }),
|
|
7280
|
+
Animated17.timing(opacity, { toValue: 1, duration: tokens40.motion.shimmer / 2, useNativeDriver: true })
|
|
7181
7281
|
])
|
|
7182
7282
|
);
|
|
7183
7283
|
loop.start();
|
|
@@ -7194,7 +7294,7 @@ function KjunChartSkeleton({
|
|
|
7194
7294
|
"aria-hidden": revealed ? void 0 : true,
|
|
7195
7295
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
7196
7296
|
...Platform25.OS === "web" ? { dataSet: { kjunChartKind: kind, skeleton: skeleton ? void 0 : "false" } } : {},
|
|
7197
|
-
children: !skeleton ? /* @__PURE__ */ jsxs26(View33, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap:
|
|
7297
|
+
children: !skeleton ? /* @__PURE__ */ jsxs26(View33, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap: tokens40.dimension.value12 }, children: [
|
|
7198
7298
|
/* @__PURE__ */ jsx41(View33, { ...hidden, children: /* @__PURE__ */ jsx41(KjunSpinner, { size: "md" }) }),
|
|
7199
7299
|
!!loadingText && /* @__PURE__ */ jsx41(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
7200
7300
|
] }) : /* @__PURE__ */ jsxs26(Fragment12, { children: [
|
|
@@ -7203,21 +7303,21 @@ function KjunChartSkeleton({
|
|
|
7203
7303
|
{
|
|
7204
7304
|
...chartPart("donut"),
|
|
7205
7305
|
...hidden,
|
|
7206
|
-
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius:
|
|
7306
|
+
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius: tokens40.radius.radius9999 }
|
|
7207
7307
|
}
|
|
7208
|
-
) : kind === "matrix" ? /* @__PURE__ */ jsx41(View33, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap:
|
|
7308
|
+
) : kind === "matrix" ? /* @__PURE__ */ jsx41(View33, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap: tokens40.dimension.value4 }, children: Array.from({ length: rowCount }, (_, row) => /* @__PURE__ */ jsx41(View33, { style: { flex: 1, flexDirection: "row", gap: tokens40.dimension.value4 }, children: Array.from({ length: columnCount }, (_2, column) => /* @__PURE__ */ jsx41(
|
|
7209
7309
|
View33,
|
|
7210
7310
|
{
|
|
7211
7311
|
...chartPart("cell"),
|
|
7212
7312
|
style: {
|
|
7213
7313
|
flex: 1,
|
|
7214
|
-
borderRadius:
|
|
7314
|
+
borderRadius: tokens40.extensions.skeleton.lineRadius,
|
|
7215
7315
|
backgroundColor: colors.skeleton,
|
|
7216
|
-
opacity: chartMatrixMuted(row, column) ?
|
|
7316
|
+
opacity: chartMatrixMuted(row, column) ? tokens40.states.opacity.pending : 1
|
|
7217
7317
|
}
|
|
7218
7318
|
},
|
|
7219
7319
|
column
|
|
7220
|
-
)) }, row)) }) : /* @__PURE__ */ jsx41(View33, { ...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:
|
|
7320
|
+
)) }, row)) }) : /* @__PURE__ */ jsx41(View33, { ...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: tokens40.border.defaultWidth, vectorEffect: "non-scaling-stroke" }) }) }),
|
|
7221
7321
|
!!loadingText && /* @__PURE__ */ jsx41(
|
|
7222
7322
|
View33,
|
|
7223
7323
|
{
|
|
@@ -7231,10 +7331,10 @@ function KjunChartSkeleton({
|
|
|
7231
7331
|
{
|
|
7232
7332
|
style: {
|
|
7233
7333
|
...typeStyle("body"),
|
|
7234
|
-
paddingHorizontal:
|
|
7235
|
-
paddingVertical:
|
|
7236
|
-
borderRadius:
|
|
7237
|
-
borderWidth: kind === "donut" ? 0 :
|
|
7334
|
+
paddingHorizontal: tokens40.dimension.value12,
|
|
7335
|
+
paddingVertical: tokens40.dimension.value4,
|
|
7336
|
+
borderRadius: tokens40.radius.radius6,
|
|
7337
|
+
borderWidth: kind === "donut" ? 0 : tokens40.border.defaultWidth,
|
|
7238
7338
|
borderColor: colors.chartGrid,
|
|
7239
7339
|
backgroundColor: colors.surface,
|
|
7240
7340
|
color: colors.textSecondary,
|
|
@@ -7252,7 +7352,7 @@ function KjunChartSkeleton({
|
|
|
7252
7352
|
}
|
|
7253
7353
|
|
|
7254
7354
|
// packages/native/src/financial-display.tsx
|
|
7255
|
-
import { deviationLevel, tokens as
|
|
7355
|
+
import { deviationLevel, tokens as tokens43 } from "@kjun-ui/tokens";
|
|
7256
7356
|
import { useId as useId8 } from "react";
|
|
7257
7357
|
import {
|
|
7258
7358
|
View as View35
|
|
@@ -7267,13 +7367,13 @@ import Svg6, {
|
|
|
7267
7367
|
} from "react-native-svg";
|
|
7268
7368
|
|
|
7269
7369
|
// packages/native/src/number-display.tsx
|
|
7270
|
-
import { tokens as
|
|
7370
|
+
import { tokens as tokens42 } from "@kjun-ui/tokens";
|
|
7271
7371
|
|
|
7272
7372
|
// shared/package-runtime/use-number-motion.ts
|
|
7273
7373
|
import { useLayoutEffect as useLayoutEffect12, useRef as useRef29, useState as useState33 } from "react";
|
|
7274
7374
|
|
|
7275
7375
|
// shared/package-runtime/number-motion.ts
|
|
7276
|
-
import { tokens as
|
|
7376
|
+
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
7277
7377
|
function createNumberMotion(apply) {
|
|
7278
7378
|
let frame = 0, revision = 0, current = 0;
|
|
7279
7379
|
let previous;
|
|
@@ -7304,7 +7404,7 @@ function createNumberMotion(apply) {
|
|
|
7304
7404
|
if (from === target) return;
|
|
7305
7405
|
const tick = (now) => {
|
|
7306
7406
|
if (version !== revision) return;
|
|
7307
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
7407
|
+
const progress = Math.min(1, Math.max(0, (now - started) / tokens41.motion.number));
|
|
7308
7408
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
7309
7409
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
7310
7410
|
};
|
|
@@ -7393,7 +7493,7 @@ function KjunFreshness({
|
|
|
7393
7493
|
KjunTooltip,
|
|
7394
7494
|
{
|
|
7395
7495
|
content: (source === "close" ? scope.messages.noRealtimeQuote : scope.messages.realtimeDelayed) + (fetchedAt ? " \xB7 " + ((formatter == null ? void 0 : formatter(fetchedAt)) || formatRelativeTime(fetchedAt, void 0, scope)) : ""),
|
|
7396
|
-
children: /* @__PURE__ */ jsx42(AccessiblePressable, { accessibilityLabel: label, focusRingRadius:
|
|
7496
|
+
children: /* @__PURE__ */ jsx42(AccessiblePressable, { accessibilityLabel: label, focusRingRadius: tokens42.extensions.badge.radius, children: /* @__PURE__ */ jsx42(KjunBadge, { variant: "warning", size: "xs", children: label }) })
|
|
7397
7497
|
}
|
|
7398
7498
|
) : null;
|
|
7399
7499
|
}
|
|
@@ -7407,11 +7507,11 @@ function KjunPriceCell({
|
|
|
7407
7507
|
fromPrevious = true
|
|
7408
7508
|
}) {
|
|
7409
7509
|
const { colors } = useKjunStyles(), quoteType = useContext18(MarketQuoteTypeContext);
|
|
7410
|
-
return value == null ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height:
|
|
7510
|
+
return value == null ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", height: tokens42.extensions.financial.priceSkeletonHeight, width: tokens42.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs27(View34, { style: { flexDirection: "row", alignItems: "center", gap: tokens42.extensions.financial.affixGap }, children: [
|
|
7411
7511
|
/* @__PURE__ */ jsx42(
|
|
7412
7512
|
View34,
|
|
7413
7513
|
{
|
|
7414
|
-
style: quoteType ? void 0 : { paddingVertical:
|
|
7514
|
+
style: quoteType ? void 0 : { paddingVertical: tokens42.extensions.financial.pillPaddingY, paddingHorizontal: tokens42.extensions.financial.pillPaddingX, borderRadius: tokens42.radius.radius9999 },
|
|
7415
7515
|
children: /* @__PURE__ */ jsx42(
|
|
7416
7516
|
KjunAnimatedNumber,
|
|
7417
7517
|
{
|
|
@@ -7450,14 +7550,14 @@ function KjunSignedValue({
|
|
|
7450
7550
|
flexDirection: "row",
|
|
7451
7551
|
alignItems: "center",
|
|
7452
7552
|
alignSelf: "flex-start",
|
|
7453
|
-
gap:
|
|
7454
|
-
paddingVertical: tone === "pill" ?
|
|
7455
|
-
paddingHorizontal: tone === "pill" ?
|
|
7456
|
-
borderRadius:
|
|
7553
|
+
gap: tokens42.extensions.financial.affixGap,
|
|
7554
|
+
paddingVertical: tone === "pill" ? tokens42.extensions.financial.pillPaddingY : 0,
|
|
7555
|
+
paddingHorizontal: tone === "pill" ? tokens42.extensions.financial.pillPaddingX : 0,
|
|
7556
|
+
borderRadius: tokens42.extensions.financial.pillRadius,
|
|
7457
7557
|
backgroundColor: tone === "pill" && !stale && !loading && n !== null ? domainColor(domainColors, role + "Bg") : void 0
|
|
7458
7558
|
},
|
|
7459
7559
|
children: [
|
|
7460
|
-
loading ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", width:
|
|
7560
|
+
loading ? /* @__PURE__ */ jsx42(KjunSkeleton, { type: "block", width: tokens42.extensions.financial.signedSkeletonWidth, height: tokens42.extensions.financial.signedSkeletonHeight }) : /* @__PURE__ */ jsx42(
|
|
7461
7561
|
KText,
|
|
7462
7562
|
{
|
|
7463
7563
|
style: {
|
|
@@ -7479,7 +7579,7 @@ function KjunSignedValue({
|
|
|
7479
7579
|
|
|
7480
7580
|
// packages/native/src/financial-display.tsx
|
|
7481
7581
|
import { Fragment as Fragment13, jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7482
|
-
var deviationFill = { neutral: 1, low:
|
|
7582
|
+
var deviationFill = { neutral: 1, low: tokens43.states.opacity.deviationLow, medium: tokens43.states.opacity.deviationMedium, strong: tokens43.states.opacity.deviationStrong };
|
|
7483
7583
|
function KjunDeviation({
|
|
7484
7584
|
value,
|
|
7485
7585
|
variant = "pill",
|
|
@@ -7500,7 +7600,7 @@ function KjunDeviation({
|
|
|
7500
7600
|
flexDirection: "row",
|
|
7501
7601
|
alignItems: "center",
|
|
7502
7602
|
justifyContent: "flex-end",
|
|
7503
|
-
gap:
|
|
7603
|
+
gap: tokens43.extensions.financial.badgeGap
|
|
7504
7604
|
},
|
|
7505
7605
|
children: [
|
|
7506
7606
|
/* @__PURE__ */ jsx43(
|
|
@@ -7519,22 +7619,22 @@ function KjunDeviation({
|
|
|
7519
7619
|
}, children: label })
|
|
7520
7620
|
}
|
|
7521
7621
|
),
|
|
7522
|
-
!signal && /* @__PURE__ */ jsx43(View35, { style: { width:
|
|
7622
|
+
!signal && /* @__PURE__ */ jsx43(View35, { style: { width: tokens43.extensions.financial.warningIconSize, flexShrink: 0 } }),
|
|
7523
7623
|
signal && /* @__PURE__ */ jsx43(Fragment13, { children: /* @__PURE__ */ jsx43(View35, { style: { alignSelf: "center" }, children: /* @__PURE__ */ jsx43(KjunTooltip, { content: m.deviationWarning(signalThreshold), children: /* @__PURE__ */ jsx43(
|
|
7524
7624
|
AccessiblePressable,
|
|
7525
7625
|
{
|
|
7526
7626
|
accessibilityRole: "image",
|
|
7527
7627
|
accessibilityLabel: m.arbitrage,
|
|
7528
7628
|
focusRingInset: true,
|
|
7529
|
-
focusRingRadius:
|
|
7629
|
+
focusRingRadius: tokens43.radius.radius4,
|
|
7530
7630
|
style: {
|
|
7531
|
-
width:
|
|
7532
|
-
height:
|
|
7533
|
-
margin: (
|
|
7631
|
+
width: tokens43.extensions.financial.warningTargetSize,
|
|
7632
|
+
height: tokens43.extensions.financial.warningTargetSize,
|
|
7633
|
+
margin: (tokens43.extensions.financial.warningIconSize - tokens43.extensions.financial.warningTargetSize) / 2,
|
|
7534
7634
|
alignItems: "center",
|
|
7535
7635
|
justifyContent: "center"
|
|
7536
7636
|
},
|
|
7537
|
-
children: /* @__PURE__ */ jsx43(KjunIcon, { name: "alert-triangle", size:
|
|
7637
|
+
children: /* @__PURE__ */ jsx43(KjunIcon, { name: "alert-triangle", size: tokens43.extensions.financial.warningIconSize, color: colors.warning })
|
|
7538
7638
|
}
|
|
7539
7639
|
) }) }) })
|
|
7540
7640
|
]
|
|
@@ -7546,9 +7646,9 @@ function KjunDeviation({
|
|
|
7546
7646
|
style: {
|
|
7547
7647
|
alignSelf: "flex-start",
|
|
7548
7648
|
position: "relative",
|
|
7549
|
-
borderRadius:
|
|
7550
|
-
paddingVertical: variant === "pill" ?
|
|
7551
|
-
paddingHorizontal: variant === "pill" ?
|
|
7649
|
+
borderRadius: tokens43.extensions.financial.cellRadius,
|
|
7650
|
+
paddingVertical: variant === "pill" ? tokens43.extensions.financial.pillPaddingY : 0,
|
|
7651
|
+
paddingHorizontal: variant === "pill" ? tokens43.extensions.financial.pillPaddingX : 0
|
|
7552
7652
|
},
|
|
7553
7653
|
children: [
|
|
7554
7654
|
variant === "pill" && /* @__PURE__ */ jsx43(
|
|
@@ -7558,7 +7658,7 @@ function KjunDeviation({
|
|
|
7558
7658
|
style: {
|
|
7559
7659
|
position: "absolute",
|
|
7560
7660
|
inset: 0,
|
|
7561
|
-
borderRadius:
|
|
7661
|
+
borderRadius: tokens43.extensions.financial.cellRadius,
|
|
7562
7662
|
backgroundColor: neutral ? colors.secondary : color,
|
|
7563
7663
|
opacity: deviationFill[level]
|
|
7564
7664
|
}
|
|
@@ -7599,9 +7699,9 @@ function KjunHeatmapCell({
|
|
|
7599
7699
|
style: {
|
|
7600
7700
|
position: "relative",
|
|
7601
7701
|
alignSelf: "flex-start",
|
|
7602
|
-
paddingVertical:
|
|
7603
|
-
paddingHorizontal:
|
|
7604
|
-
borderRadius:
|
|
7702
|
+
paddingVertical: tokens43.extensions.financial.pillPaddingY,
|
|
7703
|
+
paddingHorizontal: tokens43.extensions.financial.pillPaddingX,
|
|
7704
|
+
borderRadius: tokens43.extensions.financial.cellRadius
|
|
7605
7705
|
},
|
|
7606
7706
|
children: [
|
|
7607
7707
|
/* @__PURE__ */ jsx43(
|
|
@@ -7611,10 +7711,10 @@ function KjunHeatmapCell({
|
|
|
7611
7711
|
style: {
|
|
7612
7712
|
position: "absolute",
|
|
7613
7713
|
inset: 0,
|
|
7614
|
-
borderRadius:
|
|
7714
|
+
borderRadius: tokens43.extensions.financial.cellRadius,
|
|
7615
7715
|
// A zero cell keeps its shape on the neutral fill; any other value starts from a visible minimum.
|
|
7616
7716
|
backgroundColor: magnitude ? background : colors.secondary,
|
|
7617
|
-
opacity: magnitude ?
|
|
7717
|
+
opacity: magnitude ? tokens43.states.opacity.heatMinimum + (tokens43.states.opacity.heatMaximum - tokens43.states.opacity.heatMinimum) * magnitude : 1
|
|
7618
7718
|
}
|
|
7619
7719
|
}
|
|
7620
7720
|
),
|
|
@@ -7632,7 +7732,7 @@ function KjunProgressCell({
|
|
|
7632
7732
|
showLabel = true,
|
|
7633
7733
|
color = "auto",
|
|
7634
7734
|
customColor,
|
|
7635
|
-
height =
|
|
7735
|
+
height = tokens43.extensions.financial.progressHeight
|
|
7636
7736
|
}) {
|
|
7637
7737
|
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;
|
|
7638
7738
|
return /* @__PURE__ */ jsxs28(
|
|
@@ -7641,8 +7741,8 @@ function KjunProgressCell({
|
|
|
7641
7741
|
style: {
|
|
7642
7742
|
flexDirection: "row",
|
|
7643
7743
|
alignItems: "center",
|
|
7644
|
-
gap:
|
|
7645
|
-
minWidth:
|
|
7744
|
+
gap: tokens43.extensions.financial.progressGap,
|
|
7745
|
+
minWidth: tokens43.extensions.financial.progressMinimumWidth
|
|
7646
7746
|
},
|
|
7647
7747
|
children: [
|
|
7648
7748
|
/* @__PURE__ */ jsx43(
|
|
@@ -7652,7 +7752,7 @@ function KjunProgressCell({
|
|
|
7652
7752
|
height,
|
|
7653
7753
|
flex: 1,
|
|
7654
7754
|
backgroundColor: colors.tertiary,
|
|
7655
|
-
borderRadius:
|
|
7755
|
+
borderRadius: tokens43.extensions.financial.progressRadius,
|
|
7656
7756
|
overflow: "hidden"
|
|
7657
7757
|
},
|
|
7658
7758
|
children: /* @__PURE__ */ jsx43(
|
|
@@ -7661,7 +7761,7 @@ function KjunProgressCell({
|
|
|
7661
7761
|
style: {
|
|
7662
7762
|
width: `${percent}%`,
|
|
7663
7763
|
height: "100%",
|
|
7664
|
-
borderRadius:
|
|
7764
|
+
borderRadius: tokens43.extensions.financial.progressRadius,
|
|
7665
7765
|
backgroundColor: color === "custom" ? customColor : colors[role]
|
|
7666
7766
|
}
|
|
7667
7767
|
}
|
|
@@ -7674,7 +7774,7 @@ function KjunProgressCell({
|
|
|
7674
7774
|
style: {
|
|
7675
7775
|
...typeStyle("caption"),
|
|
7676
7776
|
color: colors.textSecondary,
|
|
7677
|
-
minWidth:
|
|
7777
|
+
minWidth: tokens43.extensions.financial.progressLabelWidth,
|
|
7678
7778
|
textAlign: "right",
|
|
7679
7779
|
fontFamily: numericFontFamily || fontFamily,
|
|
7680
7780
|
fontVariant: ["tabular-nums"]
|
|
@@ -7695,7 +7795,7 @@ function KjunCollectionMark({
|
|
|
7695
7795
|
size = "md"
|
|
7696
7796
|
}) {
|
|
7697
7797
|
const { colors, domainColors } = useKjunStyles();
|
|
7698
|
-
const box =
|
|
7798
|
+
const box = tokens43.extensions.financial.markSizes[size], glyph = kind === "interest" ? tokens43.extensions.financial.heartMarkSizes[size] : box;
|
|
7699
7799
|
return /* @__PURE__ */ jsx43(View35, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", overflow: "visible" }, children: /* @__PURE__ */ jsx43(
|
|
7700
7800
|
KjunIcon,
|
|
7701
7801
|
{
|
|
@@ -7727,8 +7827,8 @@ function KjunExecutionStatusBadge({
|
|
|
7727
7827
|
}
|
|
7728
7828
|
function KjunSparkline({
|
|
7729
7829
|
data = [],
|
|
7730
|
-
width =
|
|
7731
|
-
height =
|
|
7830
|
+
width = tokens43.extensions.financial.sparklineWidth,
|
|
7831
|
+
height = tokens43.extensions.financial.sparklineHeight,
|
|
7732
7832
|
color,
|
|
7733
7833
|
semantic = "price",
|
|
7734
7834
|
fill = true,
|
|
@@ -7919,7 +8019,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
7919
8019
|
}
|
|
7920
8020
|
|
|
7921
8021
|
// packages/native/src/table-toolbar.tsx
|
|
7922
|
-
import { tokens as
|
|
8022
|
+
import { tokens as tokens44 } from "@kjun-ui/tokens";
|
|
7923
8023
|
import { View as View36 } from "react-native";
|
|
7924
8024
|
import { Fragment as Fragment14, jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7925
8025
|
function TableToolbar({
|
|
@@ -7939,12 +8039,12 @@ function TableToolbar({
|
|
|
7939
8039
|
const toolbarStyle = {
|
|
7940
8040
|
flexDirection: "row",
|
|
7941
8041
|
alignItems: "center",
|
|
7942
|
-
gap:
|
|
8042
|
+
gap: tokens44.dimension.value8,
|
|
7943
8043
|
flexWrap: "wrap",
|
|
7944
|
-
paddingVertical:
|
|
7945
|
-
paddingHorizontal:
|
|
8044
|
+
paddingVertical: tokens44.dimension.value8,
|
|
8045
|
+
paddingHorizontal: tokens44.dimension.value12,
|
|
7946
8046
|
backgroundColor: colors.secondary,
|
|
7947
|
-
borderBottomWidth:
|
|
8047
|
+
borderBottomWidth: tokens44.border.defaultWidth,
|
|
7948
8048
|
borderBottomColor: colors.border
|
|
7949
8049
|
};
|
|
7950
8050
|
return /* @__PURE__ */ jsxs29(Fragment14, { children: [
|
|
@@ -7972,7 +8072,7 @@ function TableToolbar({
|
|
|
7972
8072
|
),
|
|
7973
8073
|
(searchable || toolbar) && // Like Web: the search toolbar sits on the surface so the filled search field stands out from it.
|
|
7974
8074
|
/* @__PURE__ */ jsxs29(View36, { style: { ...toolbarStyle, backgroundColor: colors.surface }, children: [
|
|
7975
|
-
searchable && /* @__PURE__ */ jsx44(View36, { style: { width:
|
|
8075
|
+
searchable && /* @__PURE__ */ jsx44(View36, { style: { width: tokens44.table.searchWidth, maxWidth: "100%" }, children: /* @__PURE__ */ jsx44(
|
|
7976
8076
|
KjunInput,
|
|
7977
8077
|
{
|
|
7978
8078
|
size: "sm",
|
|
@@ -7990,7 +8090,7 @@ function TableToolbar({
|
|
|
7990
8090
|
}
|
|
7991
8091
|
|
|
7992
8092
|
// packages/native/src/table-grid.tsx
|
|
7993
|
-
import { tokens as
|
|
8093
|
+
import { tokens as tokens45 } from "@kjun-ui/tokens";
|
|
7994
8094
|
import { Fragment as Fragment15, useId as useId9, useState as useState36 } from "react";
|
|
7995
8095
|
import Svg7, { Defs as Defs3, LinearGradient as LinearGradient3, Rect as Rect3, Stop as Stop3 } from "react-native-svg";
|
|
7996
8096
|
import { ScrollView as ScrollView9, View as View37 } from "react-native";
|
|
@@ -7998,7 +8098,7 @@ import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
|
7998
8098
|
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable }) {
|
|
7999
8099
|
const m = useKjunMessages();
|
|
8000
8100
|
const { colors } = useKjunStyles();
|
|
8001
|
-
const geometry2 =
|
|
8101
|
+
const geometry2 = tokens45.table;
|
|
8002
8102
|
const [scroll, setScroll] = useState36({ viewport: 0, x: 0 }), fadeId = "kjun-table-fade-" + useId9().replace(/[^a-z0-9]/gi, "");
|
|
8003
8103
|
const cellPadding = geometry2.cellPadding[compact ? "compact" : "regular"];
|
|
8004
8104
|
const width = (col) => typeof col.width === "number" ? col.width : typeof col.width === "string" && /^\d+(px)?$/.test(col.width) ? parseFloat(col.width) : geometry2.columnWidth;
|
|
@@ -8031,7 +8131,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8031
8131
|
style: {
|
|
8032
8132
|
flexDirection: "row",
|
|
8033
8133
|
backgroundColor: colors.tableHeaderBg,
|
|
8034
|
-
borderBottomWidth:
|
|
8134
|
+
borderBottomWidth: tokens45.border.defaultWidth,
|
|
8035
8135
|
borderBottomColor: colors.border
|
|
8036
8136
|
},
|
|
8037
8137
|
children: [
|
|
@@ -8055,13 +8155,13 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8055
8155
|
onPress: () => state.sortColumn(col),
|
|
8056
8156
|
style: {
|
|
8057
8157
|
width: width(col),
|
|
8058
|
-
minHeight:
|
|
8158
|
+
minHeight: tokens45.native.minimumTouchTarget,
|
|
8059
8159
|
paddingVertical: geometry2.headerPadding.y,
|
|
8060
8160
|
paddingHorizontal: geometry2.headerPadding.x,
|
|
8061
8161
|
flexDirection: "row",
|
|
8062
8162
|
alignItems: "center",
|
|
8063
8163
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
8064
|
-
gap:
|
|
8164
|
+
gap: tokens45.dimension.value4
|
|
8065
8165
|
},
|
|
8066
8166
|
children: [
|
|
8067
8167
|
/* @__PURE__ */ jsx45(
|
|
@@ -8078,7 +8178,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8078
8178
|
KjunIcon,
|
|
8079
8179
|
{
|
|
8080
8180
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
8081
|
-
size:
|
|
8181
|
+
size: tokens45.table.sortIconSize,
|
|
8082
8182
|
color: colors.text
|
|
8083
8183
|
}
|
|
8084
8184
|
)
|
|
@@ -8105,7 +8205,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8105
8205
|
{
|
|
8106
8206
|
type: "block",
|
|
8107
8207
|
height: geometry2.skeletonHeight,
|
|
8108
|
-
width: col.key === "actions" ?
|
|
8208
|
+
width: col.key === "actions" ? tokens45.table.actionColumnWidth : "75%"
|
|
8109
8209
|
}
|
|
8110
8210
|
)
|
|
8111
8211
|
},
|
|
@@ -8121,7 +8221,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8121
8221
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8122
8222
|
style: ({ pressed }) => ({
|
|
8123
8223
|
flexDirection: "row",
|
|
8124
|
-
borderBottomWidth:
|
|
8224
|
+
borderBottomWidth: tokens45.border.defaultWidth,
|
|
8125
8225
|
borderBottomColor: colors.border,
|
|
8126
8226
|
backgroundColor: pressed && hoverable ? colors.tableRowHover : striped && i % 2 ? colors.secondary : void 0
|
|
8127
8227
|
}),
|
|
@@ -8181,7 +8281,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8181
8281
|
)
|
|
8182
8282
|
}
|
|
8183
8283
|
),
|
|
8184
|
-
fade && /* @__PURE__ */ jsx45(View37, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
8284
|
+
fade && /* @__PURE__ */ jsx45(View37, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: tokens45.extensions.scrollFade.width }, children: /* @__PURE__ */ jsxs30(Svg7, { width: "100%", height: "100%", children: [
|
|
8185
8285
|
/* @__PURE__ */ jsx45(Defs3, { children: /* @__PURE__ */ jsxs30(LinearGradient3, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
8186
8286
|
/* @__PURE__ */ jsx45(Stop3, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
8187
8287
|
/* @__PURE__ */ jsx45(Stop3, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -8192,14 +8292,14 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8192
8292
|
}
|
|
8193
8293
|
|
|
8194
8294
|
// packages/native/src/table-view.tsx
|
|
8195
|
-
import { tokens as
|
|
8295
|
+
import { tokens as tokens47 } from "@kjun-ui/tokens";
|
|
8196
8296
|
import {
|
|
8197
8297
|
View as View39,
|
|
8198
8298
|
useWindowDimensions as useWindowDimensions7
|
|
8199
8299
|
} from "react-native";
|
|
8200
8300
|
|
|
8201
8301
|
// packages/native/src/table-cards.tsx
|
|
8202
|
-
import { tokens as
|
|
8302
|
+
import { tokens as tokens46 } from "@kjun-ui/tokens";
|
|
8203
8303
|
import {
|
|
8204
8304
|
View as View38
|
|
8205
8305
|
} from "react-native";
|
|
@@ -8225,7 +8325,7 @@ function TableCards({
|
|
|
8225
8325
|
return /* @__PURE__ */ jsxs31(
|
|
8226
8326
|
View38,
|
|
8227
8327
|
{
|
|
8228
|
-
style: { gap:
|
|
8328
|
+
style: { gap: tokens46.extensions.tableCard.gap, padding: tokens46.extensions.tableCard.listPadding, opacity: skeletonHidden ? 0 : void 0 },
|
|
8229
8329
|
"aria-hidden": skeletonHidden || void 0,
|
|
8230
8330
|
children: [
|
|
8231
8331
|
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ jsx46(KjunSkeleton, { type: "card" }, i)) : state.rows.map((row, i) => /* @__PURE__ */ jsxs31(
|
|
@@ -8234,10 +8334,10 @@ function TableCards({
|
|
|
8234
8334
|
accessible: false,
|
|
8235
8335
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8236
8336
|
style: ({ pressed }) => ({
|
|
8237
|
-
padding:
|
|
8238
|
-
borderWidth:
|
|
8337
|
+
padding: tokens46.extensions.tableCard.padding,
|
|
8338
|
+
borderWidth: tokens46.border.defaultWidth,
|
|
8239
8339
|
borderColor: colors.border,
|
|
8240
|
-
borderRadius:
|
|
8340
|
+
borderRadius: tokens46.extensions.tableCard.radius,
|
|
8241
8341
|
backgroundColor: pressed ? colors.hover : colors.background
|
|
8242
8342
|
}),
|
|
8243
8343
|
children: [
|
|
@@ -8247,8 +8347,8 @@ function TableCards({
|
|
|
8247
8347
|
style: {
|
|
8248
8348
|
flexDirection: "row",
|
|
8249
8349
|
alignItems: "center",
|
|
8250
|
-
gap:
|
|
8251
|
-
marginBottom:
|
|
8350
|
+
gap: tokens46.extensions.tableCard.gap,
|
|
8351
|
+
marginBottom: tokens46.dimension.value8
|
|
8252
8352
|
},
|
|
8253
8353
|
children: [
|
|
8254
8354
|
/* @__PURE__ */ jsxs31(
|
|
@@ -8258,7 +8358,7 @@ function TableCards({
|
|
|
8258
8358
|
flexDirection: "row",
|
|
8259
8359
|
flex: 1,
|
|
8260
8360
|
alignItems: "center",
|
|
8261
|
-
gap:
|
|
8361
|
+
gap: tokens46.extensions.tableCard.gap,
|
|
8262
8362
|
minWidth: 0
|
|
8263
8363
|
},
|
|
8264
8364
|
children: [
|
|
@@ -8267,8 +8367,8 @@ function TableCards({
|
|
|
8267
8367
|
]
|
|
8268
8368
|
}
|
|
8269
8369
|
),
|
|
8270
|
-
badges.length ? /* @__PURE__ */ jsx46(View38, { style: { flexDirection: "row", gap:
|
|
8271
|
-
inline.length > 0 && /* @__PURE__ */ jsx46(View38, { style: { flexDirection: "row", gap:
|
|
8370
|
+
badges.length ? /* @__PURE__ */ jsx46(View38, { style: { flexDirection: "row", gap: tokens46.extensions.tableCard.fieldGap }, children: badges.map((col) => /* @__PURE__ */ jsx46(View38, { children: cell(col, row, i) }, col.key)) }) : subtitle ? cell(subtitle, row, i) : null,
|
|
8371
|
+
inline.length > 0 && /* @__PURE__ */ jsx46(View38, { style: { flexDirection: "row", gap: tokens46.extensions.tableCard.fieldGap }, children: inline.map((col) => /* @__PURE__ */ jsx46(View38, { children: cell(col, row, i) }, col.key)) })
|
|
8272
8372
|
]
|
|
8273
8373
|
}
|
|
8274
8374
|
),
|
|
@@ -8278,10 +8378,10 @@ function TableCards({
|
|
|
8278
8378
|
View38,
|
|
8279
8379
|
{
|
|
8280
8380
|
style: {
|
|
8281
|
-
borderTopWidth: index ?
|
|
8381
|
+
borderTopWidth: index ? tokens46.border.defaultWidth : 0,
|
|
8282
8382
|
borderTopColor: colors.border,
|
|
8283
|
-
paddingTop: index ?
|
|
8284
|
-
marginTop: index ?
|
|
8383
|
+
paddingTop: index ? tokens46.dimension.value12 : 0,
|
|
8384
|
+
marginTop: index ? tokens46.dimension.value12 : 0
|
|
8285
8385
|
},
|
|
8286
8386
|
children: [
|
|
8287
8387
|
!!section.label && /* @__PURE__ */ jsx46(
|
|
@@ -8290,7 +8390,7 @@ function TableCards({
|
|
|
8290
8390
|
style: {
|
|
8291
8391
|
...typeStyle("controlSmall"),
|
|
8292
8392
|
color: colors.textTertiary,
|
|
8293
|
-
marginBottom:
|
|
8393
|
+
marginBottom: tokens46.dimension.value6
|
|
8294
8394
|
},
|
|
8295
8395
|
children: section.label
|
|
8296
8396
|
}
|
|
@@ -8301,7 +8401,7 @@ function TableCards({
|
|
|
8301
8401
|
style: {
|
|
8302
8402
|
flexDirection: "row",
|
|
8303
8403
|
flexWrap: "wrap",
|
|
8304
|
-
gap: section.layout === "metrics" ?
|
|
8404
|
+
gap: section.layout === "metrics" ? tokens46.extensions.tableCard.gap : tokens46.extensions.tableCard.metricGap
|
|
8305
8405
|
},
|
|
8306
8406
|
children: cols.map((col) => /* @__PURE__ */ jsxs31(
|
|
8307
8407
|
View38,
|
|
@@ -8310,7 +8410,7 @@ function TableCards({
|
|
|
8310
8410
|
flexBasis: col.fullWidthInCard || section.layout === "stack" ? "100%" : section.layout === "metrics" ? "30%" : "47%",
|
|
8311
8411
|
flexGrow: 1,
|
|
8312
8412
|
minWidth: 0,
|
|
8313
|
-
gap:
|
|
8413
|
+
gap: tokens46.extensions.tableCard.valueGap
|
|
8314
8414
|
},
|
|
8315
8415
|
children: [
|
|
8316
8416
|
/* @__PURE__ */ jsx46(
|
|
@@ -8341,10 +8441,10 @@ function TableCards({
|
|
|
8341
8441
|
View38,
|
|
8342
8442
|
{
|
|
8343
8443
|
style: {
|
|
8344
|
-
borderTopWidth:
|
|
8444
|
+
borderTopWidth: tokens46.border.defaultWidth,
|
|
8345
8445
|
borderTopColor: colors.border,
|
|
8346
|
-
paddingTop:
|
|
8347
|
-
marginTop:
|
|
8446
|
+
paddingTop: tokens46.dimension.value8,
|
|
8447
|
+
marginTop: tokens46.dimension.value4
|
|
8348
8448
|
},
|
|
8349
8449
|
children: content(renderExpand == null ? void 0 : renderExpand(row, i))
|
|
8350
8450
|
}
|
|
@@ -8353,10 +8453,10 @@ function TableCards({
|
|
|
8353
8453
|
View38,
|
|
8354
8454
|
{
|
|
8355
8455
|
style: {
|
|
8356
|
-
borderTopWidth:
|
|
8456
|
+
borderTopWidth: tokens46.border.defaultWidth,
|
|
8357
8457
|
borderTopColor: colors.border,
|
|
8358
|
-
paddingTop:
|
|
8359
|
-
marginTop:
|
|
8458
|
+
paddingTop: tokens46.dimension.value8,
|
|
8459
|
+
marginTop: tokens46.dimension.value8,
|
|
8360
8460
|
alignItems: "flex-end"
|
|
8361
8461
|
},
|
|
8362
8462
|
children: /* @__PURE__ */ jsx46(View38, { style: { alignSelf: "flex-end" }, children: cell(actions, row, i) })
|
|
@@ -8366,7 +8466,7 @@ function TableCards({
|
|
|
8366
8466
|
},
|
|
8367
8467
|
state.key(row, i)
|
|
8368
8468
|
)),
|
|
8369
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx46(View38, { style: { padding:
|
|
8469
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ jsx46(View38, { style: { padding: tokens46.extensions.tableCard.emptyPadding, alignItems: "center" }, children: content(emptyContent || emptyText, {
|
|
8370
8470
|
color: colors.textTertiary
|
|
8371
8471
|
}) })
|
|
8372
8472
|
]
|
|
@@ -8403,7 +8503,7 @@ function KjunTable(props) {
|
|
|
8403
8503
|
onRowClick,
|
|
8404
8504
|
onRetry
|
|
8405
8505
|
} = props;
|
|
8406
|
-
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = useWindowDimensions7().width <
|
|
8506
|
+
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = useWindowDimensions7().width < tokens47.table.mobileBreakpoint;
|
|
8407
8507
|
const layout = tablePresentation(props, mobile);
|
|
8408
8508
|
const { card, visible } = layout;
|
|
8409
8509
|
const cell = (col, row, index, role) => {
|
|
@@ -8415,9 +8515,9 @@ function KjunTable(props) {
|
|
|
8415
8515
|
{
|
|
8416
8516
|
style: {
|
|
8417
8517
|
alignSelf: "flex-start",
|
|
8418
|
-
paddingVertical:
|
|
8419
|
-
paddingHorizontal:
|
|
8420
|
-
borderRadius:
|
|
8518
|
+
paddingVertical: tokens47.dimension.value2,
|
|
8519
|
+
paddingHorizontal: tokens47.dimension.value8,
|
|
8520
|
+
borderRadius: tokens47.radius.radius4,
|
|
8421
8521
|
backgroundColor: role2 ? domainColor(domainColors, role2 + "Bg") : void 0
|
|
8422
8522
|
},
|
|
8423
8523
|
children: content(body, {
|
|
@@ -8520,7 +8620,7 @@ function KpiNumberLine({ prefix, suffix, prefixGap, suffixGap, style, unitStyle,
|
|
|
8520
8620
|
}
|
|
8521
8621
|
|
|
8522
8622
|
// packages/native/src/kpi-hero.tsx
|
|
8523
|
-
import { tokens as
|
|
8623
|
+
import { tokens as tokens48 } from "@kjun-ui/tokens";
|
|
8524
8624
|
import {
|
|
8525
8625
|
View as View41,
|
|
8526
8626
|
useWindowDimensions as useWindowDimensions8
|
|
@@ -8553,8 +8653,8 @@ function KjunKpiHero(props) {
|
|
|
8553
8653
|
deltaFormatter,
|
|
8554
8654
|
renderSecondary
|
|
8555
8655
|
} = props;
|
|
8556
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = useWindowDimensions8().width, mobile = windowWidth <=
|
|
8557
|
-
const geometry2 =
|
|
8656
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = useWindowDimensions8().width, mobile = windowWidth <= tokens48.responsive.kpiHero, small = size === "sm", numberRole = small ? "displaySm" : mobile ? "displayMd" : "displayLg", font = typeStyle(numberRole).fontSize, unitStyle = typeStyle(small ? "numberSm" : mobile ? "numberMd" : "numberLg");
|
|
8657
|
+
const geometry2 = tokens48.extensions.kpiHero;
|
|
8558
8658
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8559
8659
|
const numeric2 = {
|
|
8560
8660
|
fontFamily: numericFontFamily || fontFamily,
|
|
@@ -8566,7 +8666,7 @@ function KjunKpiHero(props) {
|
|
|
8566
8666
|
);
|
|
8567
8667
|
const delta = (v, kind, style) => {
|
|
8568
8668
|
if (deltaFormatter) return /* @__PURE__ */ jsx49(KText, { style, children: deltaFormatter(v, kind) });
|
|
8569
|
-
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap =
|
|
8669
|
+
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap = tokens48.extensions.financial.affixGap, number = new Intl.NumberFormat(void 0, {
|
|
8570
8670
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
8571
8671
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
8572
8672
|
}).format(Math.abs(v));
|
|
@@ -8669,11 +8769,11 @@ function KjunKpiHero(props) {
|
|
|
8669
8769
|
gap: small && mobile ? geometry2.smallMobileGap : spec.secondaryGap,
|
|
8670
8770
|
marginTop: spec.secondaryMargin,
|
|
8671
8771
|
paddingTop: spec.secondaryPadding,
|
|
8672
|
-
borderTopWidth:
|
|
8772
|
+
borderTopWidth: tokens48.border.defaultWidth,
|
|
8673
8773
|
borderTopColor: colors.border
|
|
8674
8774
|
},
|
|
8675
8775
|
children: secondary.map((item, i) => {
|
|
8676
|
-
const columns = mobile && !small && windowWidth <=
|
|
8776
|
+
const columns = mobile && !small && windowWidth <= tokens48.responsive.kpiHeroSecondary && secondary.length >= 3 ? 2 : 0;
|
|
8677
8777
|
const first = columns ? i % columns === 0 : i === 0;
|
|
8678
8778
|
const last = columns ? i % columns === columns - 1 || i === secondary.length - 1 : i === secondary.length - 1;
|
|
8679
8779
|
return /* @__PURE__ */ jsxs34(
|
|
@@ -8684,7 +8784,7 @@ function KjunKpiHero(props) {
|
|
|
8684
8784
|
minWidth: 0,
|
|
8685
8785
|
paddingLeft: first ? 0 : geometry2.itemPadding,
|
|
8686
8786
|
paddingRight: last ? 0 : geometry2.itemPadding,
|
|
8687
|
-
borderLeftWidth: first ? 0 :
|
|
8787
|
+
borderLeftWidth: first ? 0 : tokens48.border.defaultWidth,
|
|
8688
8788
|
borderLeftColor: colors.border
|
|
8689
8789
|
} : { minWidth: 0, maxWidth: "100%", flexShrink: 1 },
|
|
8690
8790
|
children: [
|
|
@@ -8749,7 +8849,7 @@ function KjunKpiHero(props) {
|
|
|
8749
8849
|
}
|
|
8750
8850
|
|
|
8751
8851
|
// packages/native/src/kpi-row.tsx
|
|
8752
|
-
import { tokens as
|
|
8852
|
+
import { tokens as tokens49 } from "@kjun-ui/tokens";
|
|
8753
8853
|
import { useState as useState37 } from "react";
|
|
8754
8854
|
import {
|
|
8755
8855
|
View as View42,
|
|
@@ -8765,8 +8865,8 @@ function KjunKpiRow({
|
|
|
8765
8865
|
onItemClick,
|
|
8766
8866
|
renderValue
|
|
8767
8867
|
}) {
|
|
8768
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = useWindowDimensions9().width <=
|
|
8769
|
-
const geometry2 =
|
|
8868
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = useWindowDimensions9().width <= tokens49.responsive.kpiRow, small = size === "sm", summary = mobileSummary && mobile && !small;
|
|
8869
|
+
const geometry2 = tokens49.extensions.kpiRow;
|
|
8770
8870
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8771
8871
|
const [width, setWidth] = useState37(0);
|
|
8772
8872
|
const paddingX = summary ? geometry2.summary.paddingX : spec.paddingX;
|
|
@@ -8845,8 +8945,8 @@ function KjunKpiRow({
|
|
|
8845
8945
|
minWidth: 0,
|
|
8846
8946
|
paddingVertical: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingY : spec.itemPaddingY,
|
|
8847
8947
|
paddingHorizontal: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingX : spec.itemPaddingX,
|
|
8848
|
-
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ?
|
|
8849
|
-
borderTopWidth: mobile && !small && !summary && i >= 2 ?
|
|
8948
|
+
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ? tokens49.border.defaultWidth : 0 : i ? tokens49.border.defaultWidth : 0,
|
|
8949
|
+
borderTopWidth: mobile && !small && !summary && i >= 2 ? tokens49.border.defaultWidth : 0,
|
|
8850
8950
|
borderColor: colors.border,
|
|
8851
8951
|
borderRadius: item.clickable ? geometry2.itemRadius : 0,
|
|
8852
8952
|
flexDirection: sub ? "row" : "column",
|
|
@@ -8889,7 +8989,7 @@ function KjunKpiRow({
|
|
|
8889
8989
|
summary && seg.label && /* @__PURE__ */ jsx50(
|
|
8890
8990
|
KText,
|
|
8891
8991
|
{
|
|
8892
|
-
style: { ...typeStyle("caption"), marginRight: sub ?
|
|
8992
|
+
style: { ...typeStyle("caption"), marginRight: sub ? tokens49.dimension.value4 : 0, color: colors.textTertiary },
|
|
8893
8993
|
children: seg.label
|
|
8894
8994
|
}
|
|
8895
8995
|
),
|
|
@@ -8983,7 +9083,7 @@ function KjunKpiRow({
|
|
|
8983
9083
|
}
|
|
8984
9084
|
|
|
8985
9085
|
// packages/native/src/market-cards.tsx
|
|
8986
|
-
import { tokens as
|
|
9086
|
+
import { tokens as tokens51 } from "@kjun-ui/tokens";
|
|
8987
9087
|
import { ScrollView as ScrollView10, View as View44 } from "react-native";
|
|
8988
9088
|
|
|
8989
9089
|
// shared/package-runtime/market-cards.ts
|
|
@@ -9049,7 +9149,7 @@ function useMarketCards(props) {
|
|
|
9049
9149
|
}
|
|
9050
9150
|
|
|
9051
9151
|
// packages/native/src/market-parts.tsx
|
|
9052
|
-
import { tokens as
|
|
9152
|
+
import { tokens as tokens50 } from "@kjun-ui/tokens";
|
|
9053
9153
|
import { View as View43, useWindowDimensions as useWindowDimensions10 } from "react-native";
|
|
9054
9154
|
import { Fragment as Fragment17, jsx as jsx51, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9055
9155
|
function MarketIdentity({
|
|
@@ -9059,7 +9159,7 @@ function MarketIdentity({
|
|
|
9059
9159
|
compact = false
|
|
9060
9160
|
}) {
|
|
9061
9161
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9062
|
-
const { colors } = useKjunStyles(), mobile = useWindowDimensions10().width <
|
|
9162
|
+
const { colors } = useKjunStyles(), mobile = useWindowDimensions10().width < tokens50.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");
|
|
9063
9163
|
const body = /* @__PURE__ */ jsxs36(Fragment17, { children: [
|
|
9064
9164
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
9065
9165
|
/* @__PURE__ */ jsxs36(View43, { style: { flex: 1, minWidth: 0 }, children: [
|
|
@@ -9069,7 +9169,7 @@ function MarketIdentity({
|
|
|
9069
9169
|
style: {
|
|
9070
9170
|
flexDirection: "row",
|
|
9071
9171
|
alignItems: "center",
|
|
9072
|
-
gap:
|
|
9172
|
+
gap: tokens50.dimension.value4,
|
|
9073
9173
|
minWidth: 0
|
|
9074
9174
|
},
|
|
9075
9175
|
children: [
|
|
@@ -9091,7 +9191,7 @@ function MarketIdentity({
|
|
|
9091
9191
|
]
|
|
9092
9192
|
}
|
|
9093
9193
|
),
|
|
9094
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */ jsx51(View43, { style: { marginTop:
|
|
9194
|
+
(meta || props.renderSubMeta) && /* @__PURE__ */ jsx51(View43, { style: { marginTop: tokens50.dimension.value2 }, children: ((_i = props.renderSubMeta) == null ? void 0 : _i.call(props, row)) || /* @__PURE__ */ jsx51(
|
|
9095
9195
|
KText,
|
|
9096
9196
|
{
|
|
9097
9197
|
numberOfLines: 1,
|
|
@@ -9153,9 +9253,9 @@ function MarketFooter({
|
|
|
9153
9253
|
flexWrap: "wrap",
|
|
9154
9254
|
alignItems: "center",
|
|
9155
9255
|
justifyContent: "space-between",
|
|
9156
|
-
gap:
|
|
9157
|
-
paddingVertical:
|
|
9158
|
-
paddingHorizontal:
|
|
9256
|
+
gap: tokens50.dimension.value8,
|
|
9257
|
+
paddingVertical: tokens50.dimension.value12,
|
|
9258
|
+
paddingHorizontal: tokens50.dimension.value16
|
|
9159
9259
|
},
|
|
9160
9260
|
children: [
|
|
9161
9261
|
/* @__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 }),
|
|
@@ -9201,9 +9301,9 @@ function KjunMarketCards(props) {
|
|
|
9201
9301
|
showsHorizontalScrollIndicator: false,
|
|
9202
9302
|
contentContainerStyle: {
|
|
9203
9303
|
flexDirection: "row",
|
|
9204
|
-
gap:
|
|
9205
|
-
paddingVertical:
|
|
9206
|
-
paddingHorizontal:
|
|
9304
|
+
gap: tokens51.dimension.value8,
|
|
9305
|
+
paddingVertical: tokens51.dimension.value10,
|
|
9306
|
+
paddingHorizontal: tokens51.dimension.value16
|
|
9207
9307
|
},
|
|
9208
9308
|
children: state.pills.map((pill) => /* @__PURE__ */ jsxs37(
|
|
9209
9309
|
AccessiblePressable,
|
|
@@ -9212,14 +9312,14 @@ function KjunMarketCards(props) {
|
|
|
9212
9312
|
accessibilityLabel: pill.label,
|
|
9213
9313
|
accessibilityState: { selected: state.key === pill.key },
|
|
9214
9314
|
onPress: () => state.select(pill.key),
|
|
9215
|
-
hitSlop: { top: (
|
|
9315
|
+
hitSlop: { top: (tokens51.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * tokens51.dimension.value8) / 2, bottom: (tokens51.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * tokens51.dimension.value8) / 2 },
|
|
9216
9316
|
style: {
|
|
9217
9317
|
flexDirection: "row",
|
|
9218
9318
|
alignItems: "center",
|
|
9219
|
-
gap:
|
|
9220
|
-
paddingVertical:
|
|
9221
|
-
paddingHorizontal:
|
|
9222
|
-
borderRadius:
|
|
9319
|
+
gap: tokens51.dimension.value4,
|
|
9320
|
+
paddingVertical: tokens51.dimension.value8,
|
|
9321
|
+
paddingHorizontal: tokens51.dimension.value16,
|
|
9322
|
+
borderRadius: tokens51.radius.radius9999,
|
|
9223
9323
|
backgroundColor: state.key === pill.key ? colors.brand : colors.secondary
|
|
9224
9324
|
},
|
|
9225
9325
|
children: [
|
|
@@ -9255,7 +9355,7 @@ function KjunMarketCards(props) {
|
|
|
9255
9355
|
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ jsx52(KjunListSkeleton, { variant: "compact" }),
|
|
9256
9356
|
emptyContent: /* @__PURE__ */ jsx52(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
9257
9357
|
children: /* @__PURE__ */ jsxs37(View44, { children: [
|
|
9258
|
-
state.pill && /* @__PURE__ */ jsx52(KText, { style: { textAlign: "right", paddingHorizontal:
|
|
9358
|
+
state.pill && /* @__PURE__ */ jsx52(KText, { style: { textAlign: "right", paddingHorizontal: tokens51.dimension.value16, paddingVertical: tokens51.dimension.value8, ...typeStyle("caption"), color: colors.textSecondary }, children: state.pill.label }),
|
|
9259
9359
|
rows.map((row, i) => {
|
|
9260
9360
|
var _a, _b, _c;
|
|
9261
9361
|
return /* @__PURE__ */ jsxs37(
|
|
@@ -9270,22 +9370,22 @@ function KjunMarketCards(props) {
|
|
|
9270
9370
|
flexDirection: "row",
|
|
9271
9371
|
alignItems: "center",
|
|
9272
9372
|
justifyContent: "space-between",
|
|
9273
|
-
paddingVertical:
|
|
9274
|
-
paddingHorizontal:
|
|
9275
|
-
borderBottomWidth:
|
|
9373
|
+
paddingVertical: tokens51.dimension.value10,
|
|
9374
|
+
paddingHorizontal: tokens51.dimension.value16,
|
|
9375
|
+
borderBottomWidth: tokens51.border.defaultWidth,
|
|
9276
9376
|
borderBottomColor: colors.border,
|
|
9277
9377
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9278
9378
|
}),
|
|
9279
9379
|
children: [
|
|
9280
9380
|
/* @__PURE__ */ jsx52(MarketIdentity, { row, props, compact: true }),
|
|
9281
|
-
/* @__PURE__ */ jsx52(View44, { style: { marginLeft:
|
|
9381
|
+
/* @__PURE__ */ jsx52(View44, { style: { marginLeft: tokens51.dimension.value12, alignItems: "flex-end" }, children: ((_b = state.pill) == null ? void 0 : _b.format) === "sparkline" ? /* @__PURE__ */ jsx52(
|
|
9282
9382
|
KjunSparkline,
|
|
9283
9383
|
{
|
|
9284
9384
|
data: getValue(row, state.key) || [],
|
|
9285
|
-
width:
|
|
9286
|
-
height:
|
|
9385
|
+
width: tokens51.extensions.marketTable.sparklineWidth,
|
|
9386
|
+
height: tokens51.extensions.marketTable.sparklineHeight
|
|
9287
9387
|
}
|
|
9288
|
-
) : state.pill ? /* @__PURE__ */ jsx52(Fragment18, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height:
|
|
9388
|
+
) : state.pill ? /* @__PURE__ */ jsx52(Fragment18, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height: tokens51.extensions.marketTable.valueSkeletonHeight, width: tokens51.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ jsx52(
|
|
9289
9389
|
KjunSignedValue,
|
|
9290
9390
|
{
|
|
9291
9391
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -9293,14 +9393,14 @@ function KjunMarketCards(props) {
|
|
|
9293
9393
|
stale: !!getValue(row, "stale"),
|
|
9294
9394
|
tone: "pill"
|
|
9295
9395
|
}
|
|
9296
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height:
|
|
9396
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ jsx52(KjunSkeleton, { type: "block", height: tokens51.extensions.financial.priceSkeletonHeight, width: tokens51.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ jsxs37(
|
|
9297
9397
|
View44,
|
|
9298
9398
|
{
|
|
9299
9399
|
style: {
|
|
9300
9400
|
flexDirection: "row",
|
|
9301
9401
|
alignItems: "center",
|
|
9302
9402
|
justifyContent: "flex-end",
|
|
9303
|
-
gap:
|
|
9403
|
+
gap: tokens51.dimension.value4
|
|
9304
9404
|
},
|
|
9305
9405
|
children: [
|
|
9306
9406
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
@@ -9337,7 +9437,7 @@ function KjunMarketCards(props) {
|
|
|
9337
9437
|
}
|
|
9338
9438
|
|
|
9339
9439
|
// packages/native/src/market-list.tsx
|
|
9340
|
-
import { tokens as
|
|
9440
|
+
import { tokens as tokens52 } from "@kjun-ui/tokens";
|
|
9341
9441
|
import { View as View45, useWindowDimensions as useWindowDimensions11 } from "react-native";
|
|
9342
9442
|
import { jsx as jsx53, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9343
9443
|
var changeWeight = { fontWeight: typeStyle("label").fontWeight };
|
|
@@ -9355,7 +9455,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9355
9455
|
closingPrice = false,
|
|
9356
9456
|
emptyMessage = m.noItems,
|
|
9357
9457
|
emptySubMessage = ""
|
|
9358
|
-
} = props, { colors } = useKjunStyles(), mobile = useWindowDimensions11().width <
|
|
9458
|
+
} = props, { colors } = useKjunStyles(), mobile = useWindowDimensions11().width < tokens52.responsive.market;
|
|
9359
9459
|
return /* @__PURE__ */ jsxs38(View45, { children: [
|
|
9360
9460
|
/* @__PURE__ */ jsx53(
|
|
9361
9461
|
KjunDataState,
|
|
@@ -9381,11 +9481,11 @@ function KjunMarketSimpleList(props) {
|
|
|
9381
9481
|
flexDirection: "row",
|
|
9382
9482
|
alignItems: "center",
|
|
9383
9483
|
justifyContent: "space-between",
|
|
9384
|
-
paddingVertical: mobile ?
|
|
9385
|
-
paddingHorizontal: mobile ?
|
|
9484
|
+
paddingVertical: mobile ? tokens52.dimension.value14 : tokens52.dimension.value16,
|
|
9485
|
+
paddingHorizontal: mobile ? tokens52.dimension.value20 : tokens52.dimension.value16,
|
|
9386
9486
|
// Like Web, the minimum height belongs to the narrow layout only.
|
|
9387
|
-
minHeight: mobile ?
|
|
9388
|
-
borderBottomWidth:
|
|
9487
|
+
minHeight: mobile ? tokens52.extensions.marketList.minimumHeight : void 0,
|
|
9488
|
+
borderBottomWidth: tokens52.border.defaultWidth,
|
|
9389
9489
|
borderBottomColor: colors.border,
|
|
9390
9490
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9391
9491
|
}),
|
|
@@ -9395,8 +9495,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9395
9495
|
View45,
|
|
9396
9496
|
{
|
|
9397
9497
|
style: {
|
|
9398
|
-
marginLeft:
|
|
9399
|
-
minWidth: mobile ?
|
|
9498
|
+
marginLeft: tokens52.dimension.value12,
|
|
9499
|
+
minWidth: mobile ? tokens52.extensions.marketList.mobileQuoteMinimumWidth : void 0,
|
|
9400
9500
|
maxWidth: "50%",
|
|
9401
9501
|
alignItems: "flex-end"
|
|
9402
9502
|
},
|
|
@@ -9418,8 +9518,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9418
9518
|
flexWrap: "wrap",
|
|
9419
9519
|
alignItems: "center",
|
|
9420
9520
|
justifyContent: "flex-end",
|
|
9421
|
-
gap:
|
|
9422
|
-
marginTop:
|
|
9521
|
+
gap: tokens52.dimension.value6,
|
|
9522
|
+
marginTop: tokens52.dimension.value2
|
|
9423
9523
|
},
|
|
9424
9524
|
children: [
|
|
9425
9525
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
@@ -9431,7 +9531,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9431
9531
|
fetchedAt
|
|
9432
9532
|
}
|
|
9433
9533
|
)),
|
|
9434
|
-
changeLoading(row) ? /* @__PURE__ */ jsx53(KjunSkeleton, { type: "block", height:
|
|
9534
|
+
changeLoading(row) ? /* @__PURE__ */ jsx53(KjunSkeleton, { type: "block", height: tokens52.extensions.marketList.changeSkeletonHeight, width: tokens52.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ jsx53(
|
|
9435
9535
|
KjunSignedValue,
|
|
9436
9536
|
{
|
|
9437
9537
|
value: change,
|
|
@@ -9465,7 +9565,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9465
9565
|
}
|
|
9466
9566
|
|
|
9467
9567
|
// packages/native/src/market-panel.tsx
|
|
9468
|
-
import { tokens as
|
|
9568
|
+
import { tokens as tokens53 } from "@kjun-ui/tokens";
|
|
9469
9569
|
import { View as View46 } from "react-native";
|
|
9470
9570
|
import { jsx as jsx54, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9471
9571
|
function KjunMarketListPanel({
|
|
@@ -9479,8 +9579,8 @@ function KjunMarketListPanel({
|
|
|
9479
9579
|
View46,
|
|
9480
9580
|
{
|
|
9481
9581
|
style: {
|
|
9482
|
-
marginTop:
|
|
9483
|
-
borderTopWidth:
|
|
9582
|
+
marginTop: tokens53.dimension.value16,
|
|
9583
|
+
borderTopWidth: tokens53.border.defaultWidth,
|
|
9484
9584
|
borderTopColor: colors.border
|
|
9485
9585
|
},
|
|
9486
9586
|
children
|
|
@@ -9490,7 +9590,7 @@ function KjunMarketListPanel({
|
|
|
9490
9590
|
}
|
|
9491
9591
|
|
|
9492
9592
|
// packages/native/src/market-table.tsx
|
|
9493
|
-
import { tokens as
|
|
9593
|
+
import { tokens as tokens54 } from "@kjun-ui/tokens";
|
|
9494
9594
|
import { useId as useId10, useState as useState39 } from "react";
|
|
9495
9595
|
import { ScrollView as ScrollView11, View as View47 } from "react-native";
|
|
9496
9596
|
import Svg8, { Defs as Defs4, LinearGradient as LinearGradient4, Rect as Rect4, Stop as Stop4 } from "react-native-svg";
|
|
@@ -9518,7 +9618,7 @@ function KjunMarketTable(props) {
|
|
|
9518
9618
|
const render = (row, col) => {
|
|
9519
9619
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
9520
9620
|
if (cellLoading(row, col))
|
|
9521
|
-
return /* @__PURE__ */ jsx55(KjunSkeleton, { type: "block", height:
|
|
9621
|
+
return /* @__PURE__ */ jsx55(KjunSkeleton, { type: "block", height: tokens54.extensions.marketTable.valueSkeletonHeight, width: tokens54.extensions.marketTable.valueSkeletonWidth });
|
|
9522
9622
|
if (renderCell) return content(renderCell(row, col));
|
|
9523
9623
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
9524
9624
|
return /* @__PURE__ */ jsx55(MarketIdentity, { row, props, table: true });
|
|
@@ -9527,8 +9627,8 @@ function KjunMarketTable(props) {
|
|
|
9527
9627
|
KjunSparkline,
|
|
9528
9628
|
{
|
|
9529
9629
|
data: Array.isArray(value) ? value : [],
|
|
9530
|
-
width:
|
|
9531
|
-
height:
|
|
9630
|
+
width: tokens54.extensions.marketTable.sparklineWidth,
|
|
9631
|
+
height: tokens54.extensions.marketTable.sparklineHeight
|
|
9532
9632
|
}
|
|
9533
9633
|
);
|
|
9534
9634
|
if (col.type === "price")
|
|
@@ -9586,7 +9686,7 @@ function KjunMarketTable(props) {
|
|
|
9586
9686
|
onLayout: layout.onLayout,
|
|
9587
9687
|
style: {
|
|
9588
9688
|
backgroundColor: embedded ? void 0 : colors.surface,
|
|
9589
|
-
borderRadius: embedded ? 0 :
|
|
9689
|
+
borderRadius: embedded ? 0 : tokens54.radius.radius12
|
|
9590
9690
|
},
|
|
9591
9691
|
children: [
|
|
9592
9692
|
/* @__PURE__ */ jsx55(
|
|
@@ -9626,13 +9726,13 @@ function KjunMarketTable(props) {
|
|
|
9626
9726
|
{
|
|
9627
9727
|
style: {
|
|
9628
9728
|
width: marketGeometry.actionsWidth,
|
|
9629
|
-
paddingVertical:
|
|
9630
|
-
paddingHorizontal:
|
|
9729
|
+
paddingVertical: tokens54.dimension.value12,
|
|
9730
|
+
paddingHorizontal: tokens54.dimension.value4,
|
|
9631
9731
|
flexDirection: "row",
|
|
9632
9732
|
alignItems: "center",
|
|
9633
9733
|
justifyContent: "center"
|
|
9634
9734
|
},
|
|
9635
|
-
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ jsx55(View47, { style: { width: Math.max(
|
|
9735
|
+
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ jsx55(View47, { style: { width: Math.max(tokens54.native.minimumTouchTarget, tokens54.extensions.iconToggle.sizes.xs), alignItems: "center" }, children: /* @__PURE__ */ jsx55(KjunCollectionMark, { kind, size: "md" }) }, kind))
|
|
9636
9736
|
}
|
|
9637
9737
|
),
|
|
9638
9738
|
columns.map((col, columnIndex) => /* @__PURE__ */ jsxs40(
|
|
@@ -9647,11 +9747,11 @@ function KjunMarketTable(props) {
|
|
|
9647
9747
|
},
|
|
9648
9748
|
style: {
|
|
9649
9749
|
width: layout.widths[columnIndex],
|
|
9650
|
-
padding:
|
|
9750
|
+
padding: tokens54.dimension.value12,
|
|
9651
9751
|
flexDirection: "row",
|
|
9652
9752
|
alignItems: "center",
|
|
9653
9753
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
9654
|
-
gap:
|
|
9754
|
+
gap: tokens54.dimension.value4
|
|
9655
9755
|
},
|
|
9656
9756
|
children: [
|
|
9657
9757
|
/* @__PURE__ */ jsx55(
|
|
@@ -9668,7 +9768,7 @@ function KjunMarketTable(props) {
|
|
|
9668
9768
|
KjunIcon,
|
|
9669
9769
|
{
|
|
9670
9770
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
9671
|
-
size:
|
|
9771
|
+
size: tokens54.extensions.marketTable.sortIconSize,
|
|
9672
9772
|
color: sortKey === col.key ? colors.brand : colors.textTertiary
|
|
9673
9773
|
}
|
|
9674
9774
|
)
|
|
@@ -9703,8 +9803,8 @@ function KjunMarketTable(props) {
|
|
|
9703
9803
|
{
|
|
9704
9804
|
style: {
|
|
9705
9805
|
width: marketGeometry.actionsWidth,
|
|
9706
|
-
paddingVertical:
|
|
9707
|
-
paddingHorizontal:
|
|
9806
|
+
paddingVertical: tokens54.dimension.value12,
|
|
9807
|
+
paddingHorizontal: tokens54.dimension.value4,
|
|
9708
9808
|
flexDirection: "row",
|
|
9709
9809
|
alignItems: "center",
|
|
9710
9810
|
justifyContent: "center"
|
|
@@ -9748,8 +9848,8 @@ function KjunMarketTable(props) {
|
|
|
9748
9848
|
{
|
|
9749
9849
|
style: {
|
|
9750
9850
|
width: layout.widths[columnIndex],
|
|
9751
|
-
paddingVertical:
|
|
9752
|
-
paddingHorizontal:
|
|
9851
|
+
paddingVertical: tokens54.dimension.value14,
|
|
9852
|
+
paddingHorizontal: tokens54.dimension.value12,
|
|
9753
9853
|
justifyContent: "center",
|
|
9754
9854
|
alignItems: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : void 0
|
|
9755
9855
|
},
|
|
@@ -9775,7 +9875,7 @@ function KjunMarketTable(props) {
|
|
|
9775
9875
|
] })
|
|
9776
9876
|
}
|
|
9777
9877
|
),
|
|
9778
|
-
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ jsx55(View47, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
9878
|
+
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ jsx55(View47, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: tokens54.extensions.scrollFade.width }, children: /* @__PURE__ */ jsxs40(Svg8, { width: "100%", height: "100%", children: [
|
|
9779
9879
|
/* @__PURE__ */ jsx55(Defs4, { children: /* @__PURE__ */ jsxs40(LinearGradient4, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
9780
9880
|
/* @__PURE__ */ jsx55(Stop4, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
9781
9881
|
/* @__PURE__ */ jsx55(Stop4, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -9792,50 +9892,61 @@ function KjunMarketTable(props) {
|
|
|
9792
9892
|
}
|
|
9793
9893
|
|
|
9794
9894
|
// packages/native/src/list.tsx
|
|
9795
|
-
import { tokens as
|
|
9895
|
+
import { tokens as tokens55 } from "@kjun-ui/tokens";
|
|
9796
9896
|
import { Children as Children5, createContext as createContext22, useContext as useContext19 } from "react";
|
|
9797
9897
|
import { View as View48, Platform as Platform26 } from "react-native";
|
|
9798
9898
|
import { Fragment as Fragment19, jsx as jsx56, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9799
9899
|
var ListRowContext = createContext22({ divider: true, compact: false });
|
|
9800
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onPress }) {
|
|
9900
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress }) {
|
|
9801
9901
|
const { colors } = useKjunStyles(), { divider, compact } = useContext19(ListRowContext);
|
|
9802
9902
|
const parts = /* @__PURE__ */ jsxs41(Fragment19, { children: [
|
|
9803
9903
|
hasContent(leading) && /* @__PURE__ */ jsx56(View48, { children: content(leading) }),
|
|
9804
9904
|
/* @__PURE__ */ jsxs41(View48, { style: { flex: 1, minWidth: 0 }, children: [
|
|
9805
|
-
/* @__PURE__ */ jsx56(KText, { style: { ...typeStyle("label") }, children: title }),
|
|
9806
|
-
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop:
|
|
9905
|
+
/* @__PURE__ */ jsx56(KText, { style: { ...typeStyle("label"), ...destructive ? { color: colors.danger } : {} }, children: title }),
|
|
9906
|
+
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens55.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9807
9907
|
] }),
|
|
9808
|
-
hasContent(trailing) && /* @__PURE__ */ jsx56(View48, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
9908
|
+
hasContent(trailing) && /* @__PURE__ */ jsx56(View48, { style: { maxWidth: "35%" }, children: content(trailing) }),
|
|
9909
|
+
chevron && /* @__PURE__ */ jsx56(View48, { accessible: false, importantForAccessibility: "no-hide-descendants", accessibilityElementsHidden: true, children: /* @__PURE__ */ jsx56(KjunIcon, { name: "chevron-right", size: tokens55.iconSizes.default, color: colors.textTertiary }) })
|
|
9809
9910
|
] });
|
|
9810
|
-
const style = { flex: 1, minWidth: 0, minHeight: compact ?
|
|
9811
|
-
return /* @__PURE__ */ jsxs41(View48, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap:
|
|
9812
|
-
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 ?
|
|
9813
|
-
hasContent(actions) && /* @__PURE__ */ jsx56(View48, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform26.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap:
|
|
9911
|
+
const style = { flex: 1, minWidth: 0, minHeight: compact ? tokens55.extensions.list.compactMinimumHeight : tokens55.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: tokens55.extensions.list.gap, padding: tokens55.extensions.list.padding, ...compact ? { paddingVertical: tokens55.extensions.list.compactPaddingY } : {} };
|
|
9912
|
+
return /* @__PURE__ */ jsxs41(View48, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: tokens55.extensions.list.gap, borderBottomWidth: divider ? tokens55.border.defaultWidth : 0, borderBottomColor: colors.divider }, children: [
|
|
9913
|
+
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 ? tokens55.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ jsx56(View48, { style, children: parts }),
|
|
9914
|
+
hasContent(actions) && /* @__PURE__ */ jsx56(View48, { pointerEvents: disabled ? "none" : "auto", ...disabled && Platform26.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: tokens55.extensions.list.actionsGap, paddingRight: tokens55.extensions.list.actionsPadding, opacity: disabled ? tokens55.states.opacity.disabled : 1 }, children: content(actions) })
|
|
9814
9915
|
] });
|
|
9815
9916
|
}
|
|
9816
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
9917
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
9817
9918
|
const { colors } = useKjunStyles();
|
|
9818
|
-
return /* @__PURE__ */ jsxs41(View48, { style: { minWidth: 0, backgroundColor: colors.surface }, children: [
|
|
9819
|
-
!!(title || description || actions) && /* @__PURE__ */ jsxs41(View48, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
9919
|
+
return /* @__PURE__ */ jsxs41(View48, { style: { minWidth: 0, backgroundColor: surface ? colors.surface : "transparent" }, children: [
|
|
9920
|
+
!!(title || description || actions) && /* @__PURE__ */ jsxs41(View48, { style: { flexDirection: "row", alignItems: "center", gap: tokens55.extensions.list.gap, padding: tokens55.extensions.list.padding }, children: [
|
|
9820
9921
|
/* @__PURE__ */ jsxs41(View48, { style: { flex: 1 }, children: [
|
|
9821
9922
|
!!title && /* @__PURE__ */ jsx56(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
9822
|
-
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop:
|
|
9923
|
+
!!description && /* @__PURE__ */ jsx56(KText, { style: { marginTop: tokens55.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9823
9924
|
] }),
|
|
9824
9925
|
content(actions)
|
|
9825
9926
|
] }),
|
|
9826
9927
|
/* @__PURE__ */ jsx56(View48, { 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)) })
|
|
9827
9928
|
] });
|
|
9828
9929
|
}
|
|
9930
|
+
function KjunListItem({ children }) {
|
|
9931
|
+
const { colors } = useKjunStyles(), { divider, compact } = useContext19(ListRowContext);
|
|
9932
|
+
return /* @__PURE__ */ jsx56(View48, { role: "listitem", style: {
|
|
9933
|
+
padding: tokens55.extensions.list.padding,
|
|
9934
|
+
...compact ? { paddingVertical: tokens55.extensions.list.compactPaddingY } : {},
|
|
9935
|
+
borderBottomWidth: divider ? tokens55.border.defaultWidth : 0,
|
|
9936
|
+
borderBottomColor: colors.divider,
|
|
9937
|
+
minWidth: 0
|
|
9938
|
+
}, children: content(children) });
|
|
9939
|
+
}
|
|
9829
9940
|
|
|
9830
9941
|
// packages/native/src/app-navigation.tsx
|
|
9831
|
-
import { tokens as
|
|
9942
|
+
import { tokens as tokens56 } from "@kjun-ui/tokens";
|
|
9832
9943
|
import { Children as Children6, Fragment as Fragment20, isValidElement as isValidElement8, useState as useState40 } from "react";
|
|
9833
9944
|
import { View as View49, Platform as Platform27 } from "react-native";
|
|
9834
9945
|
import { jsx as jsx57, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9835
9946
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
9836
9947
|
const { colors } = useKjunStyles();
|
|
9837
|
-
const geometry2 =
|
|
9838
|
-
const titleInset = Math.max(0, (geometry2.controlSize -
|
|
9948
|
+
const geometry2 = tokens56.extensions.topNavigation;
|
|
9949
|
+
const titleInset = Math.max(0, (geometry2.controlSize - tokens56.typography.sectionTitle.lineHeightPx) / 2);
|
|
9839
9950
|
const wrapping = Platform27.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
9840
9951
|
const edgeInset = (geometry2.controlSize - geometry2.iconSize) / 2;
|
|
9841
9952
|
const [iconEdges, setIconEdges] = useState40({ leading: false, trailing: false });
|
|
@@ -9859,13 +9970,13 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
9859
9970
|
const m = useKjunMessages();
|
|
9860
9971
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
9861
9972
|
const { colors } = useKjunStyles();
|
|
9862
|
-
const geometry2 =
|
|
9973
|
+
const geometry2 = tokens56.extensions.bottomNavigation;
|
|
9863
9974
|
const hasIcons = items2.some((item) => item.icon);
|
|
9864
9975
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
9865
9976
|
return /* @__PURE__ */ jsx57(View49, { role: "navigation", accessibilityLabel: ariaLabel, style: { flexShrink: 0, flexDirection: "row", backgroundColor: colors.surface, paddingBottom: Math.max(0, safeAreaBottom) }, children: items2.map((item) => {
|
|
9866
9977
|
const selected = item.key === value;
|
|
9867
9978
|
const ink = selected ? colors.brand : colors.textSecondary;
|
|
9868
|
-
const ring =
|
|
9979
|
+
const ring = tokens56.border.controlWidth;
|
|
9869
9980
|
const badge = item.badge != null && /* @__PURE__ */ jsx57(View49, { pointerEvents: "none", "aria-hidden": true, style: {
|
|
9870
9981
|
position: "absolute",
|
|
9871
9982
|
top: -geometry2.badgeOffset - ring,
|
|
@@ -9900,7 +10011,7 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
9900
10011
|
gap: geometry2.itemGap,
|
|
9901
10012
|
paddingHorizontal: geometry2.itemPaddingX,
|
|
9902
10013
|
paddingVertical: geometry2.itemPaddingY,
|
|
9903
|
-
opacity: item.disabled ?
|
|
10014
|
+
opacity: item.disabled ? tokens56.states.opacity.disabled : 1
|
|
9904
10015
|
},
|
|
9905
10016
|
children: [
|
|
9906
10017
|
hasIcons && /* @__PURE__ */ jsxs42(View49, { style: { width: geometry2.iconSize, height: geometry2.iconSize, flexShrink: 0 }, children: [
|
|
@@ -9921,8 +10032,8 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
9921
10032
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
9922
10033
|
const { colors } = useKjunStyles();
|
|
9923
10034
|
const [width, setWidth] = useState40(0);
|
|
9924
|
-
const geometry2 =
|
|
9925
|
-
const wide = width >=
|
|
10035
|
+
const geometry2 = tokens56.extensions.navigation;
|
|
10036
|
+
const wide = width >= tokens56.responsive.bottomAction + geometry2.padding * 2;
|
|
9926
10037
|
const wrapping = Platform27.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
9927
10038
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
9928
10039
|
return /* @__PURE__ */ jsx57(BottomActionBarContext.Provider, { value: !wide, children: /* @__PURE__ */ jsxs42(View49, { onLayout: (event) => setWidth(event.nativeEvent.layout.width), style: {
|
|
@@ -9942,52 +10053,53 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
9942
10053
|
}
|
|
9943
10054
|
|
|
9944
10055
|
// packages/native/src/media.tsx
|
|
9945
|
-
import { useRef as useRef33, useState as useState41 } from "react";
|
|
10056
|
+
import { createContext as createContext23, useContext as useContext20, useRef as useRef33, useState as useState41 } from "react";
|
|
9946
10057
|
import { Image, View as View50 } from "react-native";
|
|
9947
|
-
import { tokens as
|
|
10058
|
+
import { tokens as tokens57 } from "@kjun-ui/tokens";
|
|
9948
10059
|
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
10060
|
+
var ImageBackgroundContext = createContext23(void 0);
|
|
9949
10061
|
function KjunImage({ src, source, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, onLoad, onError }) {
|
|
9950
|
-
const { colors } = useKjunStyles();
|
|
10062
|
+
const { colors } = useKjunStyles(), background = useContext20(ImageBackgroundContext);
|
|
9951
10063
|
const request = JSON.stringify(source != null ? source : src), current = useRef33({ request, version: 0 });
|
|
9952
10064
|
if (current.current.request !== request) current.current = { request, version: current.current.version + 1 };
|
|
9953
10065
|
const version = current.current.version;
|
|
9954
10066
|
const [failed, setFailed] = useState41(null);
|
|
9955
10067
|
const missing = !source && !src;
|
|
9956
|
-
return /* @__PURE__ */ jsx58(View50, { 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: () => {
|
|
10068
|
+
return /* @__PURE__ */ jsx58(View50, { 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: () => {
|
|
9957
10069
|
if (version === current.current.version) onLoad == null ? void 0 : onLoad();
|
|
9958
10070
|
}, onError: () => {
|
|
9959
10071
|
if (version === current.current.version) {
|
|
9960
10072
|
setFailed(version);
|
|
9961
10073
|
onError == null ? void 0 : onError();
|
|
9962
10074
|
}
|
|
9963
|
-
} }, version) : /* @__PURE__ */ jsx58(View50, { 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:
|
|
10075
|
+
} }, version) : /* @__PURE__ */ jsx58(View50, { 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: tokens57.extensions.image.fallbackIconSize, color: colors.textSecondary }), { color: colors.textSecondary, fontWeight: typeStyle("control").fontWeight, textAlign: "center" }) }) });
|
|
9964
10076
|
}
|
|
9965
|
-
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
10077
|
+
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
9966
10078
|
const m = useKjunMessages();
|
|
9967
10079
|
const { colors } = useKjunStyles(), initial = Array.from(name.trim())[0];
|
|
9968
|
-
return /* @__PURE__ */ jsx58(View50, { style: { width:
|
|
10080
|
+
return /* @__PURE__ */ jsx58(View50, { style: { width: tokens57.extensions.avatar[size], height: tokens57.extensions.avatar[size], borderRadius: shape === "circle" ? tokens57.radius.radius9999 : tokens57.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: tokens57.extensions.avatar.fallbackIconSizes[size], color: textColor }), onLoad, onError }) }) });
|
|
9969
10081
|
}
|
|
9970
10082
|
|
|
9971
10083
|
// packages/native/src/chip.tsx
|
|
9972
10084
|
import { View as View51 } from "react-native";
|
|
9973
|
-
import { tokens as
|
|
10085
|
+
import { tokens as tokens58 } from "@kjun-ui/tokens";
|
|
9974
10086
|
import { jsx as jsx59, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
9975
10087
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
9976
10088
|
const m = useKjunMessages();
|
|
9977
10089
|
const { colors } = useKjunStyles();
|
|
9978
|
-
return /* @__PURE__ */ jsxs43(View51, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap:
|
|
9979
|
-
!!icon && /* @__PURE__ */ jsx59(KjunIcon, { name: icon, size:
|
|
9980
|
-
/* @__PURE__ */ jsx59(KText, { style: { ...typeStyle(
|
|
9981
|
-
removable && /* @__PURE__ */ jsx59(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width:
|
|
10090
|
+
return /* @__PURE__ */ jsxs43(View51, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: tokens58.extensions.chip.gap, minHeight: removable ? tokens58.extensions.chip.nativeRemoveSize : tokens58.extensions.chip[size], paddingVertical: removable ? 0 : tokens58.extensions.chip.paddingY, paddingLeft: tokens58.extensions.chip.paddingX, paddingRight: removable ? 0 : tokens58.extensions.chip.paddingX, borderRadius: tokens58.extensions.chip.radius, backgroundColor: colors.secondary, opacity: disabled ? tokens58.states.opacity.disabled : 1 }, children: [
|
|
10091
|
+
!!icon && /* @__PURE__ */ jsx59(KjunIcon, { name: icon, size: tokens58.extensions.chip.iconSizes[size] }),
|
|
10092
|
+
/* @__PURE__ */ jsx59(KText, { style: { ...typeStyle(tokens58.extensions.chip.typography[size]), flexShrink: 1, minWidth: 0 }, children: label }),
|
|
10093
|
+
removable && /* @__PURE__ */ jsx59(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width: tokens58.extensions.chip.nativeRemoveSize, height: tokens58.extensions.chip.nativeRemoveSize, borderRadius: tokens58.extensions.chip.radius, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx59(KjunIcon, { name: "x", size: tokens58.extensions.chip.removeIconSizes[size] }) })
|
|
9982
10094
|
] });
|
|
9983
10095
|
}
|
|
9984
10096
|
|
|
9985
10097
|
// packages/native/src/fab.tsx
|
|
9986
|
-
import { tokens as
|
|
10098
|
+
import { tokens as tokens59 } from "@kjun-ui/tokens";
|
|
9987
10099
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
9988
10100
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onPress }) {
|
|
9989
10101
|
const { colors } = useKjunStyles();
|
|
9990
|
-
const { size, inset, iconSize } =
|
|
10102
|
+
const { size, inset, iconSize } = tokens59.extensions.fab;
|
|
9991
10103
|
return /* @__PURE__ */ jsx60(
|
|
9992
10104
|
AccessiblePressable,
|
|
9993
10105
|
{
|
|
@@ -10000,15 +10112,15 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10000
10112
|
position: "absolute",
|
|
10001
10113
|
right: inset,
|
|
10002
10114
|
bottom: inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom),
|
|
10003
|
-
zIndex:
|
|
10115
|
+
zIndex: tokens59.layers.page.navigation,
|
|
10004
10116
|
width: size,
|
|
10005
10117
|
height: size,
|
|
10006
10118
|
borderRadius: size / 2,
|
|
10007
10119
|
alignItems: "center",
|
|
10008
10120
|
justifyContent: "center",
|
|
10009
10121
|
backgroundColor: pressed ? colors.brandActive : colors.brand,
|
|
10010
|
-
opacity: disabled ?
|
|
10011
|
-
boxShadow: shadowLayers(
|
|
10122
|
+
opacity: disabled ? tokens59.states.opacity.disabled : 1,
|
|
10123
|
+
boxShadow: shadowLayers(tokens59.elevation.floating, colors)
|
|
10012
10124
|
}),
|
|
10013
10125
|
children: /* @__PURE__ */ jsx60(KjunIcon, { name: icon, size: iconSize, color: colors.onBrand })
|
|
10014
10126
|
}
|
|
@@ -10018,10 +10130,10 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
10018
10130
|
// packages/native/src/range-input.tsx
|
|
10019
10131
|
import { useEffect as useEffect27, useMemo as useMemo3, useRef as useRef34, useState as useState42 } from "react";
|
|
10020
10132
|
import { PanResponder, Platform as Platform28, Pressable as Pressable3, View as View52 } from "react-native";
|
|
10021
|
-
import { tokens as
|
|
10133
|
+
import { tokens as tokens60, createSliderDomain, sliderKey } from "@kjun-ui/tokens";
|
|
10022
10134
|
import { jsx as jsx61, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
10023
|
-
var geometry =
|
|
10024
|
-
var targetSize =
|
|
10135
|
+
var geometry = tokens60.extensions.slider;
|
|
10136
|
+
var targetSize = tokens60.native.minimumTouchTarget;
|
|
10025
10137
|
var trackFocus = { tabIndex: -1 };
|
|
10026
10138
|
function RangeInput({
|
|
10027
10139
|
value,
|
|
@@ -10121,10 +10233,10 @@ function RangeInput({
|
|
|
10121
10233
|
View52,
|
|
10122
10234
|
{
|
|
10123
10235
|
style: {
|
|
10124
|
-
minWidth:
|
|
10236
|
+
minWidth: tokens60.extensions.slider.minimumWidth,
|
|
10125
10237
|
width: "100%",
|
|
10126
|
-
gap:
|
|
10127
|
-
opacity: blocked ?
|
|
10238
|
+
gap: tokens60.dimension.value4,
|
|
10239
|
+
opacity: blocked ? tokens60.states.opacity.disabled : 1
|
|
10128
10240
|
},
|
|
10129
10241
|
children: [
|
|
10130
10242
|
/* @__PURE__ */ jsxs44(
|
|
@@ -10134,7 +10246,7 @@ function RangeInput({
|
|
|
10134
10246
|
flexDirection: "row",
|
|
10135
10247
|
alignItems: "baseline",
|
|
10136
10248
|
justifyContent: "space-between",
|
|
10137
|
-
gap:
|
|
10249
|
+
gap: tokens60.dimension.value12,
|
|
10138
10250
|
minWidth: 0
|
|
10139
10251
|
},
|
|
10140
10252
|
children: [
|
|
@@ -10195,7 +10307,7 @@ function RangeInput({
|
|
|
10195
10307
|
{
|
|
10196
10308
|
style: {
|
|
10197
10309
|
height: geometry.track,
|
|
10198
|
-
borderRadius:
|
|
10310
|
+
borderRadius: tokens60.radius.radius9999,
|
|
10199
10311
|
backgroundColor: colors.border
|
|
10200
10312
|
}
|
|
10201
10313
|
}
|
|
@@ -10210,7 +10322,7 @@ function RangeInput({
|
|
|
10210
10322
|
position: "absolute",
|
|
10211
10323
|
top: (targetSize - geometry.track) / 2,
|
|
10212
10324
|
height: geometry.track,
|
|
10213
|
-
borderRadius:
|
|
10325
|
+
borderRadius: tokens60.radius.radius9999,
|
|
10214
10326
|
left: pct(values.length === 2 ? percent(values[0]) : 0),
|
|
10215
10327
|
width: pct(
|
|
10216
10328
|
percent(values[values.length - 1]) - (values.length === 2 ? percent(values[0]) : 0)
|
|
@@ -10286,14 +10398,14 @@ function RangeInput({
|
|
|
10286
10398
|
style: {
|
|
10287
10399
|
width: geometry.thumb,
|
|
10288
10400
|
height: geometry.thumb,
|
|
10289
|
-
borderRadius:
|
|
10290
|
-
borderWidth:
|
|
10401
|
+
borderRadius: tokens60.radius.radius9999,
|
|
10402
|
+
borderWidth: tokens60.border.controlWidth,
|
|
10291
10403
|
borderColor: !blocked && dragging === index ? colors.brandActive : !blocked && hovered === index ? colors.brandHover : colors.brand,
|
|
10292
10404
|
backgroundColor: colors.surface,
|
|
10293
10405
|
...Platform28.OS === "web" && !blocked && focused === index ? {
|
|
10294
10406
|
outlineStyle: "solid",
|
|
10295
|
-
outlineWidth:
|
|
10296
|
-
outlineOffset:
|
|
10407
|
+
outlineWidth: tokens60.states.focus.width,
|
|
10408
|
+
outlineOffset: tokens60.states.focus.choiceOffset,
|
|
10297
10409
|
outlineColor: colors.focusRing
|
|
10298
10410
|
} : {}
|
|
10299
10411
|
}
|
|
@@ -10319,7 +10431,7 @@ function KjunRangeSlider(props) {
|
|
|
10319
10431
|
// packages/native/src/quantity-stepper.tsx
|
|
10320
10432
|
import { useEffect as useEffect28, useRef as useRef35, useState as useState43 } from "react";
|
|
10321
10433
|
import { Platform as Platform29, View as View53 } from "react-native";
|
|
10322
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
10434
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens61 } from "@kjun-ui/tokens";
|
|
10323
10435
|
|
|
10324
10436
|
// shared/package-runtime/component-icons.ts
|
|
10325
10437
|
import minus from "@kjun-ui/icons/icons/minus";
|
|
@@ -10333,9 +10445,9 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10333
10445
|
const field = useKjunField();
|
|
10334
10446
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
10335
10447
|
const labelledBy = !ariaLabel && (field == null ? void 0 : field.label) && !field.labelHidden ? field.id + "-label" : void 0;
|
|
10336
|
-
const geometry2 =
|
|
10337
|
-
const buttonStyle = { width:
|
|
10338
|
-
const outer =
|
|
10448
|
+
const geometry2 = tokens61.extensions.compound;
|
|
10449
|
+
const buttonStyle = { width: tokens61.input[size].height, paddingHorizontal: 0 };
|
|
10450
|
+
const outer = tokens61.input[size].radius;
|
|
10339
10451
|
const decreaseStyle = { ...buttonStyle, borderRadius: 0, borderTopLeftRadius: outer, borderBottomLeftRadius: outer };
|
|
10340
10452
|
const increaseStyle = { ...buttonStyle, borderRadius: 0, borderTopRightRadius: outer, borderBottomRightRadius: outer };
|
|
10341
10453
|
const domain = createNumberDomain({ min, max, step, precision }), valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
@@ -10423,12 +10535,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10423
10535
|
input.removeEventListener("compositionend", end);
|
|
10424
10536
|
};
|
|
10425
10537
|
}, []);
|
|
10426
|
-
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height:
|
|
10538
|
+
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: tokens61.input[size].height, marginTop: -tokens61.input[size].height / 2, borderRadius: surface.spec.radius };
|
|
10427
10539
|
const hug = Platform29.OS === "web" && !block ? { width: "fit-content" } : {};
|
|
10428
10540
|
return /* @__PURE__ */ jsx62(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs45(View53, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
|
|
10429
10541
|
/* @__PURE__ */ jsx62(View53, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
|
|
10430
10542
|
/* @__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" }) }),
|
|
10431
|
-
/* @__PURE__ */ jsx62(View53, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 :
|
|
10543
|
+
/* @__PURE__ */ jsx62(View53, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : tokens61.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
|
|
10432
10544
|
var _a;
|
|
10433
10545
|
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
10434
10546
|
}, blocked), children: /* @__PURE__ */ jsx62(
|
|
@@ -10457,23 +10569,23 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10457
10569
|
},
|
|
10458
10570
|
onSubmitEditing: Platform29.OS === "web" ? void 0 : commit,
|
|
10459
10571
|
...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 },
|
|
10460
|
-
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 -
|
|
10572
|
+
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 - tokens61.border.controlWidth, paddingVertical: 0 }
|
|
10461
10573
|
}
|
|
10462
10574
|
) }),
|
|
10463
10575
|
/* @__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" }) }),
|
|
10464
|
-
(invalid || surface.active) && /* @__PURE__ */ jsx62(View53, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ?
|
|
10576
|
+
(invalid || surface.active) && /* @__PURE__ */ jsx62(View53, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ? tokens61.border.controlWidth : tokens61.states.focus.width, borderColor: invalid ? colors.danger : colors.focusRing } })
|
|
10465
10577
|
] }) });
|
|
10466
10578
|
}
|
|
10467
10579
|
|
|
10468
10580
|
// packages/native/src/time-picker.tsx
|
|
10469
10581
|
import { Fragment as Fragment21, useEffect as useEffect29, useId as useId11, useMemo as useMemo4, useRef as useRef36, useState as useState44 } from "react";
|
|
10470
10582
|
import { View as View54 } from "react-native";
|
|
10471
|
-
import { createTimeDomain, tokens as
|
|
10583
|
+
import { createTimeDomain, tokens as tokens62 } from "@kjun-ui/tokens";
|
|
10472
10584
|
import { jsx as jsx63, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10473
10585
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
10474
10586
|
const m = useKjunMessages();
|
|
10475
10587
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
10476
|
-
const geometry2 =
|
|
10588
|
+
const geometry2 = tokens62.extensions.timePicker, spec = tokens62.input[size];
|
|
10477
10589
|
const { colors } = useKjunStyles();
|
|
10478
10590
|
const first = useRef36(null);
|
|
10479
10591
|
const [focused, setFocused] = useState44(false), [opened, setOpened] = useState44(null);
|
|
@@ -10497,12 +10609,12 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10497
10609
|
if (typeof next === "number") change(domain.select(value, index, next));
|
|
10498
10610
|
}, 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 }) }) }) })
|
|
10499
10611
|
] }, label)) }),
|
|
10500
|
-
clearable && value !== null && /* @__PURE__ */ jsx63(View54, { style: { marginVertical: Math.min(0, (spec.height -
|
|
10612
|
+
clearable && value !== null && /* @__PURE__ */ jsx63(View54, { style: { marginVertical: Math.min(0, (spec.height - tokens62.native.minimumTouchTarget) / 2) }, children: /* @__PURE__ */ jsx63(FieldClear, { size, label: m.clearValue(ariaLabel), disabled: disabled || !valid, onPress: () => {
|
|
10501
10613
|
var _a;
|
|
10502
10614
|
change(null);
|
|
10503
10615
|
(_a = first.current) == null ? void 0 : _a.focus();
|
|
10504
10616
|
} }) }),
|
|
10505
|
-
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx63(View54, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ?
|
|
10617
|
+
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ jsx63(View54, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? tokens62.border.controlWidth : tokens62.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
10506
10618
|
] });
|
|
10507
10619
|
}
|
|
10508
10620
|
export {
|
|
@@ -10551,6 +10663,7 @@ export {
|
|
|
10551
10663
|
KjunInput,
|
|
10552
10664
|
KjunKpiHero,
|
|
10553
10665
|
KjunKpiRow,
|
|
10666
|
+
KjunListItem,
|
|
10554
10667
|
KjunListRow,
|
|
10555
10668
|
KjunListSection,
|
|
10556
10669
|
KjunListSkeleton,
|
|
@@ -10590,6 +10703,7 @@ export {
|
|
|
10590
10703
|
KjunTimePicker,
|
|
10591
10704
|
KjunTooltip,
|
|
10592
10705
|
KjunTopNavigation,
|
|
10706
|
+
createKjunFeedback,
|
|
10593
10707
|
kjunMessagesEn,
|
|
10594
10708
|
kjunMessagesKo,
|
|
10595
10709
|
useKjunFeedback,
|