@onlynative/components 0.1.0-alpha.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appbar/index.js +75 -123
- package/dist/button/index.js +33 -111
- package/dist/card/index.js +20 -89
- package/dist/checkbox/index.js +11 -65
- package/dist/chip/index.js +33 -110
- package/dist/icon-button/index.js +33 -87
- package/dist/index.d.ts +1 -0
- package/dist/index.js +535 -517
- package/dist/keyboard-avoiding-wrapper/index.d.ts +36 -0
- package/dist/keyboard-avoiding-wrapper/index.js +98 -0
- package/dist/list/index.js +5 -50
- package/dist/radio/index.js +8 -35
- package/dist/switch/index.js +13 -67
- package/dist/text-field/index.js +27 -69
- package/dist/typography/index.js +9 -0
- package/package.json +13 -3
- package/src/appbar/AppBar.tsx +1 -1
- package/src/button/Button.tsx +4 -1
- package/src/button/styles.ts +1 -2
- package/src/card/styles.ts +1 -2
- package/src/checkbox/Checkbox.tsx +5 -1
- package/src/checkbox/styles.ts +1 -1
- package/src/chip/Chip.tsx +7 -1
- package/src/chip/styles.ts +1 -2
- package/src/icon-button/IconButton.tsx +6 -2
- package/src/icon-button/styles.ts +1 -1
- package/src/index.ts +3 -0
- package/src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx +69 -0
- package/src/keyboard-avoiding-wrapper/index.ts +2 -0
- package/src/keyboard-avoiding-wrapper/styles.ts +10 -0
- package/src/keyboard-avoiding-wrapper/types.ts +37 -0
- package/src/list/styles.ts +1 -1
- package/src/radio/styles.ts +1 -1
- package/src/switch/Switch.tsx +4 -1
- package/src/switch/styles.ts +1 -1
- package/src/text-field/TextField.tsx +4 -1
- package/src/text-field/styles.ts +1 -2
- package/src/typography/Typography.tsx +15 -1
- package/src/test-utils/render-with-theme.tsx +0 -13
- package/src/utils/color.ts +0 -64
- package/src/utils/elevation.ts +0 -33
- package/src/utils/rtl.ts +0 -19
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
Column: () => Column,
|
|
40
40
|
Grid: () => Grid,
|
|
41
41
|
IconButton: () => IconButton,
|
|
42
|
+
KeyboardAvoidingWrapper: () => KeyboardAvoidingWrapper,
|
|
42
43
|
Layout: () => Layout,
|
|
43
44
|
List: () => List,
|
|
44
45
|
ListDivider: () => ListDivider,
|
|
@@ -52,6 +53,7 @@ __export(index_exports, {
|
|
|
52
53
|
module.exports = __toCommonJS(index_exports);
|
|
53
54
|
|
|
54
55
|
// src/typography/Typography.tsx
|
|
56
|
+
var import_react = require("react");
|
|
55
57
|
var import_react_native = require("react-native");
|
|
56
58
|
var import_core = require("@onlynative/core");
|
|
57
59
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -75,6 +77,13 @@ function Typography({
|
|
|
75
77
|
const theme = (0, import_core.useTheme)();
|
|
76
78
|
const typographyStyle = theme.typography[variant];
|
|
77
79
|
const resolvedRole = accessibilityRole != null ? accessibilityRole : HEADING_VARIANTS.has(variant) ? "header" : void 0;
|
|
80
|
+
const lineHeightFix = (0, import_react.useMemo)(() => {
|
|
81
|
+
if (!style) return void 0;
|
|
82
|
+
const flat = import_react_native.StyleSheet.flatten(style);
|
|
83
|
+
if (!(flat == null ? void 0 : flat.fontSize) || flat.lineHeight) return void 0;
|
|
84
|
+
const ratio = typographyStyle.lineHeight / typographyStyle.fontSize;
|
|
85
|
+
return { lineHeight: Math.ceil(flat.fontSize * ratio) };
|
|
86
|
+
}, [style, typographyStyle.fontSize, typographyStyle.lineHeight]);
|
|
78
87
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
88
|
Component,
|
|
80
89
|
{
|
|
@@ -84,6 +93,7 @@ function Typography({
|
|
|
84
93
|
{ color: theme.colors.onSurface },
|
|
85
94
|
typographyStyle,
|
|
86
95
|
style,
|
|
96
|
+
lineHeightFix,
|
|
87
97
|
color != null ? { color } : void 0
|
|
88
98
|
],
|
|
89
99
|
children
|
|
@@ -92,7 +102,7 @@ function Typography({
|
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
// src/layout/Layout.tsx
|
|
95
|
-
var
|
|
105
|
+
var import_react2 = require("react");
|
|
96
106
|
var import_react_native2 = require("react-native");
|
|
97
107
|
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
98
108
|
var import_core2 = require("@onlynative/core");
|
|
@@ -126,15 +136,15 @@ function removeBackgroundColor(style) {
|
|
|
126
136
|
}
|
|
127
137
|
function Layout({ immersive, edges, children, style }) {
|
|
128
138
|
const theme = (0, import_core2.useTheme)();
|
|
129
|
-
const themeBackgroundStyle = (0,
|
|
139
|
+
const themeBackgroundStyle = (0, import_react2.useMemo)(
|
|
130
140
|
() => ({ backgroundColor: theme.colors.background }),
|
|
131
141
|
[theme.colors.background]
|
|
132
142
|
);
|
|
133
|
-
const styleWithoutBackground = (0,
|
|
143
|
+
const styleWithoutBackground = (0, import_react2.useMemo)(
|
|
134
144
|
() => removeBackgroundColor(style),
|
|
135
145
|
[style]
|
|
136
146
|
);
|
|
137
|
-
const safeAreaEdges = (0,
|
|
147
|
+
const safeAreaEdges = (0, import_react2.useMemo)(
|
|
138
148
|
() => resolveEdges(immersive, edges),
|
|
139
149
|
[immersive, edges]
|
|
140
150
|
);
|
|
@@ -149,7 +159,7 @@ function Layout({ immersive, edges, children, style }) {
|
|
|
149
159
|
}
|
|
150
160
|
|
|
151
161
|
// src/layout/Box.tsx
|
|
152
|
-
var
|
|
162
|
+
var import_react3 = require("react");
|
|
153
163
|
var import_react_native3 = require("react-native");
|
|
154
164
|
var import_core3 = require("@onlynative/core");
|
|
155
165
|
|
|
@@ -188,7 +198,7 @@ function Box({
|
|
|
188
198
|
...viewProps
|
|
189
199
|
}) {
|
|
190
200
|
const { spacing } = (0, import_core3.useTheme)();
|
|
191
|
-
const layoutStyle = (0,
|
|
201
|
+
const layoutStyle = (0, import_react3.useMemo)(() => {
|
|
192
202
|
const s = (v) => resolveSpacing(spacing, v);
|
|
193
203
|
return {
|
|
194
204
|
...p !== void 0 && { padding: s(p) },
|
|
@@ -253,10 +263,10 @@ function Box({
|
|
|
253
263
|
}
|
|
254
264
|
|
|
255
265
|
// src/layout/Column.tsx
|
|
256
|
-
var
|
|
266
|
+
var import_react4 = require("react");
|
|
257
267
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
258
268
|
function Column({ inverted = false, style, ...boxProps }) {
|
|
259
|
-
const directionStyle = (0,
|
|
269
|
+
const directionStyle = (0, import_react4.useMemo)(
|
|
260
270
|
() => ({
|
|
261
271
|
flexDirection: inverted ? "column-reverse" : "column"
|
|
262
272
|
}),
|
|
@@ -266,12 +276,12 @@ function Column({ inverted = false, style, ...boxProps }) {
|
|
|
266
276
|
}
|
|
267
277
|
|
|
268
278
|
// src/layout/Grid.tsx
|
|
269
|
-
var
|
|
279
|
+
var import_react6 = __toESM(require("react"));
|
|
270
280
|
var import_react_native4 = require("react-native");
|
|
271
281
|
var import_core4 = require("@onlynative/core");
|
|
272
282
|
|
|
273
283
|
// src/layout/Row.tsx
|
|
274
|
-
var
|
|
284
|
+
var import_react5 = require("react");
|
|
275
285
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
276
286
|
function Row({
|
|
277
287
|
wrap = false,
|
|
@@ -279,7 +289,7 @@ function Row({
|
|
|
279
289
|
style,
|
|
280
290
|
...boxProps
|
|
281
291
|
}) {
|
|
282
|
-
const directionStyle = (0,
|
|
292
|
+
const directionStyle = (0, import_react5.useMemo)(
|
|
283
293
|
() => ({
|
|
284
294
|
flexDirection: inverted ? "row-reverse" : "row",
|
|
285
295
|
...wrap && { flexWrap: "wrap" }
|
|
@@ -304,7 +314,7 @@ function Grid({
|
|
|
304
314
|
const resolvedColumnGap = resolveSpacing(spacing, columnGap != null ? columnGap : gap);
|
|
305
315
|
const resolvedRowGap = resolveSpacing(spacing, rowGap != null ? rowGap : gap);
|
|
306
316
|
const halfGap = resolvedColumnGap ? resolvedColumnGap / 2 : 0;
|
|
307
|
-
const cellStyle = (0,
|
|
317
|
+
const cellStyle = (0, import_react6.useMemo)(
|
|
308
318
|
() => ({
|
|
309
319
|
flexBasis: `${100 / columns}%`,
|
|
310
320
|
flexShrink: 1,
|
|
@@ -313,114 +323,45 @@ function Grid({
|
|
|
313
323
|
}),
|
|
314
324
|
[columns, halfGap]
|
|
315
325
|
);
|
|
316
|
-
const rowStyle = (0,
|
|
326
|
+
const rowStyle = (0, import_react6.useMemo)(
|
|
317
327
|
() => ({
|
|
318
328
|
marginLeft: -halfGap,
|
|
319
329
|
marginRight: -halfGap
|
|
320
330
|
}),
|
|
321
331
|
[halfGap]
|
|
322
332
|
);
|
|
323
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { wrap: true, rowGap: resolvedRowGap, ...rowProps, style: [rowStyle, style], children:
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { wrap: true, rowGap: resolvedRowGap, ...rowProps, style: [rowStyle, style], children: import_react6.default.Children.map(
|
|
324
334
|
children,
|
|
325
335
|
(child) => child != null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, { style: cellStyle, children: child }) : null
|
|
326
336
|
) });
|
|
327
337
|
}
|
|
328
338
|
|
|
329
339
|
// src/button/Button.tsx
|
|
330
|
-
var
|
|
331
|
-
var
|
|
340
|
+
var import_react7 = require("react");
|
|
341
|
+
var import_react_native6 = require("react-native");
|
|
332
342
|
var import_react_native7 = require("react-native");
|
|
333
343
|
var import_react_native8 = require("react-native");
|
|
334
|
-
var import_react_native9 = require("react-native");
|
|
335
344
|
var import_core5 = require("@onlynative/core");
|
|
345
|
+
var import_utils2 = require("@onlynative/utils");
|
|
336
346
|
|
|
337
347
|
// src/button/styles.ts
|
|
338
|
-
var import_react_native6 = require("react-native");
|
|
339
|
-
|
|
340
|
-
// src/utils/color.ts
|
|
341
|
-
function parseHexColor(color) {
|
|
342
|
-
const normalized = color.replace("#", "");
|
|
343
|
-
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
344
|
-
return null;
|
|
345
|
-
}
|
|
346
|
-
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
347
|
-
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
348
|
-
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
349
|
-
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
return { r, g, b };
|
|
353
|
-
}
|
|
354
|
-
function clampAlpha(alpha) {
|
|
355
|
-
return Math.max(0, Math.min(1, alpha));
|
|
356
|
-
}
|
|
357
|
-
function alphaColor(color, alpha) {
|
|
358
|
-
const channels = parseHexColor(color);
|
|
359
|
-
const boundedAlpha = clampAlpha(alpha);
|
|
360
|
-
if (!channels) {
|
|
361
|
-
return color;
|
|
362
|
-
}
|
|
363
|
-
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
364
|
-
}
|
|
365
|
-
function blendColor(base, overlay, overlayAlpha) {
|
|
366
|
-
const baseChannels = parseHexColor(base);
|
|
367
|
-
const overlayChannels = parseHexColor(overlay);
|
|
368
|
-
const boundedAlpha = clampAlpha(overlayAlpha);
|
|
369
|
-
if (!baseChannels || !overlayChannels) {
|
|
370
|
-
return alphaColor(overlay, boundedAlpha);
|
|
371
|
-
}
|
|
372
|
-
const r = Math.round(
|
|
373
|
-
(1 - boundedAlpha) * baseChannels.r + boundedAlpha * overlayChannels.r
|
|
374
|
-
);
|
|
375
|
-
const g = Math.round(
|
|
376
|
-
(1 - boundedAlpha) * baseChannels.g + boundedAlpha * overlayChannels.g
|
|
377
|
-
);
|
|
378
|
-
const b = Math.round(
|
|
379
|
-
(1 - boundedAlpha) * baseChannels.b + boundedAlpha * overlayChannels.b
|
|
380
|
-
);
|
|
381
|
-
return `rgb(${r}, ${g}, ${b})`;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// src/utils/elevation.ts
|
|
385
348
|
var import_react_native5 = require("react-native");
|
|
386
|
-
|
|
387
|
-
if (import_react_native5.Platform.OS === "web") {
|
|
388
|
-
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
389
|
-
if (shadowOpacity === 0) {
|
|
390
|
-
return { boxShadow: "none" };
|
|
391
|
-
}
|
|
392
|
-
return {
|
|
393
|
-
boxShadow: `${shadowOffset.width}px ${shadowOffset.height}px ${shadowRadius}px rgba(0, 0, 0, ${shadowOpacity})`
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
return {
|
|
397
|
-
shadowColor: level.shadowColor,
|
|
398
|
-
shadowOffset: {
|
|
399
|
-
width: level.shadowOffset.width,
|
|
400
|
-
height: level.shadowOffset.height
|
|
401
|
-
},
|
|
402
|
-
shadowOpacity: level.shadowOpacity,
|
|
403
|
-
shadowRadius: level.shadowRadius,
|
|
404
|
-
elevation: level.elevation
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// src/button/styles.ts
|
|
349
|
+
var import_utils = require("@onlynative/utils");
|
|
409
350
|
function getVariantColors(theme, variant) {
|
|
410
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
411
|
-
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
412
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
351
|
+
const disabledContainerColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.12);
|
|
352
|
+
const disabledLabelColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.38);
|
|
353
|
+
const disabledOutlineColor = (0, import_utils.alphaColor)(theme.colors.onSurface, 0.12);
|
|
413
354
|
if (variant === "outlined") {
|
|
414
355
|
return {
|
|
415
356
|
backgroundColor: "transparent",
|
|
416
357
|
textColor: theme.colors.primary,
|
|
417
358
|
borderColor: theme.colors.outline,
|
|
418
359
|
borderWidth: 1,
|
|
419
|
-
hoveredBackgroundColor: alphaColor(
|
|
360
|
+
hoveredBackgroundColor: (0, import_utils.alphaColor)(
|
|
420
361
|
theme.colors.primary,
|
|
421
362
|
theme.stateLayer.hoveredOpacity
|
|
422
363
|
),
|
|
423
|
-
pressedBackgroundColor: alphaColor(
|
|
364
|
+
pressedBackgroundColor: (0, import_utils.alphaColor)(
|
|
424
365
|
theme.colors.primary,
|
|
425
366
|
theme.stateLayer.pressedOpacity
|
|
426
367
|
),
|
|
@@ -435,11 +376,11 @@ function getVariantColors(theme, variant) {
|
|
|
435
376
|
textColor: theme.colors.primary,
|
|
436
377
|
borderColor: "transparent",
|
|
437
378
|
borderWidth: 0,
|
|
438
|
-
hoveredBackgroundColor: alphaColor(
|
|
379
|
+
hoveredBackgroundColor: (0, import_utils.alphaColor)(
|
|
439
380
|
theme.colors.primary,
|
|
440
381
|
theme.stateLayer.hoveredOpacity
|
|
441
382
|
),
|
|
442
|
-
pressedBackgroundColor: alphaColor(
|
|
383
|
+
pressedBackgroundColor: (0, import_utils.alphaColor)(
|
|
443
384
|
theme.colors.primary,
|
|
444
385
|
theme.stateLayer.pressedOpacity
|
|
445
386
|
),
|
|
@@ -454,12 +395,12 @@ function getVariantColors(theme, variant) {
|
|
|
454
395
|
textColor: theme.colors.primary,
|
|
455
396
|
borderColor: theme.colors.surfaceContainerLow,
|
|
456
397
|
borderWidth: 0,
|
|
457
|
-
hoveredBackgroundColor: blendColor(
|
|
398
|
+
hoveredBackgroundColor: (0, import_utils.blendColor)(
|
|
458
399
|
theme.colors.surfaceContainerLow,
|
|
459
400
|
theme.colors.primary,
|
|
460
401
|
theme.stateLayer.hoveredOpacity
|
|
461
402
|
),
|
|
462
|
-
pressedBackgroundColor: blendColor(
|
|
403
|
+
pressedBackgroundColor: (0, import_utils.blendColor)(
|
|
463
404
|
theme.colors.surfaceContainerLow,
|
|
464
405
|
theme.colors.primary,
|
|
465
406
|
theme.stateLayer.pressedOpacity
|
|
@@ -475,12 +416,12 @@ function getVariantColors(theme, variant) {
|
|
|
475
416
|
textColor: theme.colors.onSecondaryContainer,
|
|
476
417
|
borderColor: theme.colors.secondaryContainer,
|
|
477
418
|
borderWidth: 0,
|
|
478
|
-
hoveredBackgroundColor: blendColor(
|
|
419
|
+
hoveredBackgroundColor: (0, import_utils.blendColor)(
|
|
479
420
|
theme.colors.secondaryContainer,
|
|
480
421
|
theme.colors.onSecondaryContainer,
|
|
481
422
|
theme.stateLayer.hoveredOpacity
|
|
482
423
|
),
|
|
483
|
-
pressedBackgroundColor: blendColor(
|
|
424
|
+
pressedBackgroundColor: (0, import_utils.blendColor)(
|
|
484
425
|
theme.colors.secondaryContainer,
|
|
485
426
|
theme.colors.onSecondaryContainer,
|
|
486
427
|
theme.stateLayer.pressedOpacity
|
|
@@ -495,12 +436,12 @@ function getVariantColors(theme, variant) {
|
|
|
495
436
|
textColor: theme.colors.onPrimary,
|
|
496
437
|
borderColor: theme.colors.primary,
|
|
497
438
|
borderWidth: 0,
|
|
498
|
-
hoveredBackgroundColor: blendColor(
|
|
439
|
+
hoveredBackgroundColor: (0, import_utils.blendColor)(
|
|
499
440
|
theme.colors.primary,
|
|
500
441
|
theme.colors.onPrimary,
|
|
501
442
|
theme.stateLayer.hoveredOpacity
|
|
502
443
|
),
|
|
503
|
-
pressedBackgroundColor: blendColor(
|
|
444
|
+
pressedBackgroundColor: (0, import_utils.blendColor)(
|
|
504
445
|
theme.colors.primary,
|
|
505
446
|
theme.colors.onPrimary,
|
|
506
447
|
theme.stateLayer.pressedOpacity
|
|
@@ -532,33 +473,33 @@ function applyColorOverrides(theme, colors, containerColor, contentColor) {
|
|
|
532
473
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
533
474
|
result.backgroundColor = containerColor;
|
|
534
475
|
result.borderColor = containerColor;
|
|
535
|
-
result.hoveredBackgroundColor = blendColor(
|
|
476
|
+
result.hoveredBackgroundColor = (0, import_utils.blendColor)(
|
|
536
477
|
containerColor,
|
|
537
478
|
overlay,
|
|
538
479
|
theme.stateLayer.hoveredOpacity
|
|
539
480
|
);
|
|
540
|
-
result.pressedBackgroundColor = blendColor(
|
|
481
|
+
result.pressedBackgroundColor = (0, import_utils.blendColor)(
|
|
541
482
|
containerColor,
|
|
542
483
|
overlay,
|
|
543
484
|
theme.stateLayer.pressedOpacity
|
|
544
485
|
);
|
|
545
486
|
} else if (contentColor) {
|
|
546
487
|
if (colors.backgroundColor === "transparent") {
|
|
547
|
-
result.hoveredBackgroundColor = alphaColor(
|
|
488
|
+
result.hoveredBackgroundColor = (0, import_utils.alphaColor)(
|
|
548
489
|
contentColor,
|
|
549
490
|
theme.stateLayer.hoveredOpacity
|
|
550
491
|
);
|
|
551
|
-
result.pressedBackgroundColor = alphaColor(
|
|
492
|
+
result.pressedBackgroundColor = (0, import_utils.alphaColor)(
|
|
552
493
|
contentColor,
|
|
553
494
|
theme.stateLayer.pressedOpacity
|
|
554
495
|
);
|
|
555
496
|
} else {
|
|
556
|
-
result.hoveredBackgroundColor = blendColor(
|
|
497
|
+
result.hoveredBackgroundColor = (0, import_utils.blendColor)(
|
|
557
498
|
colors.backgroundColor,
|
|
558
499
|
contentColor,
|
|
559
500
|
theme.stateLayer.hoveredOpacity
|
|
560
501
|
);
|
|
561
|
-
result.pressedBackgroundColor = blendColor(
|
|
502
|
+
result.pressedBackgroundColor = (0, import_utils.blendColor)(
|
|
562
503
|
colors.backgroundColor,
|
|
563
504
|
contentColor,
|
|
564
505
|
theme.stateLayer.pressedOpacity
|
|
@@ -582,11 +523,11 @@ function createStyles(theme, variant, hasLeadingIcon, hasTrailingIcon, container
|
|
|
582
523
|
hasLeadingIcon,
|
|
583
524
|
hasTrailingIcon
|
|
584
525
|
);
|
|
585
|
-
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
586
|
-
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
587
|
-
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
526
|
+
const elevationLevel0 = (0, import_utils.elevationStyle)(theme.elevation.level0);
|
|
527
|
+
const elevationLevel1 = (0, import_utils.elevationStyle)(theme.elevation.level1);
|
|
528
|
+
const elevationLevel2 = (0, import_utils.elevationStyle)(theme.elevation.level2);
|
|
588
529
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
589
|
-
return
|
|
530
|
+
return import_react_native5.StyleSheet.create({
|
|
590
531
|
container: {
|
|
591
532
|
alignSelf: "flex-start",
|
|
592
533
|
alignItems: "center",
|
|
@@ -674,7 +615,7 @@ function Button({
|
|
|
674
615
|
const hasLeading = Boolean(leadingIcon);
|
|
675
616
|
const hasTrailing = Boolean(trailingIcon);
|
|
676
617
|
const theme = (0, import_core5.useTheme)();
|
|
677
|
-
const
|
|
618
|
+
const styles3 = (0, import_react7.useMemo)(
|
|
678
619
|
() => createStyles(
|
|
679
620
|
theme,
|
|
680
621
|
variant,
|
|
@@ -685,55 +626,56 @@ function Button({
|
|
|
685
626
|
),
|
|
686
627
|
[theme, variant, hasLeading, hasTrailing, containerColor, contentColor]
|
|
687
628
|
);
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
629
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? (0, import_utils2.getMaterialCommunityIcons)() : null;
|
|
630
|
+
const resolvedIconColor = (0, import_react7.useMemo)(() => {
|
|
631
|
+
const base = import_react_native7.StyleSheet.flatten([
|
|
632
|
+
styles3.label,
|
|
633
|
+
isDisabled ? styles3.disabledLabel : void 0
|
|
692
634
|
]);
|
|
693
635
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
694
|
-
}, [
|
|
695
|
-
const computedLabelStyle = (0,
|
|
636
|
+
}, [styles3.label, styles3.disabledLabel, isDisabled]);
|
|
637
|
+
const computedLabelStyle = (0, import_react7.useMemo)(
|
|
696
638
|
() => [
|
|
697
|
-
|
|
698
|
-
isDisabled ?
|
|
639
|
+
styles3.label,
|
|
640
|
+
isDisabled ? styles3.disabledLabel : void 0,
|
|
699
641
|
labelStyleOverride
|
|
700
642
|
],
|
|
701
|
-
[isDisabled,
|
|
643
|
+
[isDisabled, styles3.disabledLabel, styles3.label, labelStyleOverride]
|
|
702
644
|
);
|
|
703
645
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
704
|
-
|
|
646
|
+
import_react_native6.Pressable,
|
|
705
647
|
{
|
|
706
648
|
...props,
|
|
707
649
|
accessibilityRole: "button",
|
|
708
650
|
accessibilityState: { disabled: isDisabled },
|
|
709
|
-
hitSlop:
|
|
651
|
+
hitSlop: import_react_native6.Platform.OS === "web" ? void 0 : 4,
|
|
710
652
|
disabled: isDisabled,
|
|
711
653
|
style: resolveStyle(
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
654
|
+
styles3.container,
|
|
655
|
+
styles3.hoveredContainer,
|
|
656
|
+
styles3.pressedContainer,
|
|
657
|
+
styles3.disabledContainer,
|
|
716
658
|
isDisabled,
|
|
717
659
|
style
|
|
718
660
|
),
|
|
719
661
|
children: [
|
|
720
662
|
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
721
|
-
|
|
663
|
+
MaterialCommunityIcons,
|
|
722
664
|
{
|
|
723
665
|
name: leadingIcon,
|
|
724
666
|
size: iconSize,
|
|
725
667
|
color: resolvedIconColor,
|
|
726
|
-
style:
|
|
668
|
+
style: styles3.leadingIcon
|
|
727
669
|
}
|
|
728
670
|
) : null,
|
|
729
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native8.Text, { style: computedLabelStyle, children }),
|
|
730
672
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
731
|
-
|
|
673
|
+
MaterialCommunityIcons,
|
|
732
674
|
{
|
|
733
675
|
name: trailingIcon,
|
|
734
676
|
size: iconSize,
|
|
735
677
|
color: resolvedIconColor,
|
|
736
|
-
style:
|
|
678
|
+
style: styles3.trailingIcon
|
|
737
679
|
}
|
|
738
680
|
) : null
|
|
739
681
|
]
|
|
@@ -742,18 +684,19 @@ function Button({
|
|
|
742
684
|
}
|
|
743
685
|
|
|
744
686
|
// src/icon-button/IconButton.tsx
|
|
745
|
-
var
|
|
746
|
-
var
|
|
747
|
-
var import_react_native11 = require("react-native");
|
|
687
|
+
var import_react8 = require("react");
|
|
688
|
+
var import_react_native10 = require("react-native");
|
|
748
689
|
var import_core6 = require("@onlynative/core");
|
|
690
|
+
var import_utils4 = require("@onlynative/utils");
|
|
749
691
|
|
|
750
692
|
// src/icon-button/styles.ts
|
|
751
|
-
var
|
|
693
|
+
var import_react_native9 = require("react-native");
|
|
694
|
+
var import_utils3 = require("@onlynative/utils");
|
|
752
695
|
function createStyles2(theme) {
|
|
753
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
754
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
696
|
+
const disabledContainerColor = (0, import_utils3.alphaColor)(theme.colors.onSurface, 0.12);
|
|
697
|
+
const disabledOutlineColor = (0, import_utils3.alphaColor)(theme.colors.onSurface, 0.12);
|
|
755
698
|
const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
|
|
756
|
-
return
|
|
699
|
+
return import_react_native9.StyleSheet.create({
|
|
757
700
|
container: {
|
|
758
701
|
borderRadius: theme.shape.cornerFull,
|
|
759
702
|
alignItems: "center",
|
|
@@ -819,160 +762,160 @@ function createStyles2(theme) {
|
|
|
819
762
|
},
|
|
820
763
|
// Hover states (M3: 8% state layer)
|
|
821
764
|
hoveredFilled: {
|
|
822
|
-
backgroundColor: blendColor(
|
|
765
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
823
766
|
theme.colors.primary,
|
|
824
767
|
theme.colors.onPrimary,
|
|
825
768
|
theme.stateLayer.hoveredOpacity
|
|
826
769
|
)
|
|
827
770
|
},
|
|
828
771
|
hoveredFilledToggleUnselected: {
|
|
829
|
-
backgroundColor: blendColor(
|
|
772
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
830
773
|
toggleUnselectedContainerColor,
|
|
831
774
|
theme.colors.primary,
|
|
832
775
|
theme.stateLayer.hoveredOpacity
|
|
833
776
|
)
|
|
834
777
|
},
|
|
835
778
|
hoveredFilledToggleSelected: {
|
|
836
|
-
backgroundColor: blendColor(
|
|
779
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
837
780
|
theme.colors.primary,
|
|
838
781
|
theme.colors.onPrimary,
|
|
839
782
|
theme.stateLayer.hoveredOpacity
|
|
840
783
|
)
|
|
841
784
|
},
|
|
842
785
|
hoveredTonal: {
|
|
843
|
-
backgroundColor: blendColor(
|
|
786
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
844
787
|
theme.colors.secondaryContainer,
|
|
845
788
|
theme.colors.onSecondaryContainer,
|
|
846
789
|
theme.stateLayer.hoveredOpacity
|
|
847
790
|
)
|
|
848
791
|
},
|
|
849
792
|
hoveredTonalToggleUnselected: {
|
|
850
|
-
backgroundColor: blendColor(
|
|
793
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
851
794
|
toggleUnselectedContainerColor,
|
|
852
795
|
theme.colors.onSurfaceVariant,
|
|
853
796
|
theme.stateLayer.hoveredOpacity
|
|
854
797
|
)
|
|
855
798
|
},
|
|
856
799
|
hoveredTonalToggleSelected: {
|
|
857
|
-
backgroundColor: blendColor(
|
|
800
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
858
801
|
theme.colors.secondaryContainer,
|
|
859
802
|
theme.colors.onSecondaryContainer,
|
|
860
803
|
theme.stateLayer.hoveredOpacity
|
|
861
804
|
)
|
|
862
805
|
},
|
|
863
806
|
hoveredOutlined: {
|
|
864
|
-
backgroundColor: alphaColor(
|
|
807
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
865
808
|
theme.colors.onSurfaceVariant,
|
|
866
809
|
theme.stateLayer.hoveredOpacity
|
|
867
810
|
)
|
|
868
811
|
},
|
|
869
812
|
hoveredOutlinedToggleUnselected: {
|
|
870
|
-
backgroundColor: alphaColor(
|
|
813
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
871
814
|
theme.colors.onSurfaceVariant,
|
|
872
815
|
theme.stateLayer.hoveredOpacity
|
|
873
816
|
)
|
|
874
817
|
},
|
|
875
818
|
hoveredOutlinedToggleSelected: {
|
|
876
|
-
backgroundColor: blendColor(
|
|
819
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
877
820
|
theme.colors.inverseSurface,
|
|
878
821
|
theme.colors.inverseOnSurface,
|
|
879
822
|
theme.stateLayer.hoveredOpacity
|
|
880
823
|
)
|
|
881
824
|
},
|
|
882
825
|
hoveredStandard: {
|
|
883
|
-
backgroundColor: alphaColor(
|
|
826
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
884
827
|
theme.colors.onSurfaceVariant,
|
|
885
828
|
theme.stateLayer.hoveredOpacity
|
|
886
829
|
)
|
|
887
830
|
},
|
|
888
831
|
hoveredStandardToggleUnselected: {
|
|
889
|
-
backgroundColor: alphaColor(
|
|
832
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
890
833
|
theme.colors.onSurfaceVariant,
|
|
891
834
|
theme.stateLayer.hoveredOpacity
|
|
892
835
|
)
|
|
893
836
|
},
|
|
894
837
|
hoveredStandardToggleSelected: {
|
|
895
|
-
backgroundColor: alphaColor(
|
|
838
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
896
839
|
theme.colors.primary,
|
|
897
840
|
theme.stateLayer.hoveredOpacity
|
|
898
841
|
)
|
|
899
842
|
},
|
|
900
843
|
// Pressed states (M3: 12% state layer)
|
|
901
844
|
pressedFilled: {
|
|
902
|
-
backgroundColor: blendColor(
|
|
845
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
903
846
|
theme.colors.primary,
|
|
904
847
|
theme.colors.onPrimary,
|
|
905
848
|
theme.stateLayer.pressedOpacity
|
|
906
849
|
)
|
|
907
850
|
},
|
|
908
851
|
pressedFilledToggleUnselected: {
|
|
909
|
-
backgroundColor: blendColor(
|
|
852
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
910
853
|
toggleUnselectedContainerColor,
|
|
911
854
|
theme.colors.primary,
|
|
912
855
|
theme.stateLayer.pressedOpacity
|
|
913
856
|
)
|
|
914
857
|
},
|
|
915
858
|
pressedFilledToggleSelected: {
|
|
916
|
-
backgroundColor: blendColor(
|
|
859
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
917
860
|
theme.colors.primary,
|
|
918
861
|
theme.colors.onPrimary,
|
|
919
862
|
theme.stateLayer.pressedOpacity
|
|
920
863
|
)
|
|
921
864
|
},
|
|
922
865
|
pressedTonal: {
|
|
923
|
-
backgroundColor: blendColor(
|
|
866
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
924
867
|
theme.colors.secondaryContainer,
|
|
925
868
|
theme.colors.onSecondaryContainer,
|
|
926
869
|
theme.stateLayer.pressedOpacity
|
|
927
870
|
)
|
|
928
871
|
},
|
|
929
872
|
pressedTonalToggleUnselected: {
|
|
930
|
-
backgroundColor: blendColor(
|
|
873
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
931
874
|
toggleUnselectedContainerColor,
|
|
932
875
|
theme.colors.onSurfaceVariant,
|
|
933
876
|
theme.stateLayer.pressedOpacity
|
|
934
877
|
)
|
|
935
878
|
},
|
|
936
879
|
pressedTonalToggleSelected: {
|
|
937
|
-
backgroundColor: blendColor(
|
|
880
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
938
881
|
theme.colors.secondaryContainer,
|
|
939
882
|
theme.colors.onSecondaryContainer,
|
|
940
883
|
theme.stateLayer.pressedOpacity
|
|
941
884
|
)
|
|
942
885
|
},
|
|
943
886
|
pressedOutlined: {
|
|
944
|
-
backgroundColor: alphaColor(
|
|
887
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
945
888
|
theme.colors.onSurfaceVariant,
|
|
946
889
|
theme.stateLayer.pressedOpacity
|
|
947
890
|
)
|
|
948
891
|
},
|
|
949
892
|
pressedOutlinedToggleUnselected: {
|
|
950
|
-
backgroundColor: alphaColor(
|
|
893
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
951
894
|
theme.colors.onSurfaceVariant,
|
|
952
895
|
theme.stateLayer.pressedOpacity
|
|
953
896
|
)
|
|
954
897
|
},
|
|
955
898
|
pressedOutlinedToggleSelected: {
|
|
956
|
-
backgroundColor: blendColor(
|
|
899
|
+
backgroundColor: (0, import_utils3.blendColor)(
|
|
957
900
|
theme.colors.inverseSurface,
|
|
958
901
|
theme.colors.inverseOnSurface,
|
|
959
902
|
theme.stateLayer.pressedOpacity
|
|
960
903
|
)
|
|
961
904
|
},
|
|
962
905
|
pressedStandard: {
|
|
963
|
-
backgroundColor: alphaColor(
|
|
906
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
964
907
|
theme.colors.onSurfaceVariant,
|
|
965
908
|
theme.stateLayer.pressedOpacity
|
|
966
909
|
)
|
|
967
910
|
},
|
|
968
911
|
pressedStandardToggleUnselected: {
|
|
969
|
-
backgroundColor: alphaColor(
|
|
912
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
970
913
|
theme.colors.onSurfaceVariant,
|
|
971
914
|
theme.stateLayer.pressedOpacity
|
|
972
915
|
)
|
|
973
916
|
},
|
|
974
917
|
pressedStandardToggleSelected: {
|
|
975
|
-
backgroundColor: alphaColor(
|
|
918
|
+
backgroundColor: (0, import_utils3.alphaColor)(
|
|
976
919
|
theme.colors.primary,
|
|
977
920
|
theme.stateLayer.pressedOpacity
|
|
978
921
|
)
|
|
@@ -1005,7 +948,7 @@ function createStyles2(theme) {
|
|
|
1005
948
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1006
949
|
function getIconColor(variant, theme, disabled, isToggle, selected) {
|
|
1007
950
|
if (disabled) {
|
|
1008
|
-
return alphaColor(theme.colors.onSurface, 0.38);
|
|
951
|
+
return (0, import_utils4.alphaColor)(theme.colors.onSurface, 0.38);
|
|
1009
952
|
}
|
|
1010
953
|
if (isToggle) {
|
|
1011
954
|
if (variant === "filled") {
|
|
@@ -1027,38 +970,38 @@ function getIconColor(variant, theme, disabled, isToggle, selected) {
|
|
|
1027
970
|
}
|
|
1028
971
|
return theme.colors.onSurfaceVariant;
|
|
1029
972
|
}
|
|
1030
|
-
function getColorStyle(
|
|
973
|
+
function getColorStyle(styles3, variant, isToggle, selected) {
|
|
1031
974
|
if (isToggle) {
|
|
1032
975
|
if (variant === "tonal") {
|
|
1033
|
-
return selected ?
|
|
976
|
+
return selected ? styles3.colorTonalToggleSelected : styles3.colorTonalToggleUnselected;
|
|
1034
977
|
}
|
|
1035
978
|
if (variant === "outlined") {
|
|
1036
|
-
return selected ?
|
|
979
|
+
return selected ? styles3.colorOutlinedToggleSelected : styles3.colorOutlined;
|
|
1037
980
|
}
|
|
1038
981
|
if (variant === "standard") {
|
|
1039
|
-
return selected ?
|
|
982
|
+
return selected ? styles3.colorStandardToggleSelected : styles3.colorStandard;
|
|
1040
983
|
}
|
|
1041
|
-
return selected ?
|
|
984
|
+
return selected ? styles3.colorFilledToggleSelected : styles3.colorFilledToggleUnselected;
|
|
1042
985
|
}
|
|
1043
986
|
if (variant === "tonal") {
|
|
1044
|
-
return
|
|
987
|
+
return styles3.colorTonal;
|
|
1045
988
|
}
|
|
1046
989
|
if (variant === "outlined") {
|
|
1047
|
-
return
|
|
990
|
+
return styles3.colorOutlined;
|
|
1048
991
|
}
|
|
1049
992
|
if (variant === "standard") {
|
|
1050
|
-
return
|
|
993
|
+
return styles3.colorStandard;
|
|
1051
994
|
}
|
|
1052
|
-
return
|
|
995
|
+
return styles3.colorFilled;
|
|
1053
996
|
}
|
|
1054
|
-
function getSizeStyle(
|
|
997
|
+
function getSizeStyle(styles3, size) {
|
|
1055
998
|
if (size === "small") {
|
|
1056
|
-
return
|
|
999
|
+
return styles3.sizeSmall;
|
|
1057
1000
|
}
|
|
1058
1001
|
if (size === "large") {
|
|
1059
|
-
return
|
|
1002
|
+
return styles3.sizeLarge;
|
|
1060
1003
|
}
|
|
1061
|
-
return
|
|
1004
|
+
return styles3.sizeMedium;
|
|
1062
1005
|
}
|
|
1063
1006
|
function getIconPixelSize(size) {
|
|
1064
1007
|
if (size === "small") {
|
|
@@ -1078,65 +1021,65 @@ function getDefaultHitSlop(size) {
|
|
|
1078
1021
|
}
|
|
1079
1022
|
return 4;
|
|
1080
1023
|
}
|
|
1081
|
-
function getHoveredStyle(
|
|
1024
|
+
function getHoveredStyle(styles3, variant, isToggle, selected) {
|
|
1082
1025
|
if (isToggle) {
|
|
1083
1026
|
if (variant === "tonal") {
|
|
1084
|
-
return selected ?
|
|
1027
|
+
return selected ? styles3.hoveredTonalToggleSelected : styles3.hoveredTonalToggleUnselected;
|
|
1085
1028
|
}
|
|
1086
1029
|
if (variant === "outlined") {
|
|
1087
|
-
return selected ?
|
|
1030
|
+
return selected ? styles3.hoveredOutlinedToggleSelected : styles3.hoveredOutlinedToggleUnselected;
|
|
1088
1031
|
}
|
|
1089
1032
|
if (variant === "standard") {
|
|
1090
|
-
return selected ?
|
|
1033
|
+
return selected ? styles3.hoveredStandardToggleSelected : styles3.hoveredStandardToggleUnselected;
|
|
1091
1034
|
}
|
|
1092
|
-
return selected ?
|
|
1035
|
+
return selected ? styles3.hoveredFilledToggleSelected : styles3.hoveredFilledToggleUnselected;
|
|
1093
1036
|
}
|
|
1094
1037
|
if (variant === "tonal") {
|
|
1095
|
-
return
|
|
1038
|
+
return styles3.hoveredTonal;
|
|
1096
1039
|
}
|
|
1097
1040
|
if (variant === "outlined") {
|
|
1098
|
-
return
|
|
1041
|
+
return styles3.hoveredOutlined;
|
|
1099
1042
|
}
|
|
1100
1043
|
if (variant === "standard") {
|
|
1101
|
-
return
|
|
1044
|
+
return styles3.hoveredStandard;
|
|
1102
1045
|
}
|
|
1103
|
-
return
|
|
1046
|
+
return styles3.hoveredFilled;
|
|
1104
1047
|
}
|
|
1105
|
-
function getPressedStyle(
|
|
1048
|
+
function getPressedStyle(styles3, variant, isToggle, selected) {
|
|
1106
1049
|
if (isToggle) {
|
|
1107
1050
|
if (variant === "tonal") {
|
|
1108
|
-
return selected ?
|
|
1051
|
+
return selected ? styles3.pressedTonalToggleSelected : styles3.pressedTonalToggleUnselected;
|
|
1109
1052
|
}
|
|
1110
1053
|
if (variant === "outlined") {
|
|
1111
|
-
return selected ?
|
|
1054
|
+
return selected ? styles3.pressedOutlinedToggleSelected : styles3.pressedOutlinedToggleUnselected;
|
|
1112
1055
|
}
|
|
1113
1056
|
if (variant === "standard") {
|
|
1114
|
-
return selected ?
|
|
1057
|
+
return selected ? styles3.pressedStandardToggleSelected : styles3.pressedStandardToggleUnselected;
|
|
1115
1058
|
}
|
|
1116
|
-
return selected ?
|
|
1059
|
+
return selected ? styles3.pressedFilledToggleSelected : styles3.pressedFilledToggleUnselected;
|
|
1117
1060
|
}
|
|
1118
1061
|
if (variant === "tonal") {
|
|
1119
|
-
return
|
|
1062
|
+
return styles3.pressedTonal;
|
|
1120
1063
|
}
|
|
1121
1064
|
if (variant === "outlined") {
|
|
1122
|
-
return
|
|
1065
|
+
return styles3.pressedOutlined;
|
|
1123
1066
|
}
|
|
1124
1067
|
if (variant === "standard") {
|
|
1125
|
-
return
|
|
1068
|
+
return styles3.pressedStandard;
|
|
1126
1069
|
}
|
|
1127
|
-
return
|
|
1070
|
+
return styles3.pressedFilled;
|
|
1128
1071
|
}
|
|
1129
|
-
function getDisabledStyle(
|
|
1072
|
+
function getDisabledStyle(styles3, variant) {
|
|
1130
1073
|
if (variant === "tonal") {
|
|
1131
|
-
return
|
|
1074
|
+
return styles3.disabledTonal;
|
|
1132
1075
|
}
|
|
1133
1076
|
if (variant === "outlined") {
|
|
1134
|
-
return
|
|
1077
|
+
return styles3.disabledOutlined;
|
|
1135
1078
|
}
|
|
1136
1079
|
if (variant === "standard") {
|
|
1137
|
-
return
|
|
1080
|
+
return styles3.disabledStandard;
|
|
1138
1081
|
}
|
|
1139
|
-
return
|
|
1082
|
+
return styles3.disabledFilled;
|
|
1140
1083
|
}
|
|
1141
1084
|
function IconButton({
|
|
1142
1085
|
icon,
|
|
@@ -1155,8 +1098,9 @@ function IconButton({
|
|
|
1155
1098
|
...props
|
|
1156
1099
|
}) {
|
|
1157
1100
|
var _a;
|
|
1101
|
+
const MaterialCommunityIcons = (0, import_utils4.getMaterialCommunityIcons)();
|
|
1158
1102
|
const theme = (0, import_core6.useTheme)();
|
|
1159
|
-
const
|
|
1103
|
+
const styles3 = (0, import_react8.useMemo)(() => createStyles2(theme), [theme]);
|
|
1160
1104
|
const isDisabled = Boolean(disabled);
|
|
1161
1105
|
const isToggle = selected !== void 0;
|
|
1162
1106
|
const isSelected = Boolean(selected);
|
|
@@ -1164,7 +1108,7 @@ function IconButton({
|
|
|
1164
1108
|
const displayIcon = isToggle && isSelected && selectedIcon ? selectedIcon : icon;
|
|
1165
1109
|
const iconPixelSize = getIconPixelSize(size);
|
|
1166
1110
|
const accessibilityState = isToggle ? { disabled: isDisabled, selected: isSelected } : { disabled: isDisabled };
|
|
1167
|
-
const containerOverrides = (0,
|
|
1111
|
+
const containerOverrides = (0, import_react8.useMemo)(() => {
|
|
1168
1112
|
if (!containerColor) return null;
|
|
1169
1113
|
const overlay = resolvedIconColor;
|
|
1170
1114
|
return {
|
|
@@ -1174,14 +1118,14 @@ function IconButton({
|
|
|
1174
1118
|
borderWidth: 0
|
|
1175
1119
|
},
|
|
1176
1120
|
hovered: {
|
|
1177
|
-
backgroundColor: blendColor(
|
|
1121
|
+
backgroundColor: (0, import_utils4.blendColor)(
|
|
1178
1122
|
containerColor,
|
|
1179
1123
|
overlay,
|
|
1180
1124
|
theme.stateLayer.hoveredOpacity
|
|
1181
1125
|
)
|
|
1182
1126
|
},
|
|
1183
1127
|
pressed: {
|
|
1184
|
-
backgroundColor: blendColor(
|
|
1128
|
+
backgroundColor: (0, import_utils4.blendColor)(
|
|
1185
1129
|
containerColor,
|
|
1186
1130
|
overlay,
|
|
1187
1131
|
theme.stateLayer.pressedOpacity
|
|
@@ -1190,7 +1134,7 @@ function IconButton({
|
|
|
1190
1134
|
};
|
|
1191
1135
|
}, [containerColor, resolvedIconColor, theme.stateLayer]);
|
|
1192
1136
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1193
|
-
|
|
1137
|
+
import_react_native10.Pressable,
|
|
1194
1138
|
{
|
|
1195
1139
|
...props,
|
|
1196
1140
|
accessibilityRole: "button",
|
|
@@ -1204,13 +1148,13 @@ function IconButton({
|
|
|
1204
1148
|
hovered
|
|
1205
1149
|
}) => {
|
|
1206
1150
|
const base = [
|
|
1207
|
-
|
|
1208
|
-
getSizeStyle(
|
|
1209
|
-
getColorStyle(
|
|
1151
|
+
styles3.container,
|
|
1152
|
+
getSizeStyle(styles3, size),
|
|
1153
|
+
getColorStyle(styles3, variant, isToggle, isSelected),
|
|
1210
1154
|
containerOverrides == null ? void 0 : containerOverrides.base,
|
|
1211
|
-
hovered && !pressed && !isDisabled ? containerOverrides ? containerOverrides.hovered : getHoveredStyle(
|
|
1212
|
-
pressed && !isDisabled ? containerOverrides ? containerOverrides.pressed : getPressedStyle(
|
|
1213
|
-
isDisabled ? getDisabledStyle(
|
|
1155
|
+
hovered && !pressed && !isDisabled ? containerOverrides ? containerOverrides.hovered : getHoveredStyle(styles3, variant, isToggle, isSelected) : void 0,
|
|
1156
|
+
pressed && !isDisabled ? containerOverrides ? containerOverrides.pressed : getPressedStyle(styles3, variant, isToggle, isSelected) : void 0,
|
|
1157
|
+
isDisabled ? getDisabledStyle(styles3, variant) : void 0
|
|
1214
1158
|
];
|
|
1215
1159
|
if (typeof style === "function") {
|
|
1216
1160
|
base.push(style({ pressed }));
|
|
@@ -1220,7 +1164,7 @@ function IconButton({
|
|
|
1220
1164
|
return base;
|
|
1221
1165
|
},
|
|
1222
1166
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1223
|
-
|
|
1167
|
+
MaterialCommunityIcons,
|
|
1224
1168
|
{
|
|
1225
1169
|
name: displayIcon,
|
|
1226
1170
|
size: iconPixelSize,
|
|
@@ -1232,27 +1176,19 @@ function IconButton({
|
|
|
1232
1176
|
}
|
|
1233
1177
|
|
|
1234
1178
|
// src/appbar/AppBar.tsx
|
|
1235
|
-
var
|
|
1236
|
-
var
|
|
1179
|
+
var import_react9 = require("react");
|
|
1180
|
+
var import_react_native12 = require("react-native");
|
|
1237
1181
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
1238
1182
|
var import_core8 = require("@onlynative/core");
|
|
1239
|
-
|
|
1240
|
-
// src/utils/rtl.ts
|
|
1241
|
-
var import_react_native12 = require("react-native");
|
|
1242
|
-
function transformOrigin(vertical = "top") {
|
|
1243
|
-
return import_react_native12.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
|
|
1244
|
-
}
|
|
1245
|
-
function selectRTL(ltr, rtl) {
|
|
1246
|
-
return import_react_native12.I18nManager.isRTL ? rtl : ltr;
|
|
1247
|
-
}
|
|
1183
|
+
var import_utils5 = require("@onlynative/utils");
|
|
1248
1184
|
|
|
1249
1185
|
// src/appbar/styles.ts
|
|
1250
|
-
var
|
|
1186
|
+
var import_react_native11 = require("react-native");
|
|
1251
1187
|
var import_core7 = require("@onlynative/core");
|
|
1252
1188
|
function createStyles3(theme) {
|
|
1253
1189
|
var _a;
|
|
1254
1190
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core7.defaultTopAppBarTokens;
|
|
1255
|
-
return
|
|
1191
|
+
return import_react_native11.StyleSheet.create({
|
|
1256
1192
|
root: {
|
|
1257
1193
|
backgroundColor: theme.colors.surface
|
|
1258
1194
|
},
|
|
@@ -1341,10 +1277,10 @@ function createStyles3(theme) {
|
|
|
1341
1277
|
// src/appbar/AppBar.tsx
|
|
1342
1278
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1343
1279
|
function getBackIcon() {
|
|
1344
|
-
if (
|
|
1345
|
-
return selectRTL("chevron-left", "chevron-right");
|
|
1280
|
+
if (import_react_native12.Platform.OS === "ios") {
|
|
1281
|
+
return (0, import_utils5.selectRTL)("chevron-left", "chevron-right");
|
|
1346
1282
|
}
|
|
1347
|
-
return selectRTL("arrow-left", "arrow-right");
|
|
1283
|
+
return (0, import_utils5.selectRTL)("arrow-left", "arrow-right");
|
|
1348
1284
|
}
|
|
1349
1285
|
var titleVariantBySize = {
|
|
1350
1286
|
small: "titleLarge",
|
|
@@ -1362,17 +1298,17 @@ function resolveSize(variant) {
|
|
|
1362
1298
|
}
|
|
1363
1299
|
return "small";
|
|
1364
1300
|
}
|
|
1365
|
-
function getSizeStyle2(
|
|
1301
|
+
function getSizeStyle2(styles3, size) {
|
|
1366
1302
|
if (size === "large") {
|
|
1367
|
-
return
|
|
1303
|
+
return styles3.largeContainer;
|
|
1368
1304
|
}
|
|
1369
|
-
return
|
|
1305
|
+
return styles3.mediumContainer;
|
|
1370
1306
|
}
|
|
1371
1307
|
function withTopInset(enabled, content, style) {
|
|
1372
1308
|
if (enabled) {
|
|
1373
1309
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_safe_area_context2.SafeAreaView, { edges: ["top"], style, children: content });
|
|
1374
1310
|
}
|
|
1375
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style, children: content });
|
|
1376
1312
|
}
|
|
1377
1313
|
function measureWidth(event) {
|
|
1378
1314
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -1395,10 +1331,10 @@ function AppBar({
|
|
|
1395
1331
|
var _a;
|
|
1396
1332
|
const theme = (0, import_core8.useTheme)();
|
|
1397
1333
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core8.defaultTopAppBarTokens;
|
|
1398
|
-
const
|
|
1399
|
-
const [leadingWidth, setLeadingWidth] = (0,
|
|
1400
|
-
const [actionsWidth, setActionsWidth] = (0,
|
|
1401
|
-
const titleColorStyle = (0,
|
|
1334
|
+
const styles3 = (0, import_react9.useMemo)(() => createStyles3(theme), [theme]);
|
|
1335
|
+
const [leadingWidth, setLeadingWidth] = (0, import_react9.useState)(0);
|
|
1336
|
+
const [actionsWidth, setActionsWidth] = (0, import_react9.useState)(0);
|
|
1337
|
+
const titleColorStyle = (0, import_react9.useMemo)(
|
|
1402
1338
|
() => ({ color: contentColor != null ? contentColor : theme.colors.onSurface }),
|
|
1403
1339
|
[contentColor, theme.colors.onSurface]
|
|
1404
1340
|
);
|
|
@@ -1409,22 +1345,22 @@ function AppBar({
|
|
|
1409
1345
|
const titleStartInset = topAppBar.horizontalPadding + Math.max(topAppBar.titleStartInset, leadingWidth);
|
|
1410
1346
|
const compactTitleEndInset = topAppBar.horizontalPadding + actionsWidth;
|
|
1411
1347
|
const centeredSideInset = topAppBar.horizontalPadding + Math.max(leadingWidth, actionsWidth);
|
|
1412
|
-
const expandedTitleInsetStyle = (0,
|
|
1348
|
+
const expandedTitleInsetStyle = (0, import_react9.useMemo)(
|
|
1413
1349
|
() => ({ paddingStart: titleStartInset }),
|
|
1414
1350
|
[titleStartInset]
|
|
1415
1351
|
);
|
|
1416
|
-
const overlayTitleInsetStyle = (0,
|
|
1352
|
+
const overlayTitleInsetStyle = (0, import_react9.useMemo)(
|
|
1417
1353
|
() => isCenterAligned ? { start: centeredSideInset, end: centeredSideInset } : { start: titleStartInset, end: compactTitleEndInset },
|
|
1418
1354
|
[centeredSideInset, compactTitleEndInset, isCenterAligned, titleStartInset]
|
|
1419
1355
|
);
|
|
1420
|
-
const leadingContent = (0,
|
|
1356
|
+
const leadingContent = (0, import_react9.useMemo)(() => {
|
|
1421
1357
|
if (leading) {
|
|
1422
1358
|
return leading;
|
|
1423
1359
|
}
|
|
1424
1360
|
if (!canGoBack) {
|
|
1425
1361
|
return null;
|
|
1426
1362
|
}
|
|
1427
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: styles3.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1428
1364
|
IconButton,
|
|
1429
1365
|
{
|
|
1430
1366
|
icon: getBackIcon(),
|
|
@@ -1440,20 +1376,20 @@ function AppBar({
|
|
|
1440
1376
|
contentColor,
|
|
1441
1377
|
leading,
|
|
1442
1378
|
onBackPress,
|
|
1443
|
-
|
|
1379
|
+
styles3.iconFrame,
|
|
1444
1380
|
theme.colors.onSurface
|
|
1445
1381
|
]);
|
|
1446
|
-
const actionsContent = (0,
|
|
1382
|
+
const actionsContent = (0, import_react9.useMemo)(() => {
|
|
1447
1383
|
if (trailing) {
|
|
1448
1384
|
return trailing;
|
|
1449
1385
|
}
|
|
1450
1386
|
if (!actions || actions.length === 0) {
|
|
1451
1387
|
return null;
|
|
1452
1388
|
}
|
|
1453
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1454
|
-
|
|
1389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: styles3.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1390
|
+
import_react_native12.View,
|
|
1455
1391
|
{
|
|
1456
|
-
style:
|
|
1392
|
+
style: styles3.iconFrame,
|
|
1457
1393
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1458
1394
|
IconButton,
|
|
1459
1395
|
{
|
|
@@ -1469,8 +1405,8 @@ function AppBar({
|
|
|
1469
1405
|
},
|
|
1470
1406
|
`${String(action.icon)}-${index}`
|
|
1471
1407
|
)) });
|
|
1472
|
-
}, [actions, contentColor,
|
|
1473
|
-
const onLeadingLayout = (0,
|
|
1408
|
+
}, [actions, contentColor, styles3.actionsRow, styles3.iconFrame, trailing]);
|
|
1409
|
+
const onLeadingLayout = (0, import_react9.useCallback)((event) => {
|
|
1474
1410
|
const nextWidth = measureWidth(event);
|
|
1475
1411
|
setLeadingWidth((currentWidth) => {
|
|
1476
1412
|
if (currentWidth === nextWidth) {
|
|
@@ -1479,7 +1415,7 @@ function AppBar({
|
|
|
1479
1415
|
return nextWidth;
|
|
1480
1416
|
});
|
|
1481
1417
|
}, []);
|
|
1482
|
-
const onActionsLayout = (0,
|
|
1418
|
+
const onActionsLayout = (0, import_react9.useCallback)((event) => {
|
|
1483
1419
|
const nextWidth = measureWidth(event);
|
|
1484
1420
|
setActionsWidth((currentWidth) => {
|
|
1485
1421
|
if (currentWidth === nextWidth) {
|
|
@@ -1488,48 +1424,48 @@ function AppBar({
|
|
|
1488
1424
|
return nextWidth;
|
|
1489
1425
|
});
|
|
1490
1426
|
}, []);
|
|
1491
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1427
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: styles3.topRow, children: [
|
|
1492
1428
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1493
|
-
|
|
1429
|
+
import_react_native12.View,
|
|
1494
1430
|
{
|
|
1495
1431
|
collapsable: false,
|
|
1496
1432
|
onLayout: onLeadingLayout,
|
|
1497
|
-
style:
|
|
1433
|
+
style: styles3.sideSlot,
|
|
1498
1434
|
children: leadingContent
|
|
1499
1435
|
}
|
|
1500
1436
|
),
|
|
1501
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: styles3.topRowSpacer }),
|
|
1502
1438
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1503
|
-
|
|
1439
|
+
import_react_native12.View,
|
|
1504
1440
|
{
|
|
1505
1441
|
collapsable: false,
|
|
1506
1442
|
onLayout: onActionsLayout,
|
|
1507
|
-
style:
|
|
1443
|
+
style: styles3.sideSlot,
|
|
1508
1444
|
children: actionsContent
|
|
1509
1445
|
}
|
|
1510
1446
|
)
|
|
1511
1447
|
] });
|
|
1512
1448
|
const containerOverride = containerColor ? { backgroundColor: containerColor } : void 0;
|
|
1513
1449
|
const rootStyle = [
|
|
1514
|
-
|
|
1515
|
-
elevated ?
|
|
1450
|
+
styles3.root,
|
|
1451
|
+
elevated ? styles3.elevatedRoot : void 0,
|
|
1516
1452
|
containerOverride,
|
|
1517
1453
|
style
|
|
1518
1454
|
];
|
|
1519
1455
|
const safeAreaStyle = [
|
|
1520
|
-
|
|
1521
|
-
elevated ?
|
|
1456
|
+
styles3.safeArea,
|
|
1457
|
+
elevated ? styles3.elevatedSafeArea : void 0,
|
|
1522
1458
|
containerOverride
|
|
1523
1459
|
];
|
|
1524
1460
|
if (isExpanded) {
|
|
1525
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1461
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: [styles3.expandedContainer, getSizeStyle2(styles3, size)], children: [
|
|
1526
1462
|
topRow,
|
|
1527
1463
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1528
|
-
|
|
1464
|
+
import_react_native12.View,
|
|
1529
1465
|
{
|
|
1530
1466
|
style: [
|
|
1531
|
-
|
|
1532
|
-
size === "large" ?
|
|
1467
|
+
styles3.expandedTitleContainer,
|
|
1468
|
+
size === "large" ? styles3.largeTitlePadding : styles3.mediumTitlePadding,
|
|
1533
1469
|
expandedTitleInsetStyle
|
|
1534
1470
|
],
|
|
1535
1471
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1538,9 +1474,9 @@ function AppBar({
|
|
|
1538
1474
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
1539
1475
|
variant: titleVariant,
|
|
1540
1476
|
style: [
|
|
1541
|
-
|
|
1477
|
+
styles3.title,
|
|
1542
1478
|
titleColorStyle,
|
|
1543
|
-
|
|
1479
|
+
styles3.startAlignedTitle,
|
|
1544
1480
|
titleStyle
|
|
1545
1481
|
],
|
|
1546
1482
|
children: title
|
|
@@ -1549,48 +1485,49 @@ function AppBar({
|
|
|
1549
1485
|
}
|
|
1550
1486
|
)
|
|
1551
1487
|
] });
|
|
1552
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1553
1489
|
}
|
|
1554
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1490
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native12.View, { style: styles3.smallContainer, children: [
|
|
1555
1491
|
topRow,
|
|
1556
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: [styles3.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1557
1493
|
Typography,
|
|
1558
1494
|
{
|
|
1559
1495
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
1560
1496
|
variant: titleVariant,
|
|
1561
1497
|
style: [
|
|
1562
|
-
|
|
1498
|
+
styles3.title,
|
|
1563
1499
|
titleColorStyle,
|
|
1564
|
-
isCenterAligned ?
|
|
1500
|
+
isCenterAligned ? styles3.centeredTitle : styles3.startAlignedTitle,
|
|
1565
1501
|
titleStyle
|
|
1566
1502
|
],
|
|
1567
1503
|
children: title
|
|
1568
1504
|
}
|
|
1569
1505
|
) })
|
|
1570
1506
|
] });
|
|
1571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native12.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1572
1508
|
}
|
|
1573
1509
|
|
|
1574
1510
|
// src/card/Card.tsx
|
|
1575
|
-
var
|
|
1576
|
-
var
|
|
1511
|
+
var import_react10 = require("react");
|
|
1512
|
+
var import_react_native14 = require("react-native");
|
|
1577
1513
|
var import_core9 = require("@onlynative/core");
|
|
1578
1514
|
|
|
1579
1515
|
// src/card/styles.ts
|
|
1580
|
-
var
|
|
1516
|
+
var import_react_native13 = require("react-native");
|
|
1517
|
+
var import_utils6 = require("@onlynative/utils");
|
|
1581
1518
|
function getVariantColors2(theme, variant) {
|
|
1582
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1583
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1519
|
+
const disabledContainerColor = (0, import_utils6.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1520
|
+
const disabledOutlineColor = (0, import_utils6.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1584
1521
|
if (variant === "outlined") {
|
|
1585
1522
|
return {
|
|
1586
1523
|
backgroundColor: theme.colors.surface,
|
|
1587
1524
|
borderColor: theme.colors.outline,
|
|
1588
1525
|
borderWidth: 1,
|
|
1589
|
-
hoveredBackgroundColor: alphaColor(
|
|
1526
|
+
hoveredBackgroundColor: (0, import_utils6.alphaColor)(
|
|
1590
1527
|
theme.colors.onSurface,
|
|
1591
1528
|
theme.stateLayer.hoveredOpacity
|
|
1592
1529
|
),
|
|
1593
|
-
pressedBackgroundColor: alphaColor(
|
|
1530
|
+
pressedBackgroundColor: (0, import_utils6.alphaColor)(
|
|
1594
1531
|
theme.colors.onSurface,
|
|
1595
1532
|
theme.stateLayer.pressedOpacity
|
|
1596
1533
|
),
|
|
@@ -1603,12 +1540,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1603
1540
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
1604
1541
|
borderColor: "transparent",
|
|
1605
1542
|
borderWidth: 0,
|
|
1606
|
-
hoveredBackgroundColor: blendColor(
|
|
1543
|
+
hoveredBackgroundColor: (0, import_utils6.blendColor)(
|
|
1607
1544
|
theme.colors.surfaceContainerHighest,
|
|
1608
1545
|
theme.colors.onSurface,
|
|
1609
1546
|
theme.stateLayer.hoveredOpacity
|
|
1610
1547
|
),
|
|
1611
|
-
pressedBackgroundColor: blendColor(
|
|
1548
|
+
pressedBackgroundColor: (0, import_utils6.blendColor)(
|
|
1612
1549
|
theme.colors.surfaceContainerHighest,
|
|
1613
1550
|
theme.colors.onSurface,
|
|
1614
1551
|
theme.stateLayer.pressedOpacity
|
|
@@ -1621,12 +1558,12 @@ function getVariantColors2(theme, variant) {
|
|
|
1621
1558
|
backgroundColor: theme.colors.surface,
|
|
1622
1559
|
borderColor: "transparent",
|
|
1623
1560
|
borderWidth: 0,
|
|
1624
|
-
hoveredBackgroundColor: blendColor(
|
|
1561
|
+
hoveredBackgroundColor: (0, import_utils6.blendColor)(
|
|
1625
1562
|
theme.colors.surface,
|
|
1626
1563
|
theme.colors.onSurface,
|
|
1627
1564
|
theme.stateLayer.hoveredOpacity
|
|
1628
1565
|
),
|
|
1629
|
-
pressedBackgroundColor: blendColor(
|
|
1566
|
+
pressedBackgroundColor: (0, import_utils6.blendColor)(
|
|
1630
1567
|
theme.colors.surface,
|
|
1631
1568
|
theme.colors.onSurface,
|
|
1632
1569
|
theme.stateLayer.pressedOpacity
|
|
@@ -1642,12 +1579,12 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1642
1579
|
backgroundColor: containerColor,
|
|
1643
1580
|
borderColor: containerColor,
|
|
1644
1581
|
borderWidth: 0,
|
|
1645
|
-
hoveredBackgroundColor: blendColor(
|
|
1582
|
+
hoveredBackgroundColor: (0, import_utils6.blendColor)(
|
|
1646
1583
|
containerColor,
|
|
1647
1584
|
theme.colors.onSurface,
|
|
1648
1585
|
theme.stateLayer.hoveredOpacity
|
|
1649
1586
|
),
|
|
1650
|
-
pressedBackgroundColor: blendColor(
|
|
1587
|
+
pressedBackgroundColor: (0, import_utils6.blendColor)(
|
|
1651
1588
|
containerColor,
|
|
1652
1589
|
theme.colors.onSurface,
|
|
1653
1590
|
theme.stateLayer.pressedOpacity
|
|
@@ -1657,11 +1594,11 @@ function applyColorOverrides2(theme, colors, containerColor) {
|
|
|
1657
1594
|
function createStyles4(theme, variant, containerColor) {
|
|
1658
1595
|
const baseColors = getVariantColors2(theme, variant);
|
|
1659
1596
|
const colors = applyColorOverrides2(theme, baseColors, containerColor);
|
|
1660
|
-
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1661
|
-
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1662
|
-
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1597
|
+
const elevationLevel0 = (0, import_utils6.elevationStyle)(theme.elevation.level0);
|
|
1598
|
+
const elevationLevel1 = (0, import_utils6.elevationStyle)(theme.elevation.level1);
|
|
1599
|
+
const elevationLevel2 = (0, import_utils6.elevationStyle)(theme.elevation.level2);
|
|
1663
1600
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
1664
|
-
return
|
|
1601
|
+
return import_react_native13.StyleSheet.create({
|
|
1665
1602
|
container: {
|
|
1666
1603
|
borderRadius: theme.shape.cornerMedium,
|
|
1667
1604
|
backgroundColor: colors.backgroundColor,
|
|
@@ -1706,60 +1643,61 @@ function Card({
|
|
|
1706
1643
|
const isDisabled = Boolean(disabled);
|
|
1707
1644
|
const isInteractive = onPress !== void 0;
|
|
1708
1645
|
const theme = (0, import_core9.useTheme)();
|
|
1709
|
-
const
|
|
1646
|
+
const styles3 = (0, import_react10.useMemo)(
|
|
1710
1647
|
() => createStyles4(theme, variant, containerColor),
|
|
1711
1648
|
[theme, variant, containerColor]
|
|
1712
1649
|
);
|
|
1713
1650
|
if (!isInteractive) {
|
|
1714
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native14.View, { ...props, style: [styles3.container, style], children });
|
|
1715
1652
|
}
|
|
1716
1653
|
const resolvedStyle = (state) => [
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
state.hovered && !state.pressed && !isDisabled ?
|
|
1720
|
-
state.pressed && !isDisabled ?
|
|
1721
|
-
isDisabled ?
|
|
1654
|
+
styles3.container,
|
|
1655
|
+
styles3.interactiveContainer,
|
|
1656
|
+
state.hovered && !state.pressed && !isDisabled ? styles3.hoveredContainer : void 0,
|
|
1657
|
+
state.pressed && !isDisabled ? styles3.pressedContainer : void 0,
|
|
1658
|
+
isDisabled ? styles3.disabledContainer : void 0,
|
|
1722
1659
|
typeof style === "function" ? style(state) : style
|
|
1723
1660
|
];
|
|
1724
1661
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1725
|
-
|
|
1662
|
+
import_react_native14.Pressable,
|
|
1726
1663
|
{
|
|
1727
1664
|
...props,
|
|
1728
1665
|
role: "button",
|
|
1729
1666
|
accessibilityState: { disabled: isDisabled },
|
|
1730
|
-
hitSlop:
|
|
1667
|
+
hitSlop: import_react_native14.Platform.OS === "web" ? void 0 : 4,
|
|
1731
1668
|
disabled: isDisabled,
|
|
1732
1669
|
onPress,
|
|
1733
1670
|
style: resolvedStyle,
|
|
1734
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1671
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native14.View, { style: styles3.disabledContent, children }) : children
|
|
1735
1672
|
}
|
|
1736
1673
|
);
|
|
1737
1674
|
}
|
|
1738
1675
|
|
|
1739
1676
|
// src/chip/Chip.tsx
|
|
1740
|
-
var
|
|
1741
|
-
var
|
|
1742
|
-
var import_react_native18 = require("react-native");
|
|
1677
|
+
var import_react11 = require("react");
|
|
1678
|
+
var import_react_native16 = require("react-native");
|
|
1743
1679
|
var import_core10 = require("@onlynative/core");
|
|
1680
|
+
var import_utils8 = require("@onlynative/utils");
|
|
1744
1681
|
|
|
1745
1682
|
// src/chip/styles.ts
|
|
1746
|
-
var
|
|
1683
|
+
var import_react_native15 = require("react-native");
|
|
1684
|
+
var import_utils7 = require("@onlynative/utils");
|
|
1747
1685
|
function getVariantColors3(theme, variant, elevated, selected) {
|
|
1748
|
-
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1749
|
-
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
1750
|
-
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1686
|
+
const disabledContainerColor = (0, import_utils7.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1687
|
+
const disabledLabelColor = (0, import_utils7.alphaColor)(theme.colors.onSurface, 0.38);
|
|
1688
|
+
const disabledOutlineColor = (0, import_utils7.alphaColor)(theme.colors.onSurface, 0.12);
|
|
1751
1689
|
if (variant === "filter" && selected) {
|
|
1752
1690
|
return {
|
|
1753
1691
|
backgroundColor: theme.colors.secondaryContainer,
|
|
1754
1692
|
textColor: theme.colors.onSecondaryContainer,
|
|
1755
1693
|
borderColor: "transparent",
|
|
1756
1694
|
borderWidth: 0,
|
|
1757
|
-
hoveredBackgroundColor: blendColor(
|
|
1695
|
+
hoveredBackgroundColor: (0, import_utils7.blendColor)(
|
|
1758
1696
|
theme.colors.secondaryContainer,
|
|
1759
1697
|
theme.colors.onSecondaryContainer,
|
|
1760
1698
|
theme.stateLayer.hoveredOpacity
|
|
1761
1699
|
),
|
|
1762
|
-
pressedBackgroundColor: blendColor(
|
|
1700
|
+
pressedBackgroundColor: (0, import_utils7.blendColor)(
|
|
1763
1701
|
theme.colors.secondaryContainer,
|
|
1764
1702
|
theme.colors.onSecondaryContainer,
|
|
1765
1703
|
theme.stateLayer.pressedOpacity
|
|
@@ -1776,12 +1714,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1776
1714
|
textColor: textColor2,
|
|
1777
1715
|
borderColor: "transparent",
|
|
1778
1716
|
borderWidth: 0,
|
|
1779
|
-
hoveredBackgroundColor: blendColor(
|
|
1717
|
+
hoveredBackgroundColor: (0, import_utils7.blendColor)(
|
|
1780
1718
|
theme.colors.surfaceContainerLow,
|
|
1781
1719
|
textColor2,
|
|
1782
1720
|
theme.stateLayer.hoveredOpacity
|
|
1783
1721
|
),
|
|
1784
|
-
pressedBackgroundColor: blendColor(
|
|
1722
|
+
pressedBackgroundColor: (0, import_utils7.blendColor)(
|
|
1785
1723
|
theme.colors.surfaceContainerLow,
|
|
1786
1724
|
textColor2,
|
|
1787
1725
|
theme.stateLayer.pressedOpacity
|
|
@@ -1797,12 +1735,12 @@ function getVariantColors3(theme, variant, elevated, selected) {
|
|
|
1797
1735
|
textColor,
|
|
1798
1736
|
borderColor: theme.colors.outline,
|
|
1799
1737
|
borderWidth: 1,
|
|
1800
|
-
hoveredBackgroundColor: blendColor(
|
|
1738
|
+
hoveredBackgroundColor: (0, import_utils7.blendColor)(
|
|
1801
1739
|
theme.colors.surface,
|
|
1802
1740
|
textColor,
|
|
1803
1741
|
theme.stateLayer.hoveredOpacity
|
|
1804
1742
|
),
|
|
1805
|
-
pressedBackgroundColor: blendColor(
|
|
1743
|
+
pressedBackgroundColor: (0, import_utils7.blendColor)(
|
|
1806
1744
|
theme.colors.surface,
|
|
1807
1745
|
textColor,
|
|
1808
1746
|
theme.stateLayer.pressedOpacity
|
|
@@ -1822,33 +1760,33 @@ function applyColorOverrides3(theme, colors, containerColor, contentColor) {
|
|
|
1822
1760
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
1823
1761
|
result.backgroundColor = containerColor;
|
|
1824
1762
|
result.borderColor = containerColor;
|
|
1825
|
-
result.hoveredBackgroundColor = blendColor(
|
|
1763
|
+
result.hoveredBackgroundColor = (0, import_utils7.blendColor)(
|
|
1826
1764
|
containerColor,
|
|
1827
1765
|
overlay,
|
|
1828
1766
|
theme.stateLayer.hoveredOpacity
|
|
1829
1767
|
);
|
|
1830
|
-
result.pressedBackgroundColor = blendColor(
|
|
1768
|
+
result.pressedBackgroundColor = (0, import_utils7.blendColor)(
|
|
1831
1769
|
containerColor,
|
|
1832
1770
|
overlay,
|
|
1833
1771
|
theme.stateLayer.pressedOpacity
|
|
1834
1772
|
);
|
|
1835
1773
|
} else if (contentColor) {
|
|
1836
1774
|
if (colors.backgroundColor === "transparent") {
|
|
1837
|
-
result.hoveredBackgroundColor = alphaColor(
|
|
1775
|
+
result.hoveredBackgroundColor = (0, import_utils7.alphaColor)(
|
|
1838
1776
|
contentColor,
|
|
1839
1777
|
theme.stateLayer.hoveredOpacity
|
|
1840
1778
|
);
|
|
1841
|
-
result.pressedBackgroundColor = alphaColor(
|
|
1779
|
+
result.pressedBackgroundColor = (0, import_utils7.alphaColor)(
|
|
1842
1780
|
contentColor,
|
|
1843
1781
|
theme.stateLayer.pressedOpacity
|
|
1844
1782
|
);
|
|
1845
1783
|
} else {
|
|
1846
|
-
result.hoveredBackgroundColor = blendColor(
|
|
1784
|
+
result.hoveredBackgroundColor = (0, import_utils7.blendColor)(
|
|
1847
1785
|
colors.backgroundColor,
|
|
1848
1786
|
contentColor,
|
|
1849
1787
|
theme.stateLayer.hoveredOpacity
|
|
1850
1788
|
);
|
|
1851
|
-
result.pressedBackgroundColor = blendColor(
|
|
1789
|
+
result.pressedBackgroundColor = (0, import_utils7.blendColor)(
|
|
1852
1790
|
colors.backgroundColor,
|
|
1853
1791
|
contentColor,
|
|
1854
1792
|
theme.stateLayer.pressedOpacity
|
|
@@ -1866,12 +1804,12 @@ function createStyles5(theme, variant, elevated, selected, hasLeadingContent, ha
|
|
|
1866
1804
|
contentColor
|
|
1867
1805
|
);
|
|
1868
1806
|
const labelStyle = theme.typography.labelLarge;
|
|
1869
|
-
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
1870
|
-
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1871
|
-
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1807
|
+
const elevationLevel0 = (0, import_utils7.elevationStyle)(theme.elevation.level0);
|
|
1808
|
+
const elevationLevel1 = (0, import_utils7.elevationStyle)(theme.elevation.level1);
|
|
1809
|
+
const elevationLevel2 = (0, import_utils7.elevationStyle)(theme.elevation.level2);
|
|
1872
1810
|
const isElevated = elevated && variant !== "input";
|
|
1873
1811
|
const baseElevation = isElevated ? elevationLevel1 : elevationLevel0;
|
|
1874
|
-
return
|
|
1812
|
+
return import_react_native15.StyleSheet.create({
|
|
1875
1813
|
container: {
|
|
1876
1814
|
alignSelf: "flex-start",
|
|
1877
1815
|
alignItems: "center",
|
|
@@ -1968,8 +1906,10 @@ function Chip({
|
|
|
1968
1906
|
const hasLeadingContent = Boolean(
|
|
1969
1907
|
variant === "input" && avatar || leadingIcon || variant === "filter" && isSelected
|
|
1970
1908
|
);
|
|
1909
|
+
const needsIcons = Boolean(leadingIcon) || variant === "filter" && isSelected || showCloseIcon;
|
|
1910
|
+
const MaterialCommunityIcons = needsIcons ? (0, import_utils8.getMaterialCommunityIcons)() : null;
|
|
1971
1911
|
const theme = (0, import_core10.useTheme)();
|
|
1972
|
-
const
|
|
1912
|
+
const styles3 = (0, import_react11.useMemo)(
|
|
1973
1913
|
() => createStyles5(
|
|
1974
1914
|
theme,
|
|
1975
1915
|
variant,
|
|
@@ -1991,51 +1931,51 @@ function Chip({
|
|
|
1991
1931
|
contentColor
|
|
1992
1932
|
]
|
|
1993
1933
|
);
|
|
1994
|
-
const resolvedIconColor = (0,
|
|
1995
|
-
const base =
|
|
1996
|
-
|
|
1997
|
-
isDisabled ?
|
|
1934
|
+
const resolvedIconColor = (0, import_react11.useMemo)(() => {
|
|
1935
|
+
const base = import_react_native16.StyleSheet.flatten([
|
|
1936
|
+
styles3.label,
|
|
1937
|
+
isDisabled ? styles3.disabledLabel : void 0
|
|
1998
1938
|
]);
|
|
1999
1939
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
2000
|
-
}, [
|
|
2001
|
-
const computedLabelStyle = (0,
|
|
1940
|
+
}, [styles3.label, styles3.disabledLabel, isDisabled]);
|
|
1941
|
+
const computedLabelStyle = (0, import_react11.useMemo)(
|
|
2002
1942
|
() => [
|
|
2003
|
-
|
|
2004
|
-
isDisabled ?
|
|
1943
|
+
styles3.label,
|
|
1944
|
+
isDisabled ? styles3.disabledLabel : void 0,
|
|
2005
1945
|
labelStyleOverride
|
|
2006
1946
|
],
|
|
2007
|
-
[isDisabled,
|
|
1947
|
+
[isDisabled, styles3.disabledLabel, styles3.label, labelStyleOverride]
|
|
2008
1948
|
);
|
|
2009
1949
|
const renderLeadingContent = () => {
|
|
2010
1950
|
if (variant === "input" && avatar) {
|
|
2011
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native16.View, { style: styles3.avatar, children: avatar });
|
|
2012
1952
|
}
|
|
2013
1953
|
if (leadingIcon) {
|
|
2014
1954
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2015
|
-
|
|
1955
|
+
MaterialCommunityIcons,
|
|
2016
1956
|
{
|
|
2017
1957
|
name: leadingIcon,
|
|
2018
1958
|
size: iconSize,
|
|
2019
1959
|
color: resolvedIconColor,
|
|
2020
|
-
style:
|
|
1960
|
+
style: styles3.leadingIcon
|
|
2021
1961
|
}
|
|
2022
1962
|
);
|
|
2023
1963
|
}
|
|
2024
1964
|
if (variant === "filter" && isSelected) {
|
|
2025
1965
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2026
|
-
|
|
1966
|
+
MaterialCommunityIcons,
|
|
2027
1967
|
{
|
|
2028
1968
|
name: "check",
|
|
2029
1969
|
size: iconSize,
|
|
2030
1970
|
color: resolvedIconColor,
|
|
2031
|
-
style:
|
|
1971
|
+
style: styles3.leadingIcon
|
|
2032
1972
|
}
|
|
2033
1973
|
);
|
|
2034
1974
|
}
|
|
2035
1975
|
return null;
|
|
2036
1976
|
};
|
|
2037
1977
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2038
|
-
|
|
1978
|
+
import_react_native16.Pressable,
|
|
2039
1979
|
{
|
|
2040
1980
|
...props,
|
|
2041
1981
|
accessibilityRole: "button",
|
|
@@ -2043,29 +1983,29 @@ function Chip({
|
|
|
2043
1983
|
disabled: isDisabled,
|
|
2044
1984
|
...variant === "filter" ? { selected: isSelected } : void 0
|
|
2045
1985
|
},
|
|
2046
|
-
hitSlop:
|
|
1986
|
+
hitSlop: import_react_native16.Platform.OS === "web" ? void 0 : 4,
|
|
2047
1987
|
disabled: isDisabled,
|
|
2048
1988
|
style: resolveStyle2(
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
1989
|
+
styles3.container,
|
|
1990
|
+
styles3.hoveredContainer,
|
|
1991
|
+
styles3.pressedContainer,
|
|
1992
|
+
styles3.disabledContainer,
|
|
2053
1993
|
isDisabled,
|
|
2054
1994
|
style
|
|
2055
1995
|
),
|
|
2056
1996
|
children: [
|
|
2057
1997
|
renderLeadingContent(),
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native16.Text, { style: computedLabelStyle, children }),
|
|
2059
1999
|
showCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2060
|
-
|
|
2000
|
+
import_react_native16.Pressable,
|
|
2061
2001
|
{
|
|
2062
2002
|
onPress: onClose,
|
|
2063
2003
|
accessibilityRole: "button",
|
|
2064
2004
|
accessibilityLabel: "Remove",
|
|
2065
2005
|
hitSlop: 4,
|
|
2066
|
-
style:
|
|
2006
|
+
style: styles3.closeButton,
|
|
2067
2007
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2068
|
-
|
|
2008
|
+
MaterialCommunityIcons,
|
|
2069
2009
|
{
|
|
2070
2010
|
name: "close",
|
|
2071
2011
|
size: iconSize,
|
|
@@ -2080,27 +2020,28 @@ function Chip({
|
|
|
2080
2020
|
}
|
|
2081
2021
|
|
|
2082
2022
|
// src/checkbox/Checkbox.tsx
|
|
2083
|
-
var
|
|
2084
|
-
var
|
|
2085
|
-
var import_react_native20 = require("react-native");
|
|
2023
|
+
var import_react12 = require("react");
|
|
2024
|
+
var import_react_native18 = require("react-native");
|
|
2086
2025
|
var import_core11 = require("@onlynative/core");
|
|
2026
|
+
var import_utils10 = require("@onlynative/utils");
|
|
2087
2027
|
|
|
2088
2028
|
// src/checkbox/styles.ts
|
|
2089
|
-
var
|
|
2029
|
+
var import_react_native17 = require("react-native");
|
|
2030
|
+
var import_utils9 = require("@onlynative/utils");
|
|
2090
2031
|
function getColors(theme, checked) {
|
|
2091
|
-
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2032
|
+
const disabledOnSurface38 = (0, import_utils9.alphaColor)(theme.colors.onSurface, 0.38);
|
|
2092
2033
|
if (checked) {
|
|
2093
2034
|
return {
|
|
2094
2035
|
backgroundColor: theme.colors.primary,
|
|
2095
2036
|
borderColor: "transparent",
|
|
2096
2037
|
borderWidth: 0,
|
|
2097
2038
|
iconColor: theme.colors.onPrimary,
|
|
2098
|
-
hoveredBackgroundColor: blendColor(
|
|
2039
|
+
hoveredBackgroundColor: (0, import_utils9.blendColor)(
|
|
2099
2040
|
theme.colors.primary,
|
|
2100
2041
|
theme.colors.onPrimary,
|
|
2101
2042
|
theme.stateLayer.hoveredOpacity
|
|
2102
2043
|
),
|
|
2103
|
-
pressedBackgroundColor: blendColor(
|
|
2044
|
+
pressedBackgroundColor: (0, import_utils9.blendColor)(
|
|
2104
2045
|
theme.colors.primary,
|
|
2105
2046
|
theme.colors.onPrimary,
|
|
2106
2047
|
theme.stateLayer.pressedOpacity
|
|
@@ -2116,11 +2057,11 @@ function getColors(theme, checked) {
|
|
|
2116
2057
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2117
2058
|
borderWidth: 2,
|
|
2118
2059
|
iconColor: "transparent",
|
|
2119
|
-
hoveredBackgroundColor: alphaColor(
|
|
2060
|
+
hoveredBackgroundColor: (0, import_utils9.alphaColor)(
|
|
2120
2061
|
theme.colors.onSurface,
|
|
2121
2062
|
theme.stateLayer.hoveredOpacity
|
|
2122
2063
|
),
|
|
2123
|
-
pressedBackgroundColor: alphaColor(
|
|
2064
|
+
pressedBackgroundColor: (0, import_utils9.alphaColor)(
|
|
2124
2065
|
theme.colors.onSurface,
|
|
2125
2066
|
theme.stateLayer.pressedOpacity
|
|
2126
2067
|
),
|
|
@@ -2140,12 +2081,12 @@ function applyColorOverrides4(theme, colors, containerColor, contentColor) {
|
|
|
2140
2081
|
const overlay = contentColor != null ? contentColor : colors.iconColor;
|
|
2141
2082
|
result.backgroundColor = containerColor;
|
|
2142
2083
|
result.borderColor = containerColor;
|
|
2143
|
-
result.hoveredBackgroundColor = blendColor(
|
|
2084
|
+
result.hoveredBackgroundColor = (0, import_utils9.blendColor)(
|
|
2144
2085
|
containerColor,
|
|
2145
2086
|
overlay,
|
|
2146
2087
|
theme.stateLayer.hoveredOpacity
|
|
2147
2088
|
);
|
|
2148
|
-
result.pressedBackgroundColor = blendColor(
|
|
2089
|
+
result.pressedBackgroundColor = (0, import_utils9.blendColor)(
|
|
2149
2090
|
containerColor,
|
|
2150
2091
|
overlay,
|
|
2151
2092
|
theme.stateLayer.pressedOpacity
|
|
@@ -2162,7 +2103,7 @@ function createStyles6(theme, checked, containerColor, contentColor) {
|
|
|
2162
2103
|
);
|
|
2163
2104
|
const size = 18;
|
|
2164
2105
|
const touchTarget = 48;
|
|
2165
|
-
return
|
|
2106
|
+
return import_react_native17.StyleSheet.create({
|
|
2166
2107
|
container: {
|
|
2167
2108
|
width: touchTarget,
|
|
2168
2109
|
height: touchTarget,
|
|
@@ -2236,25 +2177,26 @@ function Checkbox({
|
|
|
2236
2177
|
}) {
|
|
2237
2178
|
const isDisabled = Boolean(disabled);
|
|
2238
2179
|
const isChecked = Boolean(value);
|
|
2180
|
+
const MaterialCommunityIcons = isChecked ? (0, import_utils10.getMaterialCommunityIcons)() : null;
|
|
2239
2181
|
const theme = (0, import_core11.useTheme)();
|
|
2240
|
-
const
|
|
2182
|
+
const styles3 = (0, import_react12.useMemo)(
|
|
2241
2183
|
() => createStyles6(theme, isChecked, containerColor, contentColor),
|
|
2242
2184
|
[theme, isChecked, containerColor, contentColor]
|
|
2243
2185
|
);
|
|
2244
|
-
const resolvedIconColor = (0,
|
|
2245
|
-
const base =
|
|
2246
|
-
|
|
2247
|
-
isDisabled ?
|
|
2186
|
+
const resolvedIconColor = (0, import_react12.useMemo)(() => {
|
|
2187
|
+
const base = import_react_native18.StyleSheet.flatten([
|
|
2188
|
+
styles3.iconColor,
|
|
2189
|
+
isDisabled ? styles3.disabledIconColor : void 0
|
|
2248
2190
|
]);
|
|
2249
2191
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
2250
|
-
}, [
|
|
2192
|
+
}, [styles3.iconColor, styles3.disabledIconColor, isDisabled]);
|
|
2251
2193
|
const handlePress = () => {
|
|
2252
2194
|
if (!isDisabled) {
|
|
2253
2195
|
onValueChange == null ? void 0 : onValueChange(!isChecked);
|
|
2254
2196
|
}
|
|
2255
2197
|
};
|
|
2256
2198
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2257
|
-
|
|
2199
|
+
import_react_native18.Pressable,
|
|
2258
2200
|
{
|
|
2259
2201
|
...props,
|
|
2260
2202
|
accessibilityRole: "checkbox",
|
|
@@ -2262,19 +2204,19 @@ function Checkbox({
|
|
|
2262
2204
|
disabled: isDisabled,
|
|
2263
2205
|
checked: isChecked
|
|
2264
2206
|
},
|
|
2265
|
-
hitSlop:
|
|
2207
|
+
hitSlop: import_react_native18.Platform.OS === "web" ? void 0 : 4,
|
|
2266
2208
|
disabled: isDisabled,
|
|
2267
2209
|
onPress: handlePress,
|
|
2268
2210
|
style: resolveStyle3(
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2211
|
+
styles3.container,
|
|
2212
|
+
styles3.hoveredContainer,
|
|
2213
|
+
styles3.pressedContainer,
|
|
2214
|
+
styles3.disabledContainer,
|
|
2273
2215
|
isDisabled,
|
|
2274
2216
|
style
|
|
2275
2217
|
),
|
|
2276
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2277
|
-
|
|
2218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native18.View, { style: [styles3.box, isDisabled ? styles3.disabledBox : void 0], children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2219
|
+
MaterialCommunityIcons,
|
|
2278
2220
|
{
|
|
2279
2221
|
name: "check",
|
|
2280
2222
|
size: 14,
|
|
@@ -2286,23 +2228,24 @@ function Checkbox({
|
|
|
2286
2228
|
}
|
|
2287
2229
|
|
|
2288
2230
|
// src/radio/Radio.tsx
|
|
2289
|
-
var
|
|
2290
|
-
var
|
|
2231
|
+
var import_react13 = require("react");
|
|
2232
|
+
var import_react_native20 = require("react-native");
|
|
2291
2233
|
var import_core12 = require("@onlynative/core");
|
|
2292
2234
|
|
|
2293
2235
|
// src/radio/styles.ts
|
|
2294
|
-
var
|
|
2236
|
+
var import_react_native19 = require("react-native");
|
|
2237
|
+
var import_utils11 = require("@onlynative/utils");
|
|
2295
2238
|
function getColors2(theme, selected) {
|
|
2296
|
-
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2239
|
+
const disabledOnSurface38 = (0, import_utils11.alphaColor)(theme.colors.onSurface, 0.38);
|
|
2297
2240
|
if (selected) {
|
|
2298
2241
|
return {
|
|
2299
2242
|
borderColor: theme.colors.primary,
|
|
2300
2243
|
dotColor: theme.colors.primary,
|
|
2301
|
-
hoveredBackgroundColor: alphaColor(
|
|
2244
|
+
hoveredBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2302
2245
|
theme.colors.primary,
|
|
2303
2246
|
theme.stateLayer.hoveredOpacity
|
|
2304
2247
|
),
|
|
2305
|
-
pressedBackgroundColor: alphaColor(
|
|
2248
|
+
pressedBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2306
2249
|
theme.colors.primary,
|
|
2307
2250
|
theme.stateLayer.pressedOpacity
|
|
2308
2251
|
),
|
|
@@ -2313,11 +2256,11 @@ function getColors2(theme, selected) {
|
|
|
2313
2256
|
return {
|
|
2314
2257
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2315
2258
|
dotColor: "transparent",
|
|
2316
|
-
hoveredBackgroundColor: alphaColor(
|
|
2259
|
+
hoveredBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2317
2260
|
theme.colors.onSurface,
|
|
2318
2261
|
theme.stateLayer.hoveredOpacity
|
|
2319
2262
|
),
|
|
2320
|
-
pressedBackgroundColor: alphaColor(
|
|
2263
|
+
pressedBackgroundColor: (0, import_utils11.alphaColor)(
|
|
2321
2264
|
theme.colors.onSurface,
|
|
2322
2265
|
theme.stateLayer.pressedOpacity
|
|
2323
2266
|
),
|
|
@@ -2331,11 +2274,11 @@ function applyColorOverrides5(theme, colors, containerColor, contentColor) {
|
|
|
2331
2274
|
if (containerColor) {
|
|
2332
2275
|
result.borderColor = containerColor;
|
|
2333
2276
|
result.dotColor = containerColor;
|
|
2334
|
-
result.hoveredBackgroundColor = alphaColor(
|
|
2277
|
+
result.hoveredBackgroundColor = (0, import_utils11.alphaColor)(
|
|
2335
2278
|
containerColor,
|
|
2336
2279
|
theme.stateLayer.hoveredOpacity
|
|
2337
2280
|
);
|
|
2338
|
-
result.pressedBackgroundColor = alphaColor(
|
|
2281
|
+
result.pressedBackgroundColor = (0, import_utils11.alphaColor)(
|
|
2339
2282
|
containerColor,
|
|
2340
2283
|
theme.stateLayer.pressedOpacity
|
|
2341
2284
|
);
|
|
@@ -2355,7 +2298,7 @@ function createStyles7(theme, selected, containerColor, contentColor) {
|
|
|
2355
2298
|
const outerSize = 20;
|
|
2356
2299
|
const innerSize = 10;
|
|
2357
2300
|
const touchTarget = 48;
|
|
2358
|
-
return
|
|
2301
|
+
return import_react_native19.StyleSheet.create({
|
|
2359
2302
|
container: {
|
|
2360
2303
|
width: touchTarget,
|
|
2361
2304
|
height: touchTarget,
|
|
@@ -2430,7 +2373,7 @@ function Radio({
|
|
|
2430
2373
|
const isDisabled = Boolean(disabled);
|
|
2431
2374
|
const isSelected = Boolean(value);
|
|
2432
2375
|
const theme = (0, import_core12.useTheme)();
|
|
2433
|
-
const
|
|
2376
|
+
const styles3 = (0, import_react13.useMemo)(
|
|
2434
2377
|
() => createStyles7(theme, isSelected, containerColor, contentColor),
|
|
2435
2378
|
[theme, isSelected, containerColor, contentColor]
|
|
2436
2379
|
);
|
|
@@ -2440,7 +2383,7 @@ function Radio({
|
|
|
2440
2383
|
}
|
|
2441
2384
|
};
|
|
2442
2385
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2443
|
-
|
|
2386
|
+
import_react_native20.Pressable,
|
|
2444
2387
|
{
|
|
2445
2388
|
...props,
|
|
2446
2389
|
accessibilityRole: "radio",
|
|
@@ -2448,27 +2391,27 @@ function Radio({
|
|
|
2448
2391
|
disabled: isDisabled,
|
|
2449
2392
|
checked: isSelected
|
|
2450
2393
|
},
|
|
2451
|
-
hitSlop:
|
|
2394
|
+
hitSlop: import_react_native20.Platform.OS === "web" ? void 0 : 4,
|
|
2452
2395
|
disabled: isDisabled,
|
|
2453
2396
|
onPress: handlePress,
|
|
2454
2397
|
style: resolveStyle4(
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2398
|
+
styles3.container,
|
|
2399
|
+
styles3.hoveredContainer,
|
|
2400
|
+
styles3.pressedContainer,
|
|
2401
|
+
styles3.disabledContainer,
|
|
2459
2402
|
isDisabled,
|
|
2460
2403
|
style
|
|
2461
2404
|
),
|
|
2462
2405
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2463
|
-
|
|
2406
|
+
import_react_native20.View,
|
|
2464
2407
|
{
|
|
2465
|
-
style: [
|
|
2408
|
+
style: [styles3.outer, isDisabled ? styles3.disabledOuter : void 0],
|
|
2466
2409
|
children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2467
|
-
|
|
2410
|
+
import_react_native20.View,
|
|
2468
2411
|
{
|
|
2469
2412
|
style: [
|
|
2470
|
-
|
|
2471
|
-
isDisabled ?
|
|
2413
|
+
styles3.inner,
|
|
2414
|
+
isDisabled ? styles3.disabledInner : void 0
|
|
2472
2415
|
]
|
|
2473
2416
|
}
|
|
2474
2417
|
) : null
|
|
@@ -2479,27 +2422,28 @@ function Radio({
|
|
|
2479
2422
|
}
|
|
2480
2423
|
|
|
2481
2424
|
// src/switch/Switch.tsx
|
|
2482
|
-
var
|
|
2483
|
-
var
|
|
2484
|
-
var import_react_native24 = require("react-native");
|
|
2425
|
+
var import_react14 = require("react");
|
|
2426
|
+
var import_react_native22 = require("react-native");
|
|
2485
2427
|
var import_core13 = require("@onlynative/core");
|
|
2428
|
+
var import_utils13 = require("@onlynative/utils");
|
|
2486
2429
|
|
|
2487
2430
|
// src/switch/styles.ts
|
|
2488
|
-
var
|
|
2431
|
+
var import_react_native21 = require("react-native");
|
|
2432
|
+
var import_utils12 = require("@onlynative/utils");
|
|
2489
2433
|
function getColors3(theme, selected) {
|
|
2490
|
-
const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
|
|
2491
|
-
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2434
|
+
const disabledOnSurface12 = (0, import_utils12.alphaColor)(theme.colors.onSurface, 0.12);
|
|
2435
|
+
const disabledOnSurface38 = (0, import_utils12.alphaColor)(theme.colors.onSurface, 0.38);
|
|
2492
2436
|
if (selected) {
|
|
2493
2437
|
return {
|
|
2494
2438
|
trackColor: theme.colors.primary,
|
|
2495
2439
|
thumbColor: theme.colors.onPrimary,
|
|
2496
2440
|
iconColor: theme.colors.onPrimaryContainer,
|
|
2497
|
-
hoveredTrackColor: blendColor(
|
|
2441
|
+
hoveredTrackColor: (0, import_utils12.blendColor)(
|
|
2498
2442
|
theme.colors.primary,
|
|
2499
2443
|
theme.colors.onPrimary,
|
|
2500
2444
|
theme.stateLayer.hoveredOpacity
|
|
2501
2445
|
),
|
|
2502
|
-
pressedTrackColor: blendColor(
|
|
2446
|
+
pressedTrackColor: (0, import_utils12.blendColor)(
|
|
2503
2447
|
theme.colors.primary,
|
|
2504
2448
|
theme.colors.onPrimary,
|
|
2505
2449
|
theme.stateLayer.pressedOpacity
|
|
@@ -2516,12 +2460,12 @@ function getColors3(theme, selected) {
|
|
|
2516
2460
|
trackColor: theme.colors.surfaceContainerHighest,
|
|
2517
2461
|
thumbColor: theme.colors.outline,
|
|
2518
2462
|
iconColor: theme.colors.surfaceContainerHighest,
|
|
2519
|
-
hoveredTrackColor: blendColor(
|
|
2463
|
+
hoveredTrackColor: (0, import_utils12.blendColor)(
|
|
2520
2464
|
theme.colors.surfaceContainerHighest,
|
|
2521
2465
|
theme.colors.onSurface,
|
|
2522
2466
|
theme.stateLayer.hoveredOpacity
|
|
2523
2467
|
),
|
|
2524
|
-
pressedTrackColor: blendColor(
|
|
2468
|
+
pressedTrackColor: (0, import_utils12.blendColor)(
|
|
2525
2469
|
theme.colors.surfaceContainerHighest,
|
|
2526
2470
|
theme.colors.onSurface,
|
|
2527
2471
|
theme.stateLayer.pressedOpacity
|
|
@@ -2545,12 +2489,12 @@ function applyColorOverrides6(theme, colors, containerColor, contentColor) {
|
|
|
2545
2489
|
const overlay = contentColor != null ? contentColor : colors.thumbColor;
|
|
2546
2490
|
result.trackColor = containerColor;
|
|
2547
2491
|
result.borderColor = containerColor;
|
|
2548
|
-
result.hoveredTrackColor = blendColor(
|
|
2492
|
+
result.hoveredTrackColor = (0, import_utils12.blendColor)(
|
|
2549
2493
|
containerColor,
|
|
2550
2494
|
overlay,
|
|
2551
2495
|
theme.stateLayer.hoveredOpacity
|
|
2552
2496
|
);
|
|
2553
|
-
result.pressedTrackColor = blendColor(
|
|
2497
|
+
result.pressedTrackColor = (0, import_utils12.blendColor)(
|
|
2554
2498
|
containerColor,
|
|
2555
2499
|
overlay,
|
|
2556
2500
|
theme.stateLayer.pressedOpacity
|
|
@@ -2573,7 +2517,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2573
2517
|
const trackHeight = 32;
|
|
2574
2518
|
const trackPadding = 4;
|
|
2575
2519
|
const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
|
|
2576
|
-
return
|
|
2520
|
+
return import_react_native21.StyleSheet.create({
|
|
2577
2521
|
track: {
|
|
2578
2522
|
width: trackWidth,
|
|
2579
2523
|
height: trackHeight,
|
|
@@ -2612,7 +2556,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2612
2556
|
color: colors.iconColor
|
|
2613
2557
|
},
|
|
2614
2558
|
disabledIconColor: {
|
|
2615
|
-
color: alphaColor(theme.colors.onSurface, 0.38)
|
|
2559
|
+
color: (0, import_utils12.alphaColor)(theme.colors.onSurface, 0.38)
|
|
2616
2560
|
}
|
|
2617
2561
|
});
|
|
2618
2562
|
}
|
|
@@ -2652,26 +2596,27 @@ function Switch({
|
|
|
2652
2596
|
const isSelected = Boolean(value);
|
|
2653
2597
|
const hasIcon = isSelected || Boolean(unselectedIcon);
|
|
2654
2598
|
const theme = (0, import_core13.useTheme)();
|
|
2655
|
-
const
|
|
2599
|
+
const styles3 = (0, import_react14.useMemo)(
|
|
2656
2600
|
() => createStyles8(theme, isSelected, hasIcon, containerColor, contentColor),
|
|
2657
2601
|
[theme, isSelected, hasIcon, containerColor, contentColor]
|
|
2658
2602
|
);
|
|
2659
|
-
const resolvedIconColor = (0,
|
|
2660
|
-
const base =
|
|
2661
|
-
|
|
2662
|
-
isDisabled ?
|
|
2603
|
+
const resolvedIconColor = (0, import_react14.useMemo)(() => {
|
|
2604
|
+
const base = import_react_native22.StyleSheet.flatten([
|
|
2605
|
+
styles3.iconColor,
|
|
2606
|
+
isDisabled ? styles3.disabledIconColor : void 0
|
|
2663
2607
|
]);
|
|
2664
2608
|
return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
|
|
2665
|
-
}, [
|
|
2609
|
+
}, [styles3.iconColor, styles3.disabledIconColor, isDisabled]);
|
|
2666
2610
|
const handlePress = () => {
|
|
2667
2611
|
if (!isDisabled) {
|
|
2668
2612
|
onValueChange == null ? void 0 : onValueChange(!isSelected);
|
|
2669
2613
|
}
|
|
2670
2614
|
};
|
|
2671
2615
|
const iconName = isSelected ? selectedIcon : unselectedIcon;
|
|
2616
|
+
const MaterialCommunityIcons = iconName ? (0, import_utils13.getMaterialCommunityIcons)() : null;
|
|
2672
2617
|
const iconSize = 16;
|
|
2673
2618
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2674
|
-
|
|
2619
|
+
import_react_native22.Pressable,
|
|
2675
2620
|
{
|
|
2676
2621
|
...props,
|
|
2677
2622
|
accessibilityRole: "switch",
|
|
@@ -2679,23 +2624,23 @@ function Switch({
|
|
|
2679
2624
|
disabled: isDisabled,
|
|
2680
2625
|
checked: isSelected
|
|
2681
2626
|
},
|
|
2682
|
-
hitSlop:
|
|
2627
|
+
hitSlop: import_react_native22.Platform.OS === "web" ? void 0 : 4,
|
|
2683
2628
|
disabled: isDisabled,
|
|
2684
2629
|
onPress: handlePress,
|
|
2685
2630
|
style: resolveStyle5(
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2631
|
+
styles3.track,
|
|
2632
|
+
styles3.hoveredTrack,
|
|
2633
|
+
styles3.pressedTrack,
|
|
2634
|
+
styles3.disabledTrack,
|
|
2690
2635
|
isDisabled,
|
|
2691
2636
|
style
|
|
2692
2637
|
),
|
|
2693
2638
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2694
|
-
|
|
2639
|
+
import_react_native22.View,
|
|
2695
2640
|
{
|
|
2696
|
-
style: [
|
|
2641
|
+
style: [styles3.thumb, isDisabled ? styles3.disabledThumb : void 0],
|
|
2697
2642
|
children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2698
|
-
|
|
2643
|
+
MaterialCommunityIcons,
|
|
2699
2644
|
{
|
|
2700
2645
|
name: iconName,
|
|
2701
2646
|
size: iconSize,
|
|
@@ -2709,13 +2654,14 @@ function Switch({
|
|
|
2709
2654
|
}
|
|
2710
2655
|
|
|
2711
2656
|
// src/text-field/TextField.tsx
|
|
2712
|
-
var
|
|
2713
|
-
var
|
|
2714
|
-
var import_react_native26 = require("react-native");
|
|
2657
|
+
var import_react15 = require("react");
|
|
2658
|
+
var import_react_native24 = require("react-native");
|
|
2715
2659
|
var import_core14 = require("@onlynative/core");
|
|
2660
|
+
var import_utils15 = require("@onlynative/utils");
|
|
2716
2661
|
|
|
2717
2662
|
// src/text-field/styles.ts
|
|
2718
|
-
var
|
|
2663
|
+
var import_react_native23 = require("react-native");
|
|
2664
|
+
var import_utils14 = require("@onlynative/utils");
|
|
2719
2665
|
var CONTAINER_HEIGHT = 56;
|
|
2720
2666
|
var ICON_SIZE = 24;
|
|
2721
2667
|
var LABEL_FLOATED_LINE_HEIGHT = 16;
|
|
@@ -2740,15 +2686,15 @@ function getVariantColors4(theme, variant) {
|
|
|
2740
2686
|
focusedLabelColor: theme.colors.primary,
|
|
2741
2687
|
errorLabelColor: theme.colors.error,
|
|
2742
2688
|
textColor: theme.colors.onSurface,
|
|
2743
|
-
disabledTextColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2744
|
-
disabledLabelColor: alphaColor(theme.colors.onSurface, disabledOpacity),
|
|
2745
|
-
disabledBorderColor: alphaColor(theme.colors.onSurface, 0.12),
|
|
2689
|
+
disabledTextColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, disabledOpacity),
|
|
2690
|
+
disabledLabelColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, disabledOpacity),
|
|
2691
|
+
disabledBorderColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, 0.12),
|
|
2746
2692
|
placeholderColor: theme.colors.onSurfaceVariant,
|
|
2747
2693
|
supportingTextColor: theme.colors.onSurfaceVariant,
|
|
2748
2694
|
errorSupportingTextColor: theme.colors.error,
|
|
2749
2695
|
iconColor: theme.colors.onSurfaceVariant,
|
|
2750
2696
|
errorIconColor: theme.colors.error,
|
|
2751
|
-
disabledIconColor: alphaColor(theme.colors.onSurface, disabledOpacity)
|
|
2697
|
+
disabledIconColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, disabledOpacity)
|
|
2752
2698
|
};
|
|
2753
2699
|
if (variant === "outlined") {
|
|
2754
2700
|
return {
|
|
@@ -2763,7 +2709,7 @@ function getVariantColors4(theme, variant) {
|
|
|
2763
2709
|
...common,
|
|
2764
2710
|
backgroundColor: theme.colors.surfaceContainerHighest,
|
|
2765
2711
|
borderColor: theme.colors.onSurfaceVariant,
|
|
2766
|
-
disabledBackgroundColor: alphaColor(theme.colors.onSurface, 0.04),
|
|
2712
|
+
disabledBackgroundColor: (0, import_utils14.alphaColor)(theme.colors.onSurface, 0.04),
|
|
2767
2713
|
labelColor: theme.colors.onSurfaceVariant
|
|
2768
2714
|
};
|
|
2769
2715
|
}
|
|
@@ -2774,7 +2720,7 @@ function createStyles9(theme, variant) {
|
|
|
2774
2720
|
const isFilled = variant === "filled";
|
|
2775
2721
|
return {
|
|
2776
2722
|
colors,
|
|
2777
|
-
styles:
|
|
2723
|
+
styles: import_react_native23.StyleSheet.create({
|
|
2778
2724
|
root: {
|
|
2779
2725
|
alignSelf: "stretch"
|
|
2780
2726
|
},
|
|
@@ -2845,7 +2791,7 @@ function createStyles9(theme, variant) {
|
|
|
2845
2791
|
fontWeight: bodySmall.fontWeight,
|
|
2846
2792
|
letterSpacing: bodySmall.letterSpacing,
|
|
2847
2793
|
color: colors.labelColor,
|
|
2848
|
-
transformOrigin: transformOrigin("top")
|
|
2794
|
+
transformOrigin: (0, import_utils14.transformOrigin)("top")
|
|
2849
2795
|
},
|
|
2850
2796
|
labelNotch: {
|
|
2851
2797
|
paddingHorizontal: 4
|
|
@@ -2938,28 +2884,29 @@ function TextField({
|
|
|
2938
2884
|
const isError = Boolean(error) || Boolean(errorText);
|
|
2939
2885
|
const isFilled = variant === "filled";
|
|
2940
2886
|
const hasLeadingIcon = Boolean(leadingIcon);
|
|
2941
|
-
const
|
|
2887
|
+
const MaterialCommunityIcons = leadingIcon || trailingIcon ? (0, import_utils15.getMaterialCommunityIcons)() : null;
|
|
2888
|
+
const { colors, styles: styles3 } = (0, import_react15.useMemo)(
|
|
2942
2889
|
() => createStyles9(theme, variant),
|
|
2943
2890
|
[theme, variant]
|
|
2944
2891
|
);
|
|
2945
|
-
const [isFocused, setIsFocused] = (0,
|
|
2946
|
-
const [internalHasText, setInternalHasText] = (0,
|
|
2892
|
+
const [isFocused, setIsFocused] = (0, import_react15.useState)(false);
|
|
2893
|
+
const [internalHasText, setInternalHasText] = (0, import_react15.useState)(
|
|
2947
2894
|
() => value !== void 0 && value !== ""
|
|
2948
2895
|
);
|
|
2949
|
-
const inputRef = (0,
|
|
2896
|
+
const inputRef = (0, import_react15.useRef)(null);
|
|
2950
2897
|
const isControlled = value !== void 0;
|
|
2951
2898
|
const hasValue = isControlled ? value !== "" : internalHasText;
|
|
2952
2899
|
const isLabelFloated = isFocused || hasValue;
|
|
2953
|
-
const labelAnimRef = (0,
|
|
2900
|
+
const labelAnimRef = (0, import_react15.useRef)(new import_react_native24.Animated.Value(isLabelFloated ? 1 : 0));
|
|
2954
2901
|
const labelAnim = labelAnimRef.current;
|
|
2955
|
-
(0,
|
|
2956
|
-
|
|
2902
|
+
(0, import_react15.useEffect)(() => {
|
|
2903
|
+
import_react_native24.Animated.timing(labelAnim, {
|
|
2957
2904
|
toValue: isLabelFloated ? 1 : 0,
|
|
2958
2905
|
duration: 150,
|
|
2959
|
-
useNativeDriver:
|
|
2906
|
+
useNativeDriver: import_react_native24.Platform.OS !== "web"
|
|
2960
2907
|
}).start();
|
|
2961
2908
|
}, [isLabelFloated, labelAnim]);
|
|
2962
|
-
const labelScale = (0,
|
|
2909
|
+
const labelScale = (0, import_react15.useMemo)(() => {
|
|
2963
2910
|
const restingScale = theme.typography.bodyLarge.fontSize / theme.typography.bodySmall.fontSize;
|
|
2964
2911
|
return labelAnim.interpolate({
|
|
2965
2912
|
inputRange: [0, 1],
|
|
@@ -2970,7 +2917,7 @@ function TextField({
|
|
|
2970
2917
|
theme.typography.bodyLarge.fontSize,
|
|
2971
2918
|
theme.typography.bodySmall.fontSize
|
|
2972
2919
|
]);
|
|
2973
|
-
const labelTranslateY = (0,
|
|
2920
|
+
const labelTranslateY = (0, import_react15.useMemo)(() => {
|
|
2974
2921
|
const restingTop = isFilled ? labelPositions.filledRestingTop : labelPositions.outlinedRestingTop;
|
|
2975
2922
|
const floatedTop = isFilled ? labelPositions.filledFloatedTop : labelPositions.outlinedFloatedTop;
|
|
2976
2923
|
const restingOffset = restingTop - floatedTop;
|
|
@@ -2981,7 +2928,7 @@ function TextField({
|
|
|
2981
2928
|
}, [isFilled, labelAnim]);
|
|
2982
2929
|
const labelStart = theme.spacing.md + (hasLeadingIcon ? ICON_WITH_GAP - theme.spacing.md : 0);
|
|
2983
2930
|
const labelStaticTop = isFilled ? labelPositions.filledFloatedTop : labelPositions.outlinedFloatedTop;
|
|
2984
|
-
const handleChangeText = (0,
|
|
2931
|
+
const handleChangeText = (0, import_react15.useCallback)(
|
|
2985
2932
|
(text) => {
|
|
2986
2933
|
if (!isControlled) {
|
|
2987
2934
|
setInternalHasText(text !== "");
|
|
@@ -2990,7 +2937,7 @@ function TextField({
|
|
|
2990
2937
|
},
|
|
2991
2938
|
[isControlled, onChangeText]
|
|
2992
2939
|
);
|
|
2993
|
-
const handleFocus = (0,
|
|
2940
|
+
const handleFocus = (0, import_react15.useCallback)(
|
|
2994
2941
|
(event) => {
|
|
2995
2942
|
if (isDisabled) return;
|
|
2996
2943
|
setIsFocused(true);
|
|
@@ -2998,14 +2945,14 @@ function TextField({
|
|
|
2998
2945
|
},
|
|
2999
2946
|
[isDisabled, onFocus]
|
|
3000
2947
|
);
|
|
3001
|
-
const handleBlur = (0,
|
|
2948
|
+
const handleBlur = (0, import_react15.useCallback)(
|
|
3002
2949
|
(event) => {
|
|
3003
2950
|
setIsFocused(false);
|
|
3004
2951
|
onBlur == null ? void 0 : onBlur(event);
|
|
3005
2952
|
},
|
|
3006
2953
|
[onBlur]
|
|
3007
2954
|
);
|
|
3008
|
-
const handleContainerPress = (0,
|
|
2955
|
+
const handleContainerPress = (0, import_react15.useCallback)(() => {
|
|
3009
2956
|
var _a;
|
|
3010
2957
|
if (!isDisabled) {
|
|
3011
2958
|
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
@@ -3014,30 +2961,30 @@ function TextField({
|
|
|
3014
2961
|
const labelColor = isDisabled ? colors.disabledLabelColor : isError ? colors.errorLabelColor : isFocused ? colors.focusedLabelColor : colors.labelColor;
|
|
3015
2962
|
const labelBackgroundColor = variant === "outlined" && isLabelFloated ? theme.colors.surface : "transparent";
|
|
3016
2963
|
const iconColor = isDisabled ? colors.disabledIconColor : isError ? colors.errorIconColor : contentColor != null ? contentColor : colors.iconColor;
|
|
3017
|
-
const containerStyle = (0,
|
|
2964
|
+
const containerStyle = (0, import_react15.useMemo)(
|
|
3018
2965
|
() => [
|
|
3019
|
-
|
|
2966
|
+
styles3.container,
|
|
3020
2967
|
containerColor && !isDisabled ? { backgroundColor: containerColor } : void 0,
|
|
3021
|
-
isFocused &&
|
|
3022
|
-
isError && !isFocused &&
|
|
3023
|
-
isDisabled &&
|
|
2968
|
+
isFocused && styles3.containerFocused,
|
|
2969
|
+
isError && !isFocused && styles3.containerError,
|
|
2970
|
+
isDisabled && styles3.containerDisabled
|
|
3024
2971
|
],
|
|
3025
|
-
[
|
|
2972
|
+
[styles3, isFocused, isError, isDisabled, containerColor]
|
|
3026
2973
|
);
|
|
3027
|
-
const indicatorStyle = (0,
|
|
2974
|
+
const indicatorStyle = (0, import_react15.useMemo)(
|
|
3028
2975
|
() => [
|
|
3029
|
-
|
|
3030
|
-
isFocused &&
|
|
3031
|
-
isError && !isFocused &&
|
|
3032
|
-
isDisabled &&
|
|
2976
|
+
styles3.indicator,
|
|
2977
|
+
isFocused && styles3.indicatorFocused,
|
|
2978
|
+
isError && !isFocused && styles3.indicatorError,
|
|
2979
|
+
isDisabled && styles3.indicatorDisabled
|
|
3033
2980
|
],
|
|
3034
|
-
[
|
|
2981
|
+
[styles3, isFocused, isError, isDisabled]
|
|
3035
2982
|
);
|
|
3036
2983
|
const displaySupportingText = isError ? errorText : supportingText;
|
|
3037
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3038
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3039
|
-
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3040
|
-
|
|
2984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native24.View, { style: [styles3.root, style], children: [
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native24.View, { style: containerStyle, children: [
|
|
2986
|
+
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: styles3.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2987
|
+
MaterialCommunityIcons,
|
|
3041
2988
|
{
|
|
3042
2989
|
name: leadingIcon,
|
|
3043
2990
|
size: ICON_SIZE2,
|
|
@@ -3045,14 +2992,14 @@ function TextField({
|
|
|
3045
2992
|
}
|
|
3046
2993
|
) }) : null,
|
|
3047
2994
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3048
|
-
|
|
2995
|
+
import_react_native24.View,
|
|
3049
2996
|
{
|
|
3050
2997
|
style: [
|
|
3051
|
-
|
|
3052
|
-
label ?
|
|
2998
|
+
styles3.inputWrapper,
|
|
2999
|
+
label ? styles3.inputWrapperWithLabel : void 0
|
|
3053
3000
|
],
|
|
3054
3001
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3055
|
-
|
|
3002
|
+
import_react_native24.TextInput,
|
|
3056
3003
|
{
|
|
3057
3004
|
ref: inputRef,
|
|
3058
3005
|
...textInputProps,
|
|
@@ -3065,8 +3012,8 @@ function TextField({
|
|
|
3065
3012
|
placeholderTextColor: colors.placeholderColor,
|
|
3066
3013
|
multiline,
|
|
3067
3014
|
style: [
|
|
3068
|
-
|
|
3069
|
-
isDisabled ?
|
|
3015
|
+
styles3.input,
|
|
3016
|
+
isDisabled ? styles3.inputDisabled : void 0,
|
|
3070
3017
|
contentColor && !isDisabled ? { color: contentColor } : void 0,
|
|
3071
3018
|
inputStyle
|
|
3072
3019
|
],
|
|
@@ -3078,15 +3025,15 @@ function TextField({
|
|
|
3078
3025
|
}
|
|
3079
3026
|
),
|
|
3080
3027
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3081
|
-
|
|
3028
|
+
import_react_native24.Pressable,
|
|
3082
3029
|
{
|
|
3083
3030
|
onPress: onTrailingIconPress,
|
|
3084
3031
|
disabled: isDisabled || !onTrailingIconPress,
|
|
3085
3032
|
accessibilityRole: "button",
|
|
3086
3033
|
hitSlop: 12,
|
|
3087
|
-
style:
|
|
3088
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3089
|
-
|
|
3034
|
+
style: styles3.trailingIconPressable,
|
|
3035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: styles3.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3036
|
+
MaterialCommunityIcons,
|
|
3090
3037
|
{
|
|
3091
3038
|
name: trailingIcon,
|
|
3092
3039
|
size: ICON_SIZE2,
|
|
@@ -3096,11 +3043,11 @@ function TextField({
|
|
|
3096
3043
|
}
|
|
3097
3044
|
) : null,
|
|
3098
3045
|
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3099
|
-
|
|
3046
|
+
import_react_native24.Animated.Text,
|
|
3100
3047
|
{
|
|
3101
3048
|
numberOfLines: 1,
|
|
3102
3049
|
style: [
|
|
3103
|
-
|
|
3050
|
+
styles3.label,
|
|
3104
3051
|
{
|
|
3105
3052
|
top: labelStaticTop,
|
|
3106
3053
|
start: labelStart,
|
|
@@ -3111,19 +3058,19 @@ function TextField({
|
|
|
3111
3058
|
{ scale: labelScale }
|
|
3112
3059
|
]
|
|
3113
3060
|
},
|
|
3114
|
-
variant === "outlined" && isLabelFloated ?
|
|
3061
|
+
variant === "outlined" && isLabelFloated ? styles3.labelNotch : void 0
|
|
3115
3062
|
],
|
|
3116
3063
|
children: label
|
|
3117
3064
|
}
|
|
3118
3065
|
) : null,
|
|
3119
|
-
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3066
|
+
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: indicatorStyle }) : null
|
|
3120
3067
|
] }) }),
|
|
3121
|
-
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3122
|
-
|
|
3068
|
+
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native24.View, { style: styles3.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3069
|
+
import_react_native24.Text,
|
|
3123
3070
|
{
|
|
3124
3071
|
style: [
|
|
3125
|
-
|
|
3126
|
-
isError ?
|
|
3072
|
+
styles3.supportingText,
|
|
3073
|
+
isError ? styles3.errorSupportingText : void 0
|
|
3127
3074
|
],
|
|
3128
3075
|
children: displaySupportingText
|
|
3129
3076
|
}
|
|
@@ -3132,12 +3079,13 @@ function TextField({
|
|
|
3132
3079
|
}
|
|
3133
3080
|
|
|
3134
3081
|
// src/list/List.tsx
|
|
3135
|
-
var
|
|
3136
|
-
var
|
|
3082
|
+
var import_react16 = require("react");
|
|
3083
|
+
var import_react_native26 = require("react-native");
|
|
3137
3084
|
var import_core15 = require("@onlynative/core");
|
|
3138
3085
|
|
|
3139
3086
|
// src/list/styles.ts
|
|
3140
|
-
var
|
|
3087
|
+
var import_react_native25 = require("react-native");
|
|
3088
|
+
var import_utils16 = require("@onlynative/utils");
|
|
3141
3089
|
var ITEM_PADDING_VERTICAL = 12;
|
|
3142
3090
|
var INSET_START = 56;
|
|
3143
3091
|
var MIN_HEIGHT = {
|
|
@@ -3146,7 +3094,7 @@ var MIN_HEIGHT = {
|
|
|
3146
3094
|
3: 88
|
|
3147
3095
|
};
|
|
3148
3096
|
function createListStyles(theme) {
|
|
3149
|
-
return
|
|
3097
|
+
return import_react_native25.StyleSheet.create({
|
|
3150
3098
|
container: {
|
|
3151
3099
|
paddingVertical: theme.spacing.sm
|
|
3152
3100
|
}
|
|
@@ -3157,12 +3105,12 @@ function getItemColors(theme, containerColor) {
|
|
|
3157
3105
|
if (containerColor) {
|
|
3158
3106
|
return {
|
|
3159
3107
|
backgroundColor: containerColor,
|
|
3160
|
-
hoveredBackgroundColor: blendColor(
|
|
3108
|
+
hoveredBackgroundColor: (0, import_utils16.blendColor)(
|
|
3161
3109
|
containerColor,
|
|
3162
3110
|
theme.colors.onSurface,
|
|
3163
3111
|
theme.stateLayer.hoveredOpacity
|
|
3164
3112
|
),
|
|
3165
|
-
pressedBackgroundColor: blendColor(
|
|
3113
|
+
pressedBackgroundColor: (0, import_utils16.blendColor)(
|
|
3166
3114
|
containerColor,
|
|
3167
3115
|
theme.colors.onSurface,
|
|
3168
3116
|
theme.stateLayer.pressedOpacity
|
|
@@ -3171,11 +3119,11 @@ function getItemColors(theme, containerColor) {
|
|
|
3171
3119
|
}
|
|
3172
3120
|
return {
|
|
3173
3121
|
backgroundColor: base,
|
|
3174
|
-
hoveredBackgroundColor: alphaColor(
|
|
3122
|
+
hoveredBackgroundColor: (0, import_utils16.alphaColor)(
|
|
3175
3123
|
theme.colors.onSurface,
|
|
3176
3124
|
theme.stateLayer.hoveredOpacity
|
|
3177
3125
|
),
|
|
3178
|
-
pressedBackgroundColor: alphaColor(
|
|
3126
|
+
pressedBackgroundColor: (0, import_utils16.alphaColor)(
|
|
3179
3127
|
theme.colors.onSurface,
|
|
3180
3128
|
theme.stateLayer.pressedOpacity
|
|
3181
3129
|
)
|
|
@@ -3183,7 +3131,7 @@ function getItemColors(theme, containerColor) {
|
|
|
3183
3131
|
}
|
|
3184
3132
|
function createListItemStyles(theme, lines, containerColor) {
|
|
3185
3133
|
const colors = getItemColors(theme, containerColor);
|
|
3186
|
-
return
|
|
3134
|
+
return import_react_native25.StyleSheet.create({
|
|
3187
3135
|
container: {
|
|
3188
3136
|
flexDirection: "row",
|
|
3189
3137
|
alignItems: lines === 3 ? "flex-start" : "center",
|
|
@@ -3238,7 +3186,7 @@ function createListItemStyles(theme, lines, containerColor) {
|
|
|
3238
3186
|
});
|
|
3239
3187
|
}
|
|
3240
3188
|
function createDividerStyles(theme, inset) {
|
|
3241
|
-
return
|
|
3189
|
+
return import_react_native25.StyleSheet.create({
|
|
3242
3190
|
divider: {
|
|
3243
3191
|
height: 1,
|
|
3244
3192
|
backgroundColor: theme.colors.outlineVariant,
|
|
@@ -3251,13 +3199,13 @@ function createDividerStyles(theme, inset) {
|
|
|
3251
3199
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3252
3200
|
function List({ children, style, ...props }) {
|
|
3253
3201
|
const theme = (0, import_core15.useTheme)();
|
|
3254
|
-
const
|
|
3255
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3202
|
+
const styles3 = (0, import_react16.useMemo)(() => createListStyles(theme), [theme]);
|
|
3203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native26.View, { ...props, style: [styles3.container, style], children });
|
|
3256
3204
|
}
|
|
3257
3205
|
|
|
3258
3206
|
// src/list/ListItem.tsx
|
|
3259
|
-
var
|
|
3260
|
-
var
|
|
3207
|
+
var import_react17 = require("react");
|
|
3208
|
+
var import_react_native27 = require("react-native");
|
|
3261
3209
|
var import_core16 = require("@onlynative/core");
|
|
3262
3210
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3263
3211
|
function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
|
|
@@ -3285,58 +3233,58 @@ function ListItem({
|
|
|
3285
3233
|
const isInteractive = onPress !== void 0;
|
|
3286
3234
|
const theme = (0, import_core16.useTheme)();
|
|
3287
3235
|
const lines = getLines(supportingText, overlineText, supportingTextNumberOfLines);
|
|
3288
|
-
const
|
|
3236
|
+
const styles3 = (0, import_react17.useMemo)(
|
|
3289
3237
|
() => createListItemStyles(theme, lines, containerColor),
|
|
3290
3238
|
[theme, lines, containerColor]
|
|
3291
3239
|
);
|
|
3292
3240
|
const content = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3293
|
-
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3294
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3295
|
-
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3296
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3241
|
+
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.View, { style: styles3.leadingContent, children: leadingContent }),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native27.View, { style: styles3.textBlock, children: [
|
|
3243
|
+
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.Text, { style: styles3.overlineText, numberOfLines: 1, children: overlineText }),
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.Text, { style: styles3.headlineText, numberOfLines: 1, children: headlineText }),
|
|
3297
3245
|
supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3298
|
-
|
|
3246
|
+
import_react_native27.Text,
|
|
3299
3247
|
{
|
|
3300
|
-
style:
|
|
3248
|
+
style: styles3.supportingText,
|
|
3301
3249
|
numberOfLines: supportingTextNumberOfLines,
|
|
3302
3250
|
children: supportingText
|
|
3303
3251
|
}
|
|
3304
3252
|
)
|
|
3305
3253
|
] }),
|
|
3306
|
-
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3307
|
-
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3254
|
+
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native27.View, { style: styles3.trailingBlock, children: [
|
|
3255
|
+
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.Text, { style: styles3.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
|
|
3308
3256
|
trailingContent
|
|
3309
3257
|
] })
|
|
3310
3258
|
] });
|
|
3311
3259
|
if (!isInteractive) {
|
|
3312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.View, { ...props, style: [styles3.container, style], children: content });
|
|
3313
3261
|
}
|
|
3314
3262
|
const resolvedStyle = (state) => [
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
state.hovered && !state.pressed && !isDisabled ?
|
|
3318
|
-
state.pressed && !isDisabled ?
|
|
3319
|
-
isDisabled ?
|
|
3263
|
+
styles3.container,
|
|
3264
|
+
styles3.interactiveContainer,
|
|
3265
|
+
state.hovered && !state.pressed && !isDisabled ? styles3.hoveredContainer : void 0,
|
|
3266
|
+
state.pressed && !isDisabled ? styles3.pressedContainer : void 0,
|
|
3267
|
+
isDisabled ? styles3.disabledContainer : void 0,
|
|
3320
3268
|
typeof style === "function" ? style(state) : style
|
|
3321
3269
|
];
|
|
3322
3270
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3323
|
-
|
|
3271
|
+
import_react_native27.Pressable,
|
|
3324
3272
|
{
|
|
3325
3273
|
...props,
|
|
3326
3274
|
role: "button",
|
|
3327
3275
|
accessibilityState: { disabled: isDisabled },
|
|
3328
|
-
hitSlop:
|
|
3276
|
+
hitSlop: import_react_native27.Platform.OS === "web" ? void 0 : 4,
|
|
3329
3277
|
disabled: isDisabled,
|
|
3330
3278
|
onPress,
|
|
3331
3279
|
style: resolvedStyle,
|
|
3332
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3280
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native27.View, { style: styles3.disabledContentWrapper, children: content }) : content
|
|
3333
3281
|
}
|
|
3334
3282
|
);
|
|
3335
3283
|
}
|
|
3336
3284
|
|
|
3337
3285
|
// src/list/ListDivider.tsx
|
|
3338
|
-
var
|
|
3339
|
-
var
|
|
3286
|
+
var import_react18 = require("react");
|
|
3287
|
+
var import_react_native28 = require("react-native");
|
|
3340
3288
|
var import_core17 = require("@onlynative/core");
|
|
3341
3289
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3342
3290
|
function ListDivider({
|
|
@@ -3345,11 +3293,80 @@ function ListDivider({
|
|
|
3345
3293
|
...props
|
|
3346
3294
|
}) {
|
|
3347
3295
|
const theme = (0, import_core17.useTheme)();
|
|
3348
|
-
const
|
|
3296
|
+
const styles3 = (0, import_react18.useMemo)(
|
|
3349
3297
|
() => createDividerStyles(theme, inset),
|
|
3350
3298
|
[theme, inset]
|
|
3351
3299
|
);
|
|
3352
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native28.View, { ...props, style: [styles3.divider, style] });
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3304
|
+
var import_react19 = require("react");
|
|
3305
|
+
var import_react_native30 = require("react-native");
|
|
3306
|
+
|
|
3307
|
+
// src/keyboard-avoiding-wrapper/styles.ts
|
|
3308
|
+
var import_react_native29 = require("react-native");
|
|
3309
|
+
var styles2 = import_react_native29.StyleSheet.create({
|
|
3310
|
+
root: {
|
|
3311
|
+
flex: 1
|
|
3312
|
+
},
|
|
3313
|
+
container: {
|
|
3314
|
+
flexGrow: 1
|
|
3315
|
+
}
|
|
3316
|
+
});
|
|
3317
|
+
|
|
3318
|
+
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3319
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3320
|
+
var isIOS = import_react_native30.Platform.OS === "ios";
|
|
3321
|
+
function KeyboardAvoidingWrapper({
|
|
3322
|
+
children,
|
|
3323
|
+
behavior = "padding",
|
|
3324
|
+
keyboardVerticalOffset = 0,
|
|
3325
|
+
enabled = true,
|
|
3326
|
+
scrollViewProps,
|
|
3327
|
+
onKeyboardShow,
|
|
3328
|
+
onKeyboardHide,
|
|
3329
|
+
style,
|
|
3330
|
+
contentContainerStyle
|
|
3331
|
+
}) {
|
|
3332
|
+
(0, import_react19.useEffect)(() => {
|
|
3333
|
+
const subscriptions = [];
|
|
3334
|
+
if (onKeyboardShow) {
|
|
3335
|
+
const showEvent = isIOS ? "keyboardWillShow" : "keyboardDidShow";
|
|
3336
|
+
subscriptions.push(
|
|
3337
|
+
import_react_native30.Keyboard.addListener(showEvent, onKeyboardShow)
|
|
3338
|
+
);
|
|
3339
|
+
}
|
|
3340
|
+
if (onKeyboardHide) {
|
|
3341
|
+
const hideEvent = isIOS ? "keyboardWillHide" : "keyboardDidHide";
|
|
3342
|
+
subscriptions.push(
|
|
3343
|
+
import_react_native30.Keyboard.addListener(hideEvent, onKeyboardHide)
|
|
3344
|
+
);
|
|
3345
|
+
}
|
|
3346
|
+
return () => {
|
|
3347
|
+
subscriptions.forEach((sub) => sub.remove());
|
|
3348
|
+
};
|
|
3349
|
+
}, [onKeyboardShow, onKeyboardHide]);
|
|
3350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3351
|
+
import_react_native30.KeyboardAvoidingView,
|
|
3352
|
+
{
|
|
3353
|
+
style: [styles2.root, style],
|
|
3354
|
+
behavior,
|
|
3355
|
+
keyboardVerticalOffset,
|
|
3356
|
+
enabled: !isIOS && enabled,
|
|
3357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3358
|
+
import_react_native30.ScrollView,
|
|
3359
|
+
{
|
|
3360
|
+
automaticallyAdjustKeyboardInsets: isIOS && enabled,
|
|
3361
|
+
keyboardShouldPersistTaps: "handled",
|
|
3362
|
+
showsVerticalScrollIndicator: false,
|
|
3363
|
+
...scrollViewProps,
|
|
3364
|
+
contentContainerStyle: [styles2.container, contentContainerStyle],
|
|
3365
|
+
children
|
|
3366
|
+
}
|
|
3367
|
+
)
|
|
3368
|
+
}
|
|
3369
|
+
);
|
|
3353
3370
|
}
|
|
3354
3371
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3355
3372
|
0 && (module.exports = {
|
|
@@ -3362,6 +3379,7 @@ function ListDivider({
|
|
|
3362
3379
|
Column,
|
|
3363
3380
|
Grid,
|
|
3364
3381
|
IconButton,
|
|
3382
|
+
KeyboardAvoidingWrapper,
|
|
3365
3383
|
Layout,
|
|
3366
3384
|
List,
|
|
3367
3385
|
ListDivider,
|