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