@kanso-labs/react-native-kanso-ui 0.9.0 → 0.10.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 -3
- package/dist/autocomplete/index.js +15 -1
- package/dist/autocomplete/index.js.map +1 -1
- package/dist/button/group.d.ts +5 -0
- package/dist/button/group.js +115 -0
- package/dist/button/group.js.map +1 -0
- package/dist/button/index.d.ts +4 -1
- package/dist/button/index.js +44 -22
- package/dist/button/index.js.map +1 -1
- package/dist/button/slots.js +2 -1
- package/dist/button/slots.js.map +1 -1
- package/dist/calendar/index.js +351 -182
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +33 -2
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +5 -0
- package/dist/carousel/arrangement.js +123 -0
- package/dist/carousel/arrangement.js.map +1 -0
- package/dist/chequer/index.js +95 -0
- package/dist/chequer/index.js.map +1 -0
- package/dist/collection/index.d.ts +157 -0
- package/dist/collection/index.js +1331 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/color-thumb/index.js +56 -0
- package/dist/color-thumb/index.js.map +1 -0
- package/dist/components/button/index.d.ts +4 -2
- package/dist/components/button/index.js +227 -188
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +87 -0
- package/dist/components/button-group/index.js +275 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/calendar/index.d.ts +11 -3
- package/dist/components/calendar/index.js +60 -45
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +72 -0
- package/dist/components/carousel/index.js +496 -0
- package/dist/components/carousel/index.js.map +1 -0
- package/dist/components/checkbox-group/index.d.ts +3 -4
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +85 -0
- package/dist/components/color-area/index.js +630 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-field/index.d.ts +144 -0
- package/dist/components/color-field/index.js +516 -0
- package/dist/components/color-field/index.js.map +1 -0
- package/dist/components/color-picker/index.d.ts +74 -0
- package/dist/components/color-picker/index.js +317 -0
- package/dist/components/color-picker/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +82 -0
- package/dist/components/color-slider/index.js +456 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +46 -0
- package/dist/components/color-swatch/index.js +127 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +81 -0
- package/dist/components/color-swatch-picker/index.js +287 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/color-wheel/index.d.ts +71 -0
- package/dist/components/color-wheel/index.js +407 -0
- package/dist/components/color-wheel/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +193 -0
- package/dist/components/combo-box/index.js +616 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +120 -0
- package/dist/components/date-field/index.js +111 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +130 -0
- package/dist/components/date-picker/index.js +310 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +139 -0
- package/dist/components/date-range-picker/index.js +421 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/disclosure/index.d.ts +94 -0
- package/dist/components/disclosure/index.js +365 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +61 -0
- package/dist/components/disclosure-group/index.js +100 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/drop-zone/index.d.ts +113 -0
- package/dist/components/drop-zone/index.js +304 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/fab/index.d.ts +1 -1
- package/dist/components/fab/index.js +91 -76
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/form/index.d.ts +3 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +4 -2
- package/dist/components/icon-button/index.js +204 -171
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/list/index.d.ts +15 -158
- package/dist/components/list/index.js +21 -1047
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +73 -0
- package/dist/components/list-box/index.js +82 -0
- package/dist/components/list-box/index.js.map +1 -0
- package/dist/components/loading-indicator/index.d.ts +32 -0
- package/dist/components/loading-indicator/index.js +174 -0
- package/dist/components/loading-indicator/index.js.map +1 -0
- package/dist/components/navigation-tree/index.d.ts +117 -0
- package/dist/components/navigation-tree/index.js +135 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/number-field/index.js +132 -143
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +69 -0
- package/dist/components/range-calendar/index.js +144 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/search-view/index.d.ts +78 -0
- package/dist/components/search-view/index.js +570 -0
- package/dist/components/search-view/index.js.map +1 -0
- package/dist/components/select/index.d.ts +152 -0
- package/dist/components/select/index.js +419 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/slider/index.d.ts +111 -0
- package/dist/components/slider/index.js +673 -0
- package/dist/components/slider/index.js.map +1 -0
- package/dist/components/split-button/index.d.ts +77 -0
- package/dist/components/split-button/index.js +354 -0
- package/dist/components/split-button/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +196 -0
- package/dist/components/tabs/index.js +1137 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +43 -0
- package/dist/components/time-field/index.js +107 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/time-picker/index.d.ts +65 -0
- package/dist/components/time-picker/index.js +1168 -0
- package/dist/components/time-picker/index.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +101 -0
- package/dist/components/tooltip/index.js +223 -0
- package/dist/components/tooltip/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +112 -0
- package/dist/components/tree/index.js +157 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/disclosure/chevron.js +75 -0
- package/dist/disclosure/chevron.js.map +1 -0
- package/dist/disclosure/index.js +7 -0
- package/dist/disclosure/index.js.map +1 -0
- package/dist/drop/index.d.ts +54 -0
- package/dist/drop/index.js +161 -0
- package/dist/drop/index.js.map +1 -0
- package/dist/field/chevron.js +74 -0
- package/dist/field/chevron.js.map +1 -0
- package/dist/field/index.d.ts +2 -1
- package/dist/field/index.js +310 -154
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +9 -0
- package/dist/field/styles.js.map +1 -1
- package/dist/files/index.d.ts +18 -0
- package/dist/files/index.js +107 -0
- package/dist/files/index.js.map +1 -0
- package/dist/form/index.d.ts +5 -2
- package/dist/form/index.js +64 -85
- package/dist/form/index.js.map +1 -1
- package/dist/glyphs/index.js +92 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/i18n/index.js +20 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js +1394 -34
- package/dist/i18n/messages.js.map +1 -1
- package/dist/index.d.ts +35 -3
- package/dist/index.js +34 -3
- package/dist/indicator/paths.js +23 -1
- package/dist/indicator/paths.js.map +1 -1
- package/dist/modal/index.js +92 -77
- package/dist/modal/index.js.map +1 -1
- package/dist/number/keyboard.js +16 -0
- package/dist/number/keyboard.js.map +1 -0
- package/dist/overlay/anchored.js +68 -38
- package/dist/overlay/anchored.js.map +1 -1
- package/dist/overlay/keyboard.js +57 -0
- package/dist/overlay/keyboard.js.map +1 -0
- package/dist/overlay/panel.js +173 -19
- package/dist/overlay/panel.js.map +1 -1
- package/dist/overlay/placement.js +13 -1
- package/dist/overlay/placement.js.map +1 -1
- package/dist/picker/index.js +322 -0
- package/dist/picker/index.js.map +1 -0
- package/dist/press/index.d.ts +2 -0
- package/dist/press/index.js +102 -100
- package/dist/press/index.js.map +1 -1
- package/dist/row/index.js +77 -69
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +13 -2
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/field.js +277 -0
- package/dist/segments/field.js.map +1 -0
- package/dist/segments/index.js +574 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +24 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/slider/index.js +145 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/swatch/index.js +56 -0
- package/dist/swatch/index.js.map +1 -0
- package/package.json +11 -2
package/dist/press/index.js
CHANGED
|
@@ -77,9 +77,10 @@ function hitSlop(height, width = 48) {
|
|
|
77
77
|
*/
|
|
78
78
|
function usePressFeedback(t0) {
|
|
79
79
|
const $ = c(59);
|
|
80
|
-
const { area, color, corners, disabled, disableRipple: t1, disc, onBlur, onFocus, onHoverIn, onHoverOut, onPressIn, onPressOut, pending, pressedColor:
|
|
80
|
+
const { area, color, corners, disabled, disableRipple: t1, disc, held: t2, onBlur, onFocus, onHoverIn, onHoverOut, onPressIn, onPressOut, pending, pressedColor: t3 } = t0;
|
|
81
81
|
const disableRipple = t1 === void 0 ? false : t1;
|
|
82
|
-
const
|
|
82
|
+
const held = t2 === void 0 ? false : t2;
|
|
83
|
+
const pressedColor = t3 === void 0 ? color : t3;
|
|
83
84
|
const theme = useTheme();
|
|
84
85
|
const reduceMotion = useReducedMotion();
|
|
85
86
|
const [hovered, setHovered] = useState(false);
|
|
@@ -116,9 +117,9 @@ function usePressFeedback(t0) {
|
|
|
116
117
|
width: size
|
|
117
118
|
};
|
|
118
119
|
});
|
|
119
|
-
let
|
|
120
|
+
let t4;
|
|
120
121
|
if ($[0] !== fade || $[1] !== geometry || $[2] !== grow || $[3] !== motion || $[4] !== spacing || $[5] !== stateLayerOpacity) {
|
|
121
|
-
|
|
122
|
+
t4 = function ripple(width, height, origin) {
|
|
122
123
|
const size_0 = Math.max(1, Math.floor(Math.max(width, height) * INITIAL_ORIGIN_SCALE));
|
|
123
124
|
geometry.set({
|
|
124
125
|
end: {
|
|
@@ -149,12 +150,12 @@ function usePressFeedback(t0) {
|
|
|
149
150
|
$[3] = motion;
|
|
150
151
|
$[4] = spacing;
|
|
151
152
|
$[5] = stateLayerOpacity;
|
|
152
|
-
$[6] =
|
|
153
|
-
} else
|
|
154
|
-
const ripple =
|
|
155
|
-
let
|
|
153
|
+
$[6] = t4;
|
|
154
|
+
} else t4 = $[6];
|
|
155
|
+
const ripple = t4;
|
|
156
|
+
let t5;
|
|
156
157
|
if ($[7] !== fade || $[8] !== motion) {
|
|
157
|
-
|
|
158
|
+
t5 = function release() {
|
|
158
159
|
const shown = Date.now() - pressStarted.current;
|
|
159
160
|
fade.set(withDelay(Math.max(0, motion.durationMedium1 - shown), withTiming(0, {
|
|
160
161
|
duration: FADE_OUT,
|
|
@@ -163,51 +164,51 @@ function usePressFeedback(t0) {
|
|
|
163
164
|
};
|
|
164
165
|
$[7] = fade;
|
|
165
166
|
$[8] = motion;
|
|
166
|
-
$[9] =
|
|
167
|
-
} else
|
|
168
|
-
const release =
|
|
169
|
-
let
|
|
167
|
+
$[9] = t5;
|
|
168
|
+
} else t5 = $[9];
|
|
169
|
+
const release = t5;
|
|
170
|
+
let t6;
|
|
170
171
|
if ($[10] !== onBlur) {
|
|
171
|
-
|
|
172
|
+
t6 = (event) => {
|
|
172
173
|
focused.current = false;
|
|
173
174
|
setRingShown(false);
|
|
174
175
|
onBlur?.(event);
|
|
175
176
|
};
|
|
176
177
|
$[10] = onBlur;
|
|
177
|
-
$[11] =
|
|
178
|
-
} else
|
|
179
|
-
let
|
|
178
|
+
$[11] = t6;
|
|
179
|
+
} else t6 = $[11];
|
|
180
|
+
let t7;
|
|
180
181
|
if ($[12] !== onFocus) {
|
|
181
|
-
|
|
182
|
+
t7 = (event_0) => {
|
|
182
183
|
focused.current = true;
|
|
183
184
|
setRingShown(!pressedUnfocused.current);
|
|
184
185
|
pressedUnfocused.current = false;
|
|
185
186
|
onFocus?.(event_0);
|
|
186
187
|
};
|
|
187
188
|
$[12] = onFocus;
|
|
188
|
-
$[13] =
|
|
189
|
-
} else
|
|
190
|
-
let
|
|
189
|
+
$[13] = t7;
|
|
190
|
+
} else t7 = $[13];
|
|
191
|
+
let t8;
|
|
191
192
|
if ($[14] !== onHoverIn) {
|
|
192
|
-
|
|
193
|
+
t8 = (event_1) => {
|
|
193
194
|
setHovered(true);
|
|
194
195
|
onHoverIn?.(event_1);
|
|
195
196
|
};
|
|
196
197
|
$[14] = onHoverIn;
|
|
197
|
-
$[15] =
|
|
198
|
-
} else
|
|
199
|
-
let
|
|
198
|
+
$[15] = t8;
|
|
199
|
+
} else t8 = $[15];
|
|
200
|
+
let t9;
|
|
200
201
|
if ($[16] !== onHoverOut) {
|
|
201
|
-
|
|
202
|
+
t9 = (event_2) => {
|
|
202
203
|
setHovered(false);
|
|
203
204
|
onHoverOut?.(event_2);
|
|
204
205
|
};
|
|
205
206
|
$[16] = onHoverOut;
|
|
206
|
-
$[17] =
|
|
207
|
-
} else
|
|
208
|
-
let
|
|
207
|
+
$[17] = t9;
|
|
208
|
+
} else t9 = $[17];
|
|
209
|
+
let t10;
|
|
209
210
|
if ($[18] !== area || $[19] !== disc || $[20] !== onPressIn || $[21] !== release || $[22] !== ripple || $[23] !== rippled) {
|
|
210
|
-
|
|
211
|
+
t10 = (event_3) => {
|
|
211
212
|
pressedUnfocused.current = !focused.current;
|
|
212
213
|
setPressed(true);
|
|
213
214
|
const fixed = disc === void 0 ? area : {
|
|
@@ -242,11 +243,11 @@ function usePressFeedback(t0) {
|
|
|
242
243
|
$[21] = release;
|
|
243
244
|
$[22] = ripple;
|
|
244
245
|
$[23] = rippled;
|
|
245
|
-
$[24] =
|
|
246
|
-
} else
|
|
247
|
-
let
|
|
246
|
+
$[24] = t10;
|
|
247
|
+
} else t10 = $[24];
|
|
248
|
+
let t11;
|
|
248
249
|
if ($[25] !== onPressOut || $[26] !== release) {
|
|
249
|
-
|
|
250
|
+
t11 = (event_4) => {
|
|
250
251
|
pressedUnfocused.current = false;
|
|
251
252
|
setPressed(false);
|
|
252
253
|
if (phase.current === "shown") release();
|
|
@@ -255,100 +256,101 @@ function usePressFeedback(t0) {
|
|
|
255
256
|
};
|
|
256
257
|
$[25] = onPressOut;
|
|
257
258
|
$[26] = release;
|
|
258
|
-
$[27] =
|
|
259
|
-
} else
|
|
260
|
-
let
|
|
261
|
-
if ($[28] !== t10 || $[29] !==
|
|
262
|
-
|
|
263
|
-
onBlur:
|
|
264
|
-
onFocus:
|
|
265
|
-
onHoverIn:
|
|
266
|
-
onHoverOut:
|
|
267
|
-
onPressIn:
|
|
268
|
-
onPressOut:
|
|
259
|
+
$[27] = t11;
|
|
260
|
+
} else t11 = $[27];
|
|
261
|
+
let t12;
|
|
262
|
+
if ($[28] !== t10 || $[29] !== t11 || $[30] !== t6 || $[31] !== t7 || $[32] !== t8 || $[33] !== t9) {
|
|
263
|
+
t12 = {
|
|
264
|
+
onBlur: t6,
|
|
265
|
+
onFocus: t7,
|
|
266
|
+
onHoverIn: t8,
|
|
267
|
+
onHoverOut: t9,
|
|
268
|
+
onPressIn: t10,
|
|
269
|
+
onPressOut: t11
|
|
269
270
|
};
|
|
270
271
|
$[28] = t10;
|
|
271
|
-
$[29] =
|
|
272
|
+
$[29] = t11;
|
|
272
273
|
$[30] = t6;
|
|
273
274
|
$[31] = t7;
|
|
274
275
|
$[32] = t8;
|
|
275
276
|
$[33] = t9;
|
|
276
|
-
$[34] =
|
|
277
|
-
} else
|
|
278
|
-
const handlers =
|
|
279
|
-
const
|
|
280
|
-
|
|
277
|
+
$[34] = t12;
|
|
278
|
+
} else t12 = $[34];
|
|
279
|
+
const handlers = t12;
|
|
280
|
+
const pressedLayer = interactive && (pressed || held);
|
|
281
|
+
const layerOpacity = !active ? 0 : pressedLayer ? stateLayerOpacity.pressed : ringShown ? stateLayerOpacity.focus : interactive && hovered ? stateLayerOpacity.hover : 0;
|
|
282
|
+
let t13;
|
|
281
283
|
if ($[35] !== corners) {
|
|
282
|
-
|
|
284
|
+
t13 = composeStyles(styles.surface, corners);
|
|
283
285
|
$[35] = corners;
|
|
284
|
-
$[36] =
|
|
285
|
-
} else
|
|
286
|
-
const surface =
|
|
287
|
-
const
|
|
288
|
-
let
|
|
289
|
-
if ($[37] !== layerOpacity || $[38] !==
|
|
290
|
-
|
|
291
|
-
backgroundColor:
|
|
286
|
+
$[36] = t13;
|
|
287
|
+
} else t13 = $[36];
|
|
288
|
+
const surface = t13;
|
|
289
|
+
const t14 = pressedLayer ? pressedColor : color;
|
|
290
|
+
let t15;
|
|
291
|
+
if ($[37] !== layerOpacity || $[38] !== t14) {
|
|
292
|
+
t15 = composeStyles(styles.layer, {
|
|
293
|
+
backgroundColor: t14,
|
|
292
294
|
opacity: layerOpacity
|
|
293
295
|
});
|
|
294
296
|
$[37] = layerOpacity;
|
|
295
|
-
$[38] =
|
|
296
|
-
$[39] =
|
|
297
|
-
} else
|
|
298
|
-
const state =
|
|
299
|
-
const
|
|
300
|
-
let
|
|
297
|
+
$[38] = t14;
|
|
298
|
+
$[39] = t15;
|
|
299
|
+
} else t15 = $[39];
|
|
300
|
+
const state = t15;
|
|
301
|
+
const t16 = interactive && hovered;
|
|
302
|
+
let t17;
|
|
301
303
|
if ($[40] !== state) {
|
|
302
|
-
|
|
304
|
+
t17 = /* @__PURE__ */ jsx(View, { style: state });
|
|
303
305
|
$[40] = state;
|
|
304
|
-
$[41] =
|
|
305
|
-
} else
|
|
306
|
-
let
|
|
306
|
+
$[41] = t17;
|
|
307
|
+
} else t17 = $[41];
|
|
308
|
+
let t18;
|
|
307
309
|
if ($[42] !== rippleMotion || $[43] !== rippled) {
|
|
308
|
-
|
|
310
|
+
t18 = rippled ? /* @__PURE__ */ jsx(Animated.View, { style: rippleMotion }) : null;
|
|
309
311
|
$[42] = rippleMotion;
|
|
310
312
|
$[43] = rippled;
|
|
311
|
-
$[44] =
|
|
312
|
-
} else
|
|
313
|
-
let
|
|
314
|
-
if ($[45] !== surface || $[46] !==
|
|
315
|
-
|
|
313
|
+
$[44] = t18;
|
|
314
|
+
} else t18 = $[44];
|
|
315
|
+
let t19;
|
|
316
|
+
if ($[45] !== surface || $[46] !== t17 || $[47] !== t18) {
|
|
317
|
+
t19 = /* @__PURE__ */ jsxs(View, {
|
|
316
318
|
accessibilityElementsHidden: true,
|
|
317
319
|
importantForAccessibility: "no-hide-descendants",
|
|
318
320
|
style: surface,
|
|
319
|
-
children: [
|
|
321
|
+
children: [t17, t18]
|
|
320
322
|
});
|
|
321
323
|
$[45] = surface;
|
|
322
|
-
$[46] =
|
|
323
|
-
$[47] =
|
|
324
|
-
$[48] =
|
|
325
|
-
} else
|
|
326
|
-
const
|
|
327
|
-
let
|
|
324
|
+
$[46] = t17;
|
|
325
|
+
$[47] = t18;
|
|
326
|
+
$[48] = t19;
|
|
327
|
+
} else t19 = $[48];
|
|
328
|
+
const t20 = interactive && pressed;
|
|
329
|
+
let t21;
|
|
328
330
|
if ($[49] !== active || $[50] !== ringShown || $[51] !== theme) {
|
|
329
|
-
|
|
331
|
+
t21 = active && ringShown ? stylesOf(theme).ring : void 0;
|
|
330
332
|
$[49] = active;
|
|
331
333
|
$[50] = ringShown;
|
|
332
334
|
$[51] = theme;
|
|
333
|
-
$[52] =
|
|
334
|
-
} else
|
|
335
|
-
let
|
|
336
|
-
if ($[53] !== handlers || $[54] !==
|
|
337
|
-
|
|
335
|
+
$[52] = t21;
|
|
336
|
+
} else t21 = $[52];
|
|
337
|
+
let t22;
|
|
338
|
+
if ($[53] !== handlers || $[54] !== t16 || $[55] !== t19 || $[56] !== t20 || $[57] !== t21) {
|
|
339
|
+
t22 = {
|
|
338
340
|
handlers,
|
|
339
|
-
hovered:
|
|
340
|
-
layer:
|
|
341
|
-
pressed:
|
|
342
|
-
ring:
|
|
341
|
+
hovered: t16,
|
|
342
|
+
layer: t19,
|
|
343
|
+
pressed: t20,
|
|
344
|
+
ring: t21
|
|
343
345
|
};
|
|
344
346
|
$[53] = handlers;
|
|
345
|
-
$[54] =
|
|
346
|
-
$[55] =
|
|
347
|
-
$[56] =
|
|
348
|
-
$[57] =
|
|
349
|
-
$[58] =
|
|
350
|
-
} else
|
|
351
|
-
return
|
|
347
|
+
$[54] = t16;
|
|
348
|
+
$[55] = t19;
|
|
349
|
+
$[56] = t20;
|
|
350
|
+
$[57] = t21;
|
|
351
|
+
$[58] = t22;
|
|
352
|
+
} else t22 = $[58];
|
|
353
|
+
return t22;
|
|
352
354
|
}
|
|
353
355
|
//#endregion
|
|
354
356
|
export { hitSlop, usePressFeedback };
|
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","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,MAAMH;EACNI,OAAOJ;EACPK,KAAKR;CACP;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAAS,iBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAA0B,MAAA,EAAAnC,MAAAE,OAAAC,SAAAC,UAAAC,eAAA+B,IAAA9B,MAAA+B,QAAAC,SAAAC,WAAAC,YAAAC,WAAAC,YAAAnC,SAAAC,cAAAmC,OAAAV;CAKx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AAAA;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"}
|
|
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","held","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","t2","onBlur","onFocus","onHoverIn","onHoverOut","onPressIn","onPressOut","t3","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","t4","ripple","origin","size_0","floor","set","hypot","sm","duration","durationLong1","easing","bezier","easingStandard","linear","current","Date","now","t5","release","shown","durationMedium1","t6","event","t7","event_0","t8","event_1","t9","event_2","t10","event_3","fixed","currentTarget","pageX","pageY","nativeEvent","measure","_x","_y","width_0","height_0","Number","isFinite","t11","event_4","t12","pressedLayer","layerOpacity","focus","hover","t13","surface","t14","t15","state","t16","t17","t18","t19","t20","t21","t22","_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 * Draws the pressed layer while true, though nothing presses the control:\n * a split button's menu half while its menu is open, as web's React Aria\n * reports the trigger pressed for as long as its menu shows. It draws no\n * ripple, and `pressed` stays false, since no press is in flight.\n */\n readonly held?: boolean | 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 held = false,\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 pressedLayer = interactive && (pressed || held)\n const layerOpacity = !active\n ? 0\n : pressedLayer\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: pressedLayer ? 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":";;;;;;;;AAoIA,MAAMoD,uBAAuB;AAO7B,MAAMC,UAAU;AAChB,MAAMC,WAAW;AAEjB,MAAMC,YAA4B;CAChCX,KAAK;EAAEtB,GAAG;EAAGC,GAAG;CAAE;CAClBsB,OAAO;CACPC,MAAM;CACNC,OAAO;EAAEzB,GAAG;EAAGC,GAAG;CAAE;AACtB;;;;;;;AAQA,SAASiC,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,eAA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,QAAAiG,KAAA;EAN1DC,MAAA,qBAAC,MAAD;GACE,6BAAA;GAC0B,2BAAA;GACnBP,OAAAA;GAHT,UAAA,CAKEK,KACCC,GANE;;EAOEjG,EAAA,MAAA2F;EAAA3F,EAAA,MAAAgG;EAAAhG,EAAA,MAAAiG;EAAAjG,EAAA,MAAAkG;CAAA,OAAAA,MAAAlG,EAAA;CAEA,MAAAmG,MAAAvE,eAAAlE;CAAsB,IAAA0I;CAAA,IAAApG,EAAA,QAAA2B,UAAA3B,EAAA,QAAAe,aAAAf,EAAA,QAAAW,OAAA;EACzByF,MAAAzE,UAAAZ,YAAsBlE,SAAS8D,KAAK,CAAC,CAAAhD,OAArC8B,KAAAA;EAAsDO,EAAA,MAAA2B;EAAA3B,EAAA,MAAAe;EAAAf,EAAA,MAAAW;EAAAX,EAAA,MAAAoG;CAAA,OAAAA,MAAApG,EAAA;CAAA,IAAAqG;CAAA,IAAArG,EAAA,QAAA3C,YAAA2C,EAAA,QAAA+F,OAAA/F,EAAA,QAAAkG,OAAAlG,EAAA,QAAAmG,OAAAnG,EAAA,QAAAoG,KAAA;EAdvDC,MAAA;GAAAhJ;GAAAG,SAEIuI;GAAsBtI,OAE7ByI;GAOOxI,SAEAyI;GAAsBxI,MACzByI;EACR;EAACpG,EAAA,MAAA3C;EAAA2C,EAAA,MAAA+F;EAAA/F,EAAA,MAAAkG;EAAAlG,EAAA,MAAAmG;EAAAnG,EAAA,MAAAoG;EAAApG,EAAA,MAAAqG;CAAA,OAAAA,MAAArG,EAAA;CAAA,OAfMqG;AAeN"}
|
package/dist/row/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconStyleContext } from "../glyphs/icon-style.js";
|
|
2
2
|
import { useTheme } from "../theme/scope.js";
|
|
3
3
|
import { composeStyles } from "../theme/styles.js";
|
|
4
|
-
import { useTypeRole } from "../typography/roles.js";
|
|
4
|
+
import { nativeWeight, useTypeRole } from "../typography/roles.js";
|
|
5
5
|
import { rowContentColor, rowStyles, rowStylesOf } from "./styles.js";
|
|
6
6
|
import { c } from "react/compiler-runtime";
|
|
7
7
|
import { Text, View } from "react-native";
|
|
@@ -9,6 +9,11 @@ import "react";
|
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/row/index.tsx
|
|
11
11
|
const ICON_SIZE = 24;
|
|
12
|
+
const SELECTED_CONTAINER = {
|
|
13
|
+
drawer: "selectedDrawer",
|
|
14
|
+
list: "selectedList",
|
|
15
|
+
menu: "selectedMenu"
|
|
16
|
+
};
|
|
12
17
|
/** Whether a slot was given something to draw. */
|
|
13
18
|
function hasContent(node) {
|
|
14
19
|
return node !== void 0 && node !== null && node !== false && node !== "";
|
|
@@ -22,19 +27,20 @@ function hasContent(node) {
|
|
|
22
27
|
* `useIconStyle()`. Not a component of the library's own and not exported.
|
|
23
28
|
*/
|
|
24
29
|
function RowContent(t0) {
|
|
25
|
-
const $ = c(
|
|
26
|
-
const { children, isDisabled: t1,
|
|
30
|
+
const $ = c(31);
|
|
31
|
+
const { children, isDisabled: t1, isEmphasized: t2, isSelected: t3, leading, overline, supporting, trailing, variant: t4 } = t0;
|
|
27
32
|
const isDisabled = t1 === void 0 ? false : t1;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
33
|
+
const isEmphasized = t2 === void 0 ? false : t2;
|
|
34
|
+
const isSelected = t3 === void 0 ? false : t3;
|
|
35
|
+
const variant = t4 === void 0 ? "list" : t4;
|
|
30
36
|
const theme = useTheme();
|
|
31
37
|
const own = rowStylesOf(theme);
|
|
32
|
-
const headlineRole = useTypeRole(variant === "
|
|
38
|
+
const headlineRole = useTypeRole(variant === "list" ? "bodyLarge" : "labelLarge");
|
|
33
39
|
const overlineRole = useTypeRole("labelSmall");
|
|
34
40
|
const supportingRole = useTypeRole("bodyMedium");
|
|
35
|
-
let
|
|
41
|
+
let t5;
|
|
36
42
|
if ($[0] !== isDisabled || $[1] !== isSelected || $[2] !== theme || $[3] !== variant) {
|
|
37
|
-
|
|
43
|
+
t5 = rowContentColor(theme, {
|
|
38
44
|
isDisabled,
|
|
39
45
|
isSelected,
|
|
40
46
|
variant
|
|
@@ -43,101 +49,103 @@ function RowContent(t0) {
|
|
|
43
49
|
$[1] = isSelected;
|
|
44
50
|
$[2] = theme;
|
|
45
51
|
$[3] = variant;
|
|
46
|
-
$[4] =
|
|
47
|
-
} else
|
|
48
|
-
const color =
|
|
49
|
-
let
|
|
52
|
+
$[4] = t5;
|
|
53
|
+
} else t5 = $[4];
|
|
54
|
+
const color = t5;
|
|
55
|
+
let t6;
|
|
50
56
|
if ($[5] !== color) {
|
|
51
|
-
|
|
57
|
+
t6 = {
|
|
52
58
|
color,
|
|
53
59
|
size: ICON_SIZE
|
|
54
60
|
};
|
|
55
61
|
$[5] = color;
|
|
56
|
-
$[6] =
|
|
57
|
-
} else
|
|
58
|
-
const icons =
|
|
62
|
+
$[6] = t6;
|
|
63
|
+
} else t6 = $[6];
|
|
64
|
+
const icons = t6;
|
|
59
65
|
const tone = isDisabled || isSelected ? { color } : own.muted;
|
|
60
66
|
const T0 = IconStyleContext;
|
|
61
|
-
let
|
|
67
|
+
let t7;
|
|
62
68
|
if ($[7] !== leading) {
|
|
63
|
-
|
|
69
|
+
t7 = hasContent(leading) ? /* @__PURE__ */ jsx(View, {
|
|
64
70
|
style: rowStyles.slot,
|
|
65
71
|
children: leading
|
|
66
72
|
}) : null;
|
|
67
73
|
$[7] = leading;
|
|
68
|
-
$[8] =
|
|
69
|
-
} else
|
|
74
|
+
$[8] = t7;
|
|
75
|
+
} else t7 = $[8];
|
|
70
76
|
const T1 = View;
|
|
71
|
-
const
|
|
72
|
-
const
|
|
77
|
+
const t8 = own.main;
|
|
78
|
+
const t9 = hasContent(overline) ? /* @__PURE__ */ jsx(Text, {
|
|
73
79
|
style: composeStyles(overlineRole, tone),
|
|
74
80
|
children: overline
|
|
75
81
|
}) : null;
|
|
76
|
-
let
|
|
77
|
-
if ($[9] !== color || $[10] !== headlineRole) {
|
|
78
|
-
|
|
82
|
+
let t10;
|
|
83
|
+
if ($[9] !== color || $[10] !== headlineRole || $[11] !== isEmphasized || $[12] !== theme) {
|
|
84
|
+
t10 = composeStyles(headlineRole, { color }, isEmphasized ? { fontWeight: nativeWeight(theme.typography.weightBold) } : void 0);
|
|
79
85
|
$[9] = color;
|
|
80
86
|
$[10] = headlineRole;
|
|
81
|
-
$[11] =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
$[11] = isEmphasized;
|
|
88
|
+
$[12] = theme;
|
|
89
|
+
$[13] = t10;
|
|
90
|
+
} else t10 = $[13];
|
|
91
|
+
let t11;
|
|
92
|
+
if ($[14] !== children || $[15] !== t10) {
|
|
93
|
+
t11 = /* @__PURE__ */ jsx(Text, {
|
|
94
|
+
style: t10,
|
|
87
95
|
children
|
|
88
96
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
} else
|
|
93
|
-
const
|
|
97
|
+
$[14] = children;
|
|
98
|
+
$[15] = t10;
|
|
99
|
+
$[16] = t11;
|
|
100
|
+
} else t11 = $[16];
|
|
101
|
+
const t12 = hasContent(supporting) ? /* @__PURE__ */ jsx(Text, {
|
|
94
102
|
style: composeStyles(supportingRole, tone),
|
|
95
103
|
children: supporting
|
|
96
104
|
}) : null;
|
|
97
|
-
let
|
|
98
|
-
if ($[
|
|
99
|
-
|
|
100
|
-
style:
|
|
105
|
+
let t13;
|
|
106
|
+
if ($[17] !== T1 || $[18] !== own || $[19] !== t11 || $[20] !== t12 || $[21] !== t9) {
|
|
107
|
+
t13 = /* @__PURE__ */ jsxs(T1, {
|
|
108
|
+
style: t8,
|
|
101
109
|
children: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
t9,
|
|
111
|
+
t11,
|
|
112
|
+
t12
|
|
105
113
|
]
|
|
106
114
|
});
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[18] = t11;
|
|
111
|
-
$[19] = t8;
|
|
115
|
+
$[17] = T1;
|
|
116
|
+
$[18] = own;
|
|
117
|
+
$[19] = t11;
|
|
112
118
|
$[20] = t12;
|
|
113
|
-
|
|
114
|
-
let t13;
|
|
115
|
-
if ($[21] !== trailing) {
|
|
116
|
-
t13 = hasContent(trailing) ? /* @__PURE__ */ jsx(View, {
|
|
117
|
-
style: rowStyles.slot,
|
|
118
|
-
children: trailing
|
|
119
|
-
}) : null;
|
|
120
|
-
$[21] = trailing;
|
|
119
|
+
$[21] = t9;
|
|
121
120
|
$[22] = t13;
|
|
122
121
|
} else t13 = $[22];
|
|
123
122
|
let t14;
|
|
124
|
-
if ($[23] !==
|
|
125
|
-
t14 = /* @__PURE__ */
|
|
123
|
+
if ($[23] !== trailing) {
|
|
124
|
+
t14 = hasContent(trailing) ? /* @__PURE__ */ jsx(View, {
|
|
125
|
+
style: rowStyles.slot,
|
|
126
|
+
children: trailing
|
|
127
|
+
}) : null;
|
|
128
|
+
$[23] = trailing;
|
|
129
|
+
$[24] = t14;
|
|
130
|
+
} else t14 = $[24];
|
|
131
|
+
let t15;
|
|
132
|
+
if ($[25] !== T0 || $[26] !== icons || $[27] !== t13 || $[28] !== t14 || $[29] !== t7) {
|
|
133
|
+
t15 = /* @__PURE__ */ jsxs(T0, {
|
|
126
134
|
value: icons,
|
|
127
135
|
children: [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
t7,
|
|
137
|
+
t13,
|
|
138
|
+
t14
|
|
131
139
|
]
|
|
132
140
|
});
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[26] = t13;
|
|
137
|
-
$[27] = t6;
|
|
141
|
+
$[25] = T0;
|
|
142
|
+
$[26] = icons;
|
|
143
|
+
$[27] = t13;
|
|
138
144
|
$[28] = t14;
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
$[29] = t7;
|
|
146
|
+
$[30] = t15;
|
|
147
|
+
} else t15 = $[30];
|
|
148
|
+
return t15;
|
|
141
149
|
}
|
|
142
150
|
/**
|
|
143
151
|
* The style of the view around a row's content: the padding and gap, the
|
|
@@ -150,7 +158,7 @@ function RowContent(t0) {
|
|
|
150
158
|
function rowStyleOf(theme, { isSelected = false, overline, supporting, variant = "list" }) {
|
|
151
159
|
const own = rowStylesOf(theme);
|
|
152
160
|
const lines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);
|
|
153
|
-
return composeStyles(own.base, own[variant], lines === 1 ? own.twoLine : void 0, lines === 2 ? own.threeLine : void 0, isSelected ? own[variant
|
|
161
|
+
return composeStyles(own.base, own[variant], lines === 1 ? own.twoLine : void 0, lines === 2 ? own.threeLine : void 0, isSelected ? own[SELECTED_CONTAINER[variant]] : void 0);
|
|
154
162
|
}
|
|
155
163
|
//#endregion
|
|
156
164
|
export { RowContent, hasContent, rowContentColor, rowStyleOf, rowStyles };
|