@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.cjs
CHANGED
|
@@ -75,6 +75,7 @@ __export(index_exports, {
|
|
|
75
75
|
KjunInput: () => KjunInput,
|
|
76
76
|
KjunKpiHero: () => KjunKpiHero,
|
|
77
77
|
KjunKpiRow: () => KjunKpiRow,
|
|
78
|
+
KjunListItem: () => KjunListItem,
|
|
78
79
|
KjunListRow: () => KjunListRow,
|
|
79
80
|
KjunListSection: () => KjunListSection,
|
|
80
81
|
KjunListSkeleton: () => KjunListSkeleton,
|
|
@@ -114,6 +115,7 @@ __export(index_exports, {
|
|
|
114
115
|
KjunTimePicker: () => KjunTimePicker,
|
|
115
116
|
KjunTooltip: () => KjunTooltip,
|
|
116
117
|
KjunTopNavigation: () => KjunTopNavigation,
|
|
118
|
+
createKjunFeedback: () => import_tokens21.createKjunFeedback,
|
|
117
119
|
kjunMessagesEn: () => kjunMessagesEn,
|
|
118
120
|
kjunMessagesKo: () => kjunMessagesKo,
|
|
119
121
|
useKjunFeedback: () => useKjunFeedback,
|
|
@@ -2222,7 +2224,11 @@ function KjunCard({
|
|
|
2222
2224
|
border = false,
|
|
2223
2225
|
dividers = false,
|
|
2224
2226
|
children,
|
|
2225
|
-
style
|
|
2227
|
+
style,
|
|
2228
|
+
pressable = false,
|
|
2229
|
+
disabled = false,
|
|
2230
|
+
ariaLabel,
|
|
2231
|
+
onPress
|
|
2226
2232
|
}) {
|
|
2227
2233
|
const { colors } = useKjunStyles();
|
|
2228
2234
|
const id = "kjun-" + (0, import_react21.useId)().replace(/[^a-z0-9]/gi, "");
|
|
@@ -2233,7 +2239,7 @@ function KjunCard({
|
|
|
2233
2239
|
const hasHeading = hasContent(header) || hasContent(title) || hasContent(subtitle);
|
|
2234
2240
|
const hasHeader = hasHeading || hasContent(headerActions);
|
|
2235
2241
|
const hasBody = hasContent(children), hasFooter = hasContent(footer), hasMedia = hasContent(media);
|
|
2236
|
-
|
|
2242
|
+
const base = [
|
|
2237
2243
|
{
|
|
2238
2244
|
minWidth: 0,
|
|
2239
2245
|
borderRadius: corner,
|
|
@@ -2242,7 +2248,8 @@ function KjunCard({
|
|
|
2242
2248
|
},
|
|
2243
2249
|
import_react_native15.Platform.OS === "web" && surface === "glass" ? { backdropFilter: `blur(${import_tokens12.tokens.card.glassBlur}px)` } : {},
|
|
2244
2250
|
style
|
|
2245
|
-
]
|
|
2251
|
+
];
|
|
2252
|
+
const parts = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2246
2253
|
paint.gradientEnd && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native15.View, { pointerEvents: "none", style: { position: "absolute", inset: 0, borderRadius: corner, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native_svg2.default, { width: "100%", height: "100%", children: [
|
|
2247
2254
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_svg2.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native_svg2.LinearGradient, { id, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
2248
2255
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_svg2.Stop, { offset: "0", stopColor: colors[paint.background] }),
|
|
@@ -2285,6 +2292,18 @@ function KjunCard({
|
|
|
2285
2292
|
boxShadow: [{ offsetX: 0, offsetY: 0, blurRadius: 0, spreadDistance: import_tokens12.tokens.card.borderWidth, inset: true, color: borderColor }]
|
|
2286
2293
|
} })
|
|
2287
2294
|
] });
|
|
2295
|
+
return pressable ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2296
|
+
AccessiblePressable,
|
|
2297
|
+
{
|
|
2298
|
+
accessibilityRole: "button",
|
|
2299
|
+
accessibilityLabel: ariaLabel != null ? ariaLabel : title,
|
|
2300
|
+
accessibilityState: { disabled },
|
|
2301
|
+
disabled,
|
|
2302
|
+
onPress,
|
|
2303
|
+
style: ({ pressed }) => [base, pressed ? { transform: [{ scale: 0.99 }] } : null, disabled ? { opacity: import_tokens12.tokens.states.opacity.disabled } : null],
|
|
2304
|
+
children: parts
|
|
2305
|
+
}
|
|
2306
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native15.View, { style: base, children: parts });
|
|
2288
2307
|
}
|
|
2289
2308
|
|
|
2290
2309
|
// shared/package-runtime/alert-live.ts
|
|
@@ -2295,10 +2314,29 @@ function alertRole(tone, live) {
|
|
|
2295
2314
|
}
|
|
2296
2315
|
|
|
2297
2316
|
// packages/native/src/display-primitives.tsx
|
|
2298
|
-
var
|
|
2317
|
+
var import_tokens14 = require("@kjun-ui/tokens");
|
|
2299
2318
|
var import_react22 = require("react");
|
|
2300
2319
|
var import_react_native16 = require("react-native");
|
|
2301
2320
|
var import_react_native_svg3 = __toESM(require("react-native-svg"), 1);
|
|
2321
|
+
|
|
2322
|
+
// shared/package-runtime/progress-circle.ts
|
|
2323
|
+
var import_tokens13 = require("@kjun-ui/tokens");
|
|
2324
|
+
function progressCircle(size, percentage) {
|
|
2325
|
+
const { size: diameter, stroke } = import_tokens13.tokens.extensions.progress.circle[size];
|
|
2326
|
+
const radius = (diameter - stroke) / 2, circumference = 2 * Math.PI * radius;
|
|
2327
|
+
return {
|
|
2328
|
+
diameter,
|
|
2329
|
+
stroke,
|
|
2330
|
+
radius,
|
|
2331
|
+
centre: diameter / 2,
|
|
2332
|
+
circumference,
|
|
2333
|
+
offset: circumference * (1 - percentage / 100),
|
|
2334
|
+
// Small circles are too narrow for the centre percentage; screen readers still get the value.
|
|
2335
|
+
showsPercentage: size !== "sm"
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
// packages/native/src/display-primitives.tsx
|
|
2302
2340
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2303
2341
|
var badgeLayoutKeys = /* @__PURE__ */ new Set([
|
|
2304
2342
|
"alignSelf",
|
|
@@ -2338,10 +2376,10 @@ function BadgeView({
|
|
|
2338
2376
|
dot = false,
|
|
2339
2377
|
children,
|
|
2340
2378
|
style,
|
|
2341
|
-
dotSize =
|
|
2379
|
+
dotSize = import_tokens14.tokens.extensions.badge.dotSize
|
|
2342
2380
|
}) {
|
|
2343
2381
|
const { colors, domainColors } = useKjunStyles();
|
|
2344
|
-
const { x, y } =
|
|
2382
|
+
const { x, y } = import_tokens14.tokens.extensions.badge.padding[size];
|
|
2345
2383
|
const type = typeStyle(size === "xl" ? "controlLarge" : size === "lg" ? "control" : "controlSmall");
|
|
2346
2384
|
const neutral = variant === "default" || variant === "secondary";
|
|
2347
2385
|
const financial = variant.startsWith("price-");
|
|
@@ -2359,10 +2397,10 @@ function BadgeView({
|
|
|
2359
2397
|
maxWidth: "100%",
|
|
2360
2398
|
minWidth: 0,
|
|
2361
2399
|
flexShrink: 1,
|
|
2362
|
-
gap:
|
|
2400
|
+
gap: import_tokens14.tokens.extensions.badge.gap,
|
|
2363
2401
|
paddingHorizontal: x,
|
|
2364
2402
|
paddingVertical: y,
|
|
2365
|
-
borderRadius:
|
|
2403
|
+
borderRadius: import_tokens14.tokens.extensions.badge.radius,
|
|
2366
2404
|
backgroundColor: background
|
|
2367
2405
|
},
|
|
2368
2406
|
inner
|
|
@@ -2400,7 +2438,7 @@ function KjunEmpty({
|
|
|
2400
2438
|
const m = useKjunMessages();
|
|
2401
2439
|
text != null ? text : text = m.noData;
|
|
2402
2440
|
const { colors } = useKjunStyles();
|
|
2403
|
-
const spec =
|
|
2441
|
+
const spec = import_tokens14.tokens.extensions.empty;
|
|
2404
2442
|
const stateContent = (0, import_react22.useContext)(DataStateContentContext);
|
|
2405
2443
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2406
2444
|
import_react_native16.View,
|
|
@@ -2408,7 +2446,7 @@ function KjunEmpty({
|
|
|
2408
2446
|
style: {
|
|
2409
2447
|
alignItems: "center",
|
|
2410
2448
|
justifyContent: "center",
|
|
2411
|
-
paddingVertical: stateContent === "empty" ? 0 :
|
|
2449
|
+
paddingVertical: stateContent === "empty" ? 0 : import_tokens14.tokens.dimension.value32
|
|
2412
2450
|
},
|
|
2413
2451
|
children: [
|
|
2414
2452
|
!!icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native16.View, { style: { marginBottom: spec.iconGap }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KjunIcon, { name: icon, size: spec.iconSize, color: colors.textSecondary }) }),
|
|
@@ -2441,7 +2479,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2441
2479
|
const loop = import_react_native16.Animated.loop(
|
|
2442
2480
|
import_react_native16.Animated.timing(rotation, {
|
|
2443
2481
|
toValue: 1,
|
|
2444
|
-
duration:
|
|
2482
|
+
duration: import_tokens14.tokens.motion.spin,
|
|
2445
2483
|
easing: import_react_native16.Easing.linear,
|
|
2446
2484
|
useNativeDriver: import_react_native16.Platform.OS !== "web"
|
|
2447
2485
|
})
|
|
@@ -2452,8 +2490,8 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2452
2490
|
rotation.setValue(0);
|
|
2453
2491
|
};
|
|
2454
2492
|
}, [reduced, rotation]);
|
|
2455
|
-
const dimension =
|
|
2456
|
-
const stroke =
|
|
2493
|
+
const dimension = import_tokens14.tokens.extensions.spinner.sizes[size];
|
|
2494
|
+
const stroke = import_tokens14.tokens.extensions.spinner.strokeWidths[size] * 24 / dimension;
|
|
2457
2495
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2458
2496
|
import_react_native16.View,
|
|
2459
2497
|
{
|
|
@@ -2507,7 +2545,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2507
2545
|
)
|
|
2508
2546
|
}
|
|
2509
2547
|
),
|
|
2510
|
-
!!text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KText, { style: { marginLeft:
|
|
2548
|
+
!!text && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(KText, { style: { marginLeft: import_tokens14.tokens.dimension.value8, color: colors.textSecondary }, children: text })
|
|
2511
2549
|
]
|
|
2512
2550
|
}
|
|
2513
2551
|
);
|
|
@@ -2528,8 +2566,8 @@ function KjunAlert({
|
|
|
2528
2566
|
const [visible, setVisible] = (0, import_react22.useState)(true);
|
|
2529
2567
|
if (!visible) return null;
|
|
2530
2568
|
const tone = variant || (type === "error" ? "danger" : type), small = size === "sm";
|
|
2531
|
-
const geometry2 =
|
|
2532
|
-
const lineHeight =
|
|
2569
|
+
const geometry2 = import_tokens14.tokens.extensions.alert;
|
|
2570
|
+
const lineHeight = import_tokens14.tokens.typography[small ? "controlSmall" : "control"].lineHeightPx;
|
|
2533
2571
|
const titled = hasContent(title);
|
|
2534
2572
|
const closeSize = small ? geometry2.sm.closeSize : geometry2.closeSize;
|
|
2535
2573
|
const pick = (suffix) => tone === "primary" ? suffix === "Bg" ? colors.brandSubtleBg : suffix === "Light" ? colors.brandLight : colors.brand : colors[tone + suffix];
|
|
@@ -2540,11 +2578,11 @@ function KjunAlert({
|
|
|
2540
2578
|
style: {
|
|
2541
2579
|
flexDirection: "row",
|
|
2542
2580
|
alignItems: "flex-start",
|
|
2543
|
-
gap:
|
|
2544
|
-
borderWidth:
|
|
2545
|
-
borderRadius:
|
|
2546
|
-
paddingVertical:
|
|
2547
|
-
paddingHorizontal:
|
|
2581
|
+
gap: import_tokens14.tokens.extensions.alert[small ? "sm" : "md"].gap,
|
|
2582
|
+
borderWidth: import_tokens14.tokens.border.defaultWidth,
|
|
2583
|
+
borderRadius: import_tokens14.tokens.extensions.alert.radius,
|
|
2584
|
+
paddingVertical: import_tokens14.tokens.extensions.alert[small ? "sm" : "md"].paddingY,
|
|
2585
|
+
paddingHorizontal: import_tokens14.tokens.extensions.alert[small ? "sm" : "md"].paddingX,
|
|
2548
2586
|
backgroundColor: pick("Bg"),
|
|
2549
2587
|
borderColor: pick("Light")
|
|
2550
2588
|
},
|
|
@@ -2559,7 +2597,7 @@ function KjunAlert({
|
|
|
2559
2597
|
warning: "alert-triangle",
|
|
2560
2598
|
danger: "alert-circle"
|
|
2561
2599
|
}[tone],
|
|
2562
|
-
size:
|
|
2600
|
+
size: import_tokens14.tokens.extensions.alert.iconSizes[small ? "sm" : "md"],
|
|
2563
2601
|
color: pick("Accent")
|
|
2564
2602
|
}
|
|
2565
2603
|
) }),
|
|
@@ -2576,7 +2614,7 @@ function KjunAlert({
|
|
|
2576
2614
|
{
|
|
2577
2615
|
accessibilityRole: "button",
|
|
2578
2616
|
accessibilityLabel: m.close,
|
|
2579
|
-
hitSlop: Math.max(0, (
|
|
2617
|
+
hitSlop: Math.max(0, (import_tokens14.tokens.native.minimumTouchTarget - closeSize) / 2),
|
|
2580
2618
|
style: ({ pressed, hovered }) => ({
|
|
2581
2619
|
width: closeSize,
|
|
2582
2620
|
height: closeSize,
|
|
@@ -2614,11 +2652,58 @@ function KjunProgress({
|
|
|
2614
2652
|
variant = "primary",
|
|
2615
2653
|
showLabel = false,
|
|
2616
2654
|
label,
|
|
2617
|
-
subLabel
|
|
2655
|
+
subLabel,
|
|
2656
|
+
shape = "bar"
|
|
2618
2657
|
}) {
|
|
2619
2658
|
const m = useKjunMessages();
|
|
2620
|
-
const { colors } = useKjunStyles();
|
|
2659
|
+
const { colors, numericFontFamily, fontFamily } = useKjunStyles();
|
|
2621
2660
|
const percentage = Number.isFinite(value) && max > 0 ? Math.min(100, Math.max(0, Math.round(value / max * 100))) : 0;
|
|
2661
|
+
const name = typeof label === "string" ? label : m.progress, color = variant === "primary" ? colors.brand : colors[variant];
|
|
2662
|
+
const semantics = {
|
|
2663
|
+
accessibilityRole: "progressbar",
|
|
2664
|
+
accessibilityLabel: name,
|
|
2665
|
+
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2666
|
+
"aria-valuemin": 0,
|
|
2667
|
+
"aria-valuemax": 100,
|
|
2668
|
+
"aria-valuenow": percentage
|
|
2669
|
+
};
|
|
2670
|
+
if (shape === "circle") {
|
|
2671
|
+
const c = progressCircle(size, percentage);
|
|
2672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { style: { alignSelf: "flex-start", alignItems: "center" }, children: [
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { ...semantics, style: { width: c.diameter, height: c.diameter, alignItems: "center", justifyContent: "center" }, children: [
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native_svg3.default, { width: c.diameter, height: c.diameter, viewBox: `0 0 ${c.diameter} ${c.diameter}`, style: import_react_native16.StyleSheet.absoluteFill, children: [
|
|
2675
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native_svg3.Circle, { cx: c.centre, cy: c.centre, r: c.radius, stroke: colors.secondary, strokeWidth: c.stroke, fill: "none" }),
|
|
2676
|
+
percentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2677
|
+
import_react_native_svg3.Circle,
|
|
2678
|
+
{
|
|
2679
|
+
cx: c.centre,
|
|
2680
|
+
cy: c.centre,
|
|
2681
|
+
r: c.radius,
|
|
2682
|
+
stroke: color,
|
|
2683
|
+
strokeWidth: c.stroke,
|
|
2684
|
+
fill: "none",
|
|
2685
|
+
strokeLinecap: "round",
|
|
2686
|
+
strokeDasharray: c.circumference,
|
|
2687
|
+
strokeDashoffset: c.offset,
|
|
2688
|
+
rotation: -90,
|
|
2689
|
+
origin: `${c.centre}, ${c.centre}`
|
|
2690
|
+
}
|
|
2691
|
+
)
|
|
2692
|
+
] }),
|
|
2693
|
+
showLabel && c.showsPercentage && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(KText, { style: {
|
|
2694
|
+
...typeStyle(size === "lg" ? "numberMd" : "meta"),
|
|
2695
|
+
fontFamily: numericFontFamily || fontFamily,
|
|
2696
|
+
fontVariant: ["tabular-nums"],
|
|
2697
|
+
color: colors.text
|
|
2698
|
+
}, children: [
|
|
2699
|
+
percentage,
|
|
2700
|
+
"%"
|
|
2701
|
+
] })
|
|
2702
|
+
] }),
|
|
2703
|
+
content(label, { ...typeStyle("caption"), marginTop: import_tokens14.tokens.dimension.value8, color: colors.textSecondary, textAlign: "center" }),
|
|
2704
|
+
content(subLabel, { ...typeStyle("caption"), marginTop: import_tokens14.tokens.dimension.value4, color: colors.textTertiary, textAlign: "center" })
|
|
2705
|
+
] });
|
|
2706
|
+
}
|
|
2622
2707
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native16.View, { children: [
|
|
2623
2708
|
!!(label || showLabel) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2624
2709
|
import_react_native16.View,
|
|
@@ -2626,7 +2711,7 @@ function KjunProgress({
|
|
|
2626
2711
|
style: {
|
|
2627
2712
|
flexDirection: "row",
|
|
2628
2713
|
justifyContent: "space-between",
|
|
2629
|
-
marginBottom:
|
|
2714
|
+
marginBottom: import_tokens14.tokens.dimension.value8
|
|
2630
2715
|
},
|
|
2631
2716
|
children: [
|
|
2632
2717
|
content(label, {
|
|
@@ -2652,13 +2737,11 @@ function KjunProgress({
|
|
|
2652
2737
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2653
2738
|
import_react_native16.View,
|
|
2654
2739
|
{
|
|
2655
|
-
|
|
2656
|
-
accessibilityLabel: typeof label === "string" ? label : m.progress,
|
|
2657
|
-
accessibilityValue: { min: 0, max: 100, now: percentage },
|
|
2740
|
+
...semantics,
|
|
2658
2741
|
style: {
|
|
2659
|
-
height:
|
|
2742
|
+
height: import_tokens14.tokens.extensions.progress.heights[size],
|
|
2660
2743
|
backgroundColor: colors.secondary,
|
|
2661
|
-
borderRadius:
|
|
2744
|
+
borderRadius: import_tokens14.tokens.radius.radius9999,
|
|
2662
2745
|
overflow: "hidden"
|
|
2663
2746
|
},
|
|
2664
2747
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
@@ -2667,8 +2750,8 @@ function KjunProgress({
|
|
|
2667
2750
|
style: {
|
|
2668
2751
|
width: `${percentage}%`,
|
|
2669
2752
|
height: "100%",
|
|
2670
|
-
borderRadius:
|
|
2671
|
-
backgroundColor:
|
|
2753
|
+
borderRadius: import_tokens14.tokens.radius.radius9999,
|
|
2754
|
+
backgroundColor: color
|
|
2672
2755
|
}
|
|
2673
2756
|
}
|
|
2674
2757
|
)
|
|
@@ -2676,14 +2759,14 @@ function KjunProgress({
|
|
|
2676
2759
|
),
|
|
2677
2760
|
content(subLabel, {
|
|
2678
2761
|
...typeStyle("caption"),
|
|
2679
|
-
marginTop:
|
|
2762
|
+
marginTop: import_tokens14.tokens.dimension.value4,
|
|
2680
2763
|
color: colors.textTertiary
|
|
2681
2764
|
})
|
|
2682
2765
|
] });
|
|
2683
2766
|
}
|
|
2684
2767
|
|
|
2685
2768
|
// packages/native/src/skeleton-base.tsx
|
|
2686
|
-
var
|
|
2769
|
+
var import_tokens15 = require("@kjun-ui/tokens");
|
|
2687
2770
|
var import_react23 = require("react");
|
|
2688
2771
|
var import_react_native17 = require("react-native");
|
|
2689
2772
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -2703,12 +2786,12 @@ function KjunSkeleton({
|
|
|
2703
2786
|
import_react_native17.Animated.sequence([
|
|
2704
2787
|
import_react_native17.Animated.timing(opacity, {
|
|
2705
2788
|
toValue: 0.6,
|
|
2706
|
-
duration:
|
|
2789
|
+
duration: import_tokens15.tokens.motion.shimmer / 2,
|
|
2707
2790
|
useNativeDriver: false
|
|
2708
2791
|
}),
|
|
2709
2792
|
import_react_native17.Animated.timing(opacity, {
|
|
2710
2793
|
toValue: 1,
|
|
2711
|
-
duration:
|
|
2794
|
+
duration: import_tokens15.tokens.motion.shimmer / 2,
|
|
2712
2795
|
useNativeDriver: false
|
|
2713
2796
|
})
|
|
2714
2797
|
])
|
|
@@ -2727,18 +2810,18 @@ function KjunSkeleton({
|
|
|
2727
2810
|
width: w,
|
|
2728
2811
|
height: h,
|
|
2729
2812
|
backgroundColor: shimmer,
|
|
2730
|
-
borderRadius:
|
|
2813
|
+
borderRadius: import_tokens15.tokens.extensions.skeleton.lineRadius,
|
|
2731
2814
|
...extra
|
|
2732
2815
|
}
|
|
2733
2816
|
}
|
|
2734
2817
|
);
|
|
2735
2818
|
const count = (n) => Array.from({ length: Math.max(0, Math.floor(n)) }, (_, i) => i + 1);
|
|
2736
|
-
const line = (w, key, h =
|
|
2819
|
+
const line = (w, key, h = import_tokens15.tokens.extensions.skeleton.lineHeights.md) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native17.View, { style: { marginBottom: key === rows ? 0 : import_tokens15.tokens.extensions.skeleton.gap }, children: block(w, h) }, key);
|
|
2737
2820
|
const frame = {
|
|
2738
|
-
padding:
|
|
2739
|
-
borderWidth:
|
|
2821
|
+
padding: import_tokens15.tokens.extensions.skeleton.padding,
|
|
2822
|
+
borderWidth: import_tokens15.tokens.border.defaultWidth,
|
|
2740
2823
|
borderColor: colors.border,
|
|
2741
|
-
borderRadius:
|
|
2824
|
+
borderRadius: import_tokens15.tokens.extensions.skeleton.radius,
|
|
2742
2825
|
backgroundColor: colors.background
|
|
2743
2826
|
};
|
|
2744
2827
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -2754,7 +2837,7 @@ function KjunSkeleton({
|
|
|
2754
2837
|
i
|
|
2755
2838
|
)
|
|
2756
2839
|
),
|
|
2757
|
-
type === "avatar" && block(width ||
|
|
2840
|
+
type === "avatar" && block(width || import_tokens15.tokens.extensions.skeleton.avatarSize, height || import_tokens15.tokens.extensions.skeleton.avatarSize, { borderRadius: rounded ? import_tokens15.tokens.radius.radius9999 : import_tokens15.tokens.extensions.skeleton.blockRadius }),
|
|
2758
2841
|
type === "card" && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: frame, children: [
|
|
2759
2842
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2760
2843
|
import_react_native17.View,
|
|
@@ -2762,19 +2845,19 @@ function KjunSkeleton({
|
|
|
2762
2845
|
style: {
|
|
2763
2846
|
flexDirection: "row",
|
|
2764
2847
|
alignItems: "center",
|
|
2765
|
-
gap:
|
|
2766
|
-
marginBottom:
|
|
2848
|
+
gap: import_tokens15.tokens.extensions.skeleton.gap,
|
|
2849
|
+
marginBottom: import_tokens15.tokens.dimension.value16
|
|
2767
2850
|
},
|
|
2768
2851
|
children: [
|
|
2769
|
-
block(
|
|
2770
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap:
|
|
2852
|
+
block(import_tokens15.tokens.extensions.skeleton.cardAvatarSize, import_tokens15.tokens.extensions.skeleton.cardAvatarSize, { borderRadius: import_tokens15.tokens.radius.radius9999 }),
|
|
2853
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap: import_tokens15.tokens.dimension.value8 }, children: [
|
|
2771
2854
|
block("60%"),
|
|
2772
|
-
block("40%",
|
|
2855
|
+
block("40%", import_tokens15.tokens.extensions.skeleton.lineHeights.sm)
|
|
2773
2856
|
] })
|
|
2774
2857
|
]
|
|
2775
2858
|
}
|
|
2776
2859
|
),
|
|
2777
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { gap:
|
|
2860
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { gap: import_tokens15.tokens.dimension.value10 }, children: [
|
|
2778
2861
|
block("100%"),
|
|
2779
2862
|
block("80%"),
|
|
2780
2863
|
block("60%")
|
|
@@ -2784,9 +2867,9 @@ function KjunSkeleton({
|
|
|
2784
2867
|
import_react_native17.View,
|
|
2785
2868
|
{
|
|
2786
2869
|
style: {
|
|
2787
|
-
borderWidth:
|
|
2870
|
+
borderWidth: import_tokens15.tokens.border.defaultWidth,
|
|
2788
2871
|
borderColor: colors.border,
|
|
2789
|
-
borderRadius:
|
|
2872
|
+
borderRadius: import_tokens15.tokens.extensions.skeleton.blockRadius,
|
|
2790
2873
|
overflow: "hidden"
|
|
2791
2874
|
},
|
|
2792
2875
|
children: [0, ...count(rows)].map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -2795,7 +2878,7 @@ function KjunSkeleton({
|
|
|
2795
2878
|
style: {
|
|
2796
2879
|
flexDirection: "row",
|
|
2797
2880
|
backgroundColor: row === 0 ? colors.secondary : void 0,
|
|
2798
|
-
borderBottomWidth: row === rows ? 0 :
|
|
2881
|
+
borderBottomWidth: row === rows ? 0 : import_tokens15.tokens.border.defaultWidth,
|
|
2799
2882
|
borderBottomColor: colors.border
|
|
2800
2883
|
},
|
|
2801
2884
|
children: count(columns).map((col) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
@@ -2803,8 +2886,8 @@ function KjunSkeleton({
|
|
|
2803
2886
|
{
|
|
2804
2887
|
style: {
|
|
2805
2888
|
flex: 1,
|
|
2806
|
-
paddingVertical:
|
|
2807
|
-
paddingHorizontal:
|
|
2889
|
+
paddingVertical: import_tokens15.tokens.dimension.value12,
|
|
2890
|
+
paddingHorizontal: import_tokens15.tokens.dimension.value16
|
|
2808
2891
|
},
|
|
2809
2892
|
children: block(
|
|
2810
2893
|
row === 0 ? "70%" : [
|
|
@@ -2814,7 +2897,7 @@ function KjunSkeleton({
|
|
|
2814
2897
|
"75%",
|
|
2815
2898
|
"85%"
|
|
2816
2899
|
][(row + col) % 5],
|
|
2817
|
-
|
|
2900
|
+
import_tokens15.tokens.extensions.skeleton.tableLineHeight
|
|
2818
2901
|
)
|
|
2819
2902
|
},
|
|
2820
2903
|
col
|
|
@@ -2836,16 +2919,16 @@ function KjunSkeleton({
|
|
|
2836
2919
|
}
|
|
2837
2920
|
],
|
|
2838
2921
|
children: [
|
|
2839
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap:
|
|
2840
|
-
block("40%",
|
|
2841
|
-
block("60%",
|
|
2842
|
-
block("30%",
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native17.View, { style: { flex: 1, gap: import_tokens15.tokens.dimension.value8 }, children: [
|
|
2923
|
+
block("40%", import_tokens15.tokens.extensions.skeleton.lineHeights.sm),
|
|
2924
|
+
block("60%", import_tokens15.tokens.extensions.skeleton.lineHeights.lg),
|
|
2925
|
+
block("30%", import_tokens15.tokens.extensions.skeleton.lineHeights.sm)
|
|
2843
2926
|
] }),
|
|
2844
|
-
block(
|
|
2927
|
+
block(import_tokens15.tokens.extensions.skeleton.statWidth, import_tokens15.tokens.extensions.skeleton.statHeight)
|
|
2845
2928
|
]
|
|
2846
2929
|
}
|
|
2847
2930
|
),
|
|
2848
|
-
type === "block" && block(width || "100%", height != null ? height :
|
|
2931
|
+
type === "block" && block(width || "100%", height != null ? height : import_tokens15.tokens.extensions.skeleton.blockHeight, { borderRadius: import_tokens15.tokens.extensions.skeleton.blockRadius })
|
|
2849
2932
|
]
|
|
2850
2933
|
}
|
|
2851
2934
|
);
|
|
@@ -2854,7 +2937,7 @@ function KjunSkeleton({
|
|
|
2854
2937
|
// packages/native/src/layout-primitives.tsx
|
|
2855
2938
|
var import_react24 = require("react");
|
|
2856
2939
|
var import_react_native18 = require("react-native");
|
|
2857
|
-
var
|
|
2940
|
+
var import_tokens16 = require("@kjun-ui/tokens");
|
|
2858
2941
|
|
|
2859
2942
|
// shared/package-runtime/layout-primitives.ts
|
|
2860
2943
|
var titleVariants = ["pageTitle", "sectionTitle", "cardTitle"];
|
|
@@ -2863,7 +2946,17 @@ var isNumericVariant = (variant) => numeric.test(variant);
|
|
|
2863
2946
|
|
|
2864
2947
|
// packages/native/src/layout-primitives.tsx
|
|
2865
2948
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2866
|
-
var toneRole = {
|
|
2949
|
+
var toneRole = {
|
|
2950
|
+
default: "text",
|
|
2951
|
+
secondary: "textSecondary",
|
|
2952
|
+
tertiary: "textTertiary",
|
|
2953
|
+
disabled: "textDisabled",
|
|
2954
|
+
brand: "brand",
|
|
2955
|
+
danger: "danger",
|
|
2956
|
+
success: "success",
|
|
2957
|
+
warning: "warning",
|
|
2958
|
+
inverse: "onBrand"
|
|
2959
|
+
};
|
|
2867
2960
|
var textAlign = { start: "left", center: "center", end: "right" };
|
|
2868
2961
|
function KjunText({ variant = "body", tone = "default", align, maxLines, style, children }) {
|
|
2869
2962
|
const { colors, fontFamily, numericFontFamily } = useKjunStyles();
|
|
@@ -2891,46 +2984,51 @@ function flatten(children, path = "") {
|
|
|
2891
2984
|
return (0, import_react24.isValidElement)(child) && child.type === import_react24.Fragment ? flatten(child.props.children, `${key}.`) : [[key, child]];
|
|
2892
2985
|
});
|
|
2893
2986
|
}
|
|
2894
|
-
function items(children) {
|
|
2987
|
+
function items(children, childAlign) {
|
|
2895
2988
|
return flatten(children).map(([key, child]) => {
|
|
2896
2989
|
if (typeof child === "string" || typeof child === "number") return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(KText, { children: child }, key);
|
|
2897
2990
|
if ((0, import_react24.isValidElement)(child) && child.type === KjunFormGroup) {
|
|
2898
2991
|
const group = child;
|
|
2899
2992
|
return (0, import_react24.cloneElement)(group, { key, style: [{ marginBottom: 0 }, group.props.style] });
|
|
2900
2993
|
}
|
|
2994
|
+
if (childAlign && (0, import_react24.isValidElement)(child) && (child.type === KjunButton || child.type === KjunBadge)) {
|
|
2995
|
+
const control = child;
|
|
2996
|
+
return (0, import_react24.cloneElement)(control, { key, style: [{ alignSelf: childAlign }, control.props.style] });
|
|
2997
|
+
}
|
|
2901
2998
|
return (0, import_react24.isValidElement)(child) ? (0, import_react24.cloneElement)(child, { key }) : child;
|
|
2902
2999
|
});
|
|
2903
3000
|
}
|
|
3001
|
+
var followed = (align) => align && align !== "stretch" ? crossAxis[align] : void 0;
|
|
2904
3002
|
var stackGap = {
|
|
2905
3003
|
none: 0,
|
|
2906
|
-
sm:
|
|
2907
|
-
md:
|
|
2908
|
-
lg:
|
|
2909
|
-
"section-sm":
|
|
2910
|
-
"section-md":
|
|
2911
|
-
"section-lg":
|
|
3004
|
+
sm: import_tokens16.tokens.space.stack.sm,
|
|
3005
|
+
md: import_tokens16.tokens.space.stack.md,
|
|
3006
|
+
lg: import_tokens16.tokens.space.stack.lg,
|
|
3007
|
+
"section-sm": import_tokens16.tokens.space.section.sm,
|
|
3008
|
+
"section-md": import_tokens16.tokens.space.section.md,
|
|
3009
|
+
"section-lg": import_tokens16.tokens.space.section.lg
|
|
2912
3010
|
};
|
|
2913
3011
|
var inlineGap = {
|
|
2914
3012
|
none: 0,
|
|
2915
|
-
xs:
|
|
2916
|
-
sm:
|
|
2917
|
-
md:
|
|
2918
|
-
lg:
|
|
3013
|
+
xs: import_tokens16.tokens.space.inline.xs,
|
|
3014
|
+
sm: import_tokens16.tokens.space.inline.sm,
|
|
3015
|
+
md: import_tokens16.tokens.space.inline.md,
|
|
3016
|
+
lg: import_tokens16.tokens.space.inline.lg
|
|
2919
3017
|
};
|
|
2920
3018
|
var crossAxis = { stretch: "stretch", start: "flex-start", center: "center", end: "flex-end", baseline: "baseline" };
|
|
2921
3019
|
var mainAxis = { start: "flex-start", center: "center", end: "flex-end", between: "space-between" };
|
|
2922
|
-
function KjunStack({ gap = "md", align
|
|
2923
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: [{ flexDirection: "column", alignItems: crossAxis[align], gap: stackGap[gap], minWidth: 0 }, style], children: items(children) });
|
|
3020
|
+
function KjunStack({ gap = "md", align, style, children }) {
|
|
3021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: [{ flexDirection: "column", alignItems: crossAxis[align != null ? align : "stretch"], gap: stackGap[gap], minWidth: 0 }, style], children: items(children, followed(align)) });
|
|
2924
3022
|
}
|
|
2925
|
-
function KjunInline({ gap = "sm", align
|
|
3023
|
+
function KjunInline({ gap = "sm", align, justify = "start", wrap = true, style, children }) {
|
|
2926
3024
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native18.View, { style: [{
|
|
2927
3025
|
flexDirection: "row",
|
|
2928
3026
|
flexWrap: wrap ? "wrap" : "nowrap",
|
|
2929
|
-
alignItems: crossAxis[align],
|
|
3027
|
+
alignItems: crossAxis[align != null ? align : "center"],
|
|
2930
3028
|
justifyContent: mainAxis[justify],
|
|
2931
3029
|
gap: inlineGap[gap],
|
|
2932
3030
|
minWidth: 0
|
|
2933
|
-
}, style], children: items(children) });
|
|
3031
|
+
}, style], children: items(children, followed(align)) });
|
|
2934
3032
|
}
|
|
2935
3033
|
|
|
2936
3034
|
// shared/package-runtime/feedback-dialog.ts
|
|
@@ -2982,7 +3080,7 @@ function useFeedbackDialog(controller, request, messages = kjunMessagesKo) {
|
|
|
2982
3080
|
}
|
|
2983
3081
|
|
|
2984
3082
|
// shared/package-runtime/feedback-motion.ts
|
|
2985
|
-
var
|
|
3083
|
+
var import_tokens17 = require("@kjun-ui/tokens");
|
|
2986
3084
|
var import_react26 = require("react");
|
|
2987
3085
|
function usePresentedToasts(toasts, reduced) {
|
|
2988
3086
|
const [items2, setItems] = (0, import_react26.useState)([]);
|
|
@@ -3000,7 +3098,7 @@ function usePresentedToasts(toasts, reduced) {
|
|
|
3000
3098
|
if (!removals.current.has(item.toast.id)) removals.current.set(item.toast.id, setTimeout(() => {
|
|
3001
3099
|
removals.current.delete(item.toast.id);
|
|
3002
3100
|
setItems((current) => current.filter((value) => value.toast.id !== item.toast.id));
|
|
3003
|
-
},
|
|
3101
|
+
}, import_tokens17.tokens.motion.toastExit));
|
|
3004
3102
|
}
|
|
3005
3103
|
return next;
|
|
3006
3104
|
});
|
|
@@ -3022,7 +3120,7 @@ function usePresentedRequest(current, reduced) {
|
|
|
3022
3120
|
setRequest(current);
|
|
3023
3121
|
return;
|
|
3024
3122
|
}
|
|
3025
|
-
const timer = setTimeout(() => setRequest(current),
|
|
3123
|
+
const timer = setTimeout(() => setRequest(current), import_tokens17.tokens.motion.layerExit);
|
|
3026
3124
|
return () => clearTimeout(timer);
|
|
3027
3125
|
}, [current, request, reduced]);
|
|
3028
3126
|
return { request, open: !!request && (current == null ? void 0 : current.id) === request.id };
|
|
@@ -3038,7 +3136,7 @@ function useOptionalKjunFeedback() {
|
|
|
3038
3136
|
// packages/native/src/toast-stack.tsx
|
|
3039
3137
|
var import_react29 = require("react");
|
|
3040
3138
|
var import_react_native20 = require("react-native");
|
|
3041
|
-
var
|
|
3139
|
+
var import_tokens19 = require("@kjun-ui/tokens");
|
|
3042
3140
|
|
|
3043
3141
|
// shared/package-runtime/elevation.ts
|
|
3044
3142
|
function directionalShadow(layers, direction) {
|
|
@@ -3053,7 +3151,7 @@ function shadowLayers(layers, colors) {
|
|
|
3053
3151
|
}
|
|
3054
3152
|
|
|
3055
3153
|
// packages/native/src/toast.tsx
|
|
3056
|
-
var
|
|
3154
|
+
var import_tokens18 = require("@kjun-ui/tokens");
|
|
3057
3155
|
var import_react28 = require("react");
|
|
3058
3156
|
var import_react_native19 = require("react-native");
|
|
3059
3157
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -3097,7 +3195,7 @@ function ToastView({
|
|
|
3097
3195
|
accessible: false,
|
|
3098
3196
|
onHoverIn: () => controller.pauseToast(toast.id, reasons.hover),
|
|
3099
3197
|
onHoverOut: () => controller.resumeToast(toast.id, reasons.hover),
|
|
3100
|
-
style: { width: "100%", maxWidth:
|
|
3198
|
+
style: { width: "100%", maxWidth: import_tokens18.tokens.extensions.toast.maxWidth, alignSelf: "flex-end" },
|
|
3101
3199
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3102
3200
|
import_react_native19.View,
|
|
3103
3201
|
{
|
|
@@ -3106,19 +3204,19 @@ function ToastView({
|
|
|
3106
3204
|
style: {
|
|
3107
3205
|
flexDirection: "row",
|
|
3108
3206
|
alignItems: toast.title ? "flex-start" : "center",
|
|
3109
|
-
gap:
|
|
3110
|
-
padding:
|
|
3111
|
-
borderRadius:
|
|
3207
|
+
gap: import_tokens18.tokens.extensions.toast.gap,
|
|
3208
|
+
padding: import_tokens18.tokens.extensions.toast.padding,
|
|
3209
|
+
borderRadius: import_tokens18.tokens.extensions.toast.radius,
|
|
3112
3210
|
backgroundColor: colors.surface,
|
|
3113
|
-
boxShadow: shadowLayers(
|
|
3114
|
-
borderWidth:
|
|
3211
|
+
boxShadow: shadowLayers(import_tokens18.tokens.extensions.toast.elevation, colors),
|
|
3212
|
+
borderWidth: import_tokens18.tokens.border.defaultWidth,
|
|
3115
3213
|
borderColor: colors.border,
|
|
3116
3214
|
overflow: "hidden"
|
|
3117
3215
|
},
|
|
3118
3216
|
children: [
|
|
3119
3217
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: icon, color: colors[`${tone}Accent`] }),
|
|
3120
3218
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native19.View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
3121
|
-
!!toast.title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom:
|
|
3219
|
+
!!toast.title && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KText, { style: { fontWeight: typeStyle("control").fontWeight, marginBottom: import_tokens18.tokens.extensions.toast.titleGap }, children: toast.title }),
|
|
3122
3220
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KText, { style: { color: colors.textSecondary }, children: toast.message }),
|
|
3123
3221
|
toast.action && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3124
3222
|
AccessiblePressable,
|
|
@@ -3136,7 +3234,7 @@ function ToastView({
|
|
|
3136
3234
|
dismiss();
|
|
3137
3235
|
}
|
|
3138
3236
|
},
|
|
3139
|
-
style: { minHeight:
|
|
3237
|
+
style: { minHeight: import_tokens18.tokens.native.minimumTouchTarget, justifyContent: "center", marginTop: import_tokens18.tokens.extensions.toast.actionGap },
|
|
3140
3238
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3141
3239
|
KText,
|
|
3142
3240
|
{
|
|
@@ -3158,11 +3256,11 @@ function ToastView({
|
|
|
3158
3256
|
onBlur: () => controller.resumeToast(toast.id, reasons.focus),
|
|
3159
3257
|
onPress: dismiss,
|
|
3160
3258
|
style: {
|
|
3161
|
-
minWidth: Math.max(
|
|
3162
|
-
minHeight: Math.max(
|
|
3259
|
+
minWidth: Math.max(import_tokens18.tokens.extensions.toast.closeSize, import_tokens18.tokens.native.minimumTouchTarget),
|
|
3260
|
+
minHeight: Math.max(import_tokens18.tokens.extensions.toast.closeSize, import_tokens18.tokens.native.minimumTouchTarget),
|
|
3163
3261
|
alignItems: "center",
|
|
3164
3262
|
justifyContent: "center",
|
|
3165
|
-
borderRadius:
|
|
3263
|
+
borderRadius: import_tokens18.tokens.extensions.toast.closeRadius
|
|
3166
3264
|
},
|
|
3167
3265
|
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(KjunIcon, { name: "x", color: colors.textTertiary })
|
|
3168
3266
|
}
|
|
@@ -3175,7 +3273,7 @@ function ToastView({
|
|
|
3175
3273
|
position: "absolute",
|
|
3176
3274
|
bottom: 0,
|
|
3177
3275
|
left: 0,
|
|
3178
|
-
height:
|
|
3276
|
+
height: import_tokens18.tokens.extensions.toast.progressHeight,
|
|
3179
3277
|
width: progress.interpolate({
|
|
3180
3278
|
inputRange: [0, 1],
|
|
3181
3279
|
outputRange: ["0%", "100%"]
|
|
@@ -3198,8 +3296,8 @@ function useToastReflow(_root, _reduced) {
|
|
|
3198
3296
|
// packages/native/src/toast-stack.tsx
|
|
3199
3297
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3200
3298
|
function ToastSlot({ item, controller, boxes }) {
|
|
3201
|
-
const born = (0, import_react29.useRef)(Math.min(
|
|
3202
|
-
const motion = useNativePresence(!item.exiting,
|
|
3299
|
+
const born = (0, import_react29.useRef)(Math.min(import_tokens19.tokens.motion.toastEnter, Date.now() - item.born)).current;
|
|
3300
|
+
const motion = useNativePresence(!item.exiting, import_tokens19.tokens.motion.toastEnter - born, import_tokens19.tokens.motion.toastExit, true, born / import_tokens19.tokens.motion.toastEnter);
|
|
3203
3301
|
const offset = (0, import_react29.useRef)(new import_react_native20.Animated.Value(0)).current;
|
|
3204
3302
|
const box = boxes.get(item.toast.id);
|
|
3205
3303
|
(0, import_react29.useLayoutEffect)(() => {
|
|
@@ -3220,7 +3318,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3220
3318
|
boxes.set(item.toast.id, next);
|
|
3221
3319
|
if (old && old.y !== next.y && !motion.reduced) offset.stopAnimation((current) => {
|
|
3222
3320
|
offset.setValue(current + old.y - next.y);
|
|
3223
|
-
import_react_native20.Animated.timing(offset, { toValue: 0, duration:
|
|
3321
|
+
import_react_native20.Animated.timing(offset, { toValue: 0, duration: import_tokens19.tokens.motion.toastMove, easing: motionOut, useNativeDriver: nativeDriver }).start();
|
|
3224
3322
|
});
|
|
3225
3323
|
},
|
|
3226
3324
|
style: { transform: [{ translateY: offset }], ...item.exiting && box ? {
|
|
@@ -3237,7 +3335,7 @@ function ToastSlot({ item, controller, boxes }) {
|
|
|
3237
3335
|
accessibilityElementsHidden: item.exiting,
|
|
3238
3336
|
importantForAccessibility: item.exiting ? "no-hide-descendants" : "auto",
|
|
3239
3337
|
...item.exiting ? { inert: true } : {},
|
|
3240
|
-
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-
|
|
3338
|
+
style: { opacity: motion.opacity, transform: [{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [-import_tokens19.tokens.motionDistance.toast, 0] }) }] },
|
|
3241
3339
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToastView, { toast: item.toast, controller })
|
|
3242
3340
|
}
|
|
3243
3341
|
)
|
|
@@ -3253,19 +3351,20 @@ function ToastStack({ items: items2, controller }) {
|
|
|
3253
3351
|
for (const id of boxes.keys()) if (!items2.some((item) => item.toast.id === id)) boxes.delete(id);
|
|
3254
3352
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native20.View, { ref: root, pointerEvents: "box-none", style: {
|
|
3255
3353
|
position: "absolute",
|
|
3256
|
-
top:
|
|
3257
|
-
right:
|
|
3258
|
-
left:
|
|
3259
|
-
gap:
|
|
3354
|
+
top: import_tokens19.tokens.extensions.toast.inset,
|
|
3355
|
+
right: import_tokens19.tokens.extensions.toast.inset,
|
|
3356
|
+
left: import_tokens19.tokens.extensions.toast.inset,
|
|
3357
|
+
gap: import_tokens19.tokens.extensions.toast.stackGap,
|
|
3260
3358
|
minHeight: items2.some((item) => item.exiting) ? Math.max(0, ...[...boxes.values()].map((box) => box.y + box.height)) : void 0,
|
|
3261
3359
|
zIndex: layers.zIndex((_a = layers.topWindow()) == null ? void 0 : _a.id, "toast")
|
|
3262
3360
|
}, children: items2.map((item) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ToastSlot, { item, controller, boxes }, item.toast.id)) });
|
|
3263
3361
|
}
|
|
3264
3362
|
|
|
3265
3363
|
// packages/native/src/feedback.tsx
|
|
3266
|
-
var
|
|
3364
|
+
var import_tokens20 = require("@kjun-ui/tokens");
|
|
3267
3365
|
var import_react30 = require("react");
|
|
3268
3366
|
var import_react_native21 = require("react-native");
|
|
3367
|
+
var import_tokens21 = require("@kjun-ui/tokens");
|
|
3269
3368
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3270
3369
|
function useKjunFeedback() {
|
|
3271
3370
|
const value = useOptionalKjunFeedback();
|
|
@@ -3297,7 +3396,7 @@ function FeedbackDialog({
|
|
|
3297
3396
|
onConfirm: submit,
|
|
3298
3397
|
confirmVariant: options.type === "danger" ? "danger" : "primary",
|
|
3299
3398
|
children: [
|
|
3300
|
-
!!options.message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KText, { style: { marginBottom:
|
|
3399
|
+
!!options.message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(KText, { style: { marginBottom: import_tokens20.tokens.dimension.value16 }, children: options.message }),
|
|
3301
3400
|
request.kind === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3302
3401
|
KjunInput,
|
|
3303
3402
|
{
|
|
@@ -3314,8 +3413,10 @@ function FeedbackDialog({
|
|
|
3314
3413
|
}
|
|
3315
3414
|
);
|
|
3316
3415
|
}
|
|
3317
|
-
function KjunFeedbackProvider({ children, style }) {
|
|
3318
|
-
const [
|
|
3416
|
+
function KjunFeedbackProvider({ children, style, controller: controllerProp }) {
|
|
3417
|
+
const [owned] = (0, import_react30.useState)(() => controllerProp ? void 0 : (0, import_tokens20.createFeedbackController)());
|
|
3418
|
+
const controller = controllerProp ? (0, import_tokens20.feedbackControllerOf)(controllerProp) : owned;
|
|
3419
|
+
(0, import_react30.useEffect)(() => controller.attach(), [controller]);
|
|
3319
3420
|
const life = (0, import_react30.useRef)(0);
|
|
3320
3421
|
const snapshot = (0, import_react30.useSyncExternalStore)(
|
|
3321
3422
|
controller.subscribe,
|
|
@@ -3329,7 +3430,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3329
3430
|
const version = ++life.current;
|
|
3330
3431
|
return () => {
|
|
3331
3432
|
queueMicrotask(() => {
|
|
3332
|
-
if (life.current === version) controller.dispose();
|
|
3433
|
+
if (life.current === version && !controllerProp) controller.dispose();
|
|
3333
3434
|
});
|
|
3334
3435
|
};
|
|
3335
3436
|
}, [controller]);
|
|
@@ -3364,7 +3465,7 @@ function KjunFeedbackProvider({ children, style }) {
|
|
|
3364
3465
|
|
|
3365
3466
|
// packages/native/src/choice-controls.tsx
|
|
3366
3467
|
var import_react_native22 = require("react-native");
|
|
3367
|
-
var
|
|
3468
|
+
var import_tokens22 = require("@kjun-ui/tokens");
|
|
3368
3469
|
var import_react31 = require("react");
|
|
3369
3470
|
var import_react_native23 = require("react-native");
|
|
3370
3471
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -3379,7 +3480,7 @@ function KjunCheckbox({
|
|
|
3379
3480
|
onValueChange,
|
|
3380
3481
|
onChange
|
|
3381
3482
|
}) {
|
|
3382
|
-
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension =
|
|
3483
|
+
const { colors } = useKjunStyles(), checked = Array.isArray(value) ? value.includes(val) : value, dimension = import_tokens22.tokens.extensions.checkbox.sizes[size];
|
|
3383
3484
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3384
3485
|
AccessiblePressable,
|
|
3385
3486
|
{
|
|
@@ -3398,8 +3499,8 @@ function KjunCheckbox({
|
|
|
3398
3499
|
flexDirection: "row",
|
|
3399
3500
|
alignItems: "center",
|
|
3400
3501
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3401
|
-
minHeight: finePointer() ?
|
|
3402
|
-
opacity: disabled ?
|
|
3502
|
+
minHeight: finePointer() ? import_tokens22.tokens.extensions.choice.minimumHeight : import_tokens22.tokens.native.minimumTouchTarget,
|
|
3503
|
+
opacity: disabled ? import_tokens22.tokens.states.opacity.disabled : pressed ? import_tokens22.tokens.states.opacity.pressed : 1
|
|
3403
3504
|
}),
|
|
3404
3505
|
children: [
|
|
3405
3506
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -3410,8 +3511,8 @@ function KjunCheckbox({
|
|
|
3410
3511
|
justifyContent: "center",
|
|
3411
3512
|
width: dimension,
|
|
3412
3513
|
height: dimension,
|
|
3413
|
-
borderRadius:
|
|
3414
|
-
borderWidth:
|
|
3514
|
+
borderRadius: import_tokens22.tokens.extensions.checkbox.radii[size],
|
|
3515
|
+
borderWidth: import_tokens22.tokens.border.controlWidth,
|
|
3415
3516
|
// Same boundary roles as Radio: strong while enabled, secondary once disabled.
|
|
3416
3517
|
borderColor: checked ? colors.brand : disabled ? colors.borderSecondary : colors.borderStrong,
|
|
3417
3518
|
backgroundColor: checked ? colors.brand : colors.surface
|
|
@@ -3420,14 +3521,14 @@ function KjunCheckbox({
|
|
|
3420
3521
|
KjunIcon,
|
|
3421
3522
|
{
|
|
3422
3523
|
name: "check",
|
|
3423
|
-
size:
|
|
3524
|
+
size: import_tokens22.tokens.extensions.checkbox.iconSizes[size],
|
|
3424
3525
|
color: colors.onBrand
|
|
3425
3526
|
}
|
|
3426
3527
|
)
|
|
3427
3528
|
}
|
|
3428
3529
|
),
|
|
3429
3530
|
!!(children || label) && content(children || label, {
|
|
3430
|
-
marginLeft:
|
|
3531
|
+
marginLeft: import_tokens22.tokens.extensions.checkbox.labelGap,
|
|
3431
3532
|
...typeStyle("label")
|
|
3432
3533
|
})
|
|
3433
3534
|
]
|
|
@@ -3443,7 +3544,7 @@ function useControlFocus(disabled) {
|
|
|
3443
3544
|
onFocus: (event) => setFocused(focusVisible(event.currentTarget)),
|
|
3444
3545
|
onBlur: () => setFocused(false)
|
|
3445
3546
|
},
|
|
3446
|
-
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth:
|
|
3547
|
+
ring: focused && !disabled ? { outlineStyle: "solid", outlineWidth: import_tokens22.tokens.states.focus.width, outlineOffset: import_tokens22.tokens.states.focus.choiceOffset, outlineColor: colors.focusRing } : {}
|
|
3447
3548
|
};
|
|
3448
3549
|
}
|
|
3449
3550
|
function KjunSwitch({
|
|
@@ -3458,10 +3559,10 @@ function KjunSwitch({
|
|
|
3458
3559
|
onChange
|
|
3459
3560
|
}) {
|
|
3460
3561
|
const { colors } = useKjunStyles();
|
|
3461
|
-
const width =
|
|
3462
|
-
const height =
|
|
3463
|
-
const thumb = height - 2 *
|
|
3464
|
-
const offScale = (thumb - 2 *
|
|
3562
|
+
const width = import_tokens22.tokens.extensions.switch.widths[size];
|
|
3563
|
+
const height = import_tokens22.tokens.extensions.switch.heights[size];
|
|
3564
|
+
const thumb = height - 2 * import_tokens22.tokens.extensions.switch.padding;
|
|
3565
|
+
const offScale = (thumb - 2 * import_tokens22.tokens.border.controlWidth) / thumb;
|
|
3465
3566
|
const offset = width - height;
|
|
3466
3567
|
const motion = useMotionValue(value ? 1 : 0);
|
|
3467
3568
|
const focus = useControlFocus(disabled);
|
|
@@ -3490,8 +3591,8 @@ function KjunSwitch({
|
|
|
3490
3591
|
flexDirection: "row",
|
|
3491
3592
|
alignItems: "center",
|
|
3492
3593
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3493
|
-
minHeight: finePointer() ?
|
|
3494
|
-
opacity: disabled ?
|
|
3594
|
+
minHeight: finePointer() ? import_tokens22.tokens.extensions.choice.minimumHeight : import_tokens22.tokens.native.minimumTouchTarget,
|
|
3595
|
+
opacity: disabled ? import_tokens22.tokens.states.opacity.disabled : 1
|
|
3495
3596
|
},
|
|
3496
3597
|
children: [
|
|
3497
3598
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
@@ -3500,8 +3601,8 @@ function KjunSwitch({
|
|
|
3500
3601
|
style: {
|
|
3501
3602
|
width,
|
|
3502
3603
|
height,
|
|
3503
|
-
padding:
|
|
3504
|
-
borderRadius:
|
|
3604
|
+
padding: import_tokens22.tokens.extensions.switch.padding,
|
|
3605
|
+
borderRadius: import_tokens22.tokens.extensions.switch.radius,
|
|
3505
3606
|
backgroundColor: trackColor,
|
|
3506
3607
|
...focus.ring
|
|
3507
3608
|
},
|
|
@@ -3513,8 +3614,8 @@ function KjunSwitch({
|
|
|
3513
3614
|
style: {
|
|
3514
3615
|
position: "absolute",
|
|
3515
3616
|
inset: 0,
|
|
3516
|
-
borderRadius:
|
|
3517
|
-
borderWidth:
|
|
3617
|
+
borderRadius: import_tokens22.tokens.extensions.switch.radius,
|
|
3618
|
+
borderWidth: import_tokens22.tokens.border.controlWidth,
|
|
3518
3619
|
// Hover turns the boundary to brand, like Checkbox on Web.
|
|
3519
3620
|
borderColor: hovered && !disabled ? colors.brand : offRole,
|
|
3520
3621
|
opacity: motion.interpolate({ inputRange: [0, 1], outputRange: [1, 0] })
|
|
@@ -3527,7 +3628,7 @@ function KjunSwitch({
|
|
|
3527
3628
|
style: {
|
|
3528
3629
|
width: thumb,
|
|
3529
3630
|
height: thumb,
|
|
3530
|
-
borderRadius:
|
|
3631
|
+
borderRadius: import_tokens22.tokens.extensions.switch.radius,
|
|
3531
3632
|
backgroundColor: thumbColor,
|
|
3532
3633
|
transform: [
|
|
3533
3634
|
{ translateX: motion.interpolate({ inputRange: [0, 1], outputRange: [0, offset] }) },
|
|
@@ -3539,11 +3640,11 @@ function KjunSwitch({
|
|
|
3539
3640
|
]
|
|
3540
3641
|
}
|
|
3541
3642
|
),
|
|
3542
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native23.View, { style: { marginLeft:
|
|
3643
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native23.View, { style: { marginLeft: import_tokens22.tokens.extensions.switch.labelGap, flexShrink: 1, minWidth: 0 }, children: [
|
|
3543
3644
|
!!(children || label) && content(children || label, typeStyle("label")),
|
|
3544
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KText, { style: { ...typeStyle("caption"), marginTop:
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(KText, { style: { ...typeStyle("caption"), marginTop: import_tokens22.tokens.dimension.value4, color: colors.textSecondary }, children: description })
|
|
3545
3646
|
] }) : !!(children || label) && content(children || label, {
|
|
3546
|
-
marginLeft:
|
|
3647
|
+
marginLeft: import_tokens22.tokens.extensions.switch.labelGap,
|
|
3547
3648
|
...typeStyle("label")
|
|
3548
3649
|
})
|
|
3549
3650
|
]
|
|
@@ -3562,7 +3663,7 @@ function KjunRadio({
|
|
|
3562
3663
|
onChange
|
|
3563
3664
|
}) {
|
|
3564
3665
|
const group = (0, import_react31.useContext)(RadioContext), { colors } = useKjunStyles(), selected = (group ? group.value : value) === val;
|
|
3565
|
-
const geometry2 =
|
|
3666
|
+
const geometry2 = import_tokens22.tokens.extensions.radio;
|
|
3566
3667
|
const [hovered, setHovered] = (0, import_react31.useState)(false);
|
|
3567
3668
|
(0, import_react31.useEffect)(() => {
|
|
3568
3669
|
if (disabled) setHovered(false);
|
|
@@ -3589,8 +3690,8 @@ function KjunRadio({
|
|
|
3589
3690
|
flexDirection: "row",
|
|
3590
3691
|
alignItems: "center",
|
|
3591
3692
|
// Like Web's choice row on a mouse-like pointer; touch layouts keep the 44px target.
|
|
3592
|
-
minHeight: finePointer() ?
|
|
3593
|
-
opacity: disabled ?
|
|
3693
|
+
minHeight: finePointer() ? import_tokens22.tokens.extensions.choice.minimumHeight : import_tokens22.tokens.native.minimumTouchTarget,
|
|
3694
|
+
opacity: disabled ? import_tokens22.tokens.states.opacity.disabled : 1
|
|
3594
3695
|
},
|
|
3595
3696
|
children: ({ pressed }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3596
3697
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -3600,7 +3701,7 @@ function KjunRadio({
|
|
|
3600
3701
|
width: geometry2.size,
|
|
3601
3702
|
height: geometry2.size,
|
|
3602
3703
|
borderWidth: geometry2.borderWidth,
|
|
3603
|
-
borderRadius:
|
|
3704
|
+
borderRadius: import_tokens22.tokens.radius.radius9999,
|
|
3604
3705
|
alignItems: "center",
|
|
3605
3706
|
justifyContent: "center",
|
|
3606
3707
|
borderColor: disabled ? selected ? colors.brand : colors.borderSecondary : pressed ? colors.brandActive : hovered ? colors.brandHover : selected ? colors.brand : colors.borderStrong,
|
|
@@ -3612,7 +3713,7 @@ function KjunRadio({
|
|
|
3612
3713
|
style: {
|
|
3613
3714
|
width: geometry2.dot,
|
|
3614
3715
|
height: geometry2.dot,
|
|
3615
|
-
borderRadius:
|
|
3716
|
+
borderRadius: import_tokens22.tokens.radius.radius9999,
|
|
3616
3717
|
backgroundColor: colors.brand
|
|
3617
3718
|
}
|
|
3618
3719
|
}
|
|
@@ -3657,7 +3758,7 @@ function KjunRadioGroup({
|
|
|
3657
3758
|
style: {
|
|
3658
3759
|
flexDirection: direction === "vertical" ? "column" : "row",
|
|
3659
3760
|
flexWrap: direction === "vertical" ? "nowrap" : "wrap",
|
|
3660
|
-
gap: direction === "vertical" ?
|
|
3761
|
+
gap: direction === "vertical" ? import_tokens22.tokens.dimension.value8 : import_tokens22.tokens.dimension.value16
|
|
3661
3762
|
},
|
|
3662
3763
|
children: children || options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3663
3764
|
KjunRadio,
|
|
@@ -3675,16 +3776,16 @@ function KjunRadioGroup({
|
|
|
3675
3776
|
}
|
|
3676
3777
|
|
|
3677
3778
|
// packages/native/src/selection-groups.tsx
|
|
3678
|
-
var
|
|
3779
|
+
var import_tokens24 = require("@kjun-ui/tokens");
|
|
3679
3780
|
var import_react33 = require("react");
|
|
3680
3781
|
var import_react_native25 = require("react-native");
|
|
3681
3782
|
|
|
3682
3783
|
// packages/native/src/button-group-motion.tsx
|
|
3683
3784
|
var import_react32 = require("react");
|
|
3684
3785
|
var import_react_native24 = require("react-native");
|
|
3685
|
-
var
|
|
3786
|
+
var import_tokens23 = require("@kjun-ui/tokens");
|
|
3686
3787
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3687
|
-
var curve =
|
|
3788
|
+
var curve = import_tokens23.tokens.motion.easeOut.match(/-?\d*\.?\d+/g).map(Number);
|
|
3688
3789
|
var easing = import_react_native24.Easing.bezier(...curve);
|
|
3689
3790
|
var sameBox = (a, b) => a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
3690
3791
|
function useButtonGroupMotion(selected) {
|
|
@@ -3711,8 +3812,8 @@ function useButtonGroupMotion(selected) {
|
|
|
3711
3812
|
width.stopAnimation();
|
|
3712
3813
|
if (old && old.value !== selected.value && !reduced) {
|
|
3713
3814
|
import_react_native24.Animated.parallel([
|
|
3714
|
-
import_react_native24.Animated.timing(x, { toValue: layout.x, duration:
|
|
3715
|
-
import_react_native24.Animated.timing(width, { toValue: layout.width, duration:
|
|
3815
|
+
import_react_native24.Animated.timing(x, { toValue: layout.x, duration: import_tokens23.tokens.motion.indicator, easing, useNativeDriver: false }),
|
|
3816
|
+
import_react_native24.Animated.timing(width, { toValue: layout.width, duration: import_tokens23.tokens.motion.indicator, easing, useNativeDriver: false })
|
|
3716
3817
|
]).start();
|
|
3717
3818
|
} else {
|
|
3718
3819
|
x.setValue(layout.x);
|
|
@@ -3733,7 +3834,7 @@ function ButtonGroupLabel({ label, active, size, reduced }) {
|
|
|
3733
3834
|
(0, import_react32.useEffect)(() => {
|
|
3734
3835
|
progress.stopAnimation();
|
|
3735
3836
|
if (reduced || !interpolate) progress.setValue(active ? 1 : 0);
|
|
3736
|
-
else import_react_native24.Animated.timing(progress, { toValue: active ? 1 : 0, duration:
|
|
3837
|
+
else import_react_native24.Animated.timing(progress, { toValue: active ? 1 : 0, duration: import_tokens23.tokens.motion.indicator, easing, useNativeDriver: false }).start();
|
|
3737
3838
|
return () => progress.stopAnimation();
|
|
3738
3839
|
}, [active, reduced, interpolate, progress]);
|
|
3739
3840
|
const resolveFont = useResolveFont();
|
|
@@ -3775,8 +3876,8 @@ function KjunButtonGroup({
|
|
|
3775
3876
|
const { colors } = useKjunStyles();
|
|
3776
3877
|
const selected = options.find((option) => option.value === value);
|
|
3777
3878
|
const motion = useButtonGroupMotion(selected);
|
|
3778
|
-
const padding =
|
|
3779
|
-
const itemRadius =
|
|
3879
|
+
const padding = import_tokens24.tokens.buttonGroup.padding[size];
|
|
3880
|
+
const itemRadius = import_tokens24.tokens.buttonGroup.itemRadii[size];
|
|
3780
3881
|
const itemRefs = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
3781
3882
|
const { updateLayout } = motion;
|
|
3782
3883
|
(0, import_react33.useLayoutEffect)(() => {
|
|
@@ -3802,7 +3903,7 @@ function KjunButtonGroup({
|
|
|
3802
3903
|
style: {
|
|
3803
3904
|
flexDirection: "row",
|
|
3804
3905
|
padding,
|
|
3805
|
-
borderRadius:
|
|
3906
|
+
borderRadius: import_tokens24.tokens.buttonGroup.radii[size],
|
|
3806
3907
|
backgroundColor: colors.secondary,
|
|
3807
3908
|
flexGrow: fullWidth ? 1 : 0
|
|
3808
3909
|
},
|
|
@@ -3826,7 +3927,7 @@ function KjunButtonGroup({
|
|
|
3826
3927
|
// Disabled options dim their own labels; the selected value stays readable. The edge keeps it
|
|
3827
3928
|
// apart from the track when surface and secondary are close.
|
|
3828
3929
|
backgroundColor: colors.surface,
|
|
3829
|
-
borderWidth:
|
|
3930
|
+
borderWidth: import_tokens24.tokens.border.defaultWidth,
|
|
3830
3931
|
borderColor: colors.border
|
|
3831
3932
|
}
|
|
3832
3933
|
}
|
|
@@ -3854,22 +3955,22 @@ function KjunButtonGroup({
|
|
|
3854
3955
|
flexDirection: "row",
|
|
3855
3956
|
alignItems: "center",
|
|
3856
3957
|
justifyContent: "center",
|
|
3857
|
-
gap:
|
|
3958
|
+
gap: import_tokens24.tokens.dimension.value6,
|
|
3858
3959
|
flex: fullWidth ? 1 : void 0,
|
|
3859
|
-
minWidth:
|
|
3860
|
-
minHeight:
|
|
3861
|
-
height: Math.max(
|
|
3862
|
-
paddingHorizontal:
|
|
3960
|
+
minWidth: import_tokens24.tokens.native.minimumTouchTarget,
|
|
3961
|
+
minHeight: import_tokens24.tokens.native.minimumTouchTarget,
|
|
3962
|
+
height: Math.max(import_tokens24.tokens.native.minimumTouchTarget, import_tokens24.tokens.buttonGroup.heights[size] - 2 * padding),
|
|
3963
|
+
paddingHorizontal: import_tokens24.tokens.buttonGroup.itemPaddingX[size],
|
|
3863
3964
|
borderRadius: itemRadius,
|
|
3864
3965
|
backgroundColor: active && !motion.layout ? colors.surface : pressed && !active ? colors.hover : "transparent",
|
|
3865
|
-
opacity: blocked ?
|
|
3966
|
+
opacity: blocked ? import_tokens24.tokens.states.opacity.disabled : 1
|
|
3866
3967
|
}),
|
|
3867
3968
|
children: [
|
|
3868
3969
|
!!option.icon && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3869
3970
|
KjunIcon,
|
|
3870
3971
|
{
|
|
3871
3972
|
name: option.icon,
|
|
3872
|
-
size:
|
|
3973
|
+
size: import_tokens24.tokens.extensions.selection.iconSize,
|
|
3873
3974
|
color: active ? colors.text : colors.textSecondary
|
|
3874
3975
|
}
|
|
3875
3976
|
),
|
|
@@ -3905,7 +4006,7 @@ function KjunFilterGroup({
|
|
|
3905
4006
|
onChange
|
|
3906
4007
|
}) {
|
|
3907
4008
|
const { colors } = useKjunStyles();
|
|
3908
|
-
const wide = (0, import_react_native25.useWindowDimensions)().width >=
|
|
4009
|
+
const wide = (0, import_react_native25.useWindowDimensions)().width >= import_tokens24.tokens.responsive.selection, roomy = wide && finePointer();
|
|
3909
4010
|
const selected = (v) => multiple ? Array.isArray(value) && (v === null ? value.length === 0 : value.includes(v)) : value === v;
|
|
3910
4011
|
const children = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3911
4012
|
import_react_native25.View,
|
|
@@ -3914,7 +4015,7 @@ function KjunFilterGroup({
|
|
|
3914
4015
|
style: {
|
|
3915
4016
|
flexDirection: "row",
|
|
3916
4017
|
flexWrap: scroll ? "nowrap" : "wrap",
|
|
3917
|
-
gap:
|
|
4018
|
+
gap: import_tokens24.tokens.dimension.value8
|
|
3918
4019
|
},
|
|
3919
4020
|
children: options.map((option) => {
|
|
3920
4021
|
const active = selected(option.value), blocked = disabled || option.disabled;
|
|
@@ -3931,9 +4032,9 @@ function KjunFilterGroup({
|
|
|
3931
4032
|
onChange == null ? void 0 : onChange(next);
|
|
3932
4033
|
},
|
|
3933
4034
|
style: {
|
|
3934
|
-
minHeight: roomy ? void 0 :
|
|
4035
|
+
minHeight: roomy ? void 0 : import_tokens24.tokens.native.minimumTouchTarget,
|
|
3935
4036
|
justifyContent: "center",
|
|
3936
|
-
opacity: blocked ?
|
|
4037
|
+
opacity: blocked ? import_tokens24.tokens.states.opacity.disabledStrong : 1
|
|
3937
4038
|
},
|
|
3938
4039
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3939
4040
|
import_react_native25.View,
|
|
@@ -3942,12 +4043,12 @@ function KjunFilterGroup({
|
|
|
3942
4043
|
flexDirection: "row",
|
|
3943
4044
|
alignItems: "center",
|
|
3944
4045
|
justifyContent: "center",
|
|
3945
|
-
gap:
|
|
3946
|
-
minHeight: roomy ? void 0 :
|
|
3947
|
-
height: roomy ?
|
|
3948
|
-
paddingHorizontal: { xs:
|
|
4046
|
+
gap: import_tokens24.tokens.dimension.value4,
|
|
4047
|
+
minHeight: roomy ? void 0 : import_tokens24.tokens.extensions.selection.minimumHeight,
|
|
4048
|
+
height: roomy ? import_tokens24.tokens.button.heights[size] : Math.max(import_tokens24.tokens.extensions.selection.minimumHeight, import_tokens24.tokens.button.heights[size]),
|
|
4049
|
+
paddingHorizontal: { xs: import_tokens24.tokens.dimension.value8, sm: import_tokens24.tokens.dimension.value12, md: import_tokens24.tokens.dimension.value12, lg: import_tokens24.tokens.dimension.value14, xl: import_tokens24.tokens.dimension.value16 }[size],
|
|
3949
4050
|
// Corners follow the button scale with the height, so every size keeps the same shape.
|
|
3950
|
-
borderRadius:
|
|
4051
|
+
borderRadius: import_tokens24.tokens.button.radii[size],
|
|
3951
4052
|
backgroundColor: active ? colors.text : colors.secondary
|
|
3952
4053
|
},
|
|
3953
4054
|
children: [
|
|
@@ -3955,9 +4056,9 @@ function KjunFilterGroup({
|
|
|
3955
4056
|
import_react_native25.View,
|
|
3956
4057
|
{
|
|
3957
4058
|
style: {
|
|
3958
|
-
width:
|
|
3959
|
-
height:
|
|
3960
|
-
borderRadius:
|
|
4059
|
+
width: import_tokens24.tokens.extensions.selection.dotSize,
|
|
4060
|
+
height: import_tokens24.tokens.extensions.selection.dotSize,
|
|
4061
|
+
borderRadius: import_tokens24.tokens.radius.radius4,
|
|
3961
4062
|
backgroundColor: option.dot
|
|
3962
4063
|
}
|
|
3963
4064
|
}
|
|
@@ -3966,7 +4067,7 @@ function KjunFilterGroup({
|
|
|
3966
4067
|
KjunIcon,
|
|
3967
4068
|
{
|
|
3968
4069
|
name: option.icon,
|
|
3969
|
-
size:
|
|
4070
|
+
size: import_tokens24.tokens.extensions.selection.iconSize,
|
|
3970
4071
|
color: active ? colors.inverse : colors.textSecondary
|
|
3971
4072
|
}
|
|
3972
4073
|
),
|
|
@@ -4017,7 +4118,7 @@ function KjunFilterGroup({
|
|
|
4017
4118
|
}
|
|
4018
4119
|
|
|
4019
4120
|
// packages/native/src/textarea.tsx
|
|
4020
|
-
var
|
|
4121
|
+
var import_tokens25 = require("@kjun-ui/tokens");
|
|
4021
4122
|
var import_react34 = require("react");
|
|
4022
4123
|
var import_react_native26 = require("react-native");
|
|
4023
4124
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
@@ -4035,7 +4136,7 @@ var KjunTextarea = (0, import_react34.forwardRef)(
|
|
|
4035
4136
|
onBlur,
|
|
4036
4137
|
...props
|
|
4037
4138
|
}, ref) {
|
|
4038
|
-
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec =
|
|
4139
|
+
const field = useKjunField(), { colors, fontFamily } = useKjunStyles(), spec = import_tokens25.tokens.input[size];
|
|
4039
4140
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
4040
4141
|
const surface = useFieldSurface(size, { disabled, readOnly: readonly || props.readOnly || props.editable === false, invalid });
|
|
4041
4142
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -4076,8 +4177,8 @@ var KjunTextarea = (0, import_react34.forwardRef)(
|
|
|
4076
4177
|
...inputTypeStyle(size),
|
|
4077
4178
|
...surface.style,
|
|
4078
4179
|
height: void 0,
|
|
4079
|
-
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 *
|
|
4080
|
-
paddingHorizontal: spec.padding -
|
|
4180
|
+
minHeight: Math.max(spec.height, rows * spec.lineHeight + spec.textareaPaddingY * 2 + 2 * import_tokens25.tokens.border.controlWidth),
|
|
4181
|
+
paddingHorizontal: spec.padding - import_tokens25.tokens.border.controlWidth,
|
|
4081
4182
|
paddingVertical: spec.textareaPaddingY,
|
|
4082
4183
|
textAlignVertical: "top",
|
|
4083
4184
|
color: surface.ink
|
|
@@ -4090,7 +4191,7 @@ var KjunTextarea = (0, import_react34.forwardRef)(
|
|
|
4090
4191
|
);
|
|
4091
4192
|
|
|
4092
4193
|
// packages/native/src/drawer.tsx
|
|
4093
|
-
var
|
|
4194
|
+
var import_tokens26 = require("@kjun-ui/tokens");
|
|
4094
4195
|
var import_react35 = require("react");
|
|
4095
4196
|
var import_react_native27 = require("react-native");
|
|
4096
4197
|
|
|
@@ -4142,7 +4243,7 @@ function KjunDrawer({
|
|
|
4142
4243
|
onOpenChange,
|
|
4143
4244
|
title,
|
|
4144
4245
|
position = "right",
|
|
4145
|
-
width =
|
|
4246
|
+
width = import_tokens26.tokens.extensions.drawer.width,
|
|
4146
4247
|
closable = true,
|
|
4147
4248
|
closeOnOverlay = true,
|
|
4148
4249
|
closeOnEsc = true,
|
|
@@ -4166,13 +4267,13 @@ function KjunDrawer({
|
|
|
4166
4267
|
windowHeight: rootHeight || window2.height,
|
|
4167
4268
|
safeAreaTop: Math.max(0, safeAreaTop),
|
|
4168
4269
|
safeAreaBottom: Math.max(0, safeAreaBottom),
|
|
4169
|
-
gap:
|
|
4270
|
+
gap: import_tokens26.tokens.extensions.drawer.sheetGap,
|
|
4170
4271
|
keyboard,
|
|
4171
4272
|
maxHeight
|
|
4172
4273
|
});
|
|
4173
4274
|
const [panelHeight, setPanelHeight] = (0, import_react35.useState)(0);
|
|
4174
|
-
const motion = useNativePresence(open,
|
|
4175
|
-
const backdrop = useNativePresence(open,
|
|
4275
|
+
const motion = useNativePresence(open, import_tokens26.tokens.motion.layerEnter, import_tokens26.tokens.motion.layerExit, vertical || panelHeight > 0, 0, { enterEasing: motionEmphasized });
|
|
4276
|
+
const backdrop = useNativePresence(open, import_tokens26.tokens.motion.backdrop, import_tokens26.tokens.motion.backdropExit, true, 0, { fade: import_tokens26.tokens.motion.backdropExit });
|
|
4176
4277
|
const close = () => {
|
|
4177
4278
|
if (!open) return;
|
|
4178
4279
|
onOpenChange(false);
|
|
@@ -4237,10 +4338,10 @@ function KjunDrawer({
|
|
|
4237
4338
|
paddingTop: frame.paddingTop,
|
|
4238
4339
|
paddingBottom: frame.paddingBottom,
|
|
4239
4340
|
marginBottom: frame.lift,
|
|
4240
|
-
borderRadius:
|
|
4241
|
-
borderTopLeftRadius: position === "bottom" ?
|
|
4242
|
-
borderTopRightRadius: position === "bottom" ?
|
|
4243
|
-
boxShadow: directionalShadow(
|
|
4341
|
+
borderRadius: import_tokens26.tokens.extensions.drawer.radius,
|
|
4342
|
+
borderTopLeftRadius: position === "bottom" ? import_tokens26.tokens.extensions.drawer.bottomRadius : import_tokens26.tokens.extensions.drawer.radius,
|
|
4343
|
+
borderTopRightRadius: position === "bottom" ? import_tokens26.tokens.extensions.drawer.bottomRadius : import_tokens26.tokens.extensions.drawer.radius,
|
|
4344
|
+
boxShadow: directionalShadow(import_tokens26.tokens.extensions.drawer.elevation, position).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4244
4345
|
backgroundColor: colors.surface
|
|
4245
4346
|
},
|
|
4246
4347
|
children: [
|
|
@@ -4251,9 +4352,9 @@ function KjunDrawer({
|
|
|
4251
4352
|
flexDirection: "row",
|
|
4252
4353
|
alignItems: "center",
|
|
4253
4354
|
justifyContent: "space-between",
|
|
4254
|
-
paddingVertical:
|
|
4255
|
-
paddingHorizontal:
|
|
4256
|
-
borderBottomWidth:
|
|
4355
|
+
paddingVertical: import_tokens26.tokens.extensions.drawer.paddingY,
|
|
4356
|
+
paddingHorizontal: import_tokens26.tokens.extensions.drawer.paddingX,
|
|
4357
|
+
borderBottomWidth: import_tokens26.tokens.border.defaultWidth,
|
|
4257
4358
|
borderBottomColor: colors.border
|
|
4258
4359
|
},
|
|
4259
4360
|
children: [
|
|
@@ -4271,8 +4372,8 @@ function KjunDrawer({
|
|
|
4271
4372
|
variant: "ghost",
|
|
4272
4373
|
ariaLabel: m.close,
|
|
4273
4374
|
onPress: close,
|
|
4274
|
-
style: { borderRadius:
|
|
4275
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "x", size:
|
|
4375
|
+
style: { borderRadius: import_tokens26.tokens.extensions.drawer.closeRadius, width: import_tokens26.tokens.extensions.drawer.closeSize, height: import_tokens26.tokens.extensions.drawer.closeSize, paddingHorizontal: 0, paddingVertical: 0 },
|
|
4376
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(KjunIcon, { name: "x", size: import_tokens26.tokens.extensions.drawer.closeIconSize })
|
|
4276
4377
|
}
|
|
4277
4378
|
)
|
|
4278
4379
|
]
|
|
@@ -4283,7 +4384,7 @@ function KjunDrawer({
|
|
|
4283
4384
|
{
|
|
4284
4385
|
keyboardShouldPersistTaps: "handled",
|
|
4285
4386
|
style: vertical ? { flex: 1 } : { flexGrow: 0, flexShrink: 1 },
|
|
4286
|
-
contentContainerStyle: { padding: noPadding ? 0 :
|
|
4387
|
+
contentContainerStyle: { padding: noPadding ? 0 : import_tokens26.tokens.extensions.drawer.bodyPadding },
|
|
4287
4388
|
children: content(children)
|
|
4288
4389
|
}
|
|
4289
4390
|
),
|
|
@@ -4291,9 +4392,9 @@ function KjunDrawer({
|
|
|
4291
4392
|
import_react_native28.View,
|
|
4292
4393
|
{
|
|
4293
4394
|
style: {
|
|
4294
|
-
paddingVertical:
|
|
4295
|
-
paddingHorizontal:
|
|
4296
|
-
borderTopWidth:
|
|
4395
|
+
paddingVertical: import_tokens26.tokens.extensions.drawer.paddingY,
|
|
4396
|
+
paddingHorizontal: import_tokens26.tokens.extensions.drawer.paddingX,
|
|
4397
|
+
borderTopWidth: import_tokens26.tokens.border.defaultWidth,
|
|
4297
4398
|
borderTopColor: colors.border
|
|
4298
4399
|
},
|
|
4299
4400
|
children: content(footer)
|
|
@@ -4310,13 +4411,13 @@ function KjunDrawer({
|
|
|
4310
4411
|
}
|
|
4311
4412
|
|
|
4312
4413
|
// packages/native/src/dropdown.tsx
|
|
4313
|
-
var
|
|
4414
|
+
var import_tokens29 = require("@kjun-ui/tokens");
|
|
4314
4415
|
var import_react38 = require("react");
|
|
4315
4416
|
var import_react_native32 = require("react-native");
|
|
4316
4417
|
|
|
4317
4418
|
// packages/native/src/floating-panel.tsx
|
|
4318
4419
|
var import_react_native29 = require("react-native");
|
|
4319
|
-
var
|
|
4420
|
+
var import_tokens27 = require("@kjun-ui/tokens");
|
|
4320
4421
|
var import_react36 = require("react");
|
|
4321
4422
|
var import_react_native30 = require("react-native");
|
|
4322
4423
|
var import_react_native_svg4 = __toESM(require("react-native-svg"), 1);
|
|
@@ -4368,7 +4469,7 @@ function FloatingPanel({
|
|
|
4368
4469
|
const scroll = (0, import_react36.useRef)(null), viewport = (0, import_react36.useRef)(0);
|
|
4369
4470
|
const { colors } = useKjunStyles(), window2 = (0, import_react_native30.useWindowDimensions)(), [anchored, setAnchored] = (0, import_react36.useState)(false), [sized, setSized] = (0, import_react36.useState)(false), [anchor, setAnchor] = (0, import_react36.useState)({ x: 0, y: 0, width: 0, height: 0 }), [panel, setPanel] = (0, import_react36.useState)({ width: 0, height: 0 });
|
|
4370
4471
|
const measurement = (0, import_react36.useRef)(0);
|
|
4371
|
-
const motion = useNativePresence(open, tooltip ?
|
|
4472
|
+
const motion = useNativePresence(open, tooltip ? import_tokens27.tokens.motion.tooltipEnter : import_tokens27.tokens.motion.popupEnter, tooltip ? import_tokens27.tokens.motion.tooltipExit : import_tokens27.tokens.motion.popupExit, anchored && sized);
|
|
4372
4473
|
const layer = useLayer(open, motion.present, tooltip ? "tooltip" : "popup", () => onOpenChange(false), triggerRef);
|
|
4373
4474
|
(0, import_react36.useLayoutEffect)(() => {
|
|
4374
4475
|
var _a;
|
|
@@ -4393,7 +4494,7 @@ function FloatingPanel({
|
|
|
4393
4494
|
var _a;
|
|
4394
4495
|
const row = reveal == null ? void 0 : reveal.current;
|
|
4395
4496
|
if (!open || !anchored || !sized || !row || !viewport.current) return;
|
|
4396
|
-
const offset = row.y + row.height + (menu || field ?
|
|
4497
|
+
const offset = row.y + row.height + (menu || field ? import_tokens27.tokens.extensions.menu.padding : 0) - viewport.current;
|
|
4397
4498
|
if (offset > 0) (_a = scroll.current) == null ? void 0 : _a.scrollTo({ y: offset, animated: false });
|
|
4398
4499
|
}, [open, anchored, sized, reveal, menu, field]);
|
|
4399
4500
|
(0, import_react36.useEffect)(() => {
|
|
@@ -4406,30 +4507,30 @@ function FloatingPanel({
|
|
|
4406
4507
|
if (tag) import_react_native30.AccessibilityInfo.setAccessibilityFocus(tag);
|
|
4407
4508
|
}
|
|
4408
4509
|
}, [open, anchored, sized, focusOnOpen]);
|
|
4409
|
-
const gap = field ?
|
|
4510
|
+
const gap = field ? import_tokens27.tokens.extensions.floating.fieldGap : import_tokens27.tokens.extensions.floating.anchorGap;
|
|
4410
4511
|
const contentSizedMenu = menu && !matchTriggerWidth;
|
|
4411
|
-
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 *
|
|
4412
|
-
const maximumWidth = Math.max(0, window2.width - 2 *
|
|
4512
|
+
const tooltipWidth = Math.min(Math.max(0, window2.width - 2 * import_tokens27.tokens.extensions.floating.viewportInset), import_tokens27.tokens.extensions.tooltip.maxWidth);
|
|
4513
|
+
const maximumWidth = Math.max(0, window2.width - 2 * import_tokens27.tokens.extensions.floating.viewportInset);
|
|
4413
4514
|
const minimumPanelWidth = Math.min(
|
|
4414
4515
|
maximumWidth,
|
|
4415
|
-
Math.max(minimumWidth, menu || field ?
|
|
4516
|
+
Math.max(minimumWidth, menu || field ? import_tokens27.tokens.extensions.menu.minimumWidth : 0)
|
|
4416
4517
|
);
|
|
4417
4518
|
const width = tooltip ? Math.min(tooltipWidth, panel.width || tooltipWidth) : Math.min(
|
|
4418
4519
|
maximumWidth,
|
|
4419
|
-
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width :
|
|
4520
|
+
Math.max(minimumPanelWidth, contentSizedMenu ? panel.width : matchTriggerWidth ? anchor.width : import_tokens27.tokens.extensions.popover.width)
|
|
4420
4521
|
);
|
|
4421
|
-
const available = Math.min(maxHeight != null ? maxHeight : field ?
|
|
4522
|
+
const available = Math.min(maxHeight != null ? maxHeight : field ? import_tokens27.tokens.extensions.menu.listMaxHeight : import_tokens27.tokens.extensions.floating.maxHeight, window2.height - 2 * import_tokens27.tokens.extensions.floating.viewportInset), height = Math.min(panel.height + (header != null ? headerHeight : 0), available), roomAbove = anchor.y - gap - import_tokens27.tokens.extensions.floating.viewportInset, roomBelow = window2.height - anchor.y - anchor.height - gap - import_tokens27.tokens.extensions.floating.viewportInset, above = placement.startsWith("top") ? !(flip && height > roomAbove && roomBelow > roomAbove) : flip && height > roomBelow && roomAbove > roomBelow;
|
|
4422
4523
|
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;
|
|
4423
4524
|
if (placement === "left" || placement === "right") {
|
|
4424
4525
|
left = placement === "left" ? anchor.x - width - gap : anchor.x + anchor.width + gap;
|
|
4425
4526
|
top = anchor.y + (anchor.height - height) / 2;
|
|
4426
4527
|
}
|
|
4427
|
-
left = Math.max(
|
|
4428
|
-
top = Math.max(
|
|
4528
|
+
left = Math.max(import_tokens27.tokens.extensions.floating.viewportInset, Math.min(window2.width - width - import_tokens27.tokens.extensions.floating.viewportInset, left));
|
|
4529
|
+
top = Math.max(import_tokens27.tokens.extensions.floating.viewportInset, Math.min(window2.height - height - import_tokens27.tokens.extensions.floating.viewportInset, top));
|
|
4429
4530
|
if (layer.blocked) return null;
|
|
4430
4531
|
if (tooltip && import_react_native30.Platform.OS === "web") {
|
|
4431
4532
|
if (!motion.present) return null;
|
|
4432
|
-
const arrow =
|
|
4533
|
+
const arrow = import_tokens27.tokens.extensions.tooltip.arrowSize, corner = import_tokens27.tokens.radius.radius6, side = placement === "left" ? "right" : placement === "right" ? "left" : above ? "bottom" : "top", along = side === "top" || side === "bottom" ? Math.max(corner, Math.min(width - corner - arrow, anchor.x + anchor.width / 2 - left - arrow / 2)) : Math.max(corner, Math.min(height - corner - arrow, anchor.y + anchor.height / 2 - top - arrow / 2));
|
|
4433
4534
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4434
4535
|
import_react_native29.Animated.View,
|
|
4435
4536
|
{
|
|
@@ -4456,7 +4557,7 @@ function FloatingPanel({
|
|
|
4456
4557
|
borderRadius: corner,
|
|
4457
4558
|
overflow: "hidden",
|
|
4458
4559
|
backgroundColor: colors.chartTooltipBg,
|
|
4459
|
-
boxShadow: shadowLayers(
|
|
4560
|
+
boxShadow: shadowLayers(import_tokens27.tokens.extensions.tooltip.elevation, colors)
|
|
4460
4561
|
},
|
|
4461
4562
|
children
|
|
4462
4563
|
}
|
|
@@ -4518,8 +4619,8 @@ function FloatingPanel({
|
|
|
4518
4619
|
style: {
|
|
4519
4620
|
opacity: anchored && sized ? motion.opacity : 0,
|
|
4520
4621
|
transform: tooltip ? void 0 : [
|
|
4521
|
-
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ?
|
|
4522
|
-
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ?
|
|
4622
|
+
{ translateX: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" ? import_tokens27.tokens.motionDistance.popup : placement === "right" ? -import_tokens27.tokens.motionDistance.popup : 0, 0] }) },
|
|
4623
|
+
{ translateY: motion.progress.interpolate({ inputRange: [0, 1], outputRange: [placement === "left" || placement === "right" ? 0 : above ? import_tokens27.tokens.motionDistance.popup : -import_tokens27.tokens.motionDistance.popup, 0] }) }
|
|
4523
4624
|
],
|
|
4524
4625
|
position: "absolute",
|
|
4525
4626
|
top,
|
|
@@ -4528,11 +4629,11 @@ function FloatingPanel({
|
|
|
4528
4629
|
minWidth: contentSizedMenu ? minimumPanelWidth : void 0,
|
|
4529
4630
|
maxWidth: tooltip ? tooltipWidth : maximumWidth,
|
|
4530
4631
|
maxHeight: available,
|
|
4531
|
-
borderRadius: popover ?
|
|
4532
|
-
borderWidth: popover ? 0 :
|
|
4632
|
+
borderRadius: popover ? import_tokens27.tokens.extensions.popover.radius : field ? import_tokens27.tokens.radius.radius12 : import_tokens27.tokens.extensions.menu.radius,
|
|
4633
|
+
borderWidth: popover ? 0 : import_tokens27.tokens.border.defaultWidth,
|
|
4533
4634
|
borderColor: colors.border,
|
|
4534
4635
|
backgroundColor: colors.surface,
|
|
4535
|
-
boxShadow: (tooltip ?
|
|
4636
|
+
boxShadow: (tooltip ? import_tokens27.tokens.extensions.tooltip.elevation : popover ? import_tokens27.tokens.extensions.popover.elevation : import_tokens27.tokens.extensions.menu.elevation).map(({ colorRole, ...layer2 }) => ({ ...layer2, color: colors[colorRole] })),
|
|
4536
4637
|
overflow: "hidden"
|
|
4537
4638
|
},
|
|
4538
4639
|
children: [
|
|
@@ -4541,10 +4642,10 @@ function FloatingPanel({
|
|
|
4541
4642
|
{
|
|
4542
4643
|
onLayout: ({ nativeEvent: { layout } }) => setHeaderHeight(layout.height),
|
|
4543
4644
|
style: {
|
|
4544
|
-
paddingTop:
|
|
4545
|
-
paddingHorizontal:
|
|
4546
|
-
paddingBottom:
|
|
4547
|
-
borderBottomWidth:
|
|
4645
|
+
paddingTop: import_tokens27.tokens.extensions.popover.padding,
|
|
4646
|
+
paddingHorizontal: import_tokens27.tokens.extensions.popover.padding,
|
|
4647
|
+
paddingBottom: import_tokens27.tokens.extensions.popover.headerPaddingBottom,
|
|
4648
|
+
borderBottomWidth: import_tokens27.tokens.border.defaultWidth,
|
|
4548
4649
|
borderBottomColor: colors.divider
|
|
4549
4650
|
},
|
|
4550
4651
|
children: content(header, typeStyle("cardTitle"))
|
|
@@ -4559,7 +4660,7 @@ function FloatingPanel({
|
|
|
4559
4660
|
},
|
|
4560
4661
|
keyboardShouldPersistTaps: "handled",
|
|
4561
4662
|
style: { maxHeight: available - (header != null ? headerHeight : 0), flexShrink: 1 },
|
|
4562
|
-
contentContainerStyle: { padding: menu || field ?
|
|
4663
|
+
contentContainerStyle: { padding: menu || field ? import_tokens27.tokens.extensions.menu.padding : 0 },
|
|
4563
4664
|
onContentSizeChange: (width2, height2) => {
|
|
4564
4665
|
if (contentSizedMenu) return;
|
|
4565
4666
|
setSized(true);
|
|
@@ -4583,7 +4684,7 @@ function FloatingPanel({
|
|
|
4583
4684
|
// packages/native/src/popover.tsx
|
|
4584
4685
|
var import_react37 = require("react");
|
|
4585
4686
|
var import_react_native31 = require("react-native");
|
|
4586
|
-
var
|
|
4687
|
+
var import_tokens28 = require("@kjun-ui/tokens");
|
|
4587
4688
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4588
4689
|
function KjunPopover({
|
|
4589
4690
|
noPadding = false,
|
|
@@ -4632,7 +4733,7 @@ function KjunPopover({
|
|
|
4632
4733
|
ariaLabel,
|
|
4633
4734
|
header: header != null ? content(header, { ...typeStyle("cardTitle"), color: colors.text }) : void 0,
|
|
4634
4735
|
nonModal: !modal,
|
|
4635
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_native31.View, { style: { padding: noPadding ? 0 :
|
|
4736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_native31.View, { style: { padding: noPadding ? 0 : import_tokens28.tokens.extensions.popover.padding, gap: noPadding ? 0 : import_tokens28.tokens.extensions.popover.gap }, children: content(
|
|
4636
4737
|
typeof children === "function" ? children(() => change(false)) : children,
|
|
4637
4738
|
import_react_native31.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : void 0
|
|
4638
4739
|
) })
|
|
@@ -4739,9 +4840,9 @@ function KjunTooltip({
|
|
|
4739
4840
|
import_react_native31.View,
|
|
4740
4841
|
{
|
|
4741
4842
|
style: {
|
|
4742
|
-
paddingVertical:
|
|
4743
|
-
paddingHorizontal:
|
|
4744
|
-
maxWidth:
|
|
4843
|
+
paddingVertical: import_tokens28.tokens.extensions.tooltip.paddingY,
|
|
4844
|
+
paddingHorizontal: import_tokens28.tokens.extensions.tooltip.paddingX,
|
|
4845
|
+
maxWidth: import_tokens28.tokens.extensions.tooltip.maxWidth,
|
|
4745
4846
|
backgroundColor: colors.chartTooltipBg
|
|
4746
4847
|
},
|
|
4747
4848
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -4844,18 +4945,18 @@ function KjunDropdownItem({
|
|
|
4844
4945
|
style: ({ pressed }) => ({
|
|
4845
4946
|
flexDirection: "row",
|
|
4846
4947
|
alignItems: "center",
|
|
4847
|
-
gap:
|
|
4848
|
-
paddingVertical:
|
|
4849
|
-
paddingHorizontal:
|
|
4850
|
-
minHeight:
|
|
4851
|
-
borderRadius:
|
|
4948
|
+
gap: import_tokens29.tokens.dimension.value8,
|
|
4949
|
+
paddingVertical: import_tokens29.tokens.extensions.menu.optionPaddingY,
|
|
4950
|
+
paddingHorizontal: import_tokens29.tokens.extensions.menu.optionPaddingX,
|
|
4951
|
+
minHeight: import_tokens29.tokens.extensions.menu.optionHeight,
|
|
4952
|
+
borderRadius: import_tokens29.tokens.extensions.menu.optionRadius,
|
|
4852
4953
|
backgroundColor: selected ? colors.selectedBg : !disabled && (pressed || hovered) ? variant === "danger" ? colors.dangerBg : colors.hover : void 0,
|
|
4853
|
-
opacity: disabled ?
|
|
4954
|
+
opacity: disabled ? import_tokens29.tokens.states.opacity.disabled : 1
|
|
4854
4955
|
}),
|
|
4855
4956
|
children: [
|
|
4856
|
-
icon ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: icon, size:
|
|
4857
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize:
|
|
4858
|
-
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: "check", size:
|
|
4957
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: icon, size: import_tokens29.tokens.extensions.menu.iconSize, color: iconColor }) : reserveIcon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { width: import_tokens29.tokens.extensions.menu.iconSize }, accessible: false }),
|
|
4958
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { flexGrow: 1, flexShrink: 1 }, children: content(children, { color, fontSize: import_tokens29.tokens.extensions.menu.optionFontSize, lineHeight: import_tokens29.tokens.extensions.menu.optionLineHeight }) }),
|
|
4959
|
+
selected !== null && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native32.View, { style: { opacity: selected ? 1 : 0 }, accessible: false, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(KjunIcon, { name: "check", size: import_tokens29.tokens.extensions.menu.iconSize, color: colors.brand }) })
|
|
4859
4960
|
]
|
|
4860
4961
|
}
|
|
4861
4962
|
);
|
|
@@ -4866,7 +4967,7 @@ function KjunDropdownDivider() {
|
|
|
4866
4967
|
import_react_native32.View,
|
|
4867
4968
|
{
|
|
4868
4969
|
role: "separator",
|
|
4869
|
-
style: { height:
|
|
4970
|
+
style: { height: import_tokens29.tokens.extensions.menu.dividerHeight, marginVertical: import_tokens29.tokens.dimension.value4, backgroundColor: colors.border }
|
|
4870
4971
|
}
|
|
4871
4972
|
);
|
|
4872
4973
|
}
|
|
@@ -5039,12 +5140,12 @@ function useComboboxModel({
|
|
|
5039
5140
|
}
|
|
5040
5141
|
|
|
5041
5142
|
// packages/native/src/combobox.tsx
|
|
5042
|
-
var
|
|
5143
|
+
var import_tokens31 = require("@kjun-ui/tokens");
|
|
5043
5144
|
var import_react40 = require("react");
|
|
5044
5145
|
var import_react_native34 = require("react-native");
|
|
5045
5146
|
|
|
5046
5147
|
// packages/native/src/select-options.tsx
|
|
5047
|
-
var
|
|
5148
|
+
var import_tokens30 = require("@kjun-ui/tokens");
|
|
5048
5149
|
var import_react_native33 = require("react-native");
|
|
5049
5150
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5050
5151
|
function OptionRow({
|
|
@@ -5067,20 +5168,20 @@ function OptionRow({
|
|
|
5067
5168
|
onPress,
|
|
5068
5169
|
onLayout,
|
|
5069
5170
|
style: ({ pressed }) => ({
|
|
5070
|
-
borderRadius:
|
|
5071
|
-
minHeight:
|
|
5171
|
+
borderRadius: import_tokens30.tokens.radius.radius8,
|
|
5172
|
+
minHeight: import_tokens30.tokens.extensions.menu.optionHeight,
|
|
5072
5173
|
flexDirection: "row",
|
|
5073
5174
|
alignItems: "center",
|
|
5074
5175
|
justifyContent: "space-between",
|
|
5075
|
-
gap:
|
|
5076
|
-
paddingVertical:
|
|
5077
|
-
paddingHorizontal:
|
|
5176
|
+
gap: import_tokens30.tokens.dimension.value8,
|
|
5177
|
+
paddingVertical: import_tokens30.tokens.extensions.menu.optionPaddingY,
|
|
5178
|
+
paddingHorizontal: import_tokens30.tokens.extensions.menu.optionPaddingX,
|
|
5078
5179
|
backgroundColor: selected ? colors.selectedBg : pressed ? colors.hover : void 0,
|
|
5079
|
-
opacity: disabled ?
|
|
5180
|
+
opacity: disabled ? import_tokens30.tokens.states.opacity.disabled : 1
|
|
5080
5181
|
}),
|
|
5081
5182
|
children: [
|
|
5082
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native33.View, { style: { flex: 1 }, children: content(children || label, { fontSize:
|
|
5083
|
-
selected && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunIcon, { name: "check", size:
|
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native33.View, { style: { flex: 1 }, children: content(children || label, { fontSize: import_tokens30.tokens.extensions.menu.optionFontSize, lineHeight: import_tokens30.tokens.extensions.menu.optionLineHeight }) }),
|
|
5184
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(KjunIcon, { name: "check", size: import_tokens30.tokens.extensions.menu.iconSize, color: colors.brand })
|
|
5084
5185
|
]
|
|
5085
5186
|
}
|
|
5086
5187
|
);
|
|
@@ -5218,8 +5319,8 @@ function SearchField({
|
|
|
5218
5319
|
import_react_native34.View,
|
|
5219
5320
|
{
|
|
5220
5321
|
style: {
|
|
5221
|
-
padding:
|
|
5222
|
-
borderBottomWidth:
|
|
5322
|
+
padding: import_tokens31.tokens.dimension.value8,
|
|
5323
|
+
borderBottomWidth: import_tokens31.tokens.border.defaultWidth,
|
|
5223
5324
|
borderBottomColor: colors.border
|
|
5224
5325
|
},
|
|
5225
5326
|
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunInput, { ...inputProps, nativeID: searchId, autoFocus: true })
|
|
@@ -5227,13 +5328,13 @@ function SearchField({
|
|
|
5227
5328
|
),
|
|
5228
5329
|
loading ? (
|
|
5229
5330
|
// Centered like the Select loading row on every platform.
|
|
5230
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native34.View, { style: { padding:
|
|
5331
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native34.View, { style: { padding: import_tokens31.tokens.dimension.value12, alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(KjunSpinner, { size: "sm", text: m.searching }) })
|
|
5231
5332
|
) : failed ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5232
5333
|
KText,
|
|
5233
5334
|
{
|
|
5234
5335
|
accessibilityRole: "alert",
|
|
5235
5336
|
style: {
|
|
5236
|
-
padding:
|
|
5337
|
+
padding: import_tokens31.tokens.dimension.value12,
|
|
5237
5338
|
textAlign: "center",
|
|
5238
5339
|
color: colors.danger
|
|
5239
5340
|
},
|
|
@@ -5256,7 +5357,7 @@ function SearchField({
|
|
|
5256
5357
|
KText,
|
|
5257
5358
|
{
|
|
5258
5359
|
style: {
|
|
5259
|
-
padding:
|
|
5360
|
+
padding: import_tokens31.tokens.dimension.value12,
|
|
5260
5361
|
textAlign: "center",
|
|
5261
5362
|
color: colors.textTertiary
|
|
5262
5363
|
},
|
|
@@ -5270,7 +5371,7 @@ function SearchField({
|
|
|
5270
5371
|
}
|
|
5271
5372
|
|
|
5272
5373
|
// packages/native/src/date-picker.tsx
|
|
5273
|
-
var
|
|
5374
|
+
var import_tokens32 = require("@kjun-ui/tokens");
|
|
5274
5375
|
var import_react41 = require("react");
|
|
5275
5376
|
var import_react_native35 = require("react-native");
|
|
5276
5377
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
@@ -5294,7 +5395,7 @@ function KjunDatePicker({
|
|
|
5294
5395
|
const scope = useKjunMessageScope();
|
|
5295
5396
|
placeholder != null ? placeholder : placeholder = scope.messages.datePlaceholder;
|
|
5296
5397
|
const clear = clearable && !!value && !disabled;
|
|
5297
|
-
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = (0, import_react41.useState)(false), [month, setMonth] = (0, import_react41.useState)(() => displayMonth(value)), ref = (0, import_react41.useRef)(null), spec =
|
|
5398
|
+
const { colors } = useKjunStyles(), field = useKjunField(), [open, setOpen] = (0, import_react41.useState)(false), [month, setMonth] = (0, import_react41.useState)(() => displayMonth(value)), ref = (0, import_react41.useRef)(null), spec = import_tokens32.tokens.input[size];
|
|
5298
5399
|
const surface = useFieldSurface(size, { disabled, invalid: error || !!(field == null ? void 0 : field.error), open });
|
|
5299
5400
|
const year = month.getFullYear(), m = month.getMonth(), first = new Date(year, m, 1).getDay(), count = new Date(year, m + 1, 0).getDate();
|
|
5300
5401
|
const date = (day) => `${year}-${String(m + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
@@ -5302,7 +5403,7 @@ function KjunDatePicker({
|
|
|
5302
5403
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native35.View, { ref, collapsable: false, ...fieldTarget(() => {
|
|
5303
5404
|
setMonth(displayMonth(value));
|
|
5304
5405
|
setOpen(true);
|
|
5305
|
-
}, disabled), style: { minHeight:
|
|
5406
|
+
}, disabled), style: { minHeight: import_tokens32.tokens.native.minimumTouchTarget, justifyContent: "center" }, children: [
|
|
5306
5407
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5307
5408
|
FieldPressable,
|
|
5308
5409
|
{
|
|
@@ -5328,7 +5429,7 @@ function KjunDatePicker({
|
|
|
5328
5429
|
},
|
|
5329
5430
|
style: {
|
|
5330
5431
|
...surface.style,
|
|
5331
|
-
paddingHorizontal: spec.padding -
|
|
5432
|
+
paddingHorizontal: spec.padding - import_tokens32.tokens.border.controlWidth,
|
|
5332
5433
|
flexDirection: "row",
|
|
5333
5434
|
alignItems: "center",
|
|
5334
5435
|
justifyContent: "space-between"
|
|
@@ -5371,9 +5472,9 @@ function KjunDatePicker({
|
|
|
5371
5472
|
triggerRef: ref,
|
|
5372
5473
|
placement: "bottom-start",
|
|
5373
5474
|
matchTriggerWidth: true,
|
|
5374
|
-
minimumWidth:
|
|
5475
|
+
minimumWidth: import_tokens32.tokens.extensions.calendar.minimumWidth,
|
|
5375
5476
|
ariaLabel: scope.messages.datePlaceholder,
|
|
5376
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native35.View, { style: { padding:
|
|
5477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native35.View, { style: { padding: import_tokens32.tokens.dimension.value8 }, children: [
|
|
5377
5478
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5378
5479
|
import_react_native35.View,
|
|
5379
5480
|
{
|
|
@@ -5414,7 +5515,7 @@ function KjunDatePicker({
|
|
|
5414
5515
|
style: {
|
|
5415
5516
|
width: "14.2857%",
|
|
5416
5517
|
textAlign: "center",
|
|
5417
|
-
paddingVertical:
|
|
5518
|
+
paddingVertical: import_tokens32.tokens.dimension.value8,
|
|
5418
5519
|
color: colors.textTertiary
|
|
5419
5520
|
},
|
|
5420
5521
|
children: day
|
|
@@ -5441,12 +5542,12 @@ function KjunDatePicker({
|
|
|
5441
5542
|
},
|
|
5442
5543
|
style: {
|
|
5443
5544
|
width: "14.2857%",
|
|
5444
|
-
minHeight:
|
|
5545
|
+
minHeight: import_tokens32.tokens.native.minimumTouchTarget,
|
|
5445
5546
|
alignItems: "center",
|
|
5446
5547
|
justifyContent: "center",
|
|
5447
|
-
borderRadius:
|
|
5548
|
+
borderRadius: import_tokens32.tokens.radius.radius6,
|
|
5448
5549
|
backgroundColor: v === value ? colors.brand : void 0,
|
|
5449
|
-
opacity: blocked ?
|
|
5550
|
+
opacity: blocked ? import_tokens32.tokens.states.opacity.disabledStrong : 1
|
|
5450
5551
|
},
|
|
5451
5552
|
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5452
5553
|
KText,
|
|
@@ -5647,17 +5748,17 @@ function KjunSearchInput({
|
|
|
5647
5748
|
}
|
|
5648
5749
|
|
|
5649
5750
|
// packages/native/src/select-control.tsx
|
|
5650
|
-
var
|
|
5751
|
+
var import_tokens34 = require("@kjun-ui/tokens");
|
|
5651
5752
|
var import_react46 = require("react");
|
|
5652
5753
|
|
|
5653
5754
|
// packages/native/src/compound-control.tsx
|
|
5654
5755
|
var import_react44 = require("react");
|
|
5655
5756
|
var import_react_native36 = require("react-native");
|
|
5656
|
-
var
|
|
5757
|
+
var import_tokens33 = require("@kjun-ui/tokens");
|
|
5657
5758
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5658
5759
|
var CompoundControlContext = (0, import_react44.createContext)(null);
|
|
5659
5760
|
function CompoundTarget({ children, square = false }) {
|
|
5660
|
-
const touch = finePointer() ? void 0 :
|
|
5761
|
+
const touch = finePointer() ? void 0 : import_tokens33.tokens.native.minimumTouchTarget;
|
|
5661
5762
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native36.View, { style: { minHeight: touch, minWidth: square ? touch : void 0, alignItems: "center", justifyContent: "center" }, children });
|
|
5662
5763
|
}
|
|
5663
5764
|
|
|
@@ -5730,7 +5831,7 @@ function KjunSelect({
|
|
|
5730
5831
|
placeholder != null ? placeholder : placeholder = m.select;
|
|
5731
5832
|
searchPlaceholder != null ? searchPlaceholder : searchPlaceholder = m.search;
|
|
5732
5833
|
const { open, query, limit, changeOpen, search, showMore } = useSelectState(controlled, disabled, optionPageSize, onOpenChange);
|
|
5733
|
-
const { colors } = useKjunStyles(), field = useKjunField(), ref = (0, import_react46.useRef)(null), spec =
|
|
5834
|
+
const { colors } = useKjunStyles(), field = useKjunField(), ref = (0, import_react46.useRef)(null), spec = import_tokens34.tokens.input[size];
|
|
5734
5835
|
const trigger = (0, import_react46.useRef)(null);
|
|
5735
5836
|
const compound = (0, import_react46.useContext)(CompoundControlContext);
|
|
5736
5837
|
(0, import_react46.useEffect)(() => {
|
|
@@ -5762,10 +5863,10 @@ function KjunSelect({
|
|
|
5762
5863
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
5763
5864
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native37.View, { ref, collapsable: false, ...fieldTarget(() => changeOpen(!open), disabled), style: {
|
|
5764
5865
|
position: "relative",
|
|
5765
|
-
minHeight:
|
|
5866
|
+
minHeight: import_tokens34.tokens.native.minimumTouchTarget,
|
|
5766
5867
|
justifyContent: "center",
|
|
5767
5868
|
// Inside a compound field the touch target overflows so the shared surface keeps its size height.
|
|
5768
|
-
...compound ? { marginVertical: Math.min(0, (spec.height -
|
|
5869
|
+
...compound ? { marginVertical: Math.min(0, (spec.height - import_tokens34.tokens.native.minimumTouchTarget) / 2) } : {}
|
|
5769
5870
|
}, children: [
|
|
5770
5871
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
5771
5872
|
FieldPressable,
|
|
@@ -5801,14 +5902,14 @@ function KjunSelect({
|
|
|
5801
5902
|
flexDirection: "row",
|
|
5802
5903
|
alignItems: "center",
|
|
5803
5904
|
justifyContent: "space-between",
|
|
5804
|
-
gap:
|
|
5905
|
+
gap: import_tokens34.tokens.dimension.value8,
|
|
5805
5906
|
...surface.style,
|
|
5806
|
-
paddingHorizontal: spec.padding -
|
|
5807
|
-
paddingRight: spec.padding -
|
|
5808
|
-
...compound ? { paddingHorizontal:
|
|
5907
|
+
paddingHorizontal: spec.padding - import_tokens34.tokens.border.controlWidth,
|
|
5908
|
+
paddingRight: spec.padding - import_tokens34.tokens.border.controlWidth,
|
|
5909
|
+
...compound ? { paddingHorizontal: import_tokens34.tokens.extensions.timePicker.segmentPadding, paddingRight: import_tokens34.tokens.extensions.timePicker.segmentPadding, paddingLeft: compound.leading ? spec.padding - import_tokens34.tokens.border.controlWidth : import_tokens34.tokens.extensions.timePicker.segmentPadding, gap: import_tokens34.tokens.extensions.timePicker.segmentPadding, backgroundColor: !disabled && (surface.active || surface.hovered) ? colors.hover : "transparent", borderColor: "transparent", outlineWidth: 0 } : {}
|
|
5809
5910
|
},
|
|
5810
5911
|
children: [
|
|
5811
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native37.View, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ?
|
|
5912
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react_native37.View, { style: { ...compound ? { flexGrow: 1, flexShrink: 0 } : { flex: 1, minWidth: 0 }, paddingRight: clearable && label ? import_tokens34.tokens.native.minimumTouchTarget + spec.affixGap : 0 }, children: [
|
|
5812
5913
|
compound && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KText, { "aria-hidden": true, importantForAccessibility: "no-hide-descendants", style: { ...inputTypeStyle(size), fontVariant: ["tabular-nums"], opacity: 0 }, children: "00" }),
|
|
5813
5914
|
(renderSelected == null ? void 0 : renderSelected(selectedOption)) || /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KText, { numberOfLines: 1, style: {
|
|
5814
5915
|
...inputTypeStyle(size),
|
|
@@ -5820,7 +5921,7 @@ function KjunSelect({
|
|
|
5820
5921
|
KjunIcon,
|
|
5821
5922
|
{
|
|
5822
5923
|
name: "chevron-down",
|
|
5823
|
-
size: compound ?
|
|
5924
|
+
size: compound ? import_tokens34.tokens.extensions.timePicker.iconSize : spec.iconSize,
|
|
5824
5925
|
color: surface.icon
|
|
5825
5926
|
}
|
|
5826
5927
|
) })
|
|
@@ -5864,8 +5965,8 @@ function KjunSelect({
|
|
|
5864
5965
|
import_react_native37.View,
|
|
5865
5966
|
{
|
|
5866
5967
|
style: {
|
|
5867
|
-
padding:
|
|
5868
|
-
borderBottomWidth:
|
|
5968
|
+
padding: import_tokens34.tokens.dimension.value8,
|
|
5969
|
+
borderBottomWidth: import_tokens34.tokens.border.defaultWidth,
|
|
5869
5970
|
borderBottomColor: colors.border
|
|
5870
5971
|
},
|
|
5871
5972
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -5885,7 +5986,7 @@ function KjunSelect({
|
|
|
5885
5986
|
)
|
|
5886
5987
|
}
|
|
5887
5988
|
),
|
|
5888
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native37.View, { style: { padding:
|
|
5989
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_native37.View, { style: { padding: import_tokens34.tokens.dimension.value12 }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KjunSpinner, { size: "sm", text: m.searching }) }) : visible.map(({ option: o, key }, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
5889
5990
|
OptionRow,
|
|
5890
5991
|
{
|
|
5891
5992
|
selected: selected(o),
|
|
@@ -5907,7 +6008,7 @@ function KjunSelect({
|
|
|
5907
6008
|
KText,
|
|
5908
6009
|
{
|
|
5909
6010
|
style: {
|
|
5910
|
-
padding:
|
|
6011
|
+
padding: import_tokens34.tokens.dimension.value12,
|
|
5911
6012
|
textAlign: "center",
|
|
5912
6013
|
color: colors.textTertiary
|
|
5913
6014
|
},
|
|
@@ -5931,10 +6032,10 @@ function KjunSelect({
|
|
|
5931
6032
|
}
|
|
5932
6033
|
|
|
5933
6034
|
// packages/native/src/navigation.tsx
|
|
5934
|
-
var
|
|
6035
|
+
var import_tokens37 = require("@kjun-ui/tokens");
|
|
5935
6036
|
|
|
5936
6037
|
// packages/native/src/collapse.tsx
|
|
5937
|
-
var
|
|
6038
|
+
var import_tokens35 = require("@kjun-ui/tokens");
|
|
5938
6039
|
var import_react47 = require("react");
|
|
5939
6040
|
var import_react_native38 = require("react-native");
|
|
5940
6041
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
@@ -5961,7 +6062,7 @@ function Collapse({ open, children }) {
|
|
|
5961
6062
|
finish();
|
|
5962
6063
|
} else {
|
|
5963
6064
|
setSettled(false);
|
|
5964
|
-
import_react_native38.Animated.timing(value, { toValue: target, duration:
|
|
6065
|
+
import_react_native38.Animated.timing(value, { toValue: target, duration: import_tokens35.tokens.motion.collapse, easing: motionOut, useNativeDriver: false }).start(({ finished }) => {
|
|
5965
6066
|
if (finished) finish();
|
|
5966
6067
|
});
|
|
5967
6068
|
}
|
|
@@ -6028,7 +6129,7 @@ var import_react50 = require("react");
|
|
|
6028
6129
|
var import_react_native40 = require("react-native");
|
|
6029
6130
|
|
|
6030
6131
|
// packages/native/src/tabs.tsx
|
|
6031
|
-
var
|
|
6132
|
+
var import_tokens36 = require("@kjun-ui/tokens");
|
|
6032
6133
|
var import_react49 = require("react");
|
|
6033
6134
|
var import_react_native39 = require("react-native");
|
|
6034
6135
|
|
|
@@ -6068,14 +6169,14 @@ function KjunTabs({
|
|
|
6068
6169
|
if (!onTabMenu || !tabs.some((tab) => tab.name === pressedMenu.current && !tab.disabled)) pressedMenu.current = null;
|
|
6069
6170
|
}, [tabs, onTabMenu]);
|
|
6070
6171
|
const panelNames = panes.filter((child) => child.type === KjunTabPane).map((child) => child.props.name);
|
|
6071
|
-
const geometry2 =
|
|
6172
|
+
const geometry2 = import_tokens36.tokens.extensions.tabs;
|
|
6072
6173
|
const underline = variant === "underline";
|
|
6073
6174
|
const [hoveredTab, setHoveredTab] = (0, import_react49.useState)(null);
|
|
6074
6175
|
const singleLine = import_react_native39.Platform.OS === "web" ? { whiteSpace: "nowrap" } : {};
|
|
6075
6176
|
const paddingX = !underline ? geometry2.pillsPaddingX : density === "compact" ? geometry2.compactPaddingX : geometry2.paddingX;
|
|
6076
6177
|
const height = density === "compact" ? geometry2.compactHeight : geometry2.height;
|
|
6077
|
-
const ringRoom =
|
|
6078
|
-
const slop = Math.max(0, (
|
|
6178
|
+
const ringRoom = import_tokens36.tokens.states.focus.width + import_tokens36.tokens.states.focus.offset;
|
|
6179
|
+
const slop = Math.max(0, (import_tokens36.tokens.native.minimumTouchTarget - height) / 2);
|
|
6079
6180
|
const roomX = underline ? ringRoom : 0, roomY = Math.max(underline ? ringRoom : 0, slop);
|
|
6080
6181
|
const selectedTab = tabs.find((tab) => tab.name === value);
|
|
6081
6182
|
const selection = useButtonGroupMotion(selectedTab ? { ...selectedTab, value: selectedTab.name } : void 0);
|
|
@@ -6134,7 +6235,7 @@ function KjunTabs({
|
|
|
6134
6235
|
transform: [{ translateX: selection.x }],
|
|
6135
6236
|
borderRadius: underline ? geometry2.indicatorHeight / 2 : geometry2.radius,
|
|
6136
6237
|
backgroundColor: variant === "underline" ? colors.brand : colors.active,
|
|
6137
|
-
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ?
|
|
6238
|
+
opacity: (selectedTab == null ? void 0 : selectedTab.disabled) ? import_tokens36.tokens.states.opacity.disabled : 1
|
|
6138
6239
|
}
|
|
6139
6240
|
}
|
|
6140
6241
|
),
|
|
@@ -6194,7 +6295,7 @@ function KjunTabs({
|
|
|
6194
6295
|
borderRadius: geometry2.radius,
|
|
6195
6296
|
// Pills answer hover with the hover surface, like ButtonGroup and Web.
|
|
6196
6297
|
backgroundColor: !underline && !active && !tab.disabled && hoveredTab === tab.name ? colors.hover : void 0,
|
|
6197
|
-
opacity: tab.disabled ?
|
|
6298
|
+
opacity: tab.disabled ? import_tokens36.tokens.states.opacity.disabled : 1
|
|
6198
6299
|
},
|
|
6199
6300
|
children: [
|
|
6200
6301
|
!!tab.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -6289,7 +6390,7 @@ function KjunAccordion({
|
|
|
6289
6390
|
import_react_native40.View,
|
|
6290
6391
|
{
|
|
6291
6392
|
style: {
|
|
6292
|
-
borderRadius:
|
|
6393
|
+
borderRadius: import_tokens37.tokens.extensions.accordion.radius,
|
|
6293
6394
|
overflow: "hidden",
|
|
6294
6395
|
backgroundColor: tone === "muted" ? colors.secondary : colors.surface
|
|
6295
6396
|
},
|
|
@@ -6307,8 +6408,8 @@ function KjunAccordionItem({
|
|
|
6307
6408
|
children
|
|
6308
6409
|
}) {
|
|
6309
6410
|
const { colors } = useKjunStyles(), group = (0, import_react50.useContext)(AccordionContext), id = "kjun-" + (0, import_react50.useId)(), [own, setOwn] = (0, import_react50.useState)(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
6310
|
-
const rotation = useMotionValue(open ? 1 : 0,
|
|
6311
|
-
const geometry2 =
|
|
6411
|
+
const rotation = useMotionValue(open ? 1 : 0, import_tokens37.tokens.motion.collapse, void 0, void 0, true);
|
|
6412
|
+
const geometry2 = import_tokens37.tokens.extensions.accordion;
|
|
6312
6413
|
const [hovered, setHovered] = (0, import_react50.useState)(false);
|
|
6313
6414
|
const wrapping = import_react_native40.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
6314
6415
|
(0, import_react50.useEffect)(() => {
|
|
@@ -6321,7 +6422,7 @@ function KjunAccordionItem({
|
|
|
6321
6422
|
nativeID: id + "-heading",
|
|
6322
6423
|
accessibilityRole: "button",
|
|
6323
6424
|
focusRingInset: true,
|
|
6324
|
-
focusRingRadius:
|
|
6425
|
+
focusRingRadius: import_tokens37.tokens.extensions.accordion.radius,
|
|
6325
6426
|
accessibilityLabel: title,
|
|
6326
6427
|
accessibilityState: { expanded: open, disabled },
|
|
6327
6428
|
disabled,
|
|
@@ -6337,7 +6438,7 @@ function KjunAccordionItem({
|
|
|
6337
6438
|
paddingVertical: geometry2.headerPaddingY,
|
|
6338
6439
|
paddingHorizontal: geometry2.paddingX,
|
|
6339
6440
|
backgroundColor: !disabled && (pressed || hovered) ? colors.hover : void 0,
|
|
6340
|
-
opacity: disabled ?
|
|
6441
|
+
opacity: disabled ? import_tokens37.tokens.states.opacity.disabled : 1
|
|
6341
6442
|
}),
|
|
6342
6443
|
children: [
|
|
6343
6444
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native40.View, { style: { flex: 1, minWidth: 0 }, children: content(header || title, { ...typeStyle("control"), ...wrapping }) }),
|
|
@@ -6372,11 +6473,11 @@ function KjunBreadcrumb({
|
|
|
6372
6473
|
flexDirection: "row",
|
|
6373
6474
|
alignItems: "center",
|
|
6374
6475
|
flexWrap: "wrap",
|
|
6375
|
-
gap:
|
|
6476
|
+
gap: import_tokens37.tokens.dimension.value8
|
|
6376
6477
|
},
|
|
6377
6478
|
children: items2.map((item, i) => {
|
|
6378
|
-
const label = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6379
|
-
!!item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunIcon, { name: item.icon, size:
|
|
6479
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens37.tokens.dimension.value4 }, children: [
|
|
6480
|
+
!!item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KjunIcon, { name: item.icon, size: import_tokens37.tokens.extensions.breadcrumb.iconSize, color: colors.textSecondary }),
|
|
6380
6481
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6381
6482
|
KText,
|
|
6382
6483
|
{
|
|
@@ -6393,7 +6494,7 @@ function KjunBreadcrumb({
|
|
|
6393
6494
|
KjunIcon,
|
|
6394
6495
|
{
|
|
6395
6496
|
name: "chevron-right",
|
|
6396
|
-
size:
|
|
6497
|
+
size: import_tokens37.tokens.extensions.breadcrumb.separatorSize,
|
|
6397
6498
|
color: colors.textTertiary
|
|
6398
6499
|
}
|
|
6399
6500
|
),
|
|
@@ -6403,7 +6504,7 @@ function KjunBreadcrumb({
|
|
|
6403
6504
|
{
|
|
6404
6505
|
accessibilityRole: "link",
|
|
6405
6506
|
onPress: () => onNavigate == null ? void 0 : onNavigate(item),
|
|
6406
|
-
style: { minHeight:
|
|
6507
|
+
style: { minHeight: import_tokens37.tokens.native.minimumTouchTarget, justifyContent: "center" },
|
|
6407
6508
|
children: label
|
|
6408
6509
|
}
|
|
6409
6510
|
) : label
|
|
@@ -6432,7 +6533,7 @@ function KjunPagination({
|
|
|
6432
6533
|
const m = useKjunMessages();
|
|
6433
6534
|
const { colors } = useKjunStyles(), window2 = (0, import_react_native40.useWindowDimensions)(), current = Math.max(1, Math.min(totalPages, (_a = currentPage != null ? currentPage : page) != null ? _a : 1));
|
|
6434
6535
|
if (totalPages <= 1 && !showSizeSelector && !(showInfo && totalRows > 0)) return null;
|
|
6435
|
-
const compact = window2.width <
|
|
6536
|
+
const compact = window2.width < import_tokens37.tokens.responsive.pagination;
|
|
6436
6537
|
const change = (v) => {
|
|
6437
6538
|
if (v < 1 || v > totalPages || v === current) return;
|
|
6438
6539
|
onPageChange == null ? void 0 : onPageChange(v);
|
|
@@ -6448,12 +6549,12 @@ function KjunPagination({
|
|
|
6448
6549
|
]);
|
|
6449
6550
|
const pages = [...visible].sort((a, b) => a - b).flatMap((v, i, all) => i && v - all[i - 1] > 1 ? ["...", v] : [v]);
|
|
6450
6551
|
const pageButtonStyle = {
|
|
6451
|
-
width: Math.max(
|
|
6452
|
-
height: Math.max(
|
|
6453
|
-
borderRadius:
|
|
6552
|
+
width: Math.max(import_tokens37.tokens.extensions.pagination.itemSize, import_tokens37.tokens.native.minimumTouchTarget),
|
|
6553
|
+
height: Math.max(import_tokens37.tokens.extensions.pagination.itemSize, import_tokens37.tokens.native.minimumTouchTarget),
|
|
6554
|
+
borderRadius: import_tokens37.tokens.extensions.pagination.radius,
|
|
6454
6555
|
paddingHorizontal: 0
|
|
6455
6556
|
};
|
|
6456
|
-
const arrowSize = (_b = Object.keys(
|
|
6557
|
+
const arrowSize = (_b = Object.keys(import_tokens37.tokens.button.iconSizes).find((size) => import_tokens37.tokens.button.iconSizes[size] === import_tokens37.tokens.extensions.pagination.iconSize)) != null ? _b : "sm";
|
|
6457
6558
|
const button = (target, label, icon) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6458
6559
|
KjunButton,
|
|
6459
6560
|
{
|
|
@@ -6474,9 +6575,9 @@ function KjunPagination({
|
|
|
6474
6575
|
flexDirection: compact ? "column" : "row",
|
|
6475
6576
|
alignItems: compact ? "stretch" : "center",
|
|
6476
6577
|
justifyContent: "space-between",
|
|
6477
|
-
gap:
|
|
6478
|
-
padding:
|
|
6479
|
-
borderTopWidth:
|
|
6578
|
+
gap: import_tokens37.tokens.extensions.pagination.gap,
|
|
6579
|
+
padding: import_tokens37.tokens.extensions.pagination.padding,
|
|
6580
|
+
borderTopWidth: import_tokens37.tokens.border.defaultWidth,
|
|
6480
6581
|
borderTopColor: colors.border
|
|
6481
6582
|
},
|
|
6482
6583
|
children: [
|
|
@@ -6487,11 +6588,11 @@ function KjunPagination({
|
|
|
6487
6588
|
style: {
|
|
6488
6589
|
flexDirection: "row",
|
|
6489
6590
|
alignItems: "center",
|
|
6490
|
-
gap:
|
|
6591
|
+
gap: import_tokens37.tokens.extensions.pagination.itemGap,
|
|
6491
6592
|
flexWrap: "wrap"
|
|
6492
6593
|
},
|
|
6493
6594
|
children: [
|
|
6494
|
-
showSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native40.View, { style: { minWidth:
|
|
6595
|
+
showSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native40.View, { style: { minWidth: import_tokens37.tokens.extensions.pagination.selectorMinimumWidth }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
6495
6596
|
KjunSelect,
|
|
6496
6597
|
{
|
|
6497
6598
|
size: "sm",
|
|
@@ -6508,10 +6609,10 @@ function KjunPagination({
|
|
|
6508
6609
|
}
|
|
6509
6610
|
}
|
|
6510
6611
|
) }),
|
|
6511
|
-
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6612
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native40.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens37.tokens.extensions.pagination.itemGap, marginLeft: compact ? "auto" : void 0 }, children: [
|
|
6512
6613
|
!compact && showFirstLast && button(1, m.firstPage, "chevrons-left"),
|
|
6513
6614
|
button(current - 1, m.previousPage, "chevron-left"),
|
|
6514
|
-
compact ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(KText, { style: { paddingHorizontal:
|
|
6615
|
+
compact ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(KText, { style: { paddingHorizontal: import_tokens37.tokens.extensions.pagination.labelPaddingX, color: colors.text, fontVariant: ["tabular-nums"] }, children: [
|
|
6515
6616
|
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(KText, { style: { fontWeight: typeStyle("control").fontWeight }, children: current }),
|
|
6516
6617
|
" / ",
|
|
6517
6618
|
totalPages
|
|
@@ -6541,7 +6642,7 @@ function KjunPagination({
|
|
|
6541
6642
|
}
|
|
6542
6643
|
|
|
6543
6644
|
// packages/native/src/actions.tsx
|
|
6544
|
-
var
|
|
6645
|
+
var import_tokens38 = require("@kjun-ui/tokens");
|
|
6545
6646
|
var import_react51 = require("react");
|
|
6546
6647
|
var import_react_native41 = require("react-native");
|
|
6547
6648
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
@@ -6562,7 +6663,7 @@ function KjunIconToggle({
|
|
|
6562
6663
|
}) {
|
|
6563
6664
|
const { colors } = useKjunStyles();
|
|
6564
6665
|
const navigation = (0, import_react51.useContext)(TopNavigationContext);
|
|
6565
|
-
const box = navigation ? navigation.controlSize : size === "xs" ?
|
|
6666
|
+
const box = navigation ? navigation.controlSize : size === "xs" ? import_tokens38.tokens.extensions.iconToggle.compactSize : import_tokens38.tokens.extensions.iconToggle.sizes[size];
|
|
6566
6667
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunTooltip, { content: disabled || loading ? "" : tooltip != null ? tooltip : ariaLabel, placement: tooltipPlacement, delay: tooltipDelay, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6567
6668
|
AccessiblePressable,
|
|
6568
6669
|
{
|
|
@@ -6588,24 +6689,24 @@ function KjunIconToggle({
|
|
|
6588
6689
|
...import_react_native41.Platform.OS === "web" ? { pointerEvents: "auto" } : {},
|
|
6589
6690
|
// The touch target stays 44pt; the visible square follows the icon-toggle scale.
|
|
6590
6691
|
alignSelf: "flex-start",
|
|
6591
|
-
minWidth: Math.max(
|
|
6592
|
-
minHeight: Math.max(
|
|
6692
|
+
minWidth: Math.max(import_tokens38.tokens.native.minimumTouchTarget, box),
|
|
6693
|
+
minHeight: Math.max(import_tokens38.tokens.native.minimumTouchTarget, box),
|
|
6593
6694
|
alignItems: "center",
|
|
6594
6695
|
justifyContent: "center",
|
|
6595
6696
|
...navigation ? { width: navigation.controlSize, height: navigation.controlSize, flexShrink: 0 } : {},
|
|
6596
|
-
borderRadius:
|
|
6697
|
+
borderRadius: import_tokens38.tokens.extensions.iconToggle.radii[size],
|
|
6597
6698
|
// Loading blocks presses but stays legible; only disabled dims.
|
|
6598
|
-
opacity: disabled ?
|
|
6699
|
+
opacity: disabled ? import_tokens38.tokens.states.opacity.disabled : 1,
|
|
6599
6700
|
transform: [{ scale: pressed ? 0.94 : 1 }]
|
|
6600
6701
|
}),
|
|
6601
6702
|
children: ({ pressed, hovered }) => {
|
|
6602
6703
|
var _a;
|
|
6603
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_native41.View, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius:
|
|
6704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react_native41.View, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", borderRadius: import_tokens38.tokens.extensions.iconToggle.radii[size], backgroundColor: !disabled && !loading && (pressed || hovered) ? colors.hover : "transparent" }, children: loading ? navigation ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunIcon, { name: "loader-2", spin: true, size: navigation.iconSize }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunSpinner, { size: "sm" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6604
6705
|
KjunIcon,
|
|
6605
6706
|
{
|
|
6606
6707
|
name: active ? activeIcon : inactiveIcon || activeIcon,
|
|
6607
6708
|
filled: active,
|
|
6608
|
-
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a :
|
|
6709
|
+
size: (_a = navigation == null ? void 0 : navigation.iconSize) != null ? _a : import_tokens38.tokens.button.iconSizes[size],
|
|
6609
6710
|
color: active ? activeColor != null ? activeColor : colors.brand : hovered && !disabled && !loading ? colors.textSecondary : inactiveColor != null ? inactiveColor : colors.textTertiary
|
|
6610
6711
|
}
|
|
6611
6712
|
) });
|
|
@@ -6666,24 +6767,24 @@ function KjunCopyButton({
|
|
|
6666
6767
|
},
|
|
6667
6768
|
style: ({ pressed }) => ({
|
|
6668
6769
|
alignSelf: "flex-start",
|
|
6669
|
-
minWidth:
|
|
6670
|
-
minHeight:
|
|
6770
|
+
minWidth: import_tokens38.tokens.native.minimumTouchTarget,
|
|
6771
|
+
minHeight: import_tokens38.tokens.native.minimumTouchTarget,
|
|
6671
6772
|
alignItems: "center",
|
|
6672
6773
|
justifyContent: "center",
|
|
6673
6774
|
flexDirection: "row",
|
|
6674
|
-
gap:
|
|
6675
|
-
paddingHorizontal: { xs:
|
|
6676
|
-
paddingVertical: { xs:
|
|
6677
|
-
borderRadius:
|
|
6775
|
+
gap: import_tokens38.tokens.dimension.value6,
|
|
6776
|
+
paddingHorizontal: { xs: import_tokens38.tokens.dimension.value2, sm: import_tokens38.tokens.dimension.value8, md: import_tokens38.tokens.dimension.value12 }[size],
|
|
6777
|
+
paddingVertical: { xs: import_tokens38.tokens.dimension.value2, sm: import_tokens38.tokens.dimension.value4, md: import_tokens38.tokens.dimension.value6 }[size],
|
|
6778
|
+
borderRadius: import_tokens38.tokens.radius.radius6,
|
|
6678
6779
|
backgroundColor: pressed && !inline ? colors.hover : void 0,
|
|
6679
|
-
opacity: disabled ?
|
|
6780
|
+
opacity: disabled ? import_tokens38.tokens.states.opacity.disabled : 1
|
|
6680
6781
|
}),
|
|
6681
6782
|
children: [
|
|
6682
6783
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
6683
6784
|
KjunIcon,
|
|
6684
6785
|
{
|
|
6685
6786
|
name: copied ? "check" : "copy",
|
|
6686
|
-
size:
|
|
6787
|
+
size: import_tokens38.tokens.button.iconSizes[size],
|
|
6687
6788
|
color: copied ? colors.success : colors.textSecondary
|
|
6688
6789
|
}
|
|
6689
6790
|
),
|
|
@@ -6758,12 +6859,12 @@ function KjunExternalLink({
|
|
|
6758
6859
|
accessibilityRole: "link",
|
|
6759
6860
|
accessibilityLabel: name ? name + m.newWindow : void 0,
|
|
6760
6861
|
onPress: () => openUrl(url),
|
|
6761
|
-
style: { alignSelf: "flex-start", minHeight:
|
|
6862
|
+
style: { alignSelf: "flex-start", minHeight: import_tokens38.tokens.native.minimumTouchTarget, justifyContent: "center" },
|
|
6762
6863
|
children: mode === "text" ? (
|
|
6763
6864
|
// Like Web, text links show the new-window cue after the text.
|
|
6764
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_native41.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
6865
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react_native41.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens38.tokens.dimension.value4 }, children: [
|
|
6765
6866
|
body,
|
|
6766
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunIcon, { name: "external-link", size:
|
|
6867
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(KjunIcon, { name: "external-link", size: import_tokens38.tokens.iconSizes.small, color: colors.text })
|
|
6767
6868
|
] })
|
|
6768
6869
|
) : body
|
|
6769
6870
|
}
|
|
@@ -6782,7 +6883,7 @@ function KjunScrollFade({ children }) {
|
|
|
6782
6883
|
}
|
|
6783
6884
|
|
|
6784
6885
|
// packages/native/src/data-state.tsx
|
|
6785
|
-
var
|
|
6886
|
+
var import_tokens39 = require("@kjun-ui/tokens");
|
|
6786
6887
|
var import_react53 = require("react");
|
|
6787
6888
|
var import_react_native42 = require("react-native");
|
|
6788
6889
|
|
|
@@ -6803,13 +6904,13 @@ function useLoadingReveal(active, delay = 0) {
|
|
|
6803
6904
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6804
6905
|
function useQueryDisplay(props) {
|
|
6805
6906
|
var _a;
|
|
6806
|
-
const [state, setState] = (0, import_react53.useState)(() => (0,
|
|
6907
|
+
const [state, setState] = (0, import_react53.useState)(() => (0, import_tokens39.initialQueryDisplay)(props));
|
|
6807
6908
|
let next = state;
|
|
6808
6909
|
if (state.queryKey !== ((_a = props.queryKey) != null ? _a : null) || state.resultKey !== props.resultKey || state.loading !== !!props.loading) {
|
|
6809
|
-
next = (0,
|
|
6910
|
+
next = (0, import_tokens39.advanceQueryDisplay)(state, props);
|
|
6810
6911
|
setState(next);
|
|
6811
6912
|
}
|
|
6812
|
-
return (0,
|
|
6913
|
+
return (0, import_tokens39.queryDisplayStatus)(next, props);
|
|
6813
6914
|
}
|
|
6814
6915
|
function KjunDataState({
|
|
6815
6916
|
preserveContent = false,
|
|
@@ -6841,7 +6942,7 @@ function KjunDataState({
|
|
|
6841
6942
|
emptyText != null ? emptyText : emptyText = m.noData;
|
|
6842
6943
|
loadingText != null ? loadingText : loadingText = m.loadingEllipsis;
|
|
6843
6944
|
retryText != null ? retryText : retryText = m.retry;
|
|
6844
|
-
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 =
|
|
6945
|
+
const state = useQueryDisplay(query), blockingError = query.error && !(state.usesQueryState && state.hasCurrentResult), visibleRefreshError = refreshError || (state.usesQueryState && state.hasCurrentResult ? query.error : null), concealed = state.initialLoading || !!blockingError || empty, padding = import_tokens39.tokens.extensions.state.padding[size], revealed = useLoadingReveal(state.initialLoading, loadingDelay);
|
|
6845
6946
|
const { colors } = useKjunStyles();
|
|
6846
6947
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
6847
6948
|
import_react_native42.View,
|
|
@@ -6856,13 +6957,13 @@ function KjunDataState({
|
|
|
6856
6957
|
style: {
|
|
6857
6958
|
alignSelf: "flex-end",
|
|
6858
6959
|
maxWidth: "100%",
|
|
6859
|
-
marginBottom:
|
|
6960
|
+
marginBottom: import_tokens39.tokens.dimension.value12,
|
|
6860
6961
|
flexDirection: "row",
|
|
6861
6962
|
alignItems: "center",
|
|
6862
|
-
gap:
|
|
6863
|
-
paddingVertical:
|
|
6864
|
-
paddingHorizontal:
|
|
6865
|
-
borderRadius:
|
|
6963
|
+
gap: import_tokens39.tokens.dimension.value6,
|
|
6964
|
+
paddingVertical: import_tokens39.tokens.dimension.value4,
|
|
6965
|
+
paddingHorizontal: import_tokens39.tokens.dimension.value8,
|
|
6966
|
+
borderRadius: import_tokens39.tokens.radius.radius12,
|
|
6866
6967
|
backgroundColor: colors.surface
|
|
6867
6968
|
},
|
|
6868
6969
|
children: [
|
|
@@ -6878,7 +6979,7 @@ function KjunDataState({
|
|
|
6878
6979
|
"aria-hidden": revealed ? void 0 : true,
|
|
6879
6980
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
6880
6981
|
style: { paddingVertical: loadingPadding === "none" ? 0 : padding, opacity: revealed ? void 0 : 0 },
|
|
6881
|
-
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { gap:
|
|
6982
|
+
children: loadingContent || (skeleton ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { gap: import_tokens39.tokens.dimension.value12 }, children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSkeleton, { type: skeletonType }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native42.View, { style: { alignItems: "center", gap: import_tokens39.tokens.dimension.value12 }, children: [
|
|
6882
6983
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunSpinner, { size: "md" }),
|
|
6883
6984
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
6884
6985
|
] }))
|
|
@@ -6897,12 +6998,12 @@ function KjunDataState({
|
|
|
6897
6998
|
right: 0,
|
|
6898
6999
|
opacity: 0,
|
|
6899
7000
|
...import_react_native42.Platform.OS === "web" ? { visibility: "hidden" } : {}
|
|
6900
|
-
} : { opacity: query.loading && !state.usesQueryState ?
|
|
7001
|
+
} : { opacity: query.loading && !state.usesQueryState ? import_tokens39.tokens.states.opacity.pending : 1 },
|
|
6901
7002
|
children: content(children)
|
|
6902
7003
|
},
|
|
6903
7004
|
"content"
|
|
6904
7005
|
),
|
|
6905
|
-
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { marginTop:
|
|
7006
|
+
visibleRefreshError && !state.initialLoading && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DataStateContentContext.Provider, { value: "message", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native42.View, { style: { marginTop: import_tokens39.tokens.dimension.value12 }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunAlert, { type: "warning", size: "sm", actions: onRetry && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KjunButton, { variant: "secondary", onPress: onRetry, children: retryText }), children: m.refreshError(String(visibleRefreshError)) }) }) })
|
|
6906
7007
|
]
|
|
6907
7008
|
}
|
|
6908
7009
|
);
|
|
@@ -6910,7 +7011,7 @@ function KjunDataState({
|
|
|
6910
7011
|
function BoundaryDescription() {
|
|
6911
7012
|
const m = useKjunMessages();
|
|
6912
7013
|
const { colors } = useKjunStyles();
|
|
6913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...
|
|
7014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...import_tokens39.tokens.typography.caption, fontSizePx: import_tokens39.tokens.extensions.state.descriptionSize }), color: colors.textSecondary, textAlign: "center" }, children: m.retryHint });
|
|
6914
7015
|
}
|
|
6915
7016
|
var KjunErrorBoundary = class extends import_react53.Component {
|
|
6916
7017
|
constructor() {
|
|
@@ -6930,13 +7031,13 @@ var KjunErrorBoundary = class extends import_react53.Component {
|
|
|
6930
7031
|
{
|
|
6931
7032
|
style: {
|
|
6932
7033
|
alignItems: "center",
|
|
6933
|
-
paddingVertical:
|
|
6934
|
-
paddingHorizontal:
|
|
6935
|
-
gap:
|
|
7034
|
+
paddingVertical: import_tokens39.tokens.dimension.value64,
|
|
7035
|
+
paddingHorizontal: import_tokens39.tokens.dimension.value24,
|
|
7036
|
+
gap: import_tokens39.tokens.dimension.value16
|
|
6936
7037
|
},
|
|
6937
7038
|
children: [
|
|
6938
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native42.View, { style: { gap:
|
|
6939
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...
|
|
7039
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native42.View, { style: { gap: import_tokens39.tokens.dimension.value8, alignItems: "center" }, children: [
|
|
7040
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(KText, { style: { ...typeStyle({ ...import_tokens39.tokens.typography.sectionTitle, fontSizePx: import_tokens39.tokens.extensions.state.titleSize }), textAlign: "center" }, children: this.props.fallbackMessage || this.context.messages.somethingWentWrong }),
|
|
6940
7041
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BoundaryDescription, {})
|
|
6941
7042
|
] }),
|
|
6942
7043
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
@@ -6959,7 +7060,7 @@ var KjunErrorBoundary = class extends import_react53.Component {
|
|
|
6959
7060
|
KjunErrorBoundary.contextType = KjunMessageContext;
|
|
6960
7061
|
|
|
6961
7062
|
// packages/native/src/skeletons.tsx
|
|
6962
|
-
var
|
|
7063
|
+
var import_tokens43 = require("@kjun-ui/tokens");
|
|
6963
7064
|
var import_react55 = require("react");
|
|
6964
7065
|
var import_react_native44 = require("react-native");
|
|
6965
7066
|
var import_react_native_svg5 = __toESM(require("react-native-svg"), 1);
|
|
@@ -6983,12 +7084,12 @@ function chartSkeletonKind(kind) {
|
|
|
6983
7084
|
}
|
|
6984
7085
|
|
|
6985
7086
|
// packages/native/src/market-skeleton.tsx
|
|
6986
|
-
var
|
|
7087
|
+
var import_tokens42 = require("@kjun-ui/tokens");
|
|
6987
7088
|
var import_react_native43 = require("react-native");
|
|
6988
7089
|
|
|
6989
7090
|
// shared/package-runtime/market-layout.ts
|
|
6990
|
-
var
|
|
6991
|
-
var marketGeometry =
|
|
7091
|
+
var import_tokens40 = require("@kjun-ui/tokens");
|
|
7092
|
+
var marketGeometry = import_tokens40.tokens.extensions.marketTable;
|
|
6992
7093
|
var isMarketIdentity = (key) => ["stock_name", "name", "symbol"].includes(key || "");
|
|
6993
7094
|
var normalizeMarketColumns = (columns) => columns.map((column) => typeof column === "string" ? { key: column, label: column } : column);
|
|
6994
7095
|
var defaultWidth = (column) => isMarketIdentity(column.key) ? marketGeometry.identityWidth : marketGeometry.columnWidth;
|
|
@@ -7006,33 +7107,33 @@ function nativeMarketLayout(columns, showActions, containerWidth) {
|
|
|
7006
7107
|
}
|
|
7007
7108
|
|
|
7008
7109
|
// packages/native/src/market-layout.ts
|
|
7009
|
-
var
|
|
7110
|
+
var import_tokens41 = require("@kjun-ui/tokens");
|
|
7010
7111
|
var import_react54 = require("react");
|
|
7011
7112
|
function useMarketLayout(columns, showActions) {
|
|
7012
7113
|
const [containerWidth, setContainerWidth] = (0, import_react54.useState)(0);
|
|
7013
7114
|
const onLayout = (event) => setContainerWidth(event.nativeEvent.layout.width);
|
|
7014
7115
|
return { ...nativeMarketLayout(columns, showActions, containerWidth), onLayout };
|
|
7015
7116
|
}
|
|
7016
|
-
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth:
|
|
7017
|
-
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth:
|
|
7117
|
+
var marketHeaderStyle = { minHeight: marketGeometry.headerHeight, flexDirection: "row", borderBottomWidth: import_tokens41.tokens.border.defaultWidth };
|
|
7118
|
+
var marketRowStyle = { minHeight: marketGeometry.rowHeight, flexDirection: "row", borderBottomWidth: import_tokens41.tokens.border.defaultWidth };
|
|
7018
7119
|
|
|
7019
7120
|
// packages/native/src/market-skeleton.tsx
|
|
7020
7121
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
7021
7122
|
function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false }) {
|
|
7022
7123
|
const { colors } = useKjunStyles();
|
|
7023
7124
|
const cols = normalizeMarketColumns(columns), layout = useMarketLayout(cols, showActions);
|
|
7024
|
-
const actions = { width: marketGeometry.actionsWidth, paddingVertical:
|
|
7125
|
+
const actions = { width: marketGeometry.actionsWidth, paddingVertical: import_tokens42.tokens.dimension.value12, paddingHorizontal: import_tokens42.tokens.dimension.value4, justifyContent: "center", alignItems: "center" };
|
|
7025
7126
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.ScrollView, { horizontal: true, onLayout: layout.onLayout, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { width: layout.width }, children: [
|
|
7026
7127
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { ...marketHeaderStyle, borderBottomColor: colors.border }, children: [
|
|
7027
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width:
|
|
7028
|
-
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], padding:
|
|
7128
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: import_tokens42.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens42.tokens.extensions.marketTable.headerSkeletonHeight }) }),
|
|
7129
|
+
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], padding: import_tokens42.tokens.dimension.value12, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KText, { style: { ...typeStyle("meta"), color: colors.textTertiary, textAlign: col.align }, children: col.label }) }, col.key || i))
|
|
7029
7130
|
] }),
|
|
7030
7131
|
Array.from({ length: Math.max(0, rows) }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { ...marketRowStyle, borderBottomColor: colors.border }, children: [
|
|
7031
|
-
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width:
|
|
7032
|
-
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], paddingVertical:
|
|
7033
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height:
|
|
7034
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height:
|
|
7035
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width:
|
|
7132
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: actions, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: import_tokens42.tokens.extensions.marketTable.actionSkeletonWidth, height: import_tokens42.tokens.extensions.financial.priceSkeletonHeight }) }),
|
|
7133
|
+
cols.map((col, i) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { width: layout.widths[i], paddingVertical: import_tokens42.tokens.dimension.value14, paddingHorizontal: import_tokens42.tokens.dimension.value12, justifyContent: "center", alignItems: isMarketIdentity(col.key) ? void 0 : col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start" }, children: isMarketIdentity(col.key) ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react_native43.View, { style: { gap: import_tokens42.tokens.dimension.value2 }, children: [
|
|
7134
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height: import_tokens42.tokens.typography.body.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: "80%", height: import_tokens42.tokens.extensions.skeleton.lineHeights.md }) }),
|
|
7135
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native43.View, { style: { height: import_tokens42.tokens.typography.caption.lineHeightPx, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: "60%", height: import_tokens42.tokens.extensions.skeleton.lineHeights.sm }) })
|
|
7136
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(KjunSkeleton, { type: "block", width: import_tokens42.tokens.extensions.financial.priceSkeletonWidth, height: import_tokens42.tokens.extensions.financial.priceSkeletonHeight }) }, col.key || i))
|
|
7036
7137
|
] }, row))
|
|
7037
7138
|
] }) });
|
|
7038
7139
|
}
|
|
@@ -7043,11 +7144,11 @@ function KjunListSkeleton({
|
|
|
7043
7144
|
rows = 8,
|
|
7044
7145
|
variant = "market",
|
|
7045
7146
|
avatar = true,
|
|
7046
|
-
avatarSize =
|
|
7147
|
+
avatarSize = import_tokens43.tokens.extensions.skeleton.listAvatarSize,
|
|
7047
7148
|
quote = true
|
|
7048
7149
|
}) {
|
|
7049
7150
|
const { colors } = useKjunStyles();
|
|
7050
|
-
const market = variant === "market", narrow = (0, import_react_native44.useWindowDimensions)().width <
|
|
7151
|
+
const market = variant === "market", narrow = (0, import_react_native44.useWindowDimensions)().width < import_tokens43.tokens.responsive.market;
|
|
7051
7152
|
const slots = market ? [typeStyle(narrow ? "input" : "label").lineHeight, typeStyle(narrow ? "body" : "caption").lineHeight] : null;
|
|
7052
7153
|
const slot = (index, child) => slots ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { height: slots[index], justifyContent: "center" }, children: child }) : child;
|
|
7053
7154
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
@@ -7061,29 +7162,29 @@ function KjunListSkeleton({
|
|
|
7061
7162
|
style: {
|
|
7062
7163
|
flexDirection: "row",
|
|
7063
7164
|
alignItems: "center",
|
|
7064
|
-
gap:
|
|
7065
|
-
minHeight: market ? narrow ?
|
|
7066
|
-
paddingVertical: market ? narrow ?
|
|
7067
|
-
paddingHorizontal: market ? narrow ?
|
|
7068
|
-
borderBottomWidth:
|
|
7165
|
+
gap: import_tokens43.tokens.extensions.skeleton.gap,
|
|
7166
|
+
minHeight: market ? narrow ? import_tokens43.tokens.extensions.marketList.minimumHeight : void 0 : import_tokens43.tokens.extensions.skeleton.listHeights[variant],
|
|
7167
|
+
paddingVertical: market ? narrow ? import_tokens43.tokens.dimension.value14 : import_tokens43.tokens.dimension.value16 : import_tokens43.tokens.extensions.skeleton.list[variant].paddingY,
|
|
7168
|
+
paddingHorizontal: market ? narrow ? import_tokens43.tokens.dimension.value20 : import_tokens43.tokens.dimension.value16 : import_tokens43.tokens.extensions.skeleton.list[variant].paddingX,
|
|
7169
|
+
borderBottomWidth: import_tokens43.tokens.border.defaultWidth,
|
|
7069
7170
|
borderBottomColor: colors.border
|
|
7070
7171
|
},
|
|
7071
7172
|
children: [
|
|
7072
7173
|
avatar && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "avatar", width: avatarSize, height: avatarSize }),
|
|
7073
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { flex: 1, minWidth: 0, gap: market ?
|
|
7174
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { flex: 1, minWidth: 0, gap: market ? import_tokens43.tokens.dimension.value2 : import_tokens43.tokens.extensions.skeleton.detailGap }, children: [
|
|
7074
7175
|
slot(0, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7075
7176
|
KjunSkeleton,
|
|
7076
7177
|
{
|
|
7077
7178
|
type: "block",
|
|
7078
|
-
height:
|
|
7179
|
+
height: import_tokens43.tokens.extensions.skeleton.lineHeights.md,
|
|
7079
7180
|
width: i % 2 ? "80%" : "65%"
|
|
7080
7181
|
}
|
|
7081
7182
|
)),
|
|
7082
|
-
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7183
|
+
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens43.tokens.extensions.skeleton.lineHeights.sm, width: "50%" }))
|
|
7083
7184
|
] }),
|
|
7084
|
-
quote && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { alignItems: "flex-end", gap: market ?
|
|
7085
|
-
slot(0, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7086
|
-
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7185
|
+
quote && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { style: { alignItems: "flex-end", gap: market ? import_tokens43.tokens.dimension.value2 : import_tokens43.tokens.extensions.skeleton.detailGap }, children: [
|
|
7186
|
+
slot(0, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens43.tokens.extensions.skeleton.quoteHeight, width: import_tokens43.tokens.extensions.skeleton.quoteWidth })),
|
|
7187
|
+
slot(1, /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens43.tokens.extensions.skeleton.lineHeights.sm, width: import_tokens43.tokens.extensions.skeleton.detailWidth }))
|
|
7087
7188
|
] })
|
|
7088
7189
|
]
|
|
7089
7190
|
},
|
|
@@ -7100,7 +7201,7 @@ function KjunFormSkeleton({
|
|
|
7100
7201
|
}) {
|
|
7101
7202
|
const { colors } = useKjunStyles();
|
|
7102
7203
|
const window2 = (0, import_react_native44.useWindowDimensions)();
|
|
7103
|
-
const twoColumns = columns === 2 && window2.width >=
|
|
7204
|
+
const twoColumns = columns === 2 && window2.width >= import_tokens43.tokens.responsive.formColumns;
|
|
7104
7205
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7105
7206
|
import_react_native44.View,
|
|
7106
7207
|
{
|
|
@@ -7109,13 +7210,13 @@ function KjunFormSkeleton({
|
|
|
7109
7210
|
style: {
|
|
7110
7211
|
flexDirection: twoColumns ? "row" : "column",
|
|
7111
7212
|
flexWrap: twoColumns ? "wrap" : "nowrap",
|
|
7112
|
-
gap:
|
|
7213
|
+
gap: import_tokens43.tokens.extensions.skeleton.formGap
|
|
7113
7214
|
},
|
|
7114
7215
|
children: fields.map((field, i) => /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
7115
7216
|
import_react_native44.View,
|
|
7116
7217
|
{
|
|
7117
7218
|
style: {
|
|
7118
|
-
gap:
|
|
7219
|
+
gap: import_tokens43.tokens.extensions.skeleton.fieldGap,
|
|
7119
7220
|
minWidth: 0,
|
|
7120
7221
|
flexBasis: twoColumns ? "45%" : void 0,
|
|
7121
7222
|
flexGrow: 1
|
|
@@ -7123,13 +7224,13 @@ function KjunFormSkeleton({
|
|
|
7123
7224
|
children: [
|
|
7124
7225
|
field ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KText, { style: { color: colors.text, ...typeStyle("label") }, children: typeof field === "string" ? field : field.label }) : (
|
|
7125
7226
|
// The bar sits in a label-line slot so the field starts where the real input will.
|
|
7126
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height:
|
|
7227
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { height: typeStyle("label").lineHeight, justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSkeleton, { type: "block", height: import_tokens43.tokens.extensions.skeleton.formLabelHeight, width: import_tokens43.tokens.extensions.skeleton.formLabelWidth }) })
|
|
7127
7228
|
),
|
|
7128
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { borderRadius:
|
|
7229
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { borderRadius: import_tokens43.tokens.input[size].radius, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7129
7230
|
KjunSkeleton,
|
|
7130
7231
|
{
|
|
7131
7232
|
type: "block",
|
|
7132
|
-
height: typeof field === "object" && field.height != null ? field.height : multiline ?
|
|
7233
|
+
height: typeof field === "object" && field.height != null ? field.height : multiline ? import_tokens43.tokens.input[size].lineHeight * 3 + import_tokens43.tokens.input[size].textareaPaddingY * 2 + 2 * import_tokens43.tokens.border.controlWidth : import_tokens43.tokens.input[size].height
|
|
7133
7234
|
}
|
|
7134
7235
|
) })
|
|
7135
7236
|
]
|
|
@@ -7142,7 +7243,7 @@ function KjunFormSkeleton({
|
|
|
7142
7243
|
var chartPart = (name) => import_react_native44.Platform.OS === "web" ? { dataSet: { kjunChartPart: name } } : {};
|
|
7143
7244
|
function KjunChartSkeleton({
|
|
7144
7245
|
kind: requestedKind = "frame",
|
|
7145
|
-
height =
|
|
7246
|
+
height = import_tokens43.tokens.extensions.chartSkeleton.height,
|
|
7146
7247
|
loadingText,
|
|
7147
7248
|
skeleton = true,
|
|
7148
7249
|
loadingDelay = 0,
|
|
@@ -7151,13 +7252,13 @@ function KjunChartSkeleton({
|
|
|
7151
7252
|
}) {
|
|
7152
7253
|
const m = useKjunMessages();
|
|
7153
7254
|
loadingText != null ? loadingText : loadingText = m.chartLoading;
|
|
7154
|
-
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = (0, import_react55.useRef)(new import_react_native44.Animated.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = (0, import_react55.useState)(0), thickness =
|
|
7255
|
+
const kind = chartSkeletonKind(requestedKind), { colors } = useKjunStyles(), reduced = useReducedMotion(), opacity = (0, import_react55.useRef)(new import_react_native44.Animated.Value(1)).current, revealed = useLoadingReveal(true, loadingDelay), [measured, setMeasured] = (0, import_react55.useState)(0), thickness = import_tokens43.tokens.extensions.chartSkeleton.donutThickness, boxHeight = typeof height === "number" ? height : measured, hole = boxHeight > 0 ? chartDonutHole(boxHeight, thickness) : void 0, rowCount = chartSkeletonCount(rows), columnCount = chartSkeletonCount(columns), status = revealed && loadingText ? "status" : void 0, hidden = { "aria-hidden": true, importantForAccessibility: "no-hide-descendants" };
|
|
7155
7256
|
(0, import_react55.useEffect)(() => {
|
|
7156
7257
|
if (reduced || !skeleton) return;
|
|
7157
7258
|
const loop = import_react_native44.Animated.loop(
|
|
7158
7259
|
import_react_native44.Animated.sequence([
|
|
7159
|
-
import_react_native44.Animated.timing(opacity, { toValue: 0.55, duration:
|
|
7160
|
-
import_react_native44.Animated.timing(opacity, { toValue: 1, duration:
|
|
7260
|
+
import_react_native44.Animated.timing(opacity, { toValue: 0.55, duration: import_tokens43.tokens.motion.shimmer / 2, useNativeDriver: true }),
|
|
7261
|
+
import_react_native44.Animated.timing(opacity, { toValue: 1, duration: import_tokens43.tokens.motion.shimmer / 2, useNativeDriver: true })
|
|
7161
7262
|
])
|
|
7162
7263
|
);
|
|
7163
7264
|
loop.start();
|
|
@@ -7174,7 +7275,7 @@ function KjunChartSkeleton({
|
|
|
7174
7275
|
"aria-hidden": revealed ? void 0 : true,
|
|
7175
7276
|
importantForAccessibility: revealed ? void 0 : "no-hide-descendants",
|
|
7176
7277
|
...import_react_native44.Platform.OS === "web" ? { dataSet: { kjunChartKind: kind, skeleton: skeleton ? void 0 : "false" } } : {},
|
|
7177
|
-
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap:
|
|
7278
|
+
children: !skeleton ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native44.View, { ...chartPart("loading"), role: status, style: { alignItems: "center", gap: import_tokens43.tokens.dimension.value12 }, children: [
|
|
7178
7279
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...hidden, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KjunSpinner, { size: "md" }) }),
|
|
7179
7280
|
!!loadingText && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(KText, { style: { ...typeStyle("body"), color: colors.textSecondary, textAlign: "center", maxWidth: "100%" }, children: loadingText })
|
|
7180
7281
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
@@ -7183,21 +7284,21 @@ function KjunChartSkeleton({
|
|
|
7183
7284
|
{
|
|
7184
7285
|
...chartPart("donut"),
|
|
7185
7286
|
...hidden,
|
|
7186
|
-
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius:
|
|
7287
|
+
style: { height: `${chartDonutRatio * 100}%`, aspectRatio: 1, borderWidth: thickness, borderColor: colors.skeleton, borderRadius: import_tokens43.tokens.radius.radius9999 }
|
|
7187
7288
|
}
|
|
7188
|
-
) : kind === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap:
|
|
7289
|
+
) : kind === "matrix" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("matrix"), ...hidden, style: { alignSelf: "stretch", flex: 1, gap: import_tokens43.tokens.dimension.value4 }, children: Array.from({ length: rowCount }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { style: { flex: 1, flexDirection: "row", gap: import_tokens43.tokens.dimension.value4 }, children: Array.from({ length: columnCount }, (_2, column) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7189
7290
|
import_react_native44.View,
|
|
7190
7291
|
{
|
|
7191
7292
|
...chartPart("cell"),
|
|
7192
7293
|
style: {
|
|
7193
7294
|
flex: 1,
|
|
7194
|
-
borderRadius:
|
|
7295
|
+
borderRadius: import_tokens43.tokens.extensions.skeleton.lineRadius,
|
|
7195
7296
|
backgroundColor: colors.skeleton,
|
|
7196
|
-
opacity: chartMatrixMuted(row, column) ?
|
|
7297
|
+
opacity: chartMatrixMuted(row, column) ? import_tokens43.tokens.states.opacity.pending : 1
|
|
7197
7298
|
}
|
|
7198
7299
|
},
|
|
7199
7300
|
column
|
|
7200
|
-
)) }, row)) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("plot"), ...hidden, style: { alignSelf: "stretch", flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.default, { viewBox: chartFrameViewBox, preserveAspectRatio: "none", width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.Path, { d: chartFramePath, fill: "none", stroke: colors.chartGrid, strokeWidth:
|
|
7301
|
+
)) }, row)) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native44.View, { ...chartPart("plot"), ...hidden, style: { alignSelf: "stretch", flex: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.default, { viewBox: chartFrameViewBox, preserveAspectRatio: "none", width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native_svg5.Path, { d: chartFramePath, fill: "none", stroke: colors.chartGrid, strokeWidth: import_tokens43.tokens.border.defaultWidth, vectorEffect: "non-scaling-stroke" }) }) }),
|
|
7201
7302
|
!!loadingText && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
7202
7303
|
import_react_native44.View,
|
|
7203
7304
|
{
|
|
@@ -7211,10 +7312,10 @@ function KjunChartSkeleton({
|
|
|
7211
7312
|
{
|
|
7212
7313
|
style: {
|
|
7213
7314
|
...typeStyle("body"),
|
|
7214
|
-
paddingHorizontal:
|
|
7215
|
-
paddingVertical:
|
|
7216
|
-
borderRadius:
|
|
7217
|
-
borderWidth: kind === "donut" ? 0 :
|
|
7315
|
+
paddingHorizontal: import_tokens43.tokens.dimension.value12,
|
|
7316
|
+
paddingVertical: import_tokens43.tokens.dimension.value4,
|
|
7317
|
+
borderRadius: import_tokens43.tokens.radius.radius6,
|
|
7318
|
+
borderWidth: kind === "donut" ? 0 : import_tokens43.tokens.border.defaultWidth,
|
|
7218
7319
|
borderColor: colors.chartGrid,
|
|
7219
7320
|
backgroundColor: colors.surface,
|
|
7220
7321
|
color: colors.textSecondary,
|
|
@@ -7232,19 +7333,19 @@ function KjunChartSkeleton({
|
|
|
7232
7333
|
}
|
|
7233
7334
|
|
|
7234
7335
|
// packages/native/src/financial-display.tsx
|
|
7235
|
-
var
|
|
7336
|
+
var import_tokens46 = require("@kjun-ui/tokens");
|
|
7236
7337
|
var import_react58 = require("react");
|
|
7237
7338
|
var import_react_native46 = require("react-native");
|
|
7238
7339
|
var import_react_native_svg6 = __toESM(require("react-native-svg"), 1);
|
|
7239
7340
|
|
|
7240
7341
|
// packages/native/src/number-display.tsx
|
|
7241
|
-
var
|
|
7342
|
+
var import_tokens45 = require("@kjun-ui/tokens");
|
|
7242
7343
|
|
|
7243
7344
|
// shared/package-runtime/use-number-motion.ts
|
|
7244
7345
|
var import_react56 = require("react");
|
|
7245
7346
|
|
|
7246
7347
|
// shared/package-runtime/number-motion.ts
|
|
7247
|
-
var
|
|
7348
|
+
var import_tokens44 = require("@kjun-ui/tokens");
|
|
7248
7349
|
function createNumberMotion(apply) {
|
|
7249
7350
|
let frame = 0, revision = 0, current = 0;
|
|
7250
7351
|
let previous;
|
|
@@ -7275,7 +7376,7 @@ function createNumberMotion(apply) {
|
|
|
7275
7376
|
if (from === target) return;
|
|
7276
7377
|
const tick = (now) => {
|
|
7277
7378
|
if (version !== revision) return;
|
|
7278
|
-
const progress = Math.min(1, Math.max(0, (now - started) /
|
|
7379
|
+
const progress = Math.min(1, Math.max(0, (now - started) / import_tokens44.tokens.motion.number));
|
|
7279
7380
|
show(progress === 1 ? target : from + (target - from) * (1 - Math.pow(1 - progress, 3)));
|
|
7280
7381
|
if (progress < 1) frame = requestAnimationFrame(tick);
|
|
7281
7382
|
};
|
|
@@ -7362,7 +7463,7 @@ function KjunFreshness({
|
|
|
7362
7463
|
KjunTooltip,
|
|
7363
7464
|
{
|
|
7364
7465
|
content: (source === "close" ? scope.messages.noRealtimeQuote : scope.messages.realtimeDelayed) + (fetchedAt ? " \xB7 " + ((formatter == null ? void 0 : formatter(fetchedAt)) || formatRelativeTime(fetchedAt, void 0, scope)) : ""),
|
|
7365
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AccessiblePressable, { accessibilityLabel: label, focusRingRadius:
|
|
7466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AccessiblePressable, { accessibilityLabel: label, focusRingRadius: import_tokens45.tokens.extensions.badge.radius, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunBadge, { variant: "warning", size: "xs", children: label }) })
|
|
7366
7467
|
}
|
|
7367
7468
|
) : null;
|
|
7368
7469
|
}
|
|
@@ -7376,11 +7477,11 @@ function KjunPriceCell({
|
|
|
7376
7477
|
fromPrevious = true
|
|
7377
7478
|
}) {
|
|
7378
7479
|
const { colors } = useKjunStyles(), quoteType = (0, import_react57.useContext)(MarketQuoteTypeContext);
|
|
7379
|
-
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height:
|
|
7480
|
+
return value == null ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", height: import_tokens45.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens45.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react_native45.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens45.tokens.extensions.financial.affixGap }, children: [
|
|
7380
7481
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7381
7482
|
import_react_native45.View,
|
|
7382
7483
|
{
|
|
7383
|
-
style: quoteType ? void 0 : { paddingVertical:
|
|
7484
|
+
style: quoteType ? void 0 : { paddingVertical: import_tokens45.tokens.extensions.financial.pillPaddingY, paddingHorizontal: import_tokens45.tokens.extensions.financial.pillPaddingX, borderRadius: import_tokens45.tokens.radius.radius9999 },
|
|
7384
7485
|
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7385
7486
|
KjunAnimatedNumber,
|
|
7386
7487
|
{
|
|
@@ -7419,14 +7520,14 @@ function KjunSignedValue({
|
|
|
7419
7520
|
flexDirection: "row",
|
|
7420
7521
|
alignItems: "center",
|
|
7421
7522
|
alignSelf: "flex-start",
|
|
7422
|
-
gap:
|
|
7423
|
-
paddingVertical: tone === "pill" ?
|
|
7424
|
-
paddingHorizontal: tone === "pill" ?
|
|
7425
|
-
borderRadius:
|
|
7523
|
+
gap: import_tokens45.tokens.extensions.financial.affixGap,
|
|
7524
|
+
paddingVertical: tone === "pill" ? import_tokens45.tokens.extensions.financial.pillPaddingY : 0,
|
|
7525
|
+
paddingHorizontal: tone === "pill" ? import_tokens45.tokens.extensions.financial.pillPaddingX : 0,
|
|
7526
|
+
borderRadius: import_tokens45.tokens.extensions.financial.pillRadius,
|
|
7426
7527
|
backgroundColor: tone === "pill" && !stale && !loading && n !== null ? domainColor(domainColors, role + "Bg") : void 0
|
|
7427
7528
|
},
|
|
7428
7529
|
children: [
|
|
7429
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", width:
|
|
7530
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(KjunSkeleton, { type: "block", width: import_tokens45.tokens.extensions.financial.signedSkeletonWidth, height: import_tokens45.tokens.extensions.financial.signedSkeletonHeight }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
7430
7531
|
KText,
|
|
7431
7532
|
{
|
|
7432
7533
|
style: {
|
|
@@ -7448,7 +7549,7 @@ function KjunSignedValue({
|
|
|
7448
7549
|
|
|
7449
7550
|
// packages/native/src/financial-display.tsx
|
|
7450
7551
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
7451
|
-
var deviationFill = { neutral: 1, low:
|
|
7552
|
+
var deviationFill = { neutral: 1, low: import_tokens46.tokens.states.opacity.deviationLow, medium: import_tokens46.tokens.states.opacity.deviationMedium, strong: import_tokens46.tokens.states.opacity.deviationStrong };
|
|
7452
7553
|
function KjunDeviation({
|
|
7453
7554
|
value,
|
|
7454
7555
|
variant = "pill",
|
|
@@ -7460,7 +7561,7 @@ function KjunDeviation({
|
|
|
7460
7561
|
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), n = finiteNumber(value);
|
|
7461
7562
|
if (n === null)
|
|
7462
7563
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KText, { style: { color: colors.textDisabled }, children: "-" });
|
|
7463
|
-
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0,
|
|
7564
|
+
const abs = Math.abs(n), signal = abs >= signalThreshold, level = (0, import_tokens46.deviationLevel)(n), neutral = level === "neutral", color = neutral ? colors.textSecondary : domainColor(domainColors, n > 0 ? "priceUp" : "priceDown"), label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
|
|
7464
7565
|
if (variant === "badge")
|
|
7465
7566
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
7466
7567
|
import_react_native46.View,
|
|
@@ -7469,7 +7570,7 @@ function KjunDeviation({
|
|
|
7469
7570
|
flexDirection: "row",
|
|
7470
7571
|
alignItems: "center",
|
|
7471
7572
|
justifyContent: "flex-end",
|
|
7472
|
-
gap:
|
|
7573
|
+
gap: import_tokens46.tokens.extensions.financial.badgeGap
|
|
7473
7574
|
},
|
|
7474
7575
|
children: [
|
|
7475
7576
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7488,22 +7589,22 @@ function KjunDeviation({
|
|
|
7488
7589
|
}, children: label })
|
|
7489
7590
|
}
|
|
7490
7591
|
),
|
|
7491
|
-
!signal && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { width:
|
|
7592
|
+
!signal && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { width: import_tokens46.tokens.extensions.financial.warningIconSize, flexShrink: 0 } }),
|
|
7492
7593
|
signal && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { alignSelf: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunTooltip, { content: m.deviationWarning(signalThreshold), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7493
7594
|
AccessiblePressable,
|
|
7494
7595
|
{
|
|
7495
7596
|
accessibilityRole: "image",
|
|
7496
7597
|
accessibilityLabel: m.arbitrage,
|
|
7497
7598
|
focusRingInset: true,
|
|
7498
|
-
focusRingRadius:
|
|
7599
|
+
focusRingRadius: import_tokens46.tokens.radius.radius4,
|
|
7499
7600
|
style: {
|
|
7500
|
-
width:
|
|
7501
|
-
height:
|
|
7502
|
-
margin: (
|
|
7601
|
+
width: import_tokens46.tokens.extensions.financial.warningTargetSize,
|
|
7602
|
+
height: import_tokens46.tokens.extensions.financial.warningTargetSize,
|
|
7603
|
+
margin: (import_tokens46.tokens.extensions.financial.warningIconSize - import_tokens46.tokens.extensions.financial.warningTargetSize) / 2,
|
|
7503
7604
|
alignItems: "center",
|
|
7504
7605
|
justifyContent: "center"
|
|
7505
7606
|
},
|
|
7506
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "alert-triangle", size:
|
|
7607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(KjunIcon, { name: "alert-triangle", size: import_tokens46.tokens.extensions.financial.warningIconSize, color: colors.warning })
|
|
7507
7608
|
}
|
|
7508
7609
|
) }) }) })
|
|
7509
7610
|
]
|
|
@@ -7515,9 +7616,9 @@ function KjunDeviation({
|
|
|
7515
7616
|
style: {
|
|
7516
7617
|
alignSelf: "flex-start",
|
|
7517
7618
|
position: "relative",
|
|
7518
|
-
borderRadius:
|
|
7519
|
-
paddingVertical: variant === "pill" ?
|
|
7520
|
-
paddingHorizontal: variant === "pill" ?
|
|
7619
|
+
borderRadius: import_tokens46.tokens.extensions.financial.cellRadius,
|
|
7620
|
+
paddingVertical: variant === "pill" ? import_tokens46.tokens.extensions.financial.pillPaddingY : 0,
|
|
7621
|
+
paddingHorizontal: variant === "pill" ? import_tokens46.tokens.extensions.financial.pillPaddingX : 0
|
|
7521
7622
|
},
|
|
7522
7623
|
children: [
|
|
7523
7624
|
variant === "pill" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7527,7 +7628,7 @@ function KjunDeviation({
|
|
|
7527
7628
|
style: {
|
|
7528
7629
|
position: "absolute",
|
|
7529
7630
|
inset: 0,
|
|
7530
|
-
borderRadius:
|
|
7631
|
+
borderRadius: import_tokens46.tokens.extensions.financial.cellRadius,
|
|
7531
7632
|
backgroundColor: neutral ? colors.secondary : color,
|
|
7532
7633
|
opacity: deviationFill[level]
|
|
7533
7634
|
}
|
|
@@ -7568,9 +7669,9 @@ function KjunHeatmapCell({
|
|
|
7568
7669
|
style: {
|
|
7569
7670
|
position: "relative",
|
|
7570
7671
|
alignSelf: "flex-start",
|
|
7571
|
-
paddingVertical:
|
|
7572
|
-
paddingHorizontal:
|
|
7573
|
-
borderRadius:
|
|
7672
|
+
paddingVertical: import_tokens46.tokens.extensions.financial.pillPaddingY,
|
|
7673
|
+
paddingHorizontal: import_tokens46.tokens.extensions.financial.pillPaddingX,
|
|
7674
|
+
borderRadius: import_tokens46.tokens.extensions.financial.cellRadius
|
|
7574
7675
|
},
|
|
7575
7676
|
children: [
|
|
7576
7677
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7580,10 +7681,10 @@ function KjunHeatmapCell({
|
|
|
7580
7681
|
style: {
|
|
7581
7682
|
position: "absolute",
|
|
7582
7683
|
inset: 0,
|
|
7583
|
-
borderRadius:
|
|
7684
|
+
borderRadius: import_tokens46.tokens.extensions.financial.cellRadius,
|
|
7584
7685
|
// A zero cell keeps its shape on the neutral fill; any other value starts from a visible minimum.
|
|
7585
7686
|
backgroundColor: magnitude ? background : colors.secondary,
|
|
7586
|
-
opacity: magnitude ?
|
|
7687
|
+
opacity: magnitude ? import_tokens46.tokens.states.opacity.heatMinimum + (import_tokens46.tokens.states.opacity.heatMaximum - import_tokens46.tokens.states.opacity.heatMinimum) * magnitude : 1
|
|
7587
7688
|
}
|
|
7588
7689
|
}
|
|
7589
7690
|
),
|
|
@@ -7601,7 +7702,7 @@ function KjunProgressCell({
|
|
|
7601
7702
|
showLabel = true,
|
|
7602
7703
|
color = "auto",
|
|
7603
7704
|
customColor,
|
|
7604
|
-
height =
|
|
7705
|
+
height = import_tokens46.tokens.extensions.financial.progressHeight
|
|
7605
7706
|
}) {
|
|
7606
7707
|
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;
|
|
7607
7708
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
@@ -7610,8 +7711,8 @@ function KjunProgressCell({
|
|
|
7610
7711
|
style: {
|
|
7611
7712
|
flexDirection: "row",
|
|
7612
7713
|
alignItems: "center",
|
|
7613
|
-
gap:
|
|
7614
|
-
minWidth:
|
|
7714
|
+
gap: import_tokens46.tokens.extensions.financial.progressGap,
|
|
7715
|
+
minWidth: import_tokens46.tokens.extensions.financial.progressMinimumWidth
|
|
7615
7716
|
},
|
|
7616
7717
|
children: [
|
|
7617
7718
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7621,7 +7722,7 @@ function KjunProgressCell({
|
|
|
7621
7722
|
height,
|
|
7622
7723
|
flex: 1,
|
|
7623
7724
|
backgroundColor: colors.tertiary,
|
|
7624
|
-
borderRadius:
|
|
7725
|
+
borderRadius: import_tokens46.tokens.extensions.financial.progressRadius,
|
|
7625
7726
|
overflow: "hidden"
|
|
7626
7727
|
},
|
|
7627
7728
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7630,7 +7731,7 @@ function KjunProgressCell({
|
|
|
7630
7731
|
style: {
|
|
7631
7732
|
width: `${percent}%`,
|
|
7632
7733
|
height: "100%",
|
|
7633
|
-
borderRadius:
|
|
7734
|
+
borderRadius: import_tokens46.tokens.extensions.financial.progressRadius,
|
|
7634
7735
|
backgroundColor: color === "custom" ? customColor : colors[role]
|
|
7635
7736
|
}
|
|
7636
7737
|
}
|
|
@@ -7643,7 +7744,7 @@ function KjunProgressCell({
|
|
|
7643
7744
|
style: {
|
|
7644
7745
|
...typeStyle("caption"),
|
|
7645
7746
|
color: colors.textSecondary,
|
|
7646
|
-
minWidth:
|
|
7747
|
+
minWidth: import_tokens46.tokens.extensions.financial.progressLabelWidth,
|
|
7647
7748
|
textAlign: "right",
|
|
7648
7749
|
fontFamily: numericFontFamily || fontFamily,
|
|
7649
7750
|
fontVariant: ["tabular-nums"]
|
|
@@ -7664,7 +7765,7 @@ function KjunCollectionMark({
|
|
|
7664
7765
|
size = "md"
|
|
7665
7766
|
}) {
|
|
7666
7767
|
const { colors, domainColors } = useKjunStyles();
|
|
7667
|
-
const box =
|
|
7768
|
+
const box = import_tokens46.tokens.extensions.financial.markSizes[size], glyph = kind === "interest" ? import_tokens46.tokens.extensions.financial.heartMarkSizes[size] : box;
|
|
7668
7769
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native46.View, { style: { width: box, height: box, alignItems: "center", justifyContent: "center", overflow: "visible" }, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
7669
7770
|
KjunIcon,
|
|
7670
7771
|
{
|
|
@@ -7696,8 +7797,8 @@ function KjunExecutionStatusBadge({
|
|
|
7696
7797
|
}
|
|
7697
7798
|
function KjunSparkline({
|
|
7698
7799
|
data = [],
|
|
7699
|
-
width =
|
|
7700
|
-
height =
|
|
7800
|
+
width = import_tokens46.tokens.extensions.financial.sparklineWidth,
|
|
7801
|
+
height = import_tokens46.tokens.extensions.financial.sparklineHeight,
|
|
7701
7802
|
color,
|
|
7702
7803
|
semantic = "price",
|
|
7703
7804
|
fill = true,
|
|
@@ -7750,7 +7851,7 @@ function KjunSparkline({
|
|
|
7750
7851
|
}
|
|
7751
7852
|
|
|
7752
7853
|
// shared/package-runtime/table.ts
|
|
7753
|
-
var
|
|
7854
|
+
var import_tokens47 = require("@kjun-ui/tokens");
|
|
7754
7855
|
var import_react59 = require("react");
|
|
7755
7856
|
|
|
7756
7857
|
// shared/package-runtime/table-model.ts
|
|
@@ -7824,7 +7925,7 @@ function useTableModel(props) {
|
|
|
7824
7925
|
sortColumn: (col) => {
|
|
7825
7926
|
var _a2;
|
|
7826
7927
|
if (!sortable || !col.sortable) return;
|
|
7827
|
-
const next = (0,
|
|
7928
|
+
const next = (0, import_tokens47.nextTableSort)(sort, col.key);
|
|
7828
7929
|
if (props.sort === void 0) setSort(next);
|
|
7829
7930
|
(_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
|
|
7830
7931
|
},
|
|
@@ -7888,7 +7989,7 @@ function tableCellValue(props, column, row, index) {
|
|
|
7888
7989
|
}
|
|
7889
7990
|
|
|
7890
7991
|
// packages/native/src/table-toolbar.tsx
|
|
7891
|
-
var
|
|
7992
|
+
var import_tokens48 = require("@kjun-ui/tokens");
|
|
7892
7993
|
var import_react_native47 = require("react-native");
|
|
7893
7994
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
7894
7995
|
function TableToolbar({
|
|
@@ -7908,12 +8009,12 @@ function TableToolbar({
|
|
|
7908
8009
|
const toolbarStyle = {
|
|
7909
8010
|
flexDirection: "row",
|
|
7910
8011
|
alignItems: "center",
|
|
7911
|
-
gap:
|
|
8012
|
+
gap: import_tokens48.tokens.dimension.value8,
|
|
7912
8013
|
flexWrap: "wrap",
|
|
7913
|
-
paddingVertical:
|
|
7914
|
-
paddingHorizontal:
|
|
8014
|
+
paddingVertical: import_tokens48.tokens.dimension.value8,
|
|
8015
|
+
paddingHorizontal: import_tokens48.tokens.dimension.value12,
|
|
7915
8016
|
backgroundColor: colors.secondary,
|
|
7916
|
-
borderBottomWidth:
|
|
8017
|
+
borderBottomWidth: import_tokens48.tokens.border.defaultWidth,
|
|
7917
8018
|
borderBottomColor: colors.border
|
|
7918
8019
|
};
|
|
7919
8020
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
@@ -7941,7 +8042,7 @@ function TableToolbar({
|
|
|
7941
8042
|
),
|
|
7942
8043
|
(searchable || toolbar) && // Like Web: the search toolbar sits on the surface so the filled search field stands out from it.
|
|
7943
8044
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react_native47.View, { style: { ...toolbarStyle, backgroundColor: colors.surface }, children: [
|
|
7944
|
-
searchable && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native47.View, { style: { width:
|
|
8045
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native47.View, { style: { width: import_tokens48.tokens.table.searchWidth, maxWidth: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7945
8046
|
KjunInput,
|
|
7946
8047
|
{
|
|
7947
8048
|
size: "sm",
|
|
@@ -7959,7 +8060,7 @@ function TableToolbar({
|
|
|
7959
8060
|
}
|
|
7960
8061
|
|
|
7961
8062
|
// packages/native/src/table-grid.tsx
|
|
7962
|
-
var
|
|
8063
|
+
var import_tokens49 = require("@kjun-ui/tokens");
|
|
7963
8064
|
var import_react60 = require("react");
|
|
7964
8065
|
var import_react_native_svg7 = __toESM(require("react-native-svg"), 1);
|
|
7965
8066
|
var import_react_native48 = require("react-native");
|
|
@@ -7967,7 +8068,7 @@ var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
|
7967
8068
|
function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable }) {
|
|
7968
8069
|
const m = useKjunMessages();
|
|
7969
8070
|
const { colors } = useKjunStyles();
|
|
7970
|
-
const geometry2 =
|
|
8071
|
+
const geometry2 = import_tokens49.tokens.table;
|
|
7971
8072
|
const [scroll, setScroll] = (0, import_react60.useState)({ viewport: 0, x: 0 }), fadeId = "kjun-table-fade-" + (0, import_react60.useId)().replace(/[^a-z0-9]/gi, "");
|
|
7972
8073
|
const cellPadding = geometry2.cellPadding[compact ? "compact" : "regular"];
|
|
7973
8074
|
const width = (col) => typeof col.width === "number" ? col.width : typeof col.width === "string" && /^\d+(px)?$/.test(col.width) ? parseFloat(col.width) : geometry2.columnWidth;
|
|
@@ -8000,7 +8101,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8000
8101
|
style: {
|
|
8001
8102
|
flexDirection: "row",
|
|
8002
8103
|
backgroundColor: colors.tableHeaderBg,
|
|
8003
|
-
borderBottomWidth:
|
|
8104
|
+
borderBottomWidth: import_tokens49.tokens.border.defaultWidth,
|
|
8004
8105
|
borderBottomColor: colors.border
|
|
8005
8106
|
},
|
|
8006
8107
|
children: [
|
|
@@ -8024,13 +8125,13 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8024
8125
|
onPress: () => state.sortColumn(col),
|
|
8025
8126
|
style: {
|
|
8026
8127
|
width: width(col),
|
|
8027
|
-
minHeight:
|
|
8128
|
+
minHeight: import_tokens49.tokens.native.minimumTouchTarget,
|
|
8028
8129
|
paddingVertical: geometry2.headerPadding.y,
|
|
8029
8130
|
paddingHorizontal: geometry2.headerPadding.x,
|
|
8030
8131
|
flexDirection: "row",
|
|
8031
8132
|
alignItems: "center",
|
|
8032
8133
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
8033
|
-
gap:
|
|
8134
|
+
gap: import_tokens49.tokens.dimension.value4
|
|
8034
8135
|
},
|
|
8035
8136
|
children: [
|
|
8036
8137
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
@@ -8047,7 +8148,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8047
8148
|
KjunIcon,
|
|
8048
8149
|
{
|
|
8049
8150
|
name: state.sort.order === "asc" ? "sort-ascending" : "sort-descending",
|
|
8050
|
-
size:
|
|
8151
|
+
size: import_tokens49.tokens.table.sortIconSize,
|
|
8051
8152
|
color: colors.text
|
|
8052
8153
|
}
|
|
8053
8154
|
)
|
|
@@ -8074,7 +8175,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8074
8175
|
{
|
|
8075
8176
|
type: "block",
|
|
8076
8177
|
height: geometry2.skeletonHeight,
|
|
8077
|
-
width: col.key === "actions" ?
|
|
8178
|
+
width: col.key === "actions" ? import_tokens49.tokens.table.actionColumnWidth : "75%"
|
|
8078
8179
|
}
|
|
8079
8180
|
)
|
|
8080
8181
|
},
|
|
@@ -8090,7 +8191,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8090
8191
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8091
8192
|
style: ({ pressed }) => ({
|
|
8092
8193
|
flexDirection: "row",
|
|
8093
|
-
borderBottomWidth:
|
|
8194
|
+
borderBottomWidth: import_tokens49.tokens.border.defaultWidth,
|
|
8094
8195
|
borderBottomColor: colors.border,
|
|
8095
8196
|
backgroundColor: pressed && hoverable ? colors.tableRowHover : striped && i % 2 ? colors.secondary : void 0
|
|
8096
8197
|
}),
|
|
@@ -8150,7 +8251,7 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8150
8251
|
)
|
|
8151
8252
|
}
|
|
8152
8253
|
),
|
|
8153
|
-
fade && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native48.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
8254
|
+
fade && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native48.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: import_tokens49.tokens.extensions.scrollFade.width }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native_svg7.default, { width: "100%", height: "100%", children: [
|
|
8154
8255
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native_svg7.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_react_native_svg7.LinearGradient, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
8155
8256
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native_svg7.Stop, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
8156
8257
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react_native_svg7.Stop, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -8161,11 +8262,11 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
|
|
|
8161
8262
|
}
|
|
8162
8263
|
|
|
8163
8264
|
// packages/native/src/table-view.tsx
|
|
8164
|
-
var
|
|
8265
|
+
var import_tokens51 = require("@kjun-ui/tokens");
|
|
8165
8266
|
var import_react_native50 = require("react-native");
|
|
8166
8267
|
|
|
8167
8268
|
// packages/native/src/table-cards.tsx
|
|
8168
|
-
var
|
|
8269
|
+
var import_tokens50 = require("@kjun-ui/tokens");
|
|
8169
8270
|
var import_react_native49 = require("react-native");
|
|
8170
8271
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
8171
8272
|
function TableCards({
|
|
@@ -8189,7 +8290,7 @@ function TableCards({
|
|
|
8189
8290
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
8190
8291
|
import_react_native49.View,
|
|
8191
8292
|
{
|
|
8192
|
-
style: { gap:
|
|
8293
|
+
style: { gap: import_tokens50.tokens.extensions.tableCard.gap, padding: import_tokens50.tokens.extensions.tableCard.listPadding, opacity: skeletonHidden ? 0 : void 0 },
|
|
8193
8294
|
"aria-hidden": skeletonHidden || void 0,
|
|
8194
8295
|
children: [
|
|
8195
8296
|
initialLoading ? Array.from({ length: skeletonRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(KjunSkeleton, { type: "card" }, i)) : state.rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
@@ -8198,10 +8299,10 @@ function TableCards({
|
|
|
8198
8299
|
accessible: false,
|
|
8199
8300
|
onPress: () => onRowClick == null ? void 0 : onRowClick(row, i),
|
|
8200
8301
|
style: ({ pressed }) => ({
|
|
8201
|
-
padding:
|
|
8202
|
-
borderWidth:
|
|
8302
|
+
padding: import_tokens50.tokens.extensions.tableCard.padding,
|
|
8303
|
+
borderWidth: import_tokens50.tokens.border.defaultWidth,
|
|
8203
8304
|
borderColor: colors.border,
|
|
8204
|
-
borderRadius:
|
|
8305
|
+
borderRadius: import_tokens50.tokens.extensions.tableCard.radius,
|
|
8205
8306
|
backgroundColor: pressed ? colors.hover : colors.background
|
|
8206
8307
|
}),
|
|
8207
8308
|
children: [
|
|
@@ -8211,8 +8312,8 @@ function TableCards({
|
|
|
8211
8312
|
style: {
|
|
8212
8313
|
flexDirection: "row",
|
|
8213
8314
|
alignItems: "center",
|
|
8214
|
-
gap:
|
|
8215
|
-
marginBottom:
|
|
8315
|
+
gap: import_tokens50.tokens.extensions.tableCard.gap,
|
|
8316
|
+
marginBottom: import_tokens50.tokens.dimension.value8
|
|
8216
8317
|
},
|
|
8217
8318
|
children: [
|
|
8218
8319
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
@@ -8222,7 +8323,7 @@ function TableCards({
|
|
|
8222
8323
|
flexDirection: "row",
|
|
8223
8324
|
flex: 1,
|
|
8224
8325
|
alignItems: "center",
|
|
8225
|
-
gap:
|
|
8326
|
+
gap: import_tokens50.tokens.extensions.tableCard.gap,
|
|
8226
8327
|
minWidth: 0
|
|
8227
8328
|
},
|
|
8228
8329
|
children: [
|
|
@@ -8231,8 +8332,8 @@ function TableCards({
|
|
|
8231
8332
|
]
|
|
8232
8333
|
}
|
|
8233
8334
|
),
|
|
8234
|
-
badges.length ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap:
|
|
8235
|
-
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap:
|
|
8335
|
+
badges.length ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap: import_tokens50.tokens.extensions.tableCard.fieldGap }, children: badges.map((col) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { children: cell(col, row, i) }, col.key)) }) : subtitle ? cell(subtitle, row, i) : null,
|
|
8336
|
+
inline.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { flexDirection: "row", gap: import_tokens50.tokens.extensions.tableCard.fieldGap }, children: inline.map((col) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { children: cell(col, row, i) }, col.key)) })
|
|
8236
8337
|
]
|
|
8237
8338
|
}
|
|
8238
8339
|
),
|
|
@@ -8242,10 +8343,10 @@ function TableCards({
|
|
|
8242
8343
|
import_react_native49.View,
|
|
8243
8344
|
{
|
|
8244
8345
|
style: {
|
|
8245
|
-
borderTopWidth: index ?
|
|
8346
|
+
borderTopWidth: index ? import_tokens50.tokens.border.defaultWidth : 0,
|
|
8246
8347
|
borderTopColor: colors.border,
|
|
8247
|
-
paddingTop: index ?
|
|
8248
|
-
marginTop: index ?
|
|
8348
|
+
paddingTop: index ? import_tokens50.tokens.dimension.value12 : 0,
|
|
8349
|
+
marginTop: index ? import_tokens50.tokens.dimension.value12 : 0
|
|
8249
8350
|
},
|
|
8250
8351
|
children: [
|
|
8251
8352
|
!!section.label && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
@@ -8254,7 +8355,7 @@ function TableCards({
|
|
|
8254
8355
|
style: {
|
|
8255
8356
|
...typeStyle("controlSmall"),
|
|
8256
8357
|
color: colors.textTertiary,
|
|
8257
|
-
marginBottom:
|
|
8358
|
+
marginBottom: import_tokens50.tokens.dimension.value6
|
|
8258
8359
|
},
|
|
8259
8360
|
children: section.label
|
|
8260
8361
|
}
|
|
@@ -8265,7 +8366,7 @@ function TableCards({
|
|
|
8265
8366
|
style: {
|
|
8266
8367
|
flexDirection: "row",
|
|
8267
8368
|
flexWrap: "wrap",
|
|
8268
|
-
gap: section.layout === "metrics" ?
|
|
8369
|
+
gap: section.layout === "metrics" ? import_tokens50.tokens.extensions.tableCard.gap : import_tokens50.tokens.extensions.tableCard.metricGap
|
|
8269
8370
|
},
|
|
8270
8371
|
children: cols.map((col) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
8271
8372
|
import_react_native49.View,
|
|
@@ -8274,7 +8375,7 @@ function TableCards({
|
|
|
8274
8375
|
flexBasis: col.fullWidthInCard || section.layout === "stack" ? "100%" : section.layout === "metrics" ? "30%" : "47%",
|
|
8275
8376
|
flexGrow: 1,
|
|
8276
8377
|
minWidth: 0,
|
|
8277
|
-
gap:
|
|
8378
|
+
gap: import_tokens50.tokens.extensions.tableCard.valueGap
|
|
8278
8379
|
},
|
|
8279
8380
|
children: [
|
|
8280
8381
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
@@ -8305,10 +8406,10 @@ function TableCards({
|
|
|
8305
8406
|
import_react_native49.View,
|
|
8306
8407
|
{
|
|
8307
8408
|
style: {
|
|
8308
|
-
borderTopWidth:
|
|
8409
|
+
borderTopWidth: import_tokens50.tokens.border.defaultWidth,
|
|
8309
8410
|
borderTopColor: colors.border,
|
|
8310
|
-
paddingTop:
|
|
8311
|
-
marginTop:
|
|
8411
|
+
paddingTop: import_tokens50.tokens.dimension.value8,
|
|
8412
|
+
marginTop: import_tokens50.tokens.dimension.value4
|
|
8312
8413
|
},
|
|
8313
8414
|
children: content(renderExpand == null ? void 0 : renderExpand(row, i))
|
|
8314
8415
|
}
|
|
@@ -8317,10 +8418,10 @@ function TableCards({
|
|
|
8317
8418
|
import_react_native49.View,
|
|
8318
8419
|
{
|
|
8319
8420
|
style: {
|
|
8320
|
-
borderTopWidth:
|
|
8421
|
+
borderTopWidth: import_tokens50.tokens.border.defaultWidth,
|
|
8321
8422
|
borderTopColor: colors.border,
|
|
8322
|
-
paddingTop:
|
|
8323
|
-
marginTop:
|
|
8423
|
+
paddingTop: import_tokens50.tokens.dimension.value8,
|
|
8424
|
+
marginTop: import_tokens50.tokens.dimension.value8,
|
|
8324
8425
|
alignItems: "flex-end"
|
|
8325
8426
|
},
|
|
8326
8427
|
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { alignSelf: "flex-end" }, children: cell(actions, row, i) })
|
|
@@ -8330,7 +8431,7 @@ function TableCards({
|
|
|
8330
8431
|
},
|
|
8331
8432
|
state.key(row, i)
|
|
8332
8433
|
)),
|
|
8333
|
-
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { padding:
|
|
8434
|
+
!initialLoading && !state.rows.length && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native49.View, { style: { padding: import_tokens50.tokens.extensions.tableCard.emptyPadding, alignItems: "center" }, children: content(emptyContent || emptyText, {
|
|
8334
8435
|
color: colors.textTertiary
|
|
8335
8436
|
}) })
|
|
8336
8437
|
]
|
|
@@ -8367,7 +8468,7 @@ function KjunTable(props) {
|
|
|
8367
8468
|
onRowClick,
|
|
8368
8469
|
onRetry
|
|
8369
8470
|
} = props;
|
|
8370
|
-
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = (0, import_react_native50.useWindowDimensions)().width <
|
|
8471
|
+
const { colors, domainColors } = useKjunStyles(), state = useTableModel2(props), query = useQueryDisplay(props), revealed = useLoadingReveal(query.initialLoading, skeleton ? loadingDelay : 0), mobile = (0, import_react_native50.useWindowDimensions)().width < import_tokens51.tokens.table.mobileBreakpoint;
|
|
8371
8472
|
const layout = tablePresentation(props, mobile);
|
|
8372
8473
|
const { card, visible } = layout;
|
|
8373
8474
|
const cell = (col, row, index, role) => {
|
|
@@ -8379,9 +8480,9 @@ function KjunTable(props) {
|
|
|
8379
8480
|
{
|
|
8380
8481
|
style: {
|
|
8381
8482
|
alignSelf: "flex-start",
|
|
8382
|
-
paddingVertical:
|
|
8383
|
-
paddingHorizontal:
|
|
8384
|
-
borderRadius:
|
|
8483
|
+
paddingVertical: import_tokens51.tokens.dimension.value2,
|
|
8484
|
+
paddingHorizontal: import_tokens51.tokens.dimension.value8,
|
|
8485
|
+
borderRadius: import_tokens51.tokens.radius.radius4,
|
|
8385
8486
|
backgroundColor: role2 ? domainColor(domainColors, role2 + "Bg") : void 0
|
|
8386
8487
|
},
|
|
8387
8488
|
children: content(body, {
|
|
@@ -8484,7 +8585,7 @@ function KpiNumberLine({ prefix, suffix, prefixGap, suffixGap, style, unitStyle,
|
|
|
8484
8585
|
}
|
|
8485
8586
|
|
|
8486
8587
|
// packages/native/src/kpi-hero.tsx
|
|
8487
|
-
var
|
|
8588
|
+
var import_tokens52 = require("@kjun-ui/tokens");
|
|
8488
8589
|
var import_react_native52 = require("react-native");
|
|
8489
8590
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
8490
8591
|
var kpiFormat = (item, value = item.value) => {
|
|
@@ -8514,8 +8615,8 @@ function KjunKpiHero(props) {
|
|
|
8514
8615
|
deltaFormatter,
|
|
8515
8616
|
renderSecondary
|
|
8516
8617
|
} = props;
|
|
8517
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = (0, import_react_native52.useWindowDimensions)().width, mobile = windowWidth <=
|
|
8518
|
-
const geometry2 =
|
|
8618
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), windowWidth = (0, import_react_native52.useWindowDimensions)().width, mobile = windowWidth <= import_tokens52.tokens.responsive.kpiHero, small = size === "sm", numberRole = small ? "displaySm" : mobile ? "displayMd" : "displayLg", font = typeStyle(numberRole).fontSize, unitStyle = typeStyle(small ? "numberSm" : mobile ? "numberMd" : "numberLg");
|
|
8619
|
+
const geometry2 = import_tokens52.tokens.extensions.kpiHero;
|
|
8519
8620
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8520
8621
|
const numeric2 = {
|
|
8521
8622
|
fontFamily: numericFontFamily || fontFamily,
|
|
@@ -8527,7 +8628,7 @@ function KjunKpiHero(props) {
|
|
|
8527
8628
|
);
|
|
8528
8629
|
const delta = (v, kind, style) => {
|
|
8529
8630
|
if (deltaFormatter) return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(KText, { style, children: deltaFormatter(v, kind) });
|
|
8530
|
-
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap =
|
|
8631
|
+
const sign = v > 0 ? "+" : v < 0 ? "\u2212" : "", gap = import_tokens52.tokens.extensions.financial.affixGap, number = new Intl.NumberFormat(void 0, {
|
|
8531
8632
|
minimumFractionDigits: kind === "absolute" ? decimals : 1,
|
|
8532
8633
|
maximumFractionDigits: kind === "absolute" ? decimals : 1
|
|
8533
8634
|
}).format(Math.abs(v));
|
|
@@ -8630,11 +8731,11 @@ function KjunKpiHero(props) {
|
|
|
8630
8731
|
gap: small && mobile ? geometry2.smallMobileGap : spec.secondaryGap,
|
|
8631
8732
|
marginTop: spec.secondaryMargin,
|
|
8632
8733
|
paddingTop: spec.secondaryPadding,
|
|
8633
|
-
borderTopWidth:
|
|
8734
|
+
borderTopWidth: import_tokens52.tokens.border.defaultWidth,
|
|
8634
8735
|
borderTopColor: colors.border
|
|
8635
8736
|
},
|
|
8636
8737
|
children: secondary.map((item, i) => {
|
|
8637
|
-
const columns = mobile && !small && windowWidth <=
|
|
8738
|
+
const columns = mobile && !small && windowWidth <= import_tokens52.tokens.responsive.kpiHeroSecondary && secondary.length >= 3 ? 2 : 0;
|
|
8638
8739
|
const first = columns ? i % columns === 0 : i === 0;
|
|
8639
8740
|
const last = columns ? i % columns === columns - 1 || i === secondary.length - 1 : i === secondary.length - 1;
|
|
8640
8741
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
@@ -8645,7 +8746,7 @@ function KjunKpiHero(props) {
|
|
|
8645
8746
|
minWidth: 0,
|
|
8646
8747
|
paddingLeft: first ? 0 : geometry2.itemPadding,
|
|
8647
8748
|
paddingRight: last ? 0 : geometry2.itemPadding,
|
|
8648
|
-
borderLeftWidth: first ? 0 :
|
|
8749
|
+
borderLeftWidth: first ? 0 : import_tokens52.tokens.border.defaultWidth,
|
|
8649
8750
|
borderLeftColor: colors.border
|
|
8650
8751
|
} : { minWidth: 0, maxWidth: "100%", flexShrink: 1 },
|
|
8651
8752
|
children: [
|
|
@@ -8710,7 +8811,7 @@ function KjunKpiHero(props) {
|
|
|
8710
8811
|
}
|
|
8711
8812
|
|
|
8712
8813
|
// packages/native/src/kpi-row.tsx
|
|
8713
|
-
var
|
|
8814
|
+
var import_tokens53 = require("@kjun-ui/tokens");
|
|
8714
8815
|
var import_react61 = require("react");
|
|
8715
8816
|
var import_react_native53 = require("react-native");
|
|
8716
8817
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
@@ -8723,8 +8824,8 @@ function KjunKpiRow({
|
|
|
8723
8824
|
onItemClick,
|
|
8724
8825
|
renderValue
|
|
8725
8826
|
}) {
|
|
8726
|
-
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = (0, import_react_native53.useWindowDimensions)().width <=
|
|
8727
|
-
const geometry2 =
|
|
8827
|
+
const { colors, domainColors, numericFontFamily, fontFamily } = useKjunStyles(), mobile = (0, import_react_native53.useWindowDimensions)().width <= import_tokens53.tokens.responsive.kpiRow, small = size === "sm", summary = mobileSummary && mobile && !small;
|
|
8828
|
+
const geometry2 = import_tokens53.tokens.extensions.kpiRow;
|
|
8728
8829
|
const spec = small ? geometry2.sm : mobile ? geometry2.mobile : geometry2.md;
|
|
8729
8830
|
const [width, setWidth] = (0, import_react61.useState)(0);
|
|
8730
8831
|
const paddingX = summary ? geometry2.summary.paddingX : spec.paddingX;
|
|
@@ -8803,8 +8904,8 @@ function KjunKpiRow({
|
|
|
8803
8904
|
minWidth: 0,
|
|
8804
8905
|
paddingVertical: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingY : spec.itemPaddingY,
|
|
8805
8906
|
paddingHorizontal: summary ? 0 : small && mobile ? geometry2.smallMobile.itemPaddingX : spec.itemPaddingX,
|
|
8806
|
-
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ?
|
|
8807
|
-
borderTopWidth: mobile && !small && !summary && i >= 2 ?
|
|
8907
|
+
borderLeftWidth: summary ? 0 : mobile && !small ? i % 2 && !full ? import_tokens53.tokens.border.defaultWidth : 0 : i ? import_tokens53.tokens.border.defaultWidth : 0,
|
|
8908
|
+
borderTopWidth: mobile && !small && !summary && i >= 2 ? import_tokens53.tokens.border.defaultWidth : 0,
|
|
8808
8909
|
borderColor: colors.border,
|
|
8809
8910
|
borderRadius: item.clickable ? geometry2.itemRadius : 0,
|
|
8810
8911
|
flexDirection: sub ? "row" : "column",
|
|
@@ -8847,7 +8948,7 @@ function KjunKpiRow({
|
|
|
8847
8948
|
summary && seg.label && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
8848
8949
|
KText,
|
|
8849
8950
|
{
|
|
8850
|
-
style: { ...typeStyle("caption"), marginRight: sub ?
|
|
8951
|
+
style: { ...typeStyle("caption"), marginRight: sub ? import_tokens53.tokens.dimension.value4 : 0, color: colors.textTertiary },
|
|
8851
8952
|
children: seg.label
|
|
8852
8953
|
}
|
|
8853
8954
|
),
|
|
@@ -8941,7 +9042,7 @@ function KjunKpiRow({
|
|
|
8941
9042
|
}
|
|
8942
9043
|
|
|
8943
9044
|
// packages/native/src/market-cards.tsx
|
|
8944
|
-
var
|
|
9045
|
+
var import_tokens55 = require("@kjun-ui/tokens");
|
|
8945
9046
|
var import_react_native55 = require("react-native");
|
|
8946
9047
|
|
|
8947
9048
|
// shared/package-runtime/market-cards.ts
|
|
@@ -9007,7 +9108,7 @@ function useMarketCards(props) {
|
|
|
9007
9108
|
}
|
|
9008
9109
|
|
|
9009
9110
|
// packages/native/src/market-parts.tsx
|
|
9010
|
-
var
|
|
9111
|
+
var import_tokens54 = require("@kjun-ui/tokens");
|
|
9011
9112
|
var import_react_native54 = require("react-native");
|
|
9012
9113
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
9013
9114
|
function MarketIdentity({
|
|
@@ -9017,7 +9118,7 @@ function MarketIdentity({
|
|
|
9017
9118
|
compact = false
|
|
9018
9119
|
}) {
|
|
9019
9120
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9020
|
-
const { colors } = useKjunStyles(), mobile = (0, import_react_native54.useWindowDimensions)().width <
|
|
9121
|
+
const { colors } = useKjunStyles(), mobile = (0, import_react_native54.useWindowDimensions)().width < import_tokens54.tokens.responsive.market && !table && !compact, label = (_c = (_a = props.primaryLabel) == null ? void 0 : _a.call(props, row)) != null ? _c : String((_b = getValue(row, "name")) != null ? _b : ""), meta = ((_d = props.subMeta) == null ? void 0 : _d.call(props, row)) || "", id = getValue(row, props.rowKey || "id");
|
|
9021
9122
|
const body = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
9022
9123
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
9023
9124
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_react_native54.View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
@@ -9027,7 +9128,7 @@ function MarketIdentity({
|
|
|
9027
9128
|
style: {
|
|
9028
9129
|
flexDirection: "row",
|
|
9029
9130
|
alignItems: "center",
|
|
9030
|
-
gap:
|
|
9131
|
+
gap: import_tokens54.tokens.dimension.value4,
|
|
9031
9132
|
minWidth: 0
|
|
9032
9133
|
},
|
|
9033
9134
|
children: [
|
|
@@ -9049,7 +9150,7 @@ function MarketIdentity({
|
|
|
9049
9150
|
]
|
|
9050
9151
|
}
|
|
9051
9152
|
),
|
|
9052
|
-
(meta || props.renderSubMeta) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native54.View, { style: { marginTop:
|
|
9153
|
+
(meta || props.renderSubMeta) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react_native54.View, { style: { marginTop: import_tokens54.tokens.dimension.value2 }, children: ((_i = props.renderSubMeta) == null ? void 0 : _i.call(props, row)) || /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
9053
9154
|
KText,
|
|
9054
9155
|
{
|
|
9055
9156
|
numberOfLines: 1,
|
|
@@ -9111,9 +9212,9 @@ function MarketFooter({
|
|
|
9111
9212
|
flexWrap: "wrap",
|
|
9112
9213
|
alignItems: "center",
|
|
9113
9214
|
justifyContent: "space-between",
|
|
9114
|
-
gap:
|
|
9115
|
-
paddingVertical:
|
|
9116
|
-
paddingHorizontal:
|
|
9215
|
+
gap: import_tokens54.tokens.dimension.value8,
|
|
9216
|
+
paddingVertical: import_tokens54.tokens.dimension.value12,
|
|
9217
|
+
paddingHorizontal: import_tokens54.tokens.dimension.value16
|
|
9117
9218
|
},
|
|
9118
9219
|
children: [
|
|
9119
9220
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(KText, { style: { ...typeStyle("caption"), color: colors.textTertiary }, children: calculatedAt ? m.lastUpdated + (((_a = props.formatDate) == null ? void 0 : _a.call(props, calculatedAt)) || calculatedAt) : footerNote }),
|
|
@@ -9159,9 +9260,9 @@ function KjunMarketCards(props) {
|
|
|
9159
9260
|
showsHorizontalScrollIndicator: false,
|
|
9160
9261
|
contentContainerStyle: {
|
|
9161
9262
|
flexDirection: "row",
|
|
9162
|
-
gap:
|
|
9163
|
-
paddingVertical:
|
|
9164
|
-
paddingHorizontal:
|
|
9263
|
+
gap: import_tokens55.tokens.dimension.value8,
|
|
9264
|
+
paddingVertical: import_tokens55.tokens.dimension.value10,
|
|
9265
|
+
paddingHorizontal: import_tokens55.tokens.dimension.value16
|
|
9165
9266
|
},
|
|
9166
9267
|
children: state.pills.map((pill) => /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
9167
9268
|
AccessiblePressable,
|
|
@@ -9170,14 +9271,14 @@ function KjunMarketCards(props) {
|
|
|
9170
9271
|
accessibilityLabel: pill.label,
|
|
9171
9272
|
accessibilityState: { selected: state.key === pill.key },
|
|
9172
9273
|
onPress: () => state.select(pill.key),
|
|
9173
|
-
hitSlop: { top: (
|
|
9274
|
+
hitSlop: { top: (import_tokens55.tokens.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * import_tokens55.tokens.dimension.value8) / 2, bottom: (import_tokens55.tokens.native.minimumTouchTarget - typeStyle("label").lineHeight - 2 * import_tokens55.tokens.dimension.value8) / 2 },
|
|
9174
9275
|
style: {
|
|
9175
9276
|
flexDirection: "row",
|
|
9176
9277
|
alignItems: "center",
|
|
9177
|
-
gap:
|
|
9178
|
-
paddingVertical:
|
|
9179
|
-
paddingHorizontal:
|
|
9180
|
-
borderRadius:
|
|
9278
|
+
gap: import_tokens55.tokens.dimension.value4,
|
|
9279
|
+
paddingVertical: import_tokens55.tokens.dimension.value8,
|
|
9280
|
+
paddingHorizontal: import_tokens55.tokens.dimension.value16,
|
|
9281
|
+
borderRadius: import_tokens55.tokens.radius.radius9999,
|
|
9181
9282
|
backgroundColor: state.key === pill.key ? colors.brand : colors.secondary
|
|
9182
9283
|
},
|
|
9183
9284
|
children: [
|
|
@@ -9213,7 +9314,7 @@ function KjunMarketCards(props) {
|
|
|
9213
9314
|
loadingContent: props.skeleton === false ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunListSkeleton, { variant: "compact" }),
|
|
9214
9315
|
emptyContent: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunEmpty, { text: emptyMessage, description: emptySubMessage }),
|
|
9215
9316
|
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_react_native55.View, { children: [
|
|
9216
|
-
state.pill && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KText, { style: { textAlign: "right", paddingHorizontal:
|
|
9317
|
+
state.pill && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KText, { style: { textAlign: "right", paddingHorizontal: import_tokens55.tokens.dimension.value16, paddingVertical: import_tokens55.tokens.dimension.value8, ...typeStyle("caption"), color: colors.textSecondary }, children: state.pill.label }),
|
|
9217
9318
|
rows.map((row, i) => {
|
|
9218
9319
|
var _a, _b, _c;
|
|
9219
9320
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
@@ -9228,22 +9329,22 @@ function KjunMarketCards(props) {
|
|
|
9228
9329
|
flexDirection: "row",
|
|
9229
9330
|
alignItems: "center",
|
|
9230
9331
|
justifyContent: "space-between",
|
|
9231
|
-
paddingVertical:
|
|
9232
|
-
paddingHorizontal:
|
|
9233
|
-
borderBottomWidth:
|
|
9332
|
+
paddingVertical: import_tokens55.tokens.dimension.value10,
|
|
9333
|
+
paddingHorizontal: import_tokens55.tokens.dimension.value16,
|
|
9334
|
+
borderBottomWidth: import_tokens55.tokens.border.defaultWidth,
|
|
9234
9335
|
borderBottomColor: colors.border,
|
|
9235
9336
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9236
9337
|
}),
|
|
9237
9338
|
children: [
|
|
9238
9339
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(MarketIdentity, { row, props, compact: true }),
|
|
9239
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_native55.View, { style: { marginLeft:
|
|
9340
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react_native55.View, { style: { marginLeft: import_tokens55.tokens.dimension.value12, alignItems: "flex-end" }, children: ((_b = state.pill) == null ? void 0 : _b.format) === "sparkline" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9240
9341
|
KjunSparkline,
|
|
9241
9342
|
{
|
|
9242
9343
|
data: getValue(row, state.key) || [],
|
|
9243
|
-
width:
|
|
9244
|
-
height:
|
|
9344
|
+
width: import_tokens55.tokens.extensions.marketTable.sparklineWidth,
|
|
9345
|
+
height: import_tokens55.tokens.extensions.marketTable.sparklineHeight
|
|
9245
9346
|
}
|
|
9246
|
-
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height:
|
|
9347
|
+
) : state.pill ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: metricLoading(row, state.key) ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height: import_tokens55.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens55.tokens.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
9247
9348
|
KjunSignedValue,
|
|
9248
9349
|
{
|
|
9249
9350
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -9251,14 +9352,14 @@ function KjunMarketCards(props) {
|
|
|
9251
9352
|
stale: !!getValue(row, "stale"),
|
|
9252
9353
|
tone: "pill"
|
|
9253
9354
|
}
|
|
9254
|
-
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height:
|
|
9355
|
+
) : isPrice && getValue(row, state.key) == null ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(KjunSkeleton, { type: "block", height: import_tokens55.tokens.extensions.financial.priceSkeletonHeight, width: import_tokens55.tokens.extensions.financial.priceSkeletonWidth }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
9255
9356
|
import_react_native55.View,
|
|
9256
9357
|
{
|
|
9257
9358
|
style: {
|
|
9258
9359
|
flexDirection: "row",
|
|
9259
9360
|
alignItems: "center",
|
|
9260
9361
|
justifyContent: "flex-end",
|
|
9261
|
-
gap:
|
|
9362
|
+
gap: import_tokens55.tokens.dimension.value4
|
|
9262
9363
|
},
|
|
9263
9364
|
children: [
|
|
9264
9365
|
(_c = props.renderMetricPrefix) == null ? void 0 : _c.call(
|
|
@@ -9295,7 +9396,7 @@ function KjunMarketCards(props) {
|
|
|
9295
9396
|
}
|
|
9296
9397
|
|
|
9297
9398
|
// packages/native/src/market-list.tsx
|
|
9298
|
-
var
|
|
9399
|
+
var import_tokens56 = require("@kjun-ui/tokens");
|
|
9299
9400
|
var import_react_native56 = require("react-native");
|
|
9300
9401
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
9301
9402
|
var changeWeight = { fontWeight: typeStyle("label").fontWeight };
|
|
@@ -9313,7 +9414,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9313
9414
|
closingPrice = false,
|
|
9314
9415
|
emptyMessage = m.noItems,
|
|
9315
9416
|
emptySubMessage = ""
|
|
9316
|
-
} = props, { colors } = useKjunStyles(), mobile = (0, import_react_native56.useWindowDimensions)().width <
|
|
9417
|
+
} = props, { colors } = useKjunStyles(), mobile = (0, import_react_native56.useWindowDimensions)().width < import_tokens56.tokens.responsive.market;
|
|
9317
9418
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react_native56.View, { children: [
|
|
9318
9419
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9319
9420
|
KjunDataState,
|
|
@@ -9339,11 +9440,11 @@ function KjunMarketSimpleList(props) {
|
|
|
9339
9440
|
flexDirection: "row",
|
|
9340
9441
|
alignItems: "center",
|
|
9341
9442
|
justifyContent: "space-between",
|
|
9342
|
-
paddingVertical: mobile ?
|
|
9343
|
-
paddingHorizontal: mobile ?
|
|
9443
|
+
paddingVertical: mobile ? import_tokens56.tokens.dimension.value14 : import_tokens56.tokens.dimension.value16,
|
|
9444
|
+
paddingHorizontal: mobile ? import_tokens56.tokens.dimension.value20 : import_tokens56.tokens.dimension.value16,
|
|
9344
9445
|
// Like Web, the minimum height belongs to the narrow layout only.
|
|
9345
|
-
minHeight: mobile ?
|
|
9346
|
-
borderBottomWidth:
|
|
9446
|
+
minHeight: mobile ? import_tokens56.tokens.extensions.marketList.minimumHeight : void 0,
|
|
9447
|
+
borderBottomWidth: import_tokens56.tokens.border.defaultWidth,
|
|
9347
9448
|
borderBottomColor: colors.border,
|
|
9348
9449
|
backgroundColor: pressed ? colors.hover : void 0
|
|
9349
9450
|
}),
|
|
@@ -9353,8 +9454,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9353
9454
|
import_react_native56.View,
|
|
9354
9455
|
{
|
|
9355
9456
|
style: {
|
|
9356
|
-
marginLeft:
|
|
9357
|
-
minWidth: mobile ?
|
|
9457
|
+
marginLeft: import_tokens56.tokens.dimension.value12,
|
|
9458
|
+
minWidth: mobile ? import_tokens56.tokens.extensions.marketList.mobileQuoteMinimumWidth : void 0,
|
|
9358
9459
|
maxWidth: "50%",
|
|
9359
9460
|
alignItems: "flex-end"
|
|
9360
9461
|
},
|
|
@@ -9376,8 +9477,8 @@ function KjunMarketSimpleList(props) {
|
|
|
9376
9477
|
flexWrap: "wrap",
|
|
9377
9478
|
alignItems: "center",
|
|
9378
9479
|
justifyContent: "flex-end",
|
|
9379
|
-
gap:
|
|
9380
|
-
marginTop:
|
|
9480
|
+
gap: import_tokens56.tokens.dimension.value6,
|
|
9481
|
+
marginTop: import_tokens56.tokens.dimension.value2
|
|
9381
9482
|
},
|
|
9382
9483
|
children: [
|
|
9383
9484
|
price !== null && ((_b = props.renderPricePrefix) == null ? void 0 : _b.call(props, row)),
|
|
@@ -9389,7 +9490,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9389
9490
|
fetchedAt
|
|
9390
9491
|
}
|
|
9391
9492
|
)),
|
|
9392
|
-
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(KjunSkeleton, { type: "block", height:
|
|
9493
|
+
changeLoading(row) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(KjunSkeleton, { type: "block", height: import_tokens56.tokens.extensions.marketList.changeSkeletonHeight, width: import_tokens56.tokens.extensions.marketList.changeSkeletonWidth }) : change !== null ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
9393
9494
|
KjunSignedValue,
|
|
9394
9495
|
{
|
|
9395
9496
|
value: change,
|
|
@@ -9423,7 +9524,7 @@ function KjunMarketSimpleList(props) {
|
|
|
9423
9524
|
}
|
|
9424
9525
|
|
|
9425
9526
|
// packages/native/src/market-panel.tsx
|
|
9426
|
-
var
|
|
9527
|
+
var import_tokens57 = require("@kjun-ui/tokens");
|
|
9427
9528
|
var import_react_native57 = require("react-native");
|
|
9428
9529
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
9429
9530
|
function KjunMarketListPanel({
|
|
@@ -9437,8 +9538,8 @@ function KjunMarketListPanel({
|
|
|
9437
9538
|
import_react_native57.View,
|
|
9438
9539
|
{
|
|
9439
9540
|
style: {
|
|
9440
|
-
marginTop:
|
|
9441
|
-
borderTopWidth:
|
|
9541
|
+
marginTop: import_tokens57.tokens.dimension.value16,
|
|
9542
|
+
borderTopWidth: import_tokens57.tokens.border.defaultWidth,
|
|
9442
9543
|
borderTopColor: colors.border
|
|
9443
9544
|
},
|
|
9444
9545
|
children
|
|
@@ -9448,7 +9549,7 @@ function KjunMarketListPanel({
|
|
|
9448
9549
|
}
|
|
9449
9550
|
|
|
9450
9551
|
// packages/native/src/market-table.tsx
|
|
9451
|
-
var
|
|
9552
|
+
var import_tokens58 = require("@kjun-ui/tokens");
|
|
9452
9553
|
var import_react63 = require("react");
|
|
9453
9554
|
var import_react_native58 = require("react-native");
|
|
9454
9555
|
var import_react_native_svg8 = __toESM(require("react-native-svg"), 1);
|
|
@@ -9476,7 +9577,7 @@ function KjunMarketTable(props) {
|
|
|
9476
9577
|
const render = (row, col) => {
|
|
9477
9578
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
9478
9579
|
if (cellLoading(row, col))
|
|
9479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(KjunSkeleton, { type: "block", height:
|
|
9580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(KjunSkeleton, { type: "block", height: import_tokens58.tokens.extensions.marketTable.valueSkeletonHeight, width: import_tokens58.tokens.extensions.marketTable.valueSkeletonWidth });
|
|
9480
9581
|
if (renderCell) return content(renderCell(row, col));
|
|
9481
9582
|
if (["stock_name", "name", "symbol"].includes(col.key))
|
|
9482
9583
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(MarketIdentity, { row, props, table: true });
|
|
@@ -9485,8 +9586,8 @@ function KjunMarketTable(props) {
|
|
|
9485
9586
|
KjunSparkline,
|
|
9486
9587
|
{
|
|
9487
9588
|
data: Array.isArray(value) ? value : [],
|
|
9488
|
-
width:
|
|
9489
|
-
height:
|
|
9589
|
+
width: import_tokens58.tokens.extensions.marketTable.sparklineWidth,
|
|
9590
|
+
height: import_tokens58.tokens.extensions.marketTable.sparklineHeight
|
|
9490
9591
|
}
|
|
9491
9592
|
);
|
|
9492
9593
|
if (col.type === "price")
|
|
@@ -9544,7 +9645,7 @@ function KjunMarketTable(props) {
|
|
|
9544
9645
|
onLayout: layout.onLayout,
|
|
9545
9646
|
style: {
|
|
9546
9647
|
backgroundColor: embedded ? void 0 : colors.surface,
|
|
9547
|
-
borderRadius: embedded ? 0 :
|
|
9648
|
+
borderRadius: embedded ? 0 : import_tokens58.tokens.radius.radius12
|
|
9548
9649
|
},
|
|
9549
9650
|
children: [
|
|
9550
9651
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -9584,13 +9685,13 @@ function KjunMarketTable(props) {
|
|
|
9584
9685
|
{
|
|
9585
9686
|
style: {
|
|
9586
9687
|
width: marketGeometry.actionsWidth,
|
|
9587
|
-
paddingVertical:
|
|
9588
|
-
paddingHorizontal:
|
|
9688
|
+
paddingVertical: import_tokens58.tokens.dimension.value12,
|
|
9689
|
+
paddingHorizontal: import_tokens58.tokens.dimension.value4,
|
|
9589
9690
|
flexDirection: "row",
|
|
9590
9691
|
alignItems: "center",
|
|
9591
9692
|
justifyContent: "center"
|
|
9592
9693
|
},
|
|
9593
|
-
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { style: { width: Math.max(
|
|
9694
|
+
children: ["interest", "favorite"].map((kind) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { style: { width: Math.max(import_tokens58.tokens.native.minimumTouchTarget, import_tokens58.tokens.extensions.iconToggle.sizes.xs), alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(KjunCollectionMark, { kind, size: "md" }) }, kind))
|
|
9594
9695
|
}
|
|
9595
9696
|
),
|
|
9596
9697
|
columns.map((col, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
@@ -9605,11 +9706,11 @@ function KjunMarketTable(props) {
|
|
|
9605
9706
|
},
|
|
9606
9707
|
style: {
|
|
9607
9708
|
width: layout.widths[columnIndex],
|
|
9608
|
-
padding:
|
|
9709
|
+
padding: import_tokens58.tokens.dimension.value12,
|
|
9609
9710
|
flexDirection: "row",
|
|
9610
9711
|
alignItems: "center",
|
|
9611
9712
|
justifyContent: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : "flex-start",
|
|
9612
|
-
gap:
|
|
9713
|
+
gap: import_tokens58.tokens.dimension.value4
|
|
9613
9714
|
},
|
|
9614
9715
|
children: [
|
|
9615
9716
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
@@ -9626,7 +9727,7 @@ function KjunMarketTable(props) {
|
|
|
9626
9727
|
KjunIcon,
|
|
9627
9728
|
{
|
|
9628
9729
|
name: sortKey === col.key ? sortOrder === "asc" ? "sort-ascending" : "sort-descending" : "arrows-sort",
|
|
9629
|
-
size:
|
|
9730
|
+
size: import_tokens58.tokens.extensions.marketTable.sortIconSize,
|
|
9630
9731
|
color: sortKey === col.key ? colors.brand : colors.textTertiary
|
|
9631
9732
|
}
|
|
9632
9733
|
)
|
|
@@ -9661,8 +9762,8 @@ function KjunMarketTable(props) {
|
|
|
9661
9762
|
{
|
|
9662
9763
|
style: {
|
|
9663
9764
|
width: marketGeometry.actionsWidth,
|
|
9664
|
-
paddingVertical:
|
|
9665
|
-
paddingHorizontal:
|
|
9765
|
+
paddingVertical: import_tokens58.tokens.dimension.value12,
|
|
9766
|
+
paddingHorizontal: import_tokens58.tokens.dimension.value4,
|
|
9666
9767
|
flexDirection: "row",
|
|
9667
9768
|
alignItems: "center",
|
|
9668
9769
|
justifyContent: "center"
|
|
@@ -9706,8 +9807,8 @@ function KjunMarketTable(props) {
|
|
|
9706
9807
|
{
|
|
9707
9808
|
style: {
|
|
9708
9809
|
width: layout.widths[columnIndex],
|
|
9709
|
-
paddingVertical:
|
|
9710
|
-
paddingHorizontal:
|
|
9810
|
+
paddingVertical: import_tokens58.tokens.dimension.value14,
|
|
9811
|
+
paddingHorizontal: import_tokens58.tokens.dimension.value12,
|
|
9711
9812
|
justifyContent: "center",
|
|
9712
9813
|
alignItems: col.align === "right" ? "flex-end" : col.align === "center" ? "center" : void 0
|
|
9713
9814
|
},
|
|
@@ -9733,7 +9834,7 @@ function KjunMarketTable(props) {
|
|
|
9733
9834
|
] })
|
|
9734
9835
|
}
|
|
9735
9836
|
),
|
|
9736
|
-
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width:
|
|
9837
|
+
layout.width - scroll.viewport - scroll.x > 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native58.View, { pointerEvents: "none", style: { position: "absolute", top: 0, right: 0, bottom: 0, width: import_tokens58.tokens.extensions.scrollFade.width }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react_native_svg8.default, { width: "100%", height: "100%", children: [
|
|
9737
9838
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native_svg8.Defs, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react_native_svg8.LinearGradient, { id: fadeId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
9738
9839
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native_svg8.Stop, { offset: "0", stopColor: colors.surface, stopOpacity: 0 }),
|
|
9739
9840
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react_native_svg8.Stop, { offset: "1", stopColor: colors.surface, stopOpacity: 1 })
|
|
@@ -9750,50 +9851,61 @@ function KjunMarketTable(props) {
|
|
|
9750
9851
|
}
|
|
9751
9852
|
|
|
9752
9853
|
// packages/native/src/list.tsx
|
|
9753
|
-
var
|
|
9854
|
+
var import_tokens59 = require("@kjun-ui/tokens");
|
|
9754
9855
|
var import_react64 = require("react");
|
|
9755
9856
|
var import_react_native59 = require("react-native");
|
|
9756
9857
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
9757
9858
|
var ListRowContext = (0, import_react64.createContext)({ divider: true, compact: false });
|
|
9758
|
-
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, onPress }) {
|
|
9859
|
+
function KjunListRow({ title, description, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, onPress }) {
|
|
9759
9860
|
const { colors } = useKjunStyles(), { divider, compact } = (0, import_react64.useContext)(ListRowContext);
|
|
9760
9861
|
const parts = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
9761
9862
|
hasContent(leading) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { children: content(leading) }),
|
|
9762
9863
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
9763
|
-
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { ...typeStyle("label") }, children: title }),
|
|
9764
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop:
|
|
9864
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { ...typeStyle("label"), ...destructive ? { color: colors.danger } : {} }, children: title }),
|
|
9865
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop: import_tokens59.tokens.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9765
9866
|
] }),
|
|
9766
|
-
hasContent(trailing) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { style: { maxWidth: "35%" }, children: content(trailing) })
|
|
9867
|
+
hasContent(trailing) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { style: { maxWidth: "35%" }, children: content(trailing) }),
|
|
9868
|
+
chevron && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { accessible: false, importantForAccessibility: "no-hide-descendants", accessibilityElementsHidden: true, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KjunIcon, { name: "chevron-right", size: import_tokens59.tokens.iconSizes.default, color: colors.textTertiary }) })
|
|
9767
9869
|
] });
|
|
9768
|
-
const style = { flex: 1, minWidth: 0, minHeight: compact ?
|
|
9769
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap:
|
|
9770
|
-
onPress || href ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccessiblePressable, { ...import_react_native59.Platform.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ?
|
|
9771
|
-
hasContent(actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { pointerEvents: disabled ? "none" : "auto", ...disabled && import_react_native59.Platform.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap:
|
|
9870
|
+
const style = { flex: 1, minWidth: 0, minHeight: compact ? import_tokens59.tokens.extensions.list.compactMinimumHeight : import_tokens59.tokens.extensions.list.minimumHeight, flexDirection: "row", alignItems: "center", gap: import_tokens59.tokens.extensions.list.gap, padding: import_tokens59.tokens.extensions.list.padding, ...compact ? { paddingVertical: import_tokens59.tokens.extensions.list.compactPaddingY } : {} };
|
|
9871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { role: "listitem", style: { flexDirection: "row", alignItems: "center", gap: import_tokens59.tokens.extensions.list.gap, borderBottomWidth: divider ? import_tokens59.tokens.border.defaultWidth : 0, borderBottomColor: colors.divider }, children: [
|
|
9872
|
+
onPress || href ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AccessiblePressable, { ...import_react_native59.Platform.OS === "web" && href && !disabled ? { href } : {}, accessibilityRole: href ? "link" : "button", accessibilityLabel: title + (description ? ", " + description : ""), disabled, accessibilityState: { disabled }, onPress, style: ({ pressed }) => ({ ...style, opacity: disabled ? import_tokens59.tokens.states.opacity.disabled : 1, backgroundColor: pressed ? colors.hover : "transparent" }), children: parts }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { style, children: parts }),
|
|
9873
|
+
hasContent(actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { pointerEvents: disabled ? "none" : "auto", ...disabled && import_react_native59.Platform.OS === "web" ? { inert: true } : {}, style: { maxWidth: "45%", flexDirection: "row", flexWrap: "wrap", gap: import_tokens59.tokens.extensions.list.actionsGap, paddingRight: import_tokens59.tokens.extensions.list.actionsPadding, opacity: disabled ? import_tokens59.tokens.states.opacity.disabled : 1 }, children: content(actions) })
|
|
9772
9874
|
] });
|
|
9773
9875
|
}
|
|
9774
|
-
function KjunListSection({ title, description, actions, children, ariaLabel, divider = true, density = "default" }) {
|
|
9876
|
+
function KjunListSection({ title, description, actions, children, ariaLabel, surface = true, divider = true, density = "default" }) {
|
|
9775
9877
|
const { colors } = useKjunStyles();
|
|
9776
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { minWidth: 0, backgroundColor: colors.surface }, children: [
|
|
9777
|
-
!!(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flexDirection: "row", alignItems: "center", gap:
|
|
9878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { minWidth: 0, backgroundColor: surface ? colors.surface : "transparent" }, children: [
|
|
9879
|
+
!!(title || description || actions) && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flexDirection: "row", alignItems: "center", gap: import_tokens59.tokens.extensions.list.gap, padding: import_tokens59.tokens.extensions.list.padding }, children: [
|
|
9778
9880
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_react_native59.View, { style: { flex: 1 }, children: [
|
|
9779
9881
|
!!title && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { accessibilityRole: "header", style: { ...typeStyle("cardTitle") }, children: title }),
|
|
9780
|
-
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop:
|
|
9882
|
+
!!description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(KText, { style: { marginTop: import_tokens59.tokens.extensions.list.descriptionGap, color: colors.textSecondary, ...typeStyle("caption") }, children: description })
|
|
9781
9883
|
] }),
|
|
9782
9884
|
content(actions)
|
|
9783
9885
|
] }),
|
|
9784
9886
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { role: "list", accessibilityLabel: ariaLabel || title, children: import_react64.Children.toArray(children).map((row, i, rows) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ListRowContext.Provider, { value: { divider: divider && i < rows.length - 1, compact: density === "compact" }, children: row }, i)) })
|
|
9785
9887
|
] });
|
|
9786
9888
|
}
|
|
9889
|
+
function KjunListItem({ children }) {
|
|
9890
|
+
const { colors } = useKjunStyles(), { divider, compact } = (0, import_react64.useContext)(ListRowContext);
|
|
9891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_native59.View, { role: "listitem", style: {
|
|
9892
|
+
padding: import_tokens59.tokens.extensions.list.padding,
|
|
9893
|
+
...compact ? { paddingVertical: import_tokens59.tokens.extensions.list.compactPaddingY } : {},
|
|
9894
|
+
borderBottomWidth: divider ? import_tokens59.tokens.border.defaultWidth : 0,
|
|
9895
|
+
borderBottomColor: colors.divider,
|
|
9896
|
+
minWidth: 0
|
|
9897
|
+
}, children: content(children) });
|
|
9898
|
+
}
|
|
9787
9899
|
|
|
9788
9900
|
// packages/native/src/app-navigation.tsx
|
|
9789
|
-
var
|
|
9901
|
+
var import_tokens60 = require("@kjun-ui/tokens");
|
|
9790
9902
|
var import_react65 = require("react");
|
|
9791
9903
|
var import_react_native60 = require("react-native");
|
|
9792
9904
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
9793
9905
|
function KjunTopNavigation({ title, description, leading, actions, safeAreaTop = 0 }) {
|
|
9794
9906
|
const { colors } = useKjunStyles();
|
|
9795
|
-
const geometry2 =
|
|
9796
|
-
const titleInset = Math.max(0, (geometry2.controlSize -
|
|
9907
|
+
const geometry2 = import_tokens60.tokens.extensions.topNavigation;
|
|
9908
|
+
const titleInset = Math.max(0, (geometry2.controlSize - import_tokens60.tokens.typography.sectionTitle.lineHeightPx) / 2);
|
|
9797
9909
|
const wrapping = import_react_native60.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
9798
9910
|
const edgeInset = (geometry2.controlSize - geometry2.iconSize) / 2;
|
|
9799
9911
|
const [iconEdges, setIconEdges] = (0, import_react65.useState)({ leading: false, trailing: false });
|
|
@@ -9817,13 +9929,13 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
9817
9929
|
const m = useKjunMessages();
|
|
9818
9930
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
9819
9931
|
const { colors } = useKjunStyles();
|
|
9820
|
-
const geometry2 =
|
|
9932
|
+
const geometry2 = import_tokens60.tokens.extensions.bottomNavigation;
|
|
9821
9933
|
const hasIcons = items2.some((item) => item.icon);
|
|
9822
9934
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
9823
9935
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react_native60.View, { role: "navigation", accessibilityLabel: ariaLabel, style: { flexShrink: 0, flexDirection: "row", backgroundColor: colors.surface, paddingBottom: Math.max(0, safeAreaBottom) }, children: items2.map((item) => {
|
|
9824
9936
|
const selected = item.key === value;
|
|
9825
9937
|
const ink = selected ? colors.brand : colors.textSecondary;
|
|
9826
|
-
const ring =
|
|
9938
|
+
const ring = import_tokens60.tokens.border.controlWidth;
|
|
9827
9939
|
const badge = item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react_native60.View, { pointerEvents: "none", "aria-hidden": true, style: {
|
|
9828
9940
|
position: "absolute",
|
|
9829
9941
|
top: -geometry2.badgeOffset - ring,
|
|
@@ -9858,7 +9970,7 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
9858
9970
|
gap: geometry2.itemGap,
|
|
9859
9971
|
paddingHorizontal: geometry2.itemPaddingX,
|
|
9860
9972
|
paddingVertical: geometry2.itemPaddingY,
|
|
9861
|
-
opacity: item.disabled ?
|
|
9973
|
+
opacity: item.disabled ? import_tokens60.tokens.states.opacity.disabled : 1
|
|
9862
9974
|
},
|
|
9863
9975
|
children: [
|
|
9864
9976
|
hasIcons && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react_native60.View, { style: { width: geometry2.iconSize, height: geometry2.iconSize, flexShrink: 0 }, children: [
|
|
@@ -9879,8 +9991,8 @@ function KjunBottomNavigation({ items: items2, value, ariaLabel, safeAreaBottom
|
|
|
9879
9991
|
function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboardVisible = false, hideOnKeyboard = false }) {
|
|
9880
9992
|
const { colors } = useKjunStyles();
|
|
9881
9993
|
const [width, setWidth] = (0, import_react65.useState)(0);
|
|
9882
|
-
const geometry2 =
|
|
9883
|
-
const wide = width >=
|
|
9994
|
+
const geometry2 = import_tokens60.tokens.extensions.navigation;
|
|
9995
|
+
const wide = width >= import_tokens60.tokens.responsive.bottomAction + geometry2.padding * 2;
|
|
9884
9996
|
const wrapping = import_react_native60.Platform.OS === "web" ? { wordBreak: "keep-all", overflowWrap: "anywhere" } : {};
|
|
9885
9997
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
9886
9998
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BottomActionBarContext.Provider, { value: !wide, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_react_native60.View, { onLayout: (event) => setWidth(event.nativeEvent.layout.width), style: {
|
|
@@ -9902,50 +10014,51 @@ function KjunBottomActionBar({ description, children, safeAreaBottom = 0, keyboa
|
|
|
9902
10014
|
// packages/native/src/media.tsx
|
|
9903
10015
|
var import_react66 = require("react");
|
|
9904
10016
|
var import_react_native61 = require("react-native");
|
|
9905
|
-
var
|
|
10017
|
+
var import_tokens61 = require("@kjun-ui/tokens");
|
|
9906
10018
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10019
|
+
var ImageBackgroundContext = (0, import_react66.createContext)(void 0);
|
|
9907
10020
|
function KjunImage({ src, source, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, onLoad, onError }) {
|
|
9908
|
-
const { colors } = useKjunStyles();
|
|
10021
|
+
const { colors } = useKjunStyles(), background = (0, import_react66.useContext)(ImageBackgroundContext);
|
|
9909
10022
|
const request = JSON.stringify(source != null ? source : src), current = (0, import_react66.useRef)({ request, version: 0 });
|
|
9910
10023
|
if (current.current.request !== request) current.current = { request, version: current.current.version + 1 };
|
|
9911
10024
|
const version = current.current.version;
|
|
9912
10025
|
const [failed, setFailed] = (0, import_react66.useState)(null);
|
|
9913
10026
|
const missing = !source && !src;
|
|
9914
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessibilityElementsHidden: decorative, importantForAccessibility: decorative ? "no-hide-descendants" : "auto", "aria-hidden": decorative || void 0, style: { width: "100%", aspectRatio: aspectRatio > 0 ? aspectRatio : 1, overflow: "hidden", backgroundColor: colors.secondary }, children: !missing && failed !== version ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.Image, { source: source != null ? source : { uri: src }, accessible: !decorative, accessibilityLabel: decorative ? void 0 : alt, resizeMode: fit, style: { position: "absolute", inset: 0, width: "100%", height: "100%" }, onLoad: () => {
|
|
10027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessibilityElementsHidden: decorative, importantForAccessibility: decorative ? "no-hide-descendants" : "auto", "aria-hidden": decorative || void 0, style: { width: "100%", aspectRatio: aspectRatio > 0 ? aspectRatio : 1, overflow: "hidden", backgroundColor: background != null ? background : colors.secondary }, children: !missing && failed !== version ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.Image, { source: source != null ? source : { uri: src }, accessible: !decorative, accessibilityLabel: decorative ? void 0 : alt, resizeMode: fit, style: { position: "absolute", inset: 0, width: "100%", height: "100%" }, onLoad: () => {
|
|
9915
10028
|
if (version === current.current.version) onLoad == null ? void 0 : onLoad();
|
|
9916
10029
|
}, onError: () => {
|
|
9917
10030
|
if (version === current.current.version) {
|
|
9918
10031
|
setFailed(version);
|
|
9919
10032
|
onError == null ? void 0 : onError();
|
|
9920
10033
|
}
|
|
9921
|
-
} }, version) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessible: !decorative, accessibilityRole: "image", accessibilityLabel: decorative ? void 0 : alt, "aria-hidden": decorative || void 0, style: { flex: 1, alignItems: "center", justifyContent: "center" }, children: content(fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunIcon, { name: "image", size:
|
|
10034
|
+
} }, version) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { accessible: !decorative, accessibilityRole: "image", accessibilityLabel: decorative ? void 0 : alt, "aria-hidden": decorative || void 0, style: { flex: 1, alignItems: "center", justifyContent: "center" }, children: content(fallback2 != null ? fallback2 : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunIcon, { name: "image", size: import_tokens61.tokens.extensions.image.fallbackIconSize, color: colors.textSecondary }), { color: colors.textSecondary, fontWeight: typeStyle("control").fontWeight, textAlign: "center" }) }) });
|
|
9922
10035
|
}
|
|
9923
|
-
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", fallback: fallback2, onLoad, onError }) {
|
|
10036
|
+
function KjunAvatar({ src, source, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
9924
10037
|
const m = useKjunMessages();
|
|
9925
10038
|
const { colors } = useKjunStyles(), initial = Array.from(name.trim())[0];
|
|
9926
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { style: { width:
|
|
10039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_native61.View, { style: { width: import_tokens61.tokens.extensions.avatar[size], height: import_tokens61.tokens.extensions.avatar[size], borderRadius: shape === "circle" ? import_tokens61.tokens.radius.radius9999 : import_tokens61.tokens.radius.radius8, overflow: "hidden", flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ImageBackgroundContext.Provider, { value: color, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunImage, { src, source, alt: alt || name || m.user, decorative, fallback: fallback2 != null ? fallback2 : initial ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KText, { style: { ...typeStyle(size === "sm" ? "control" : size === "lg" ? "sectionTitle" : "input"), fontWeight: typeStyle("control").fontWeight, color: textColor != null ? textColor : colors.textSecondary }, children: initial.toLocaleUpperCase() }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(KjunIcon, { name: "user", size: import_tokens61.tokens.extensions.avatar.fallbackIconSizes[size], color: textColor }), onLoad, onError }) }) });
|
|
9927
10040
|
}
|
|
9928
10041
|
|
|
9929
10042
|
// packages/native/src/chip.tsx
|
|
9930
10043
|
var import_react_native62 = require("react-native");
|
|
9931
|
-
var
|
|
10044
|
+
var import_tokens62 = require("@kjun-ui/tokens");
|
|
9932
10045
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
9933
10046
|
function KjunChip({ label, icon, removable = false, disabled = false, size = "md", removeLabel, onRemove }) {
|
|
9934
10047
|
const m = useKjunMessages();
|
|
9935
10048
|
const { colors } = useKjunStyles();
|
|
9936
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap:
|
|
9937
|
-
!!icon && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunIcon, { name: icon, size:
|
|
9938
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KText, { style: { ...typeStyle(
|
|
9939
|
-
removable && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width:
|
|
10049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { alignSelf: "flex-start", maxWidth: "100%", minWidth: 0, flexShrink: 1, flexDirection: "row", alignItems: "center", gap: import_tokens62.tokens.extensions.chip.gap, minHeight: removable ? import_tokens62.tokens.extensions.chip.nativeRemoveSize : import_tokens62.tokens.extensions.chip[size], paddingVertical: removable ? 0 : import_tokens62.tokens.extensions.chip.paddingY, paddingLeft: import_tokens62.tokens.extensions.chip.paddingX, paddingRight: removable ? 0 : import_tokens62.tokens.extensions.chip.paddingX, borderRadius: import_tokens62.tokens.extensions.chip.radius, backgroundColor: colors.secondary, opacity: disabled ? import_tokens62.tokens.states.opacity.disabled : 1 }, children: [
|
|
10050
|
+
!!icon && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunIcon, { name: icon, size: import_tokens62.tokens.extensions.chip.iconSizes[size] }),
|
|
10051
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KText, { style: { ...typeStyle(import_tokens62.tokens.extensions.chip.typography[size]), flexShrink: 1, minWidth: 0 }, children: label }),
|
|
10052
|
+
removable && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(AccessiblePressable, { accessibilityRole: "button", accessibilityLabel: removeLabel || m.remove(label), disabled, accessibilityState: { disabled }, onPress: onRemove, style: { width: import_tokens62.tokens.extensions.chip.nativeRemoveSize, height: import_tokens62.tokens.extensions.chip.nativeRemoveSize, borderRadius: import_tokens62.tokens.extensions.chip.radius, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunIcon, { name: "x", size: import_tokens62.tokens.extensions.chip.removeIconSizes[size] }) })
|
|
9940
10053
|
] });
|
|
9941
10054
|
}
|
|
9942
10055
|
|
|
9943
10056
|
// packages/native/src/fab.tsx
|
|
9944
|
-
var
|
|
10057
|
+
var import_tokens63 = require("@kjun-ui/tokens");
|
|
9945
10058
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
9946
10059
|
function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offsetBottom = 0, onPress }) {
|
|
9947
10060
|
const { colors } = useKjunStyles();
|
|
9948
|
-
const { size, inset, iconSize } =
|
|
10061
|
+
const { size, inset, iconSize } = import_tokens63.tokens.extensions.fab;
|
|
9949
10062
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
9950
10063
|
AccessiblePressable,
|
|
9951
10064
|
{
|
|
@@ -9958,15 +10071,15 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
9958
10071
|
position: "absolute",
|
|
9959
10072
|
right: inset,
|
|
9960
10073
|
bottom: inset + Math.max(0, safeAreaBottom) + Math.max(0, offsetBottom),
|
|
9961
|
-
zIndex:
|
|
10074
|
+
zIndex: import_tokens63.tokens.layers.page.navigation,
|
|
9962
10075
|
width: size,
|
|
9963
10076
|
height: size,
|
|
9964
10077
|
borderRadius: size / 2,
|
|
9965
10078
|
alignItems: "center",
|
|
9966
10079
|
justifyContent: "center",
|
|
9967
10080
|
backgroundColor: pressed ? colors.brandActive : colors.brand,
|
|
9968
|
-
opacity: disabled ?
|
|
9969
|
-
boxShadow: shadowLayers(
|
|
10081
|
+
opacity: disabled ? import_tokens63.tokens.states.opacity.disabled : 1,
|
|
10082
|
+
boxShadow: shadowLayers(import_tokens63.tokens.elevation.floating, colors)
|
|
9970
10083
|
}),
|
|
9971
10084
|
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(KjunIcon, { name: icon, size: iconSize, color: colors.onBrand })
|
|
9972
10085
|
}
|
|
@@ -9976,10 +10089,10 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeAreaBottom = 0, offset
|
|
|
9976
10089
|
// packages/native/src/range-input.tsx
|
|
9977
10090
|
var import_react67 = require("react");
|
|
9978
10091
|
var import_react_native63 = require("react-native");
|
|
9979
|
-
var
|
|
10092
|
+
var import_tokens64 = require("@kjun-ui/tokens");
|
|
9980
10093
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
9981
|
-
var geometry =
|
|
9982
|
-
var targetSize =
|
|
10094
|
+
var geometry = import_tokens64.tokens.extensions.slider;
|
|
10095
|
+
var targetSize = import_tokens64.tokens.native.minimumTouchTarget;
|
|
9983
10096
|
var trackFocus = { tabIndex: -1 };
|
|
9984
10097
|
function RangeInput({
|
|
9985
10098
|
value,
|
|
@@ -9995,7 +10108,7 @@ function RangeInput({
|
|
|
9995
10108
|
}) {
|
|
9996
10109
|
const m = useKjunMessages();
|
|
9997
10110
|
const { colors, numericFontFamily, fontFamily } = useKjunStyles();
|
|
9998
|
-
const domain = (0,
|
|
10111
|
+
const domain = (0, import_tokens64.createSliderDomain)(min, max, step), values = Array.isArray(value) ? value : [value];
|
|
9999
10112
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && values.every(domain.accepts) && (values.length === 1 || values[0] <= values[1]);
|
|
10000
10113
|
const blocked = disabled || !valid;
|
|
10001
10114
|
const effectiveMax = valid ? domain.snap(max) : min;
|
|
@@ -10079,10 +10192,10 @@ function RangeInput({
|
|
|
10079
10192
|
import_react_native63.View,
|
|
10080
10193
|
{
|
|
10081
10194
|
style: {
|
|
10082
|
-
minWidth:
|
|
10195
|
+
minWidth: import_tokens64.tokens.extensions.slider.minimumWidth,
|
|
10083
10196
|
width: "100%",
|
|
10084
|
-
gap:
|
|
10085
|
-
opacity: blocked ?
|
|
10197
|
+
gap: import_tokens64.tokens.dimension.value4,
|
|
10198
|
+
opacity: blocked ? import_tokens64.tokens.states.opacity.disabled : 1
|
|
10086
10199
|
},
|
|
10087
10200
|
children: [
|
|
10088
10201
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
@@ -10092,7 +10205,7 @@ function RangeInput({
|
|
|
10092
10205
|
flexDirection: "row",
|
|
10093
10206
|
alignItems: "baseline",
|
|
10094
10207
|
justifyContent: "space-between",
|
|
10095
|
-
gap:
|
|
10208
|
+
gap: import_tokens64.tokens.dimension.value12,
|
|
10096
10209
|
minWidth: 0
|
|
10097
10210
|
},
|
|
10098
10211
|
children: [
|
|
@@ -10153,7 +10266,7 @@ function RangeInput({
|
|
|
10153
10266
|
{
|
|
10154
10267
|
style: {
|
|
10155
10268
|
height: geometry.track,
|
|
10156
|
-
borderRadius:
|
|
10269
|
+
borderRadius: import_tokens64.tokens.radius.radius9999,
|
|
10157
10270
|
backgroundColor: colors.border
|
|
10158
10271
|
}
|
|
10159
10272
|
}
|
|
@@ -10168,7 +10281,7 @@ function RangeInput({
|
|
|
10168
10281
|
position: "absolute",
|
|
10169
10282
|
top: (targetSize - geometry.track) / 2,
|
|
10170
10283
|
height: geometry.track,
|
|
10171
|
-
borderRadius:
|
|
10284
|
+
borderRadius: import_tokens64.tokens.radius.radius9999,
|
|
10172
10285
|
left: pct(values.length === 2 ? percent(values[0]) : 0),
|
|
10173
10286
|
width: pct(
|
|
10174
10287
|
percent(values[values.length - 1]) - (values.length === 2 ? percent(values[0]) : 0)
|
|
@@ -10214,7 +10327,7 @@ function RangeInput({
|
|
|
10214
10327
|
"aria-valuetext": String(number),
|
|
10215
10328
|
"aria-disabled": blocked,
|
|
10216
10329
|
onKeyDown: (event) => {
|
|
10217
|
-
const next = (0,
|
|
10330
|
+
const next = (0, import_tokens64.sliderKey)(event.key, number, min, max, step);
|
|
10218
10331
|
if (next !== null) {
|
|
10219
10332
|
event.preventDefault();
|
|
10220
10333
|
emit(index, next);
|
|
@@ -10244,14 +10357,14 @@ function RangeInput({
|
|
|
10244
10357
|
style: {
|
|
10245
10358
|
width: geometry.thumb,
|
|
10246
10359
|
height: geometry.thumb,
|
|
10247
|
-
borderRadius:
|
|
10248
|
-
borderWidth:
|
|
10360
|
+
borderRadius: import_tokens64.tokens.radius.radius9999,
|
|
10361
|
+
borderWidth: import_tokens64.tokens.border.controlWidth,
|
|
10249
10362
|
borderColor: !blocked && dragging === index ? colors.brandActive : !blocked && hovered === index ? colors.brandHover : colors.brand,
|
|
10250
10363
|
backgroundColor: colors.surface,
|
|
10251
10364
|
...import_react_native63.Platform.OS === "web" && !blocked && focused === index ? {
|
|
10252
10365
|
outlineStyle: "solid",
|
|
10253
|
-
outlineWidth:
|
|
10254
|
-
outlineOffset:
|
|
10366
|
+
outlineWidth: import_tokens64.tokens.states.focus.width,
|
|
10367
|
+
outlineOffset: import_tokens64.tokens.states.focus.choiceOffset,
|
|
10255
10368
|
outlineColor: colors.focusRing
|
|
10256
10369
|
} : {}
|
|
10257
10370
|
}
|
|
@@ -10277,7 +10390,7 @@ function KjunRangeSlider(props) {
|
|
|
10277
10390
|
// packages/native/src/quantity-stepper.tsx
|
|
10278
10391
|
var import_react68 = require("react");
|
|
10279
10392
|
var import_react_native64 = require("react-native");
|
|
10280
|
-
var
|
|
10393
|
+
var import_tokens65 = require("@kjun-ui/tokens");
|
|
10281
10394
|
|
|
10282
10395
|
// shared/package-runtime/component-icons.ts
|
|
10283
10396
|
var import_minus = __toESM(require("@kjun-ui/icons/icons/minus"), 1);
|
|
@@ -10291,12 +10404,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10291
10404
|
const field = useKjunField();
|
|
10292
10405
|
const invalid = error || !!(field == null ? void 0 : field.error);
|
|
10293
10406
|
const labelledBy = !ariaLabel && (field == null ? void 0 : field.label) && !field.labelHidden ? field.id + "-label" : void 0;
|
|
10294
|
-
const geometry2 =
|
|
10295
|
-
const buttonStyle = { width:
|
|
10296
|
-
const outer =
|
|
10407
|
+
const geometry2 = import_tokens65.tokens.extensions.compound;
|
|
10408
|
+
const buttonStyle = { width: import_tokens65.tokens.input[size].height, paddingHorizontal: 0 };
|
|
10409
|
+
const outer = import_tokens65.tokens.input[size].radius;
|
|
10297
10410
|
const decreaseStyle = { ...buttonStyle, borderRadius: 0, borderTopLeftRadius: outer, borderBottomLeftRadius: outer };
|
|
10298
10411
|
const increaseStyle = { ...buttonStyle, borderRadius: 0, borderTopRightRadius: outer, borderBottomRightRadius: outer };
|
|
10299
|
-
const domain = (0,
|
|
10412
|
+
const domain = (0, import_tokens65.createNumberDomain)({ min, max, step, precision }), valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
|
|
10300
10413
|
const surface = useFieldSurface(size, { disabled: blocked, invalid });
|
|
10301
10414
|
const [draft, setDraft] = (0, import_react68.useState)(String(value));
|
|
10302
10415
|
const inputRef = (0, import_react68.useRef)(null);
|
|
@@ -10333,7 +10446,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10333
10446
|
const key = (event) => {
|
|
10334
10447
|
var _a, _b;
|
|
10335
10448
|
if (blocked) return;
|
|
10336
|
-
const action = (0,
|
|
10449
|
+
const action = (0, import_tokens65.quantityKeyAction)(event, composing.current, dirty.current);
|
|
10337
10450
|
if (!action) return;
|
|
10338
10451
|
(_a = event.preventDefault) == null ? void 0 : _a.call(event);
|
|
10339
10452
|
if (action === "cancel") {
|
|
@@ -10381,12 +10494,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10381
10494
|
input.removeEventListener("compositionend", end);
|
|
10382
10495
|
};
|
|
10383
10496
|
}, []);
|
|
10384
|
-
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height:
|
|
10497
|
+
const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: import_tokens65.tokens.input[size].height, marginTop: -import_tokens65.tokens.input[size].height / 2, borderRadius: surface.spec.radius };
|
|
10385
10498
|
const hug = import_react_native64.Platform.OS === "web" && !block ? { width: "fit-content" } : {};
|
|
10386
10499
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react_native64.View, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
|
|
10387
10500
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
|
|
10388
10501
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CompoundTarget, { square: true, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: m.decreaseQuantity, disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
|
|
10389
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 :
|
|
10502
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : import_tokens65.tokens.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
|
|
10390
10503
|
var _a;
|
|
10391
10504
|
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
10392
10505
|
}, blocked), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
@@ -10415,29 +10528,29 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
10415
10528
|
},
|
|
10416
10529
|
onSubmitEditing: import_react_native64.Platform.OS === "web" ? void 0 : commit,
|
|
10417
10530
|
...import_react_native64.Platform.OS === "web" ? { "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, "aria-labelledby": labelledBy, "aria-describedby": field == null ? void 0 : field.describedBy, "aria-invalid": invalid || void 0, "aria-required": (field == null ? void 0 : field.required) || void 0 } : { onKeyPress: key },
|
|
10418
|
-
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 -
|
|
10531
|
+
style: { width: "100%", minWidth: 0, ...surface.style, borderRadius: 0, borderTopColor: "transparent", borderBottomColor: "transparent", borderLeftColor: "transparent", borderRightColor: "transparent", backgroundColor: !blocked && (surface.active || surface.hovered) ? colors.hover : "transparent", outlineWidth: 0, color: surface.ink, fontFamily, ...inputTypeStyle(size), textAlign: "center", paddingHorizontal: surface.spec.padding - import_tokens65.tokens.border.controlWidth, paddingVertical: 0 }
|
|
10419
10532
|
}
|
|
10420
10533
|
) }),
|
|
10421
10534
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CompoundTarget, { square: true, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(KjunButton, { size, style: increaseStyle, variant: "ghost", ariaLabel: m.increaseQuantity, disabled: blocked || max !== void 0 && value >= max, onPress: () => move(1), prefixIcon: "plus" }) }),
|
|
10422
|
-
(invalid || surface.active) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ?
|
|
10535
|
+
(invalid || surface.active) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react_native64.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, borderWidth: invalid ? import_tokens65.tokens.border.controlWidth : import_tokens65.tokens.states.focus.width, borderColor: invalid ? colors.danger : colors.focusRing } })
|
|
10423
10536
|
] }) });
|
|
10424
10537
|
}
|
|
10425
10538
|
|
|
10426
10539
|
// packages/native/src/time-picker.tsx
|
|
10427
10540
|
var import_react69 = require("react");
|
|
10428
10541
|
var import_react_native65 = require("react-native");
|
|
10429
|
-
var
|
|
10542
|
+
var import_tokens66 = require("@kjun-ui/tokens");
|
|
10430
10543
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10431
10544
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel, onValueChange, onChangeCommit }) {
|
|
10432
10545
|
const m = useKjunMessages();
|
|
10433
10546
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
10434
|
-
const geometry2 =
|
|
10547
|
+
const geometry2 = import_tokens66.tokens.extensions.timePicker, spec = import_tokens66.tokens.input[size];
|
|
10435
10548
|
const { colors } = useKjunStyles();
|
|
10436
10549
|
const first = (0, import_react69.useRef)(null);
|
|
10437
10550
|
const [focused, setFocused] = (0, import_react69.useState)(false), [opened, setOpened] = (0, import_react69.useState)(null);
|
|
10438
10551
|
const field = useKjunField(), uid = (0, import_react69.useId)();
|
|
10439
10552
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
10440
|
-
const domain = (0, import_react69.useMemo)(() => (0,
|
|
10553
|
+
const domain = (0, import_react69.useMemo)(() => (0, import_tokens66.createTimeDomain)({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]), valid = domain.valid && domain.accepts(value);
|
|
10441
10554
|
(0, import_react69.useEffect)(() => {
|
|
10442
10555
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
10443
10556
|
}, [valid]);
|
|
@@ -10455,11 +10568,11 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
10455
10568
|
if (typeof next === "number") change(domain.select(value, index, next));
|
|
10456
10569
|
}, 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 }) }) }) })
|
|
10457
10570
|
] }, label)) }),
|
|
10458
|
-
clearable && value !== null && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { style: { marginVertical: Math.min(0, (spec.height -
|
|
10571
|
+
clearable && value !== null && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { style: { marginVertical: Math.min(0, (spec.height - import_tokens66.tokens.native.minimumTouchTarget) / 2) }, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(FieldClear, { size, label: m.clearValue(ariaLabel), disabled: disabled || !valid, onPress: () => {
|
|
10459
10572
|
var _a;
|
|
10460
10573
|
change(null);
|
|
10461
10574
|
(_a = first.current) == null ? void 0 : _a.focus();
|
|
10462
10575
|
} }) }),
|
|
10463
|
-
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ?
|
|
10576
|
+
!!(error || !!(field == null ? void 0 : field.error) || focused || opened !== null) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_react_native65.View, { pointerEvents: "none", "aria-hidden": true, style: { position: "absolute", inset: 0, borderRadius: spec.radius, borderWidth: error || !!(field == null ? void 0 : field.error) ? import_tokens66.tokens.border.controlWidth : import_tokens66.tokens.states.focus.width, borderColor: error || (field == null ? void 0 : field.error) ? colors.danger : colors.focusRing } })
|
|
10464
10577
|
] });
|
|
10465
10578
|
}
|