@onlynative/components 0.1.0 → 0.1.1-alpha.1
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 +133 -62
- package/dist/button/index.js +125 -33
- package/dist/card/index.js +88 -20
- package/dist/checkbox/index.js +88 -17
- package/dist/chip/index.js +122 -30
- package/dist/icon-button/index.js +107 -36
- package/dist/index.js +335 -251
- package/dist/list/index.js +71 -24
- package/dist/radio/index.js +43 -14
- package/dist/switch/index.js +90 -19
- package/dist/text-field/index.js +82 -26
- package/package.json +4 -23
- package/src/appbar/AppBar.tsx +0 -302
- package/src/appbar/index.ts +0 -2
- package/src/appbar/styles.ts +0 -92
- package/src/appbar/types.ts +0 -67
- package/src/button/Button.tsx +0 -133
- package/src/button/index.ts +0 -2
- package/src/button/styles.ts +0 -287
- package/src/button/types.ts +0 -42
- package/src/card/Card.tsx +0 -69
- package/src/card/index.ts +0 -2
- package/src/card/styles.ts +0 -150
- package/src/card/types.ts +0 -27
- package/src/checkbox/Checkbox.tsx +0 -113
- package/src/checkbox/index.ts +0 -2
- package/src/checkbox/styles.ts +0 -155
- package/src/checkbox/types.ts +0 -20
- package/src/chip/Chip.tsx +0 -188
- package/src/chip/index.ts +0 -2
- package/src/chip/styles.ts +0 -239
- package/src/chip/types.ts +0 -58
- package/src/icon-button/IconButton.tsx +0 -362
- package/src/icon-button/index.ts +0 -6
- package/src/icon-button/styles.ts +0 -259
- package/src/icon-button/types.ts +0 -55
- package/src/index.ts +0 -54
- package/src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx +0 -69
- package/src/keyboard-avoiding-wrapper/index.ts +0 -2
- package/src/keyboard-avoiding-wrapper/styles.ts +0 -10
- package/src/keyboard-avoiding-wrapper/types.ts +0 -37
- package/src/layout/Box.tsx +0 -99
- package/src/layout/Column.tsx +0 -16
- package/src/layout/Grid.tsx +0 -49
- package/src/layout/Layout.tsx +0 -81
- package/src/layout/Row.tsx +0 -22
- package/src/layout/index.ts +0 -13
- package/src/layout/resolveSpacing.ts +0 -11
- package/src/layout/types.ts +0 -82
- package/src/list/List.tsx +0 -17
- package/src/list/ListDivider.tsx +0 -20
- package/src/list/ListItem.tsx +0 -128
- package/src/list/index.ts +0 -9
- package/src/list/styles.ts +0 -132
- package/src/list/types.ts +0 -54
- package/src/radio/Radio.tsx +0 -103
- package/src/radio/index.ts +0 -2
- package/src/radio/styles.ts +0 -139
- package/src/radio/types.ts +0 -20
- package/src/switch/Switch.tsx +0 -121
- package/src/switch/index.ts +0 -2
- package/src/switch/styles.ts +0 -172
- package/src/switch/types.ts +0 -32
- package/src/text-field/TextField.tsx +0 -301
- package/src/text-field/index.ts +0 -2
- package/src/text-field/styles.ts +0 -239
- package/src/text-field/types.ts +0 -49
- package/src/typography/Typography.tsx +0 -79
- package/src/typography/index.ts +0 -3
- package/src/typography/types.ts +0 -17
package/dist/chip/index.js
CHANGED
|
@@ -26,29 +26,121 @@ module.exports = __toCommonJS(chip_exports);
|
|
|
26
26
|
|
|
27
27
|
// src/chip/Chip.tsx
|
|
28
28
|
var import_react = require("react");
|
|
29
|
-
var
|
|
29
|
+
var import_react_native4 = require("react-native");
|
|
30
30
|
var import_core = require("@onlynative/core");
|
|
31
|
-
var import_utils2 = require("@onlynative/utils");
|
|
32
31
|
|
|
33
|
-
//
|
|
32
|
+
// ../utils/dist/chunk-OQRDRRQA.mjs
|
|
33
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
+
}) : x)(function(x) {
|
|
36
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// ../utils/dist/index.mjs
|
|
34
41
|
var import_react_native = require("react-native");
|
|
35
|
-
var
|
|
42
|
+
var import_react_native2 = require("react-native");
|
|
43
|
+
function parseHexColor(color) {
|
|
44
|
+
const normalized = color.replace("#", "");
|
|
45
|
+
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
49
|
+
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
50
|
+
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
51
|
+
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return { r, g, b };
|
|
55
|
+
}
|
|
56
|
+
function clampAlpha(alpha) {
|
|
57
|
+
return Math.max(0, Math.min(1, alpha));
|
|
58
|
+
}
|
|
59
|
+
function alphaColor(color, alpha) {
|
|
60
|
+
const channels = parseHexColor(color);
|
|
61
|
+
const boundedAlpha = clampAlpha(alpha);
|
|
62
|
+
if (!channels) {
|
|
63
|
+
return color;
|
|
64
|
+
}
|
|
65
|
+
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
66
|
+
}
|
|
67
|
+
function blendColor(base, overlay, overlayAlpha) {
|
|
68
|
+
const baseChannels = parseHexColor(base);
|
|
69
|
+
const overlayChannels = parseHexColor(overlay);
|
|
70
|
+
const boundedAlpha = clampAlpha(overlayAlpha);
|
|
71
|
+
if (!baseChannels || !overlayChannels) {
|
|
72
|
+
return alphaColor(overlay, boundedAlpha);
|
|
73
|
+
}
|
|
74
|
+
const r = Math.round(
|
|
75
|
+
(1 - boundedAlpha) * baseChannels.r + boundedAlpha * overlayChannels.r
|
|
76
|
+
);
|
|
77
|
+
const g = Math.round(
|
|
78
|
+
(1 - boundedAlpha) * baseChannels.g + boundedAlpha * overlayChannels.g
|
|
79
|
+
);
|
|
80
|
+
const b = Math.round(
|
|
81
|
+
(1 - boundedAlpha) * baseChannels.b + boundedAlpha * overlayChannels.b
|
|
82
|
+
);
|
|
83
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
84
|
+
}
|
|
85
|
+
function elevationStyle(level) {
|
|
86
|
+
if (import_react_native.Platform.OS === "web") {
|
|
87
|
+
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
88
|
+
if (shadowOpacity === 0) {
|
|
89
|
+
return { boxShadow: "none" };
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
boxShadow: `${shadowOffset.width}px ${shadowOffset.height}px ${shadowRadius}px rgba(0, 0, 0, ${shadowOpacity})`
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
shadowColor: level.shadowColor,
|
|
97
|
+
shadowOffset: {
|
|
98
|
+
width: level.shadowOffset.width,
|
|
99
|
+
height: level.shadowOffset.height
|
|
100
|
+
},
|
|
101
|
+
shadowOpacity: level.shadowOpacity,
|
|
102
|
+
shadowRadius: level.shadowRadius,
|
|
103
|
+
elevation: level.elevation
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
var _MCIcons = null;
|
|
107
|
+
var _resolved = false;
|
|
108
|
+
function getMaterialCommunityIcons() {
|
|
109
|
+
if (!_resolved) {
|
|
110
|
+
_resolved = true;
|
|
111
|
+
try {
|
|
112
|
+
const mod = __require("@expo/vector-icons/MaterialCommunityIcons");
|
|
113
|
+
_MCIcons = mod.default || mod;
|
|
114
|
+
} catch {
|
|
115
|
+
_MCIcons = null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (!_MCIcons) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
"@expo/vector-icons is required for icon support. Install it with: npx expo install @expo/vector-icons"
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return _MCIcons;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/chip/styles.ts
|
|
127
|
+
var import_react_native3 = require("react-native");
|
|
36
128
|
function getVariantColors(theme, variant, elevated, selected) {
|
|
37
|
-
const disabledContainerColor =
|
|
38
|
-
const disabledLabelColor =
|
|
39
|
-
const disabledOutlineColor =
|
|
129
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
130
|
+
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
131
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
40
132
|
if (variant === "filter" && selected) {
|
|
41
133
|
return {
|
|
42
134
|
backgroundColor: theme.colors.secondaryContainer,
|
|
43
135
|
textColor: theme.colors.onSecondaryContainer,
|
|
44
136
|
borderColor: "transparent",
|
|
45
137
|
borderWidth: 0,
|
|
46
|
-
hoveredBackgroundColor:
|
|
138
|
+
hoveredBackgroundColor: blendColor(
|
|
47
139
|
theme.colors.secondaryContainer,
|
|
48
140
|
theme.colors.onSecondaryContainer,
|
|
49
141
|
theme.stateLayer.hoveredOpacity
|
|
50
142
|
),
|
|
51
|
-
pressedBackgroundColor:
|
|
143
|
+
pressedBackgroundColor: blendColor(
|
|
52
144
|
theme.colors.secondaryContainer,
|
|
53
145
|
theme.colors.onSecondaryContainer,
|
|
54
146
|
theme.stateLayer.pressedOpacity
|
|
@@ -65,12 +157,12 @@ function getVariantColors(theme, variant, elevated, selected) {
|
|
|
65
157
|
textColor: textColor2,
|
|
66
158
|
borderColor: "transparent",
|
|
67
159
|
borderWidth: 0,
|
|
68
|
-
hoveredBackgroundColor:
|
|
160
|
+
hoveredBackgroundColor: blendColor(
|
|
69
161
|
theme.colors.surfaceContainerLow,
|
|
70
162
|
textColor2,
|
|
71
163
|
theme.stateLayer.hoveredOpacity
|
|
72
164
|
),
|
|
73
|
-
pressedBackgroundColor:
|
|
165
|
+
pressedBackgroundColor: blendColor(
|
|
74
166
|
theme.colors.surfaceContainerLow,
|
|
75
167
|
textColor2,
|
|
76
168
|
theme.stateLayer.pressedOpacity
|
|
@@ -86,12 +178,12 @@ function getVariantColors(theme, variant, elevated, selected) {
|
|
|
86
178
|
textColor,
|
|
87
179
|
borderColor: theme.colors.outline,
|
|
88
180
|
borderWidth: 1,
|
|
89
|
-
hoveredBackgroundColor:
|
|
181
|
+
hoveredBackgroundColor: blendColor(
|
|
90
182
|
theme.colors.surface,
|
|
91
183
|
textColor,
|
|
92
184
|
theme.stateLayer.hoveredOpacity
|
|
93
185
|
),
|
|
94
|
-
pressedBackgroundColor:
|
|
186
|
+
pressedBackgroundColor: blendColor(
|
|
95
187
|
theme.colors.surface,
|
|
96
188
|
textColor,
|
|
97
189
|
theme.stateLayer.pressedOpacity
|
|
@@ -111,33 +203,33 @@ function applyColorOverrides(theme, colors, containerColor, contentColor) {
|
|
|
111
203
|
const overlay = contentColor != null ? contentColor : colors.textColor;
|
|
112
204
|
result.backgroundColor = containerColor;
|
|
113
205
|
result.borderColor = containerColor;
|
|
114
|
-
result.hoveredBackgroundColor =
|
|
206
|
+
result.hoveredBackgroundColor = blendColor(
|
|
115
207
|
containerColor,
|
|
116
208
|
overlay,
|
|
117
209
|
theme.stateLayer.hoveredOpacity
|
|
118
210
|
);
|
|
119
|
-
result.pressedBackgroundColor =
|
|
211
|
+
result.pressedBackgroundColor = blendColor(
|
|
120
212
|
containerColor,
|
|
121
213
|
overlay,
|
|
122
214
|
theme.stateLayer.pressedOpacity
|
|
123
215
|
);
|
|
124
216
|
} else if (contentColor) {
|
|
125
217
|
if (colors.backgroundColor === "transparent") {
|
|
126
|
-
result.hoveredBackgroundColor =
|
|
218
|
+
result.hoveredBackgroundColor = alphaColor(
|
|
127
219
|
contentColor,
|
|
128
220
|
theme.stateLayer.hoveredOpacity
|
|
129
221
|
);
|
|
130
|
-
result.pressedBackgroundColor =
|
|
222
|
+
result.pressedBackgroundColor = alphaColor(
|
|
131
223
|
contentColor,
|
|
132
224
|
theme.stateLayer.pressedOpacity
|
|
133
225
|
);
|
|
134
226
|
} else {
|
|
135
|
-
result.hoveredBackgroundColor =
|
|
227
|
+
result.hoveredBackgroundColor = blendColor(
|
|
136
228
|
colors.backgroundColor,
|
|
137
229
|
contentColor,
|
|
138
230
|
theme.stateLayer.hoveredOpacity
|
|
139
231
|
);
|
|
140
|
-
result.pressedBackgroundColor =
|
|
232
|
+
result.pressedBackgroundColor = blendColor(
|
|
141
233
|
colors.backgroundColor,
|
|
142
234
|
contentColor,
|
|
143
235
|
theme.stateLayer.pressedOpacity
|
|
@@ -155,12 +247,12 @@ function createStyles(theme, variant, elevated, selected, hasLeadingContent, has
|
|
|
155
247
|
contentColor
|
|
156
248
|
);
|
|
157
249
|
const labelStyle = theme.typography.labelLarge;
|
|
158
|
-
const elevationLevel0 =
|
|
159
|
-
const elevationLevel1 =
|
|
160
|
-
const elevationLevel2 =
|
|
250
|
+
const elevationLevel0 = elevationStyle(theme.elevation.level0);
|
|
251
|
+
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
252
|
+
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
161
253
|
const isElevated = elevated && variant !== "input";
|
|
162
254
|
const baseElevation = isElevated ? elevationLevel1 : elevationLevel0;
|
|
163
|
-
return
|
|
255
|
+
return import_react_native3.StyleSheet.create({
|
|
164
256
|
container: {
|
|
165
257
|
alignSelf: "flex-start",
|
|
166
258
|
alignItems: "center",
|
|
@@ -258,7 +350,7 @@ function Chip({
|
|
|
258
350
|
variant === "input" && avatar || leadingIcon || variant === "filter" && isSelected
|
|
259
351
|
);
|
|
260
352
|
const needsIcons = Boolean(leadingIcon) || variant === "filter" && isSelected || showCloseIcon;
|
|
261
|
-
const MaterialCommunityIcons = needsIcons ?
|
|
353
|
+
const MaterialCommunityIcons = needsIcons ? getMaterialCommunityIcons() : null;
|
|
262
354
|
const theme = (0, import_core.useTheme)();
|
|
263
355
|
const styles = (0, import_react.useMemo)(
|
|
264
356
|
() => createStyles(
|
|
@@ -283,7 +375,7 @@ function Chip({
|
|
|
283
375
|
]
|
|
284
376
|
);
|
|
285
377
|
const resolvedIconColor = (0, import_react.useMemo)(() => {
|
|
286
|
-
const base =
|
|
378
|
+
const base = import_react_native4.StyleSheet.flatten([
|
|
287
379
|
styles.label,
|
|
288
380
|
isDisabled ? styles.disabledLabel : void 0
|
|
289
381
|
]);
|
|
@@ -299,7 +391,7 @@ function Chip({
|
|
|
299
391
|
);
|
|
300
392
|
const renderLeadingContent = () => {
|
|
301
393
|
if (variant === "input" && avatar) {
|
|
302
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
394
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { style: styles.avatar, children: avatar });
|
|
303
395
|
}
|
|
304
396
|
if (leadingIcon) {
|
|
305
397
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -326,7 +418,7 @@ function Chip({
|
|
|
326
418
|
return null;
|
|
327
419
|
};
|
|
328
420
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
329
|
-
|
|
421
|
+
import_react_native4.Pressable,
|
|
330
422
|
{
|
|
331
423
|
...props,
|
|
332
424
|
accessibilityRole: "button",
|
|
@@ -334,7 +426,7 @@ function Chip({
|
|
|
334
426
|
disabled: isDisabled,
|
|
335
427
|
...variant === "filter" ? { selected: isSelected } : void 0
|
|
336
428
|
},
|
|
337
|
-
hitSlop:
|
|
429
|
+
hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
|
|
338
430
|
disabled: isDisabled,
|
|
339
431
|
style: resolveStyle(
|
|
340
432
|
styles.container,
|
|
@@ -346,9 +438,9 @@ function Chip({
|
|
|
346
438
|
),
|
|
347
439
|
children: [
|
|
348
440
|
renderLeadingContent(),
|
|
349
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.Text, { style: computedLabelStyle, children }),
|
|
350
442
|
showCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
351
|
-
|
|
443
|
+
import_react_native4.Pressable,
|
|
352
444
|
{
|
|
353
445
|
onPress: onClose,
|
|
354
446
|
accessibilityRole: "button",
|
|
@@ -26,18 +26,89 @@ module.exports = __toCommonJS(icon_button_exports);
|
|
|
26
26
|
|
|
27
27
|
// src/icon-button/IconButton.tsx
|
|
28
28
|
var import_react = require("react");
|
|
29
|
-
var
|
|
29
|
+
var import_react_native4 = require("react-native");
|
|
30
30
|
var import_core = require("@onlynative/core");
|
|
31
|
-
var import_utils2 = require("@onlynative/utils");
|
|
32
31
|
|
|
33
|
-
//
|
|
32
|
+
// ../utils/dist/chunk-OQRDRRQA.mjs
|
|
33
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
+
}) : x)(function(x) {
|
|
36
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// ../utils/dist/index.mjs
|
|
34
41
|
var import_react_native = require("react-native");
|
|
35
|
-
var
|
|
42
|
+
var import_react_native2 = require("react-native");
|
|
43
|
+
function parseHexColor(color) {
|
|
44
|
+
const normalized = color.replace("#", "");
|
|
45
|
+
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const r = Number.parseInt(normalized.slice(0, 2), 16);
|
|
49
|
+
const g = Number.parseInt(normalized.slice(2, 4), 16);
|
|
50
|
+
const b = Number.parseInt(normalized.slice(4, 6), 16);
|
|
51
|
+
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return { r, g, b };
|
|
55
|
+
}
|
|
56
|
+
function clampAlpha(alpha) {
|
|
57
|
+
return Math.max(0, Math.min(1, alpha));
|
|
58
|
+
}
|
|
59
|
+
function alphaColor(color, alpha) {
|
|
60
|
+
const channels = parseHexColor(color);
|
|
61
|
+
const boundedAlpha = clampAlpha(alpha);
|
|
62
|
+
if (!channels) {
|
|
63
|
+
return color;
|
|
64
|
+
}
|
|
65
|
+
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
66
|
+
}
|
|
67
|
+
function blendColor(base, overlay, overlayAlpha) {
|
|
68
|
+
const baseChannels = parseHexColor(base);
|
|
69
|
+
const overlayChannels = parseHexColor(overlay);
|
|
70
|
+
const boundedAlpha = clampAlpha(overlayAlpha);
|
|
71
|
+
if (!baseChannels || !overlayChannels) {
|
|
72
|
+
return alphaColor(overlay, boundedAlpha);
|
|
73
|
+
}
|
|
74
|
+
const r = Math.round(
|
|
75
|
+
(1 - boundedAlpha) * baseChannels.r + boundedAlpha * overlayChannels.r
|
|
76
|
+
);
|
|
77
|
+
const g = Math.round(
|
|
78
|
+
(1 - boundedAlpha) * baseChannels.g + boundedAlpha * overlayChannels.g
|
|
79
|
+
);
|
|
80
|
+
const b = Math.round(
|
|
81
|
+
(1 - boundedAlpha) * baseChannels.b + boundedAlpha * overlayChannels.b
|
|
82
|
+
);
|
|
83
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
84
|
+
}
|
|
85
|
+
var _MCIcons = null;
|
|
86
|
+
var _resolved = false;
|
|
87
|
+
function getMaterialCommunityIcons() {
|
|
88
|
+
if (!_resolved) {
|
|
89
|
+
_resolved = true;
|
|
90
|
+
try {
|
|
91
|
+
const mod = __require("@expo/vector-icons/MaterialCommunityIcons");
|
|
92
|
+
_MCIcons = mod.default || mod;
|
|
93
|
+
} catch {
|
|
94
|
+
_MCIcons = null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!_MCIcons) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
"@expo/vector-icons is required for icon support. Install it with: npx expo install @expo/vector-icons"
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return _MCIcons;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/icon-button/styles.ts
|
|
106
|
+
var import_react_native3 = require("react-native");
|
|
36
107
|
function createStyles(theme) {
|
|
37
|
-
const disabledContainerColor =
|
|
38
|
-
const disabledOutlineColor =
|
|
108
|
+
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
109
|
+
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
39
110
|
const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
|
|
40
|
-
return
|
|
111
|
+
return import_react_native3.StyleSheet.create({
|
|
41
112
|
container: {
|
|
42
113
|
borderRadius: theme.shape.cornerFull,
|
|
43
114
|
alignItems: "center",
|
|
@@ -103,160 +174,160 @@ function createStyles(theme) {
|
|
|
103
174
|
},
|
|
104
175
|
// Hover states (M3: 8% state layer)
|
|
105
176
|
hoveredFilled: {
|
|
106
|
-
backgroundColor:
|
|
177
|
+
backgroundColor: blendColor(
|
|
107
178
|
theme.colors.primary,
|
|
108
179
|
theme.colors.onPrimary,
|
|
109
180
|
theme.stateLayer.hoveredOpacity
|
|
110
181
|
)
|
|
111
182
|
},
|
|
112
183
|
hoveredFilledToggleUnselected: {
|
|
113
|
-
backgroundColor:
|
|
184
|
+
backgroundColor: blendColor(
|
|
114
185
|
toggleUnselectedContainerColor,
|
|
115
186
|
theme.colors.primary,
|
|
116
187
|
theme.stateLayer.hoveredOpacity
|
|
117
188
|
)
|
|
118
189
|
},
|
|
119
190
|
hoveredFilledToggleSelected: {
|
|
120
|
-
backgroundColor:
|
|
191
|
+
backgroundColor: blendColor(
|
|
121
192
|
theme.colors.primary,
|
|
122
193
|
theme.colors.onPrimary,
|
|
123
194
|
theme.stateLayer.hoveredOpacity
|
|
124
195
|
)
|
|
125
196
|
},
|
|
126
197
|
hoveredTonal: {
|
|
127
|
-
backgroundColor:
|
|
198
|
+
backgroundColor: blendColor(
|
|
128
199
|
theme.colors.secondaryContainer,
|
|
129
200
|
theme.colors.onSecondaryContainer,
|
|
130
201
|
theme.stateLayer.hoveredOpacity
|
|
131
202
|
)
|
|
132
203
|
},
|
|
133
204
|
hoveredTonalToggleUnselected: {
|
|
134
|
-
backgroundColor:
|
|
205
|
+
backgroundColor: blendColor(
|
|
135
206
|
toggleUnselectedContainerColor,
|
|
136
207
|
theme.colors.onSurfaceVariant,
|
|
137
208
|
theme.stateLayer.hoveredOpacity
|
|
138
209
|
)
|
|
139
210
|
},
|
|
140
211
|
hoveredTonalToggleSelected: {
|
|
141
|
-
backgroundColor:
|
|
212
|
+
backgroundColor: blendColor(
|
|
142
213
|
theme.colors.secondaryContainer,
|
|
143
214
|
theme.colors.onSecondaryContainer,
|
|
144
215
|
theme.stateLayer.hoveredOpacity
|
|
145
216
|
)
|
|
146
217
|
},
|
|
147
218
|
hoveredOutlined: {
|
|
148
|
-
backgroundColor:
|
|
219
|
+
backgroundColor: alphaColor(
|
|
149
220
|
theme.colors.onSurfaceVariant,
|
|
150
221
|
theme.stateLayer.hoveredOpacity
|
|
151
222
|
)
|
|
152
223
|
},
|
|
153
224
|
hoveredOutlinedToggleUnselected: {
|
|
154
|
-
backgroundColor:
|
|
225
|
+
backgroundColor: alphaColor(
|
|
155
226
|
theme.colors.onSurfaceVariant,
|
|
156
227
|
theme.stateLayer.hoveredOpacity
|
|
157
228
|
)
|
|
158
229
|
},
|
|
159
230
|
hoveredOutlinedToggleSelected: {
|
|
160
|
-
backgroundColor:
|
|
231
|
+
backgroundColor: blendColor(
|
|
161
232
|
theme.colors.inverseSurface,
|
|
162
233
|
theme.colors.inverseOnSurface,
|
|
163
234
|
theme.stateLayer.hoveredOpacity
|
|
164
235
|
)
|
|
165
236
|
},
|
|
166
237
|
hoveredStandard: {
|
|
167
|
-
backgroundColor:
|
|
238
|
+
backgroundColor: alphaColor(
|
|
168
239
|
theme.colors.onSurfaceVariant,
|
|
169
240
|
theme.stateLayer.hoveredOpacity
|
|
170
241
|
)
|
|
171
242
|
},
|
|
172
243
|
hoveredStandardToggleUnselected: {
|
|
173
|
-
backgroundColor:
|
|
244
|
+
backgroundColor: alphaColor(
|
|
174
245
|
theme.colors.onSurfaceVariant,
|
|
175
246
|
theme.stateLayer.hoveredOpacity
|
|
176
247
|
)
|
|
177
248
|
},
|
|
178
249
|
hoveredStandardToggleSelected: {
|
|
179
|
-
backgroundColor:
|
|
250
|
+
backgroundColor: alphaColor(
|
|
180
251
|
theme.colors.primary,
|
|
181
252
|
theme.stateLayer.hoveredOpacity
|
|
182
253
|
)
|
|
183
254
|
},
|
|
184
255
|
// Pressed states (M3: 12% state layer)
|
|
185
256
|
pressedFilled: {
|
|
186
|
-
backgroundColor:
|
|
257
|
+
backgroundColor: blendColor(
|
|
187
258
|
theme.colors.primary,
|
|
188
259
|
theme.colors.onPrimary,
|
|
189
260
|
theme.stateLayer.pressedOpacity
|
|
190
261
|
)
|
|
191
262
|
},
|
|
192
263
|
pressedFilledToggleUnselected: {
|
|
193
|
-
backgroundColor:
|
|
264
|
+
backgroundColor: blendColor(
|
|
194
265
|
toggleUnselectedContainerColor,
|
|
195
266
|
theme.colors.primary,
|
|
196
267
|
theme.stateLayer.pressedOpacity
|
|
197
268
|
)
|
|
198
269
|
},
|
|
199
270
|
pressedFilledToggleSelected: {
|
|
200
|
-
backgroundColor:
|
|
271
|
+
backgroundColor: blendColor(
|
|
201
272
|
theme.colors.primary,
|
|
202
273
|
theme.colors.onPrimary,
|
|
203
274
|
theme.stateLayer.pressedOpacity
|
|
204
275
|
)
|
|
205
276
|
},
|
|
206
277
|
pressedTonal: {
|
|
207
|
-
backgroundColor:
|
|
278
|
+
backgroundColor: blendColor(
|
|
208
279
|
theme.colors.secondaryContainer,
|
|
209
280
|
theme.colors.onSecondaryContainer,
|
|
210
281
|
theme.stateLayer.pressedOpacity
|
|
211
282
|
)
|
|
212
283
|
},
|
|
213
284
|
pressedTonalToggleUnselected: {
|
|
214
|
-
backgroundColor:
|
|
285
|
+
backgroundColor: blendColor(
|
|
215
286
|
toggleUnselectedContainerColor,
|
|
216
287
|
theme.colors.onSurfaceVariant,
|
|
217
288
|
theme.stateLayer.pressedOpacity
|
|
218
289
|
)
|
|
219
290
|
},
|
|
220
291
|
pressedTonalToggleSelected: {
|
|
221
|
-
backgroundColor:
|
|
292
|
+
backgroundColor: blendColor(
|
|
222
293
|
theme.colors.secondaryContainer,
|
|
223
294
|
theme.colors.onSecondaryContainer,
|
|
224
295
|
theme.stateLayer.pressedOpacity
|
|
225
296
|
)
|
|
226
297
|
},
|
|
227
298
|
pressedOutlined: {
|
|
228
|
-
backgroundColor:
|
|
299
|
+
backgroundColor: alphaColor(
|
|
229
300
|
theme.colors.onSurfaceVariant,
|
|
230
301
|
theme.stateLayer.pressedOpacity
|
|
231
302
|
)
|
|
232
303
|
},
|
|
233
304
|
pressedOutlinedToggleUnselected: {
|
|
234
|
-
backgroundColor:
|
|
305
|
+
backgroundColor: alphaColor(
|
|
235
306
|
theme.colors.onSurfaceVariant,
|
|
236
307
|
theme.stateLayer.pressedOpacity
|
|
237
308
|
)
|
|
238
309
|
},
|
|
239
310
|
pressedOutlinedToggleSelected: {
|
|
240
|
-
backgroundColor:
|
|
311
|
+
backgroundColor: blendColor(
|
|
241
312
|
theme.colors.inverseSurface,
|
|
242
313
|
theme.colors.inverseOnSurface,
|
|
243
314
|
theme.stateLayer.pressedOpacity
|
|
244
315
|
)
|
|
245
316
|
},
|
|
246
317
|
pressedStandard: {
|
|
247
|
-
backgroundColor:
|
|
318
|
+
backgroundColor: alphaColor(
|
|
248
319
|
theme.colors.onSurfaceVariant,
|
|
249
320
|
theme.stateLayer.pressedOpacity
|
|
250
321
|
)
|
|
251
322
|
},
|
|
252
323
|
pressedStandardToggleUnselected: {
|
|
253
|
-
backgroundColor:
|
|
324
|
+
backgroundColor: alphaColor(
|
|
254
325
|
theme.colors.onSurfaceVariant,
|
|
255
326
|
theme.stateLayer.pressedOpacity
|
|
256
327
|
)
|
|
257
328
|
},
|
|
258
329
|
pressedStandardToggleSelected: {
|
|
259
|
-
backgroundColor:
|
|
330
|
+
backgroundColor: alphaColor(
|
|
260
331
|
theme.colors.primary,
|
|
261
332
|
theme.stateLayer.pressedOpacity
|
|
262
333
|
)
|
|
@@ -289,7 +360,7 @@ function createStyles(theme) {
|
|
|
289
360
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
290
361
|
function getIconColor(variant, theme, disabled, isToggle, selected) {
|
|
291
362
|
if (disabled) {
|
|
292
|
-
return
|
|
363
|
+
return alphaColor(theme.colors.onSurface, 0.38);
|
|
293
364
|
}
|
|
294
365
|
if (isToggle) {
|
|
295
366
|
if (variant === "filled") {
|
|
@@ -439,7 +510,7 @@ function IconButton({
|
|
|
439
510
|
...props
|
|
440
511
|
}) {
|
|
441
512
|
var _a;
|
|
442
|
-
const MaterialCommunityIcons =
|
|
513
|
+
const MaterialCommunityIcons = getMaterialCommunityIcons();
|
|
443
514
|
const theme = (0, import_core.useTheme)();
|
|
444
515
|
const styles = (0, import_react.useMemo)(() => createStyles(theme), [theme]);
|
|
445
516
|
const isDisabled = Boolean(disabled);
|
|
@@ -459,14 +530,14 @@ function IconButton({
|
|
|
459
530
|
borderWidth: 0
|
|
460
531
|
},
|
|
461
532
|
hovered: {
|
|
462
|
-
backgroundColor:
|
|
533
|
+
backgroundColor: blendColor(
|
|
463
534
|
containerColor,
|
|
464
535
|
overlay,
|
|
465
536
|
theme.stateLayer.hoveredOpacity
|
|
466
537
|
)
|
|
467
538
|
},
|
|
468
539
|
pressed: {
|
|
469
|
-
backgroundColor:
|
|
540
|
+
backgroundColor: blendColor(
|
|
470
541
|
containerColor,
|
|
471
542
|
overlay,
|
|
472
543
|
theme.stateLayer.pressedOpacity
|
|
@@ -475,7 +546,7 @@ function IconButton({
|
|
|
475
546
|
};
|
|
476
547
|
}, [containerColor, resolvedIconColor, theme.stateLayer]);
|
|
477
548
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
478
|
-
|
|
549
|
+
import_react_native4.Pressable,
|
|
479
550
|
{
|
|
480
551
|
...props,
|
|
481
552
|
accessibilityRole: "button",
|