@kanso-labs/react-native-kanso-ui 0.5.0 → 0.7.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/README.md +4 -1
- package/dist/badge/index.js +74 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/badge/styles.js +51 -0
- package/dist/badge/styles.js.map +1 -0
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/pending.js +1 -1
- package/dist/button/slots.d.ts +2 -2
- package/dist/calendar/index.js +1182 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/calendar/styles.js +120 -0
- package/dist/calendar/styles.js.map +1 -0
- package/dist/chip/index.js +2 -2
- package/dist/components/app-bar/index.d.ts +111 -0
- package/dist/components/app-bar/index.js +341 -0
- package/dist/components/app-bar/index.js.map +1 -0
- package/dist/components/avatar/index.d.ts +1 -1
- package/dist/components/button/index.d.ts +1 -1
- package/dist/components/button/index.js +2 -2
- package/dist/components/calendar/index.d.ts +51 -0
- package/dist/components/calendar/index.js +82 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/index.js +3 -3
- package/dist/components/checkbox/index.d.ts +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/index.d.ts +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip-group/index.d.ts +1 -1
- package/dist/components/chip-group/index.js +4 -4
- package/dist/components/copy-field/index.d.ts +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/currency/index.d.ts +1 -1
- package/dist/components/currency/index.js +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/icon-button/index.d.ts +1 -1
- package/dist/components/icon-button/index.js +2 -2
- package/dist/components/link/index.d.ts +1 -1
- package/dist/components/link/index.js +3 -3
- package/dist/components/list/index.d.ts +1 -1
- package/dist/components/list/index.js +5 -5
- package/dist/components/list-detail/index.d.ts +56 -0
- package/dist/components/list-detail/index.js +169 -0
- package/dist/components/list-detail/index.js.map +1 -0
- package/dist/components/list-item/index.d.ts +1 -1
- package/dist/components/list-item/index.js +1 -1
- package/dist/components/menu/index.d.ts +1 -1
- package/dist/components/menu/index.js +7 -7
- package/dist/components/meter/index.d.ts +1 -1
- package/dist/components/meter/index.js +1 -1
- package/dist/components/navigation-bar/index.d.ts +164 -0
- package/dist/components/navigation-bar/index.js +470 -0
- package/dist/components/navigation-bar/index.js.map +1 -0
- package/dist/components/navigation-rail/index.d.ts +68 -0
- package/dist/components/navigation-rail/index.js +294 -0
- package/dist/components/navigation-rail/index.js.map +1 -0
- package/dist/components/number-field/index.d.ts +1 -1
- package/dist/components/number-field/index.js +5 -5
- package/dist/components/popover/index.d.ts +1 -1
- package/dist/components/popover/index.js +3 -3
- package/dist/components/product-icon/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.d.ts +1 -1
- package/dist/components/progress-indicator/index.js +3 -3
- package/dist/components/radio-group/index.d.ts +1 -1
- package/dist/components/radio-group/index.js +3 -3
- package/dist/components/search-field/index.d.ts +1 -1
- package/dist/components/search-field/index.js +5 -5
- package/dist/components/segmented-button/index.d.ts +1 -1
- package/dist/components/segmented-button/index.js +5 -5
- package/dist/components/separator/index.d.ts +1 -1
- package/dist/components/separator/index.js +1 -1
- package/dist/components/sheet/index.d.ts +1 -1
- package/dist/components/sheet/index.js +3 -3
- package/dist/components/snackbar/index.d.ts +1 -1
- package/dist/components/snackbar/index.js +4 -4
- package/dist/components/stack/index.d.ts +1 -1
- package/dist/components/stack/index.js +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/switch/index.js +4 -4
- package/dist/components/text/index.d.ts +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/text-field/index.d.ts +1 -1
- package/dist/components/text-field/index.js +1 -1
- package/dist/control/checkbox-box.js +2 -2
- package/dist/control/index.js +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +4 -4
- package/dist/form/index.d.ts +1 -1
- package/dist/glyphs/index.js +21 -3
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useAppBarScroll.d.ts +56 -0
- package/dist/hooks/useAppBarScroll.js +87 -0
- package/dist/hooks/useAppBarScroll.js.map +1 -0
- package/dist/i18n/messages.js +374 -0
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +10 -4
- package/dist/indicator/index.d.ts +2 -2
- package/dist/indicator/index.js +3 -3
- package/dist/indicator/motion.js +1 -1
- package/dist/mark/index.d.ts +1 -1
- package/dist/mark/index.js +2 -2
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +2 -2
- package/dist/navigation/index.d.ts +36 -0
- package/dist/navigation/index.js +454 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/styles.js +83 -0
- package/dist/navigation/styles.js.map +1 -0
- package/dist/overlay/anchored.d.ts +2 -2
- package/dist/overlay/anchored.js +1 -1
- package/dist/overlay/host.d.ts +2 -2
- package/dist/overlay/host.js +1 -1
- package/dist/overlay/panel.js +2 -2
- package/dist/press/index.js +75 -69
- package/dist/press/index.js.map +1 -1
- package/dist/router/index.js +1 -1
- package/dist/row/index.js +1 -1
- package/dist/theme/scope.js +1 -1
- package/dist/theme-scope.d.ts +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/typography/fonts.js +1 -1
- package/package.json +4 -3
package/dist/press/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { useTheme } from "../theme/scope.js";
|
|
|
2
2
|
import { composeStyles } from "../theme/styles.js";
|
|
3
3
|
import { styles, stylesOf } from "./styles.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
-
import { useRef, useState } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { View } from "react-native";
|
|
8
6
|
import Animated, { Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withDelay, withTiming } from "react-native-reanimated";
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
const INITIAL_ORIGIN_SCALE = .2;
|
|
10
10
|
const FADE_IN = 105;
|
|
11
11
|
const FADE_OUT = 375;
|
|
@@ -59,7 +59,8 @@ function hitSlop(height, width = 48) {
|
|
|
59
59
|
*
|
|
60
60
|
* A control whose layer is a disc of its own beside its label, as a
|
|
61
61
|
* checkbox's is, passes the disc's side as `disc`, and its ripple grows from
|
|
62
|
-
* the disc's centre instead. One whose
|
|
62
|
+
* the disc's centre instead. One whose layer is drawn on a part of it of a
|
|
63
|
+
* fixed size passes that size as `area`, with the same effect. One whose pressed layer takes another colour
|
|
63
64
|
* passes it as `pressedColor`.
|
|
64
65
|
*
|
|
65
66
|
* The ring shows when focus arrives from a keyboard, and not when it arrives
|
|
@@ -75,8 +76,8 @@ function hitSlop(height, width = 48) {
|
|
|
75
76
|
* ```
|
|
76
77
|
*/
|
|
77
78
|
function usePressFeedback(t0) {
|
|
78
|
-
const $ = c(
|
|
79
|
-
const { color, corners, disabled, disableRipple: t1, disc, onBlur, onFocus, onHoverIn, onHoverOut, onPressIn, onPressOut, pending, pressedColor: t2 } = t0;
|
|
79
|
+
const $ = c(59);
|
|
80
|
+
const { area, color, corners, disabled, disableRipple: t1, disc, onBlur, onFocus, onHoverIn, onHoverOut, onPressIn, onPressOut, pending, pressedColor: t2 } = t0;
|
|
80
81
|
const disableRipple = t1 === void 0 ? false : t1;
|
|
81
82
|
const pressedColor = t2 === void 0 ? color : t2;
|
|
82
83
|
const theme = useTheme();
|
|
@@ -205,14 +206,18 @@ function usePressFeedback(t0) {
|
|
|
205
206
|
$[17] = t8;
|
|
206
207
|
} else t8 = $[17];
|
|
207
208
|
let t9;
|
|
208
|
-
if ($[18] !==
|
|
209
|
+
if ($[18] !== area || $[19] !== disc || $[20] !== onPressIn || $[21] !== release || $[22] !== ripple || $[23] !== rippled) {
|
|
209
210
|
t9 = (event_3) => {
|
|
210
211
|
pressedUnfocused.current = !focused.current;
|
|
211
212
|
setPressed(true);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
const fixed = disc === void 0 ? area : {
|
|
214
|
+
height: disc,
|
|
215
|
+
width: disc
|
|
216
|
+
};
|
|
217
|
+
if (rippled && fixed !== void 0) {
|
|
218
|
+
ripple(fixed.width, fixed.height, {
|
|
219
|
+
x: fixed.width / 2,
|
|
220
|
+
y: fixed.height / 2
|
|
216
221
|
});
|
|
217
222
|
phase.current = "shown";
|
|
218
223
|
} else if (rippled && typeof event_3.currentTarget !== "number") {
|
|
@@ -231,15 +236,16 @@ function usePressFeedback(t0) {
|
|
|
231
236
|
}
|
|
232
237
|
onPressIn?.(event_3);
|
|
233
238
|
};
|
|
234
|
-
$[18] =
|
|
235
|
-
$[19] =
|
|
236
|
-
$[20] =
|
|
237
|
-
$[21] =
|
|
238
|
-
$[22] =
|
|
239
|
-
$[23] =
|
|
240
|
-
|
|
239
|
+
$[18] = area;
|
|
240
|
+
$[19] = disc;
|
|
241
|
+
$[20] = onPressIn;
|
|
242
|
+
$[21] = release;
|
|
243
|
+
$[22] = ripple;
|
|
244
|
+
$[23] = rippled;
|
|
245
|
+
$[24] = t9;
|
|
246
|
+
} else t9 = $[24];
|
|
241
247
|
let t10;
|
|
242
|
-
if ($[
|
|
248
|
+
if ($[25] !== onPressOut || $[26] !== release) {
|
|
243
249
|
t10 = (event_4) => {
|
|
244
250
|
pressedUnfocused.current = false;
|
|
245
251
|
setPressed(false);
|
|
@@ -247,12 +253,12 @@ function usePressFeedback(t0) {
|
|
|
247
253
|
phase.current = phase.current === "measuring" ? "released" : "idle";
|
|
248
254
|
onPressOut?.(event_4);
|
|
249
255
|
};
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
} else t10 = $[
|
|
256
|
+
$[25] = onPressOut;
|
|
257
|
+
$[26] = release;
|
|
258
|
+
$[27] = t10;
|
|
259
|
+
} else t10 = $[27];
|
|
254
260
|
let t11;
|
|
255
|
-
if ($[
|
|
261
|
+
if ($[28] !== t10 || $[29] !== t5 || $[30] !== t6 || $[31] !== t7 || $[32] !== t8 || $[33] !== t9) {
|
|
256
262
|
t11 = {
|
|
257
263
|
onBlur: t5,
|
|
258
264
|
onFocus: t6,
|
|
@@ -261,73 +267,73 @@ function usePressFeedback(t0) {
|
|
|
261
267
|
onPressIn: t9,
|
|
262
268
|
onPressOut: t10
|
|
263
269
|
};
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
} else t11 = $[
|
|
270
|
+
$[28] = t10;
|
|
271
|
+
$[29] = t5;
|
|
272
|
+
$[30] = t6;
|
|
273
|
+
$[31] = t7;
|
|
274
|
+
$[32] = t8;
|
|
275
|
+
$[33] = t9;
|
|
276
|
+
$[34] = t11;
|
|
277
|
+
} else t11 = $[34];
|
|
272
278
|
const handlers = t11;
|
|
273
279
|
const layerOpacity = !active ? 0 : interactive && pressed ? stateLayerOpacity.pressed : ringShown ? stateLayerOpacity.focus : interactive && hovered ? stateLayerOpacity.hover : 0;
|
|
274
280
|
let t12;
|
|
275
|
-
if ($[
|
|
281
|
+
if ($[35] !== corners) {
|
|
276
282
|
t12 = composeStyles(styles.surface, corners);
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
} else t12 = $[
|
|
283
|
+
$[35] = corners;
|
|
284
|
+
$[36] = t12;
|
|
285
|
+
} else t12 = $[36];
|
|
280
286
|
const surface = t12;
|
|
281
287
|
const t13 = interactive && pressed ? pressedColor : color;
|
|
282
288
|
let t14;
|
|
283
|
-
if ($[
|
|
289
|
+
if ($[37] !== layerOpacity || $[38] !== t13) {
|
|
284
290
|
t14 = composeStyles(styles.layer, {
|
|
285
291
|
backgroundColor: t13,
|
|
286
292
|
opacity: layerOpacity
|
|
287
293
|
});
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
} else t14 = $[
|
|
294
|
+
$[37] = layerOpacity;
|
|
295
|
+
$[38] = t13;
|
|
296
|
+
$[39] = t14;
|
|
297
|
+
} else t14 = $[39];
|
|
292
298
|
const state = t14;
|
|
293
299
|
const t15 = interactive && hovered;
|
|
294
300
|
let t16;
|
|
295
|
-
if ($[
|
|
301
|
+
if ($[40] !== state) {
|
|
296
302
|
t16 = /* @__PURE__ */ jsx(View, { style: state });
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
} else t16 = $[
|
|
303
|
+
$[40] = state;
|
|
304
|
+
$[41] = t16;
|
|
305
|
+
} else t16 = $[41];
|
|
300
306
|
let t17;
|
|
301
|
-
if ($[
|
|
307
|
+
if ($[42] !== rippleMotion || $[43] !== rippled) {
|
|
302
308
|
t17 = rippled ? /* @__PURE__ */ jsx(Animated.View, { style: rippleMotion }) : null;
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
} else t17 = $[
|
|
309
|
+
$[42] = rippleMotion;
|
|
310
|
+
$[43] = rippled;
|
|
311
|
+
$[44] = t17;
|
|
312
|
+
} else t17 = $[44];
|
|
307
313
|
let t18;
|
|
308
|
-
if ($[
|
|
314
|
+
if ($[45] !== surface || $[46] !== t16 || $[47] !== t17) {
|
|
309
315
|
t18 = /* @__PURE__ */ jsxs(View, {
|
|
310
316
|
accessibilityElementsHidden: true,
|
|
311
317
|
importantForAccessibility: "no-hide-descendants",
|
|
312
318
|
style: surface,
|
|
313
319
|
children: [t16, t17]
|
|
314
320
|
});
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
} else t18 = $[
|
|
321
|
+
$[45] = surface;
|
|
322
|
+
$[46] = t16;
|
|
323
|
+
$[47] = t17;
|
|
324
|
+
$[48] = t18;
|
|
325
|
+
} else t18 = $[48];
|
|
320
326
|
const t19 = interactive && pressed;
|
|
321
327
|
let t20;
|
|
322
|
-
if ($[
|
|
328
|
+
if ($[49] !== active || $[50] !== ringShown || $[51] !== theme) {
|
|
323
329
|
t20 = active && ringShown ? stylesOf(theme).ring : void 0;
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
} else t20 = $[
|
|
330
|
+
$[49] = active;
|
|
331
|
+
$[50] = ringShown;
|
|
332
|
+
$[51] = theme;
|
|
333
|
+
$[52] = t20;
|
|
334
|
+
} else t20 = $[52];
|
|
329
335
|
let t21;
|
|
330
|
-
if ($[
|
|
336
|
+
if ($[53] !== handlers || $[54] !== t15 || $[55] !== t18 || $[56] !== t19 || $[57] !== t20) {
|
|
331
337
|
t21 = {
|
|
332
338
|
handlers,
|
|
333
339
|
hovered: t15,
|
|
@@ -335,13 +341,13 @@ function usePressFeedback(t0) {
|
|
|
335
341
|
pressed: t19,
|
|
336
342
|
ring: t20
|
|
337
343
|
};
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
} else t21 = $[
|
|
344
|
+
$[53] = handlers;
|
|
345
|
+
$[54] = t15;
|
|
346
|
+
$[55] = t18;
|
|
347
|
+
$[56] = t19;
|
|
348
|
+
$[57] = t20;
|
|
349
|
+
$[58] = t21;
|
|
350
|
+
} else t21 = $[58];
|
|
345
351
|
return t21;
|
|
346
352
|
}
|
|
347
353
|
//#endregion
|
package/dist/press/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","Insets","PressableProps","ViewStyle","useRef","useState","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withDelay","withTiming","useTheme","composeStyles","styles","stylesOf","Corners","Pick","Handlers","Point","x","y","PressFeedback","handlers","NonNullable","Name","hovered","layer","pressed","ring","PressFeedbackOptions","color","corners","disabled","disableRipple","disc","pending","pressedColor","RippleGeometry","end","scale","size","start","RipplePhase","TARGET_SIZE","INITIAL_ORIGIN_SCALE","FADE_IN","FADE_OUT","NO_RIPPLE","hitSlop","height","width","vertical","Math","max","horizontal","undefined","bottom","left","right","top","usePressFeedback","t0","$","_c","t1","onBlur","onFocus","onHoverIn","onHoverOut","onPressIn","onPressOut","t2","theme","reduceMotion","setHovered","setPressed","ringShown","setRingShown","focused","pressedUnfocused","pressStarted","phase","geometry","grow","fade","motion","spacing","stateLayerOpacity","active","interactive","rippled","rippleMotion","get","progress","backgroundColor","borderRadius","opacity","position","transform","translateX","translateY","t3","ripple","origin","size_0","floor","set","hypot","sm","duration","durationLong1","easing","bezier","easingStandard","linear","current","Date","now","t4","release","shown","durationMedium1","t5","event","t6","event_0","t7","event_1","t8","event_2","t9","event_3","currentTarget","pageX","pageY","nativeEvent","measure","_x","_y","width_0","height_0","Number","isFinite","t10","event_4","t11","layerOpacity","focus","hover","t12","surface","t13","t14","state","t15","t16","t17","t18","t19","t20","t21","_c"],"sources":["../../src/press/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Insets, PressableProps, ViewStyle } from 'react-native'\n\nimport { useRef, useState } from 'react'\nimport { View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withDelay,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { styles, stylesOf } from './styles'\n\n/** The corners a control is drawn with, which its feedback clips to. */\ntype Corners = Pick<\n ViewStyle,\n | 'borderBottomEndRadius'\n | 'borderBottomStartRadius'\n | 'borderRadius'\n | 'borderTopEndRadius'\n | 'borderTopStartRadius'\n>\n\n/** The handlers the feedback reads its states from. */\ntype Handlers = Pick<\n PressableProps,\n 'onBlur' | 'onFocus' | 'onHoverIn' | 'onHoverOut' | 'onPressIn' | 'onPressOut'\n>\n\ntype Point = { readonly x: number; readonly y: number }\n\ntype PressFeedback = {\n /**\n * The handlers to hand the control's `Pressable`. Each calls the one of\n * the same name it was given after its own.\n */\n readonly handlers: {\n readonly [Name in keyof Handlers]-?: NonNullable<Handlers[Name]>\n }\n /**\n * Whether a pointer is over the control, for a control that draws more\n * than the layer while hovered. Never while disabled or pending.\n */\n readonly hovered: boolean\n /** The state layer and the ripple, to render as the `Pressable`'s first child. */\n readonly layer: ReactNode\n /**\n * Whether the control is pressed, for a control that draws more than the\n * layer while pressed. Never while disabled or pending.\n */\n readonly pressed: boolean\n /** The focus ring while it shows, to compose into the control's style. */\n readonly ring: undefined | ViewStyle\n}\n\ntype PressFeedbackOptions = Handlers & {\n /**\n * The colour the layer and the ripple are drawn in: the theme's value for\n * the control's content colour role.\n */\n readonly color: string\n /** The control's corners, which the layer and the ripple clip to. */\n readonly corners?: Corners | undefined\n readonly disabled?: boolean | null | undefined\n /**\n * Draws no ripple and leaves the state layer, as `disableRipple` does on\n * web's Button.\n */\n readonly disableRipple?: boolean | undefined\n /**\n * The side of a round layer of a fixed size, for a control whose state\n * layer is a disc beside its label rather than the whole control: a\n * checkbox's. The ripple then grows from the disc's centre wherever the\n * press lands, and nothing is measured. Left out, the ripple grows from\n * the press point across the control.\n */\n readonly disc?: number | undefined\n /**\n * Takes no press or hover while true, with no layer and no ripple for\n * either, and keeps the focus and its ring, as a pending button does.\n */\n readonly pending?: boolean | undefined\n /**\n * The colour the pressed layer and the ripple are drawn in, where it\n * differs from the hover and focus layers': a checkbox's swaps between\n * primary and on surface once pressed. Defaults to `color`.\n */\n readonly pressedColor?: string | undefined\n}\n\n/** Where the ripple starts and ends, and how far it grows, for one press. */\ntype RippleGeometry = {\n readonly end: Point\n readonly scale: number\n readonly size: number\n readonly start: Point\n}\n\n// Where the ripple of the latest press is: waiting on the control's\n// measurement, shown, or released before the measurement arrived.\ntype RipplePhase = 'idle' | 'measuring' | 'released' | 'shown'\n\n/**\n * The least a touch target measures each way, from Material Design's\n * accessibility guidance. A floor rather than a token, as web's `TARGET_SIZE`\n * is: a theme changes how big a control is drawn, never how small a target\n * may be.\n */\nconst TARGET_SIZE = 48\n\n// The ripple starts as a disc a fifth of the control's longer side, as on web.\nconst INITIAL_ORIGIN_SCALE = 0.2\n\n// The fade, in milliseconds: quick in and slow out, so a tap reads as a ripple\n// rather than a flicker. These are web's, and deliberately not motion tokens:\n// the two are tuned as a ratio to each other, which snapping either to the\n// scale would undo. Linear for the same reason, since a fade to and from a\n// state layer wants no acceleration.\nconst FADE_IN = 105\nconst FADE_OUT = 375\n\nconst NO_RIPPLE: RippleGeometry = {\n end: { x: 0, y: 0 },\n scale: 1,\n size: 0,\n start: { x: 0, y: 0 },\n}\n\n/**\n * The `hitSlop` that brings a control smaller than 48dp up to a 48dp target,\n * centred on it, as web's controls draw their target with a `::before`.\n * Nothing for a control already that big. A width left out is taken to be\n * wide enough, as a labelled button's is.\n */\nfunction hitSlop(height: number, width = TARGET_SIZE): Insets | undefined {\n const vertical = Math.max(0, (TARGET_SIZE - height) / 2)\n const horizontal = Math.max(0, (TARGET_SIZE - width) / 2)\n\n if (vertical === 0 && horizontal === 0) {\n return undefined\n }\n\n return {\n bottom: vertical,\n left: horizontal,\n right: horizontal,\n top: vertical,\n }\n}\n\n/**\n * The press feedback every interactive control draws: the state layer, the\n * ripple and the focus ring, as Material Design's state layers page sets them\n * out.\n *\n * The state layer is the control's content colour at the state's opacity\n * token, over the whole control: hover for an iPad pointer or an Android\n * mouse, focus while the ring shows, pressed while pressed. React Native has\n * no `color-mix()`, so it is a view of its own rather than a blended\n * background.\n *\n * The ripple grows from the press point to cover the control and fades out\n * once the press ends, held at least `durationMedium1` so a tap reads, and is\n * drawn the same on iOS and Android rather than through Android's own\n * `android_ripple`. It is a solid disc where web's has a soft edge, since\n * React Native draws a gradient only through an experimental style that React\n * Native Web ignores. It is not drawn while the device asks for reduced\n * motion, where the pressed layer alone marks the press.\n *\n * A control whose layer is a disc of its own beside its label, as a\n * checkbox's is, passes the disc's side as `disc`, and its ripple grows from\n * the disc's centre instead. One whose pressed layer takes another colour\n * passes it as `pressedColor`.\n *\n * The ring shows when focus arrives from a keyboard, and not when it arrives\n * with a press, which on web is a click focusing what it presses.\n *\n * ```tsx\n * const feedback = usePressFeedback({ color: colors.onPrimary, corners, onPressIn })\n *\n * <Pressable {...feedback.handlers} style={[styles.button, feedback.ring]}>\n * {feedback.layer}\n * <Text>Label</Text>\n * </Pressable>\n * ```\n */\nfunction usePressFeedback({\n color,\n corners,\n disabled,\n disableRipple = false,\n disc,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pending,\n pressedColor = color,\n}: PressFeedbackOptions): PressFeedback {\n const theme = useTheme()\n const reduceMotion = useReducedMotion()\n const [hovered, setHovered] = useState(false)\n const [pressed, setPressed] = useState(false)\n const [ringShown, setRingShown] = useState(false)\n const focused = useRef(false)\n // Whether the press in flight began while the control had no focus, which\n // makes the focus that follows it a pointer's.\n const pressedUnfocused = useRef(false)\n const pressStarted = useRef(0)\n const phase = useRef<RipplePhase>('idle')\n const geometry = useSharedValue(NO_RIPPLE)\n const grow = useSharedValue(0)\n const fade = useSharedValue(0)\n\n const { motion, spacing, stateLayerOpacity } = theme\n const active = disabled !== true\n const interactive = active && pending !== true\n const rippled = interactive && !disableRipple && !reduceMotion\n\n const rippleMotion = useAnimatedStyle(() => {\n 'worklet'\n const { end, scale, size, start } = geometry.get()\n const progress = grow.get()\n\n // The whole style is the animation's, so the view takes the one object it\n // hands back.\n return {\n backgroundColor: pressedColor,\n borderRadius: size / 2,\n height: size,\n left: 0,\n opacity: fade.get(),\n position: 'absolute',\n top: 0,\n transform: [\n { translateX: start.x + (end.x - start.x) * progress },\n { translateY: start.y + (end.y - start.y) * progress },\n { scale: 1 + (scale - 1) * progress },\n ],\n width: size,\n }\n })\n\n // Grows a disc a fifth of the control's longer side from the press point\n // to the centre, until it covers the control and `spacing.sm` beyond its\n // corners, as web's does.\n function ripple(width: number, height: number, origin: Point) {\n const size = Math.max(\n 1,\n Math.floor(Math.max(width, height) * INITIAL_ORIGIN_SCALE),\n )\n\n geometry.set({\n end: { x: (width - size) / 2, y: (height - size) / 2 },\n scale: (Math.hypot(width, height) + spacing.sm) / size,\n size,\n start: { x: origin.x - size / 2, y: origin.y - size / 2 },\n })\n grow.set(0)\n grow.set(\n withTiming(1, {\n duration: motion.durationLong1,\n easing: Easing.bezier(...motion.easingStandard),\n }),\n )\n fade.set(\n withTiming(stateLayerOpacity.pressed, {\n duration: FADE_IN,\n easing: Easing.linear,\n }),\n )\n pressStarted.current = Date.now()\n }\n\n // Fades the ripple out, once it has been shown for `durationMedium1`.\n function release() {\n const shown = Date.now() - pressStarted.current\n\n fade.set(\n withDelay(\n Math.max(0, motion.durationMedium1 - shown),\n withTiming(0, { duration: FADE_OUT, easing: Easing.linear }),\n ),\n )\n }\n\n const handlers: PressFeedback['handlers'] = {\n onBlur: (event) => {\n focused.current = false\n setRingShown(false)\n onBlur?.(event)\n },\n onFocus: (event) => {\n focused.current = true\n setRingShown(!pressedUnfocused.current)\n pressedUnfocused.current = false\n onFocus?.(event)\n },\n onHoverIn: (event) => {\n setHovered(true)\n onHoverIn?.(event)\n },\n onHoverOut: (event) => {\n setHovered(false)\n onHoverOut?.(event)\n },\n onPressIn: (event) => {\n pressedUnfocused.current = !focused.current\n setPressed(true)\n\n if (rippled && disc !== undefined) {\n ripple(disc, disc, { x: disc / 2, y: disc / 2 })\n phase.current = 'shown'\n } else if (rippled && typeof event.currentTarget !== 'number') {\n const { pageX, pageY } = event.nativeEvent\n\n // A touch's own location is measured from whichever child it landed\n // on, so the point is taken from the page and the control measured\n // there. A press from a key carries no point, and ripples from the\n // centre. React Native Web measures a frame later, so a press can end\n // first, and its ripple is then drawn whole. React Native types the\n // target as a bare view tag too, which has nothing to measure.\n phase.current = 'measuring'\n event.currentTarget.measure((_x, _y, width, height, left, top) => {\n ripple(width, height, {\n x: Number.isFinite(pageX - left) ? pageX - left : width / 2,\n y: Number.isFinite(pageY - top) ? pageY - top : height / 2,\n })\n\n if (phase.current === 'released') {\n release()\n phase.current = 'idle'\n } else {\n phase.current = 'shown'\n }\n })\n }\n\n onPressIn?.(event)\n },\n onPressOut: (event) => {\n pressedUnfocused.current = false\n setPressed(false)\n\n if (phase.current === 'shown') {\n release()\n }\n phase.current = phase.current === 'measuring' ? 'released' : 'idle'\n\n onPressOut?.(event)\n },\n }\n\n const layerOpacity = !active\n ? 0\n : interactive && pressed\n ? stateLayerOpacity.pressed\n : ringShown\n ? stateLayerOpacity.focus\n : interactive && hovered\n ? stateLayerOpacity.hover\n : 0\n const surface = composeStyles<ViewStyle>(styles.surface, corners)\n const state = composeStyles<ViewStyle>(styles.layer, {\n backgroundColor: interactive && pressed ? pressedColor : color,\n opacity: layerOpacity,\n })\n\n return {\n handlers,\n hovered: interactive && hovered,\n layer: (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={surface}\n >\n <View style={state} />\n {rippled ? <Animated.View style={rippleMotion} /> : null}\n </View>\n ),\n pressed: interactive && pressed,\n ring: active && ringShown ? stylesOf(theme).ring : undefined,\n }\n}\n\nexport { hitSlop, TARGET_SIZE, usePressFeedback }\nexport type { Corners, PressFeedback, PressFeedbackOptions }\n"],"mappings":";;;;;;;;AAoHA,MAAM+C,uBAAuB;AAO7B,MAAMC,UAAU;AAChB,MAAMC,WAAW;AAEjB,MAAMC,YAA4B;CAChCT,KAAK;EAAEnB,GAAG;EAAGC,GAAG;CAAE;CAClBmB,OAAO;CACPC,MAAM;CACNC,OAAO;EAAEtB,GAAG;EAAGC,GAAG;CAAE;AACtB;;;;;;;AAQA,SAAS4B,QAAQC,QAAgBC,QAAAA,IAAyC;CACxE,MAAMC,WAAWC,KAAKC,IAAI,IAAA,KAAkBJ,UAAU,CAAC;CACvD,MAAMK,aAAaF,KAAKC,IAAI,IAAA,KAAkBH,SAAS,CAAC;CAExD,IAAIC,aAAa,KAAKG,eAAe,GACn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AA,IAAAjG,EAAA,QAAA0B,UAAA1B,EAAA,QAAAc,aAAAd,EAAA,QAAAU,OAAA;EACzBuF,MAAAvE,UAAAZ,YAAsB9D,SAAS0D,KAAK,CAAC,CAAA5C,OAArC2B,KAAAA;EAAsDO,EAAA,MAAA0B;EAAA1B,EAAA,MAAAc;EAAAd,EAAA,MAAAU;EAAAV,EAAA,MAAAiG;CAAA,OAAAA,MAAAjG,EAAA;CAAA,IAAAkG;CAAA,IAAAlG,EAAA,QAAAxC,YAAAwC,EAAA,QAAA4F,OAAA5F,EAAA,QAAA+F,OAAA/F,EAAA,QAAAgG,OAAAhG,EAAA,QAAAiG,KAAA;EAdvDC,MAAA;GAAA1I;GAAAG,SAEIiI;GAAsBhI,OAE7BmI;GAOOlI,SAEAmI;GAAsBlI,MACzBmI;EACR;EAACjG,EAAA,MAAAxC;EAAAwC,EAAA,MAAA4F;EAAA5F,EAAA,MAAA+F;EAAA/F,EAAA,MAAAgG;EAAAhG,EAAA,MAAAiG;EAAAjG,EAAA,MAAAkG;CAAA,OAAAA,MAAAlG,EAAA;CAAA,OAfMkG;AAeN"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","Insets","PressableProps","ViewStyle","useRef","useState","View","Animated","Easing","useAnimatedStyle","useReducedMotion","useSharedValue","withDelay","withTiming","useTheme","composeStyles","styles","stylesOf","Corners","Pick","Handlers","Point","x","y","PressFeedback","handlers","NonNullable","Name","hovered","layer","pressed","ring","PressFeedbackOptions","area","Size","color","corners","disabled","disableRipple","disc","pending","pressedColor","RippleGeometry","end","scale","size","start","RipplePhase","height","width","TARGET_SIZE","INITIAL_ORIGIN_SCALE","FADE_IN","FADE_OUT","NO_RIPPLE","hitSlop","vertical","Math","max","horizontal","undefined","bottom","left","right","top","usePressFeedback","t0","$","_c","t1","onBlur","onFocus","onHoverIn","onHoverOut","onPressIn","onPressOut","t2","theme","reduceMotion","setHovered","setPressed","ringShown","setRingShown","focused","pressedUnfocused","pressStarted","phase","geometry","grow","fade","motion","spacing","stateLayerOpacity","active","interactive","rippled","rippleMotion","get","progress","backgroundColor","borderRadius","opacity","position","transform","translateX","translateY","t3","ripple","origin","size_0","floor","set","hypot","sm","duration","durationLong1","easing","bezier","easingStandard","linear","current","Date","now","t4","release","shown","durationMedium1","t5","event","t6","event_0","t7","event_1","t8","event_2","t9","event_3","fixed","currentTarget","pageX","pageY","nativeEvent","measure","_x","_y","width_0","height_0","Number","isFinite","t10","event_4","t11","layerOpacity","focus","hover","t12","surface","t13","t14","state","t15","t16","t17","t18","t19","t20","t21","_c"],"sources":["../../src/press/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Insets, PressableProps, ViewStyle } from 'react-native'\n\nimport { useRef, useState } from 'react'\nimport { View } from 'react-native'\nimport Animated, {\n Easing,\n useAnimatedStyle,\n useReducedMotion,\n useSharedValue,\n withDelay,\n withTiming,\n} from 'react-native-reanimated'\n\nimport { useTheme } from '../theme/scope'\nimport { composeStyles } from '../theme/styles'\nimport { styles, stylesOf } from './styles'\n\n/** The corners a control is drawn with, which its feedback clips to. */\ntype Corners = Pick<\n ViewStyle,\n | 'borderBottomEndRadius'\n | 'borderBottomStartRadius'\n | 'borderRadius'\n | 'borderTopEndRadius'\n | 'borderTopStartRadius'\n>\n\n/** The handlers the feedback reads its states from. */\ntype Handlers = Pick<\n PressableProps,\n 'onBlur' | 'onFocus' | 'onHoverIn' | 'onHoverOut' | 'onPressIn' | 'onPressOut'\n>\n\ntype Point = { readonly x: number; readonly y: number }\n\ntype PressFeedback = {\n /**\n * The handlers to hand the control's `Pressable`. Each calls the one of\n * the same name it was given after its own.\n */\n readonly handlers: {\n readonly [Name in keyof Handlers]-?: NonNullable<Handlers[Name]>\n }\n /**\n * Whether a pointer is over the control, for a control that draws more\n * than the layer while hovered. Never while disabled or pending.\n */\n readonly hovered: boolean\n /** The state layer and the ripple, to render as the `Pressable`'s first child. */\n readonly layer: ReactNode\n /**\n * Whether the control is pressed, for a control that draws more than the\n * layer while pressed. Never while disabled or pending.\n */\n readonly pressed: boolean\n /** The focus ring while it shows, to compose into the control's style. */\n readonly ring: undefined | ViewStyle\n}\n\ntype PressFeedbackOptions = Handlers & {\n /**\n * The size of a layer drawn on a part of the control rather than across\n * it, as a navigation destination draws its layer on the indicator behind\n * its icon. The ripple then grows from that part's centre wherever the\n * press lands, and nothing is measured, as for `disc`.\n */\n readonly area?: Size | undefined\n /**\n * The colour the layer and the ripple are drawn in: the theme's value for\n * the control's content colour role.\n */\n readonly color: string\n /** The control's corners, which the layer and the ripple clip to. */\n readonly corners?: Corners | undefined\n readonly disabled?: boolean | null | undefined\n /**\n * Draws no ripple and leaves the state layer, as `disableRipple` does on\n * web's Button.\n */\n readonly disableRipple?: boolean | undefined\n /**\n * The side of a round layer of a fixed size, for a control whose state\n * layer is a disc beside its label rather than the whole control: a\n * checkbox's. The ripple then grows from the disc's centre wherever the\n * press lands, and nothing is measured. Left out, the ripple grows from\n * the press point across the control.\n */\n readonly disc?: number | undefined\n /**\n * Takes no press or hover while true, with no layer and no ripple for\n * either, and keeps the focus and its ring, as a pending button does.\n */\n readonly pending?: boolean | undefined\n /**\n * The colour the pressed layer and the ripple are drawn in, where it\n * differs from the hover and focus layers': a checkbox's swaps between\n * primary and on surface once pressed. Defaults to `color`.\n */\n readonly pressedColor?: string | undefined\n}\n\n/** Where the ripple starts and ends, and how far it grows, for one press. */\ntype RippleGeometry = {\n readonly end: Point\n readonly scale: number\n readonly size: number\n readonly start: Point\n}\n\n// Where the ripple of the latest press is: waiting on the control's\n// measurement, shown, or released before the measurement arrived.\ntype RipplePhase = 'idle' | 'measuring' | 'released' | 'shown'\n\ntype Size = { readonly height: number; readonly width: number }\n\n/**\n * The least a touch target measures each way, from Material Design's\n * accessibility guidance. A floor rather than a token, as web's `TARGET_SIZE`\n * is: a theme changes how big a control is drawn, never how small a target\n * may be.\n */\nconst TARGET_SIZE = 48\n\n// The ripple starts as a disc a fifth of the control's longer side, as on web.\nconst INITIAL_ORIGIN_SCALE = 0.2\n\n// The fade, in milliseconds: quick in and slow out, so a tap reads as a ripple\n// rather than a flicker. These are web's, and deliberately not motion tokens:\n// the two are tuned as a ratio to each other, which snapping either to the\n// scale would undo. Linear for the same reason, since a fade to and from a\n// state layer wants no acceleration.\nconst FADE_IN = 105\nconst FADE_OUT = 375\n\nconst NO_RIPPLE: RippleGeometry = {\n end: { x: 0, y: 0 },\n scale: 1,\n size: 0,\n start: { x: 0, y: 0 },\n}\n\n/**\n * The `hitSlop` that brings a control smaller than 48dp up to a 48dp target,\n * centred on it, as web's controls draw their target with a `::before`.\n * Nothing for a control already that big. A width left out is taken to be\n * wide enough, as a labelled button's is.\n */\nfunction hitSlop(height: number, width = TARGET_SIZE): Insets | undefined {\n const vertical = Math.max(0, (TARGET_SIZE - height) / 2)\n const horizontal = Math.max(0, (TARGET_SIZE - width) / 2)\n\n if (vertical === 0 && horizontal === 0) {\n return undefined\n }\n\n return {\n bottom: vertical,\n left: horizontal,\n right: horizontal,\n top: vertical,\n }\n}\n\n/**\n * The press feedback every interactive control draws: the state layer, the\n * ripple and the focus ring, as Material Design's state layers page sets them\n * out.\n *\n * The state layer is the control's content colour at the state's opacity\n * token, over the whole control: hover for an iPad pointer or an Android\n * mouse, focus while the ring shows, pressed while pressed. React Native has\n * no `color-mix()`, so it is a view of its own rather than a blended\n * background.\n *\n * The ripple grows from the press point to cover the control and fades out\n * once the press ends, held at least `durationMedium1` so a tap reads, and is\n * drawn the same on iOS and Android rather than through Android's own\n * `android_ripple`. It is a solid disc where web's has a soft edge, since\n * React Native draws a gradient only through an experimental style that React\n * Native Web ignores. It is not drawn while the device asks for reduced\n * motion, where the pressed layer alone marks the press.\n *\n * A control whose layer is a disc of its own beside its label, as a\n * checkbox's is, passes the disc's side as `disc`, and its ripple grows from\n * the disc's centre instead. One whose layer is drawn on a part of it of a\n * fixed size passes that size as `area`, with the same effect. One whose pressed layer takes another colour\n * passes it as `pressedColor`.\n *\n * The ring shows when focus arrives from a keyboard, and not when it arrives\n * with a press, which on web is a click focusing what it presses.\n *\n * ```tsx\n * const feedback = usePressFeedback({ color: colors.onPrimary, corners, onPressIn })\n *\n * <Pressable {...feedback.handlers} style={[styles.button, feedback.ring]}>\n * {feedback.layer}\n * <Text>Label</Text>\n * </Pressable>\n * ```\n */\nfunction usePressFeedback({\n area,\n color,\n corners,\n disabled,\n disableRipple = false,\n disc,\n onBlur,\n onFocus,\n onHoverIn,\n onHoverOut,\n onPressIn,\n onPressOut,\n pending,\n pressedColor = color,\n}: PressFeedbackOptions): PressFeedback {\n const theme = useTheme()\n const reduceMotion = useReducedMotion()\n const [hovered, setHovered] = useState(false)\n const [pressed, setPressed] = useState(false)\n const [ringShown, setRingShown] = useState(false)\n const focused = useRef(false)\n // Whether the press in flight began while the control had no focus, which\n // makes the focus that follows it a pointer's.\n const pressedUnfocused = useRef(false)\n const pressStarted = useRef(0)\n const phase = useRef<RipplePhase>('idle')\n const geometry = useSharedValue(NO_RIPPLE)\n const grow = useSharedValue(0)\n const fade = useSharedValue(0)\n\n const { motion, spacing, stateLayerOpacity } = theme\n const active = disabled !== true\n const interactive = active && pending !== true\n const rippled = interactive && !disableRipple && !reduceMotion\n\n const rippleMotion = useAnimatedStyle(() => {\n 'worklet'\n const { end, scale, size, start } = geometry.get()\n const progress = grow.get()\n\n // The whole style is the animation's, so the view takes the one object it\n // hands back.\n return {\n backgroundColor: pressedColor,\n borderRadius: size / 2,\n height: size,\n left: 0,\n opacity: fade.get(),\n position: 'absolute',\n top: 0,\n transform: [\n { translateX: start.x + (end.x - start.x) * progress },\n { translateY: start.y + (end.y - start.y) * progress },\n { scale: 1 + (scale - 1) * progress },\n ],\n width: size,\n }\n })\n\n // Grows a disc a fifth of the control's longer side from the press point\n // to the centre, until it covers the control and `spacing.sm` beyond its\n // corners, as web's does.\n function ripple(width: number, height: number, origin: Point) {\n const size = Math.max(\n 1,\n Math.floor(Math.max(width, height) * INITIAL_ORIGIN_SCALE),\n )\n\n geometry.set({\n end: { x: (width - size) / 2, y: (height - size) / 2 },\n scale: (Math.hypot(width, height) + spacing.sm) / size,\n size,\n start: { x: origin.x - size / 2, y: origin.y - size / 2 },\n })\n grow.set(0)\n grow.set(\n withTiming(1, {\n duration: motion.durationLong1,\n easing: Easing.bezier(...motion.easingStandard),\n }),\n )\n fade.set(\n withTiming(stateLayerOpacity.pressed, {\n duration: FADE_IN,\n easing: Easing.linear,\n }),\n )\n pressStarted.current = Date.now()\n }\n\n // Fades the ripple out, once it has been shown for `durationMedium1`.\n function release() {\n const shown = Date.now() - pressStarted.current\n\n fade.set(\n withDelay(\n Math.max(0, motion.durationMedium1 - shown),\n withTiming(0, { duration: FADE_OUT, easing: Easing.linear }),\n ),\n )\n }\n\n const handlers: PressFeedback['handlers'] = {\n onBlur: (event) => {\n focused.current = false\n setRingShown(false)\n onBlur?.(event)\n },\n onFocus: (event) => {\n focused.current = true\n setRingShown(!pressedUnfocused.current)\n pressedUnfocused.current = false\n onFocus?.(event)\n },\n onHoverIn: (event) => {\n setHovered(true)\n onHoverIn?.(event)\n },\n onHoverOut: (event) => {\n setHovered(false)\n onHoverOut?.(event)\n },\n onPressIn: (event) => {\n pressedUnfocused.current = !focused.current\n setPressed(true)\n\n const fixed = disc === undefined ? area : { height: disc, width: disc }\n\n if (rippled && fixed !== undefined) {\n ripple(fixed.width, fixed.height, {\n x: fixed.width / 2,\n y: fixed.height / 2,\n })\n phase.current = 'shown'\n } else if (rippled && typeof event.currentTarget !== 'number') {\n const { pageX, pageY } = event.nativeEvent\n\n // A touch's own location is measured from whichever child it landed\n // on, so the point is taken from the page and the control measured\n // there. A press from a key carries no point, and ripples from the\n // centre. React Native Web measures a frame later, so a press can end\n // first, and its ripple is then drawn whole. React Native types the\n // target as a bare view tag too, which has nothing to measure.\n phase.current = 'measuring'\n event.currentTarget.measure((_x, _y, width, height, left, top) => {\n ripple(width, height, {\n x: Number.isFinite(pageX - left) ? pageX - left : width / 2,\n y: Number.isFinite(pageY - top) ? pageY - top : height / 2,\n })\n\n if (phase.current === 'released') {\n release()\n phase.current = 'idle'\n } else {\n phase.current = 'shown'\n }\n })\n }\n\n onPressIn?.(event)\n },\n onPressOut: (event) => {\n pressedUnfocused.current = false\n setPressed(false)\n\n if (phase.current === 'shown') {\n release()\n }\n phase.current = phase.current === 'measuring' ? 'released' : 'idle'\n\n onPressOut?.(event)\n },\n }\n\n const layerOpacity = !active\n ? 0\n : interactive && pressed\n ? stateLayerOpacity.pressed\n : ringShown\n ? stateLayerOpacity.focus\n : interactive && hovered\n ? stateLayerOpacity.hover\n : 0\n const surface = composeStyles<ViewStyle>(styles.surface, corners)\n const state = composeStyles<ViewStyle>(styles.layer, {\n backgroundColor: interactive && pressed ? pressedColor : color,\n opacity: layerOpacity,\n })\n\n return {\n handlers,\n hovered: interactive && hovered,\n layer: (\n <View\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={surface}\n >\n <View style={state} />\n {rippled ? <Animated.View style={rippleMotion} /> : null}\n </View>\n ),\n pressed: interactive && pressed,\n ring: active && ringShown ? stylesOf(theme).ring : undefined,\n }\n}\n\nexport { hitSlop, TARGET_SIZE, usePressFeedback }\nexport type { Corners, PressFeedback, PressFeedbackOptions }\n"],"mappings":";;;;;;;;AA6HA,MAAMmD,uBAAuB;AAO7B,MAAMC,UAAU;AAChB,MAAMC,WAAW;AAEjB,MAAMC,YAA4B;CAChCX,KAAK;EAAErB,GAAG;EAAGC,GAAG;CAAE;CAClBqB,OAAO;CACPC,MAAM;CACNC,OAAO;EAAExB,GAAG;EAAGC,GAAG;CAAE;AACtB;;;;;;;AAQA,SAASgC,QAAQP,QAAgBC,QAAAA,IAAyC;CACxE,MAAMO,WAAWC,KAAKC,IAAI,IAAA,KAAkBV,UAAU,CAAC;CACvD,MAAMW,aAAaF,KAAKC,IAAI,IAAA,KAAkBT,SAAS,CAAC;CAExD,IAAIO,aAAa,KAAKG,eAAe,GACnC;CAGF,OAAO;EACLE,QAAQL;EACRM,MAAM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EAAAzF,EAAA,MAAA8F;EAAA9F,EAAA,MAAA+F;EAAA/F,EAAA,MAAAgG;CAAA,OAAAA,MAAAhG,EAAA;CAEA,MAAAiG,MAAAtE,eAAAhE;CAAsB,IAAAuI;CAAA,IAAAlG,EAAA,QAAA0B,UAAA1B,EAAA,QAAAc,aAAAd,EAAA,QAAAU,OAAA;EACzBwF,MAAAxE,UAAAZ,YAAsBhE,SAAS4D,KAAK,CAAC,CAAA9C,OAArC6B,KAAAA;EAAsDO,EAAA,MAAA0B;EAAA1B,EAAA,MAAAc;EAAAd,EAAA,MAAAU;EAAAV,EAAA,MAAAkG;CAAA,OAAAA,MAAAlG,EAAA;CAAA,IAAAmG;CAAA,IAAAnG,EAAA,QAAA1C,YAAA0C,EAAA,QAAA6F,OAAA7F,EAAA,QAAAgG,OAAAhG,EAAA,QAAAiG,OAAAjG,EAAA,QAAAkG,KAAA;EAdvDC,MAAA;GAAA7I;GAAAG,SAEIoI;GAAsBnI,OAE7BsI;GAOOrI,SAEAsI;GAAsBrI,MACzBsI;EACR;EAAClG,EAAA,MAAA1C;EAAA0C,EAAA,MAAA6F;EAAA7F,EAAA,MAAAgG;EAAAhG,EAAA,MAAAiG;EAAAjG,EAAA,MAAAkG;EAAAlG,EAAA,MAAAmG;CAAA,OAAAA,MAAAnG,EAAA;CAAA,OAfMmG;AAeN"}
|
package/dist/router/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c } from "react/compiler-runtime";
|
|
2
|
+
import { Linking } from "react-native";
|
|
2
3
|
import { createContext, use } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { Linking } from "react-native";
|
|
5
5
|
//#region src/router/index.tsx
|
|
6
6
|
const SCHEME = /^[a-z][\d+.a-z-]*:/iu;
|
|
7
7
|
const RouterContext = createContext(null);
|
package/dist/row/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import { composeStyles } from "../theme/styles.js";
|
|
|
4
4
|
import { useTypeRole } from "../typography/roles.js";
|
|
5
5
|
import { rowContentColor, rowStyles, rowStylesOf } from "./styles.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
|
+
import { Text, View } from "react-native";
|
|
7
8
|
import "react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { Text, View } from "react-native";
|
|
10
10
|
//#region src/row/index.tsx
|
|
11
11
|
const ICON_SIZE = 24;
|
|
12
12
|
/** Whether a slot was given something to draw. */
|
package/dist/theme/scope.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { dark, light } from "../tokens/defaults.js";
|
|
2
2
|
import { resolveTheme } from "./resolve.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import { createContext, use } from "react";
|
|
5
4
|
import { useColorScheme } from "react-native";
|
|
5
|
+
import { createContext, use } from "react";
|
|
6
6
|
//#region src/theme/scope.ts
|
|
7
7
|
const DEFAULTS = {
|
|
8
8
|
dark,
|
package/dist/theme-scope.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KuiTheme } from "./tokens/defaults.js";
|
|
2
|
-
import { ComponentRef, Ref } from "react";
|
|
3
2
|
import { View, ViewProps } from "react-native";
|
|
3
|
+
import { ComponentRef, Ref } from "react";
|
|
4
4
|
//#region src/theme-scope.d.ts
|
|
5
5
|
type ThemeScopeProps = ViewProps & {
|
|
6
6
|
readonly ref?: Ref<ComponentRef<typeof View>>;
|
package/dist/theme-scope.js
CHANGED
|
@@ -2,9 +2,9 @@ import { ScopeContext, merged, scopeFor, useScope } from "./theme/scope.js";
|
|
|
2
2
|
import { themedStyles } from "./theme/styles.js";
|
|
3
3
|
import { OverlayHost, OverlayHostContext } from "./overlay/host.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { StyleSheet, View } from "react-native";
|
|
5
6
|
import { use } from "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { StyleSheet, View } from "react-native";
|
|
8
8
|
//#region src/theme-scope.tsx
|
|
9
9
|
const stylesOf = themedStyles(({ colors }) => StyleSheet.create({ pinned: { backgroundColor: colors.surface } }));
|
|
10
10
|
/**
|
package/dist/typography/fonts.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanso-labs/react-native-kanso-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Kanso UI's Material Design components for React Native, themed through the same --kui-* design tokens as the web library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"author": "Kanso Labs <kanso.labs.org@gmail.com>",
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@internationalized/date": "3.12.4",
|
|
52
53
|
"@internationalized/number": "3.6.9",
|
|
53
54
|
"react-stately": "3.51.0"
|
|
54
55
|
},
|
|
@@ -61,8 +62,8 @@
|
|
|
61
62
|
"@commitlint/config-conventional": "21.2.3",
|
|
62
63
|
"@eslint/js": "10.0.1",
|
|
63
64
|
"@jest/globals": "29.7.0",
|
|
64
|
-
"@kanso-labs/kanso-ui": "0.43.
|
|
65
|
-
"@kanso-labs/unplugin-style-dictionary": "0.10.
|
|
65
|
+
"@kanso-labs/kanso-ui": "0.43.6",
|
|
66
|
+
"@kanso-labs/unplugin-style-dictionary": "0.10.34",
|
|
66
67
|
"@react-native/babel-preset": "0.88.0",
|
|
67
68
|
"@react-native/jest-preset": "0.88.0",
|
|
68
69
|
"@rolldown/plugin-babel": "0.2.4",
|