@xaui/native 0.2.7 → 0.9.1-alpha.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/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -356
- package/dist/alert/index.d.cts +0 -90
- package/dist/alert/index.d.ts +0 -90
- package/dist/alert/index.js +0 -356
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/alert/index.cjs
DELETED
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-56RPWZD2.cjs');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunk7UFBLUMVcjs = require('../chunk-7UFBLUMV.cjs');
|
|
6
|
-
|
|
7
|
-
// src/components/alert/alert.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
16
|
-
var _reactnative = require('react-native');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
22
|
-
var _reactnativeworklets = require('react-native-worklets');
|
|
23
|
-
|
|
24
|
-
// src/components/alert/alert.style.ts
|
|
25
|
-
|
|
26
|
-
var styles = _reactnative.StyleSheet.create({
|
|
27
|
-
container: {
|
|
28
|
-
flexDirection: "row",
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
width: "100%",
|
|
31
|
-
gap: 12
|
|
32
|
-
},
|
|
33
|
-
mainWrapper: {
|
|
34
|
-
flex: 1,
|
|
35
|
-
justifyContent: "center",
|
|
36
|
-
gap: 2
|
|
37
|
-
},
|
|
38
|
-
title: {
|
|
39
|
-
fontWeight: "600"
|
|
40
|
-
},
|
|
41
|
-
description: {
|
|
42
|
-
fontWeight: "400"
|
|
43
|
-
},
|
|
44
|
-
iconWrapper: {
|
|
45
|
-
width: 36,
|
|
46
|
-
height: 36,
|
|
47
|
-
borderRadius: 18,
|
|
48
|
-
alignItems: "center",
|
|
49
|
-
justifyContent: "center"
|
|
50
|
-
},
|
|
51
|
-
iconText: {
|
|
52
|
-
fontWeight: "600"
|
|
53
|
-
},
|
|
54
|
-
closeButton: {
|
|
55
|
-
alignSelf: "flex-start",
|
|
56
|
-
padding: 4
|
|
57
|
-
},
|
|
58
|
-
extraContent: {
|
|
59
|
-
marginTop: 4
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// src/components/alert/alert.hook.ts
|
|
64
|
-
|
|
65
|
-
var _core = require('@xaui/core');
|
|
66
|
-
var useAlertColorScheme = (themeColor) => {
|
|
67
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
68
|
-
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
69
|
-
return {
|
|
70
|
-
theme,
|
|
71
|
-
colorScheme: theme.colors[safeThemeColor],
|
|
72
|
-
isDefault: safeThemeColor === "default"
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
var useAlertContainerStyles = (themeColor, variant) => {
|
|
76
|
-
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
77
|
-
const containerStyles = _react.useMemo.call(void 0, () => {
|
|
78
|
-
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.container : variant === "faded" ? _core.withOpacity.call(void 0, colorScheme.container, 0.75) : "transparent";
|
|
79
|
-
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.md : 0;
|
|
80
|
-
const borderColor = variant === "bordered" ? _core.withOpacity.call(void 0, colorScheme.main, 0.75) : variant === "faded" ? _core.withOpacity.call(void 0, isDefault ? theme.colors.foreground : colorScheme.main, 0.25) : "transparent";
|
|
81
|
-
return {
|
|
82
|
-
backgroundColor,
|
|
83
|
-
borderColor,
|
|
84
|
-
borderWidth,
|
|
85
|
-
paddingVertical: theme.spacing.sm,
|
|
86
|
-
paddingHorizontal: theme.spacing.md
|
|
87
|
-
};
|
|
88
|
-
}, [colorScheme, isDefault, theme, variant]);
|
|
89
|
-
return containerStyles;
|
|
90
|
-
};
|
|
91
|
-
var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
92
|
-
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
93
|
-
const iconWrapperStyles = _react.useMemo.call(void 0, () => {
|
|
94
|
-
const backgroundColor = variant === "solid" ? _core.withOpacity.call(void 0, colorScheme.onMain, 0.16) : _core.withOpacity.call(void 0, isDefault ? theme.colors.foreground : colorScheme.main, 0.12);
|
|
95
|
-
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.xs : 0;
|
|
96
|
-
const borderColor = _core.withOpacity.call(void 0,
|
|
97
|
-
isDefault ? theme.colors.foreground : colorScheme.main,
|
|
98
|
-
0.2
|
|
99
|
-
);
|
|
100
|
-
return {
|
|
101
|
-
backgroundColor,
|
|
102
|
-
borderColor,
|
|
103
|
-
borderWidth
|
|
104
|
-
};
|
|
105
|
-
}, [colorScheme, isDefault, theme, variant]);
|
|
106
|
-
return iconWrapperStyles;
|
|
107
|
-
};
|
|
108
|
-
var useAlertTextStyles = (themeColor, variant) => {
|
|
109
|
-
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
110
|
-
const textStyles = _react.useMemo.call(void 0, () => {
|
|
111
|
-
const baseTextColor = variant === "solid" ? colorScheme.onMain : variant === "flat" || variant === "faded" ? isDefault ? theme.colors.foreground : colorScheme.onContainer : isDefault ? theme.colors.foreground : colorScheme.main;
|
|
112
|
-
return {
|
|
113
|
-
titleStyles: {
|
|
114
|
-
color: baseTextColor,
|
|
115
|
-
fontSize: theme.fontSizes.sm,
|
|
116
|
-
fontWeight: theme.fontWeights.semibold
|
|
117
|
-
},
|
|
118
|
-
descriptionStyles: {
|
|
119
|
-
color: _core.withOpacity.call(void 0, baseTextColor, 0.75),
|
|
120
|
-
fontSize: theme.fontSizes.xs,
|
|
121
|
-
fontWeight: theme.fontWeights.normal
|
|
122
|
-
},
|
|
123
|
-
iconColor: baseTextColor,
|
|
124
|
-
closeButtonColor: baseTextColor
|
|
125
|
-
};
|
|
126
|
-
}, [colorScheme, isDefault, theme, variant]);
|
|
127
|
-
return textStyles;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// src/components/alert/alert-icons.tsx
|
|
131
|
-
|
|
132
|
-
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
133
|
-
function InfoIcon({ color, size }) {
|
|
134
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ _react2.default.createElement(
|
|
135
|
-
_reactnativesvg.Line,
|
|
136
|
-
{
|
|
137
|
-
x1: 12,
|
|
138
|
-
y1: 10,
|
|
139
|
-
x2: 12,
|
|
140
|
-
y2: 16,
|
|
141
|
-
stroke: color,
|
|
142
|
-
strokeWidth: 2,
|
|
143
|
-
strokeLinecap: "round"
|
|
144
|
-
}
|
|
145
|
-
), /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 7, r: 1, fill: color }));
|
|
146
|
-
}
|
|
147
|
-
function SuccessIcon({ color, size }) {
|
|
148
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ _react2.default.createElement(
|
|
149
|
-
_reactnativesvg.Path,
|
|
150
|
-
{
|
|
151
|
-
d: "M7 12.5L10.2 15.5L17 9",
|
|
152
|
-
stroke: color,
|
|
153
|
-
strokeWidth: 2,
|
|
154
|
-
strokeLinecap: "round",
|
|
155
|
-
strokeLinejoin: "round"
|
|
156
|
-
}
|
|
157
|
-
));
|
|
158
|
-
}
|
|
159
|
-
function WarningIcon({ color, size }) {
|
|
160
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(
|
|
161
|
-
_reactnativesvg.Path,
|
|
162
|
-
{
|
|
163
|
-
d: "M12 3L22 20H2L12 3Z",
|
|
164
|
-
stroke: color,
|
|
165
|
-
strokeWidth: 2,
|
|
166
|
-
strokeLinejoin: "round"
|
|
167
|
-
}
|
|
168
|
-
), /* @__PURE__ */ _react2.default.createElement(
|
|
169
|
-
_reactnativesvg.Line,
|
|
170
|
-
{
|
|
171
|
-
x1: 12,
|
|
172
|
-
y1: 9,
|
|
173
|
-
x2: 12,
|
|
174
|
-
y2: 14,
|
|
175
|
-
stroke: color,
|
|
176
|
-
strokeWidth: 2,
|
|
177
|
-
strokeLinecap: "round"
|
|
178
|
-
}
|
|
179
|
-
), /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 17, r: 1, fill: color }));
|
|
180
|
-
}
|
|
181
|
-
function DangerIcon({ color, size }) {
|
|
182
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 12, r: 10, stroke: color, strokeWidth: 2 }), /* @__PURE__ */ _react2.default.createElement(
|
|
183
|
-
_reactnativesvg.Line,
|
|
184
|
-
{
|
|
185
|
-
x1: 9,
|
|
186
|
-
y1: 9,
|
|
187
|
-
x2: 15,
|
|
188
|
-
y2: 15,
|
|
189
|
-
stroke: color,
|
|
190
|
-
strokeWidth: 2,
|
|
191
|
-
strokeLinecap: "round"
|
|
192
|
-
}
|
|
193
|
-
), /* @__PURE__ */ _react2.default.createElement(
|
|
194
|
-
_reactnativesvg.Line,
|
|
195
|
-
{
|
|
196
|
-
x1: 15,
|
|
197
|
-
y1: 9,
|
|
198
|
-
x2: 9,
|
|
199
|
-
y2: 15,
|
|
200
|
-
stroke: color,
|
|
201
|
-
strokeWidth: 2,
|
|
202
|
-
strokeLinecap: "round"
|
|
203
|
-
}
|
|
204
|
-
));
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// src/components/alert/alert.tsx
|
|
208
|
-
var _icons = require('@xaui/icons');
|
|
209
|
-
var iconMap = {
|
|
210
|
-
default: InfoIcon,
|
|
211
|
-
primary: InfoIcon,
|
|
212
|
-
secondary: InfoIcon,
|
|
213
|
-
tertiary: InfoIcon,
|
|
214
|
-
success: SuccessIcon,
|
|
215
|
-
warning: WarningIcon,
|
|
216
|
-
danger: DangerIcon
|
|
217
|
-
};
|
|
218
|
-
var Alert = ({
|
|
219
|
-
title,
|
|
220
|
-
description,
|
|
221
|
-
icon,
|
|
222
|
-
themeColor = "default",
|
|
223
|
-
variant = "flat",
|
|
224
|
-
radius = "md",
|
|
225
|
-
isClosable = false,
|
|
226
|
-
hideIcon = false,
|
|
227
|
-
closeButton,
|
|
228
|
-
isVisible,
|
|
229
|
-
customAppearance,
|
|
230
|
-
children,
|
|
231
|
-
onClose,
|
|
232
|
-
onVisibleChange
|
|
233
|
-
}) => {
|
|
234
|
-
const [internalVisible, setInternalVisible] = _react.useState.call(void 0, _nullishCoalesce(isVisible, () => ( true)));
|
|
235
|
-
const [shouldRender, setShouldRender] = _react.useState.call(void 0, _nullishCoalesce(isVisible, () => ( true)));
|
|
236
|
-
const isControlled = typeof isVisible === "boolean";
|
|
237
|
-
const visible = isControlled ? isVisible : internalVisible;
|
|
238
|
-
const opacity = _reactnativereanimated.useSharedValue.call(void 0, 1);
|
|
239
|
-
const scale = _reactnativereanimated.useSharedValue.call(void 0, 1);
|
|
240
|
-
const radiusStyles = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
241
|
-
const containerStyles = useAlertContainerStyles(themeColor, variant);
|
|
242
|
-
const iconWrapperStyles = useAlertIconWrapperStyles(themeColor, variant);
|
|
243
|
-
const { titleStyles, descriptionStyles, iconColor, closeButtonColor } = useAlertTextStyles(themeColor, variant);
|
|
244
|
-
const finishClosing = _react.useCallback.call(void 0, () => {
|
|
245
|
-
setShouldRender(false);
|
|
246
|
-
if (!isControlled) {
|
|
247
|
-
setInternalVisible(false);
|
|
248
|
-
}
|
|
249
|
-
_optionalChain([onVisibleChange, 'optionalCall', _ => _(false)]);
|
|
250
|
-
_optionalChain([onClose, 'optionalCall', _2 => _2()]);
|
|
251
|
-
}, [isControlled, onClose, onVisibleChange]);
|
|
252
|
-
const handleClose = _react.useCallback.call(void 0, () => {
|
|
253
|
-
if (!visible) return;
|
|
254
|
-
opacity.value = _reactnativereanimated.withTiming.call(void 0, 0, { duration: 250 });
|
|
255
|
-
scale.value = _reactnativereanimated.withTiming.call(void 0, 0.95, { duration: 250 }, (finished) => {
|
|
256
|
-
if (finished) {
|
|
257
|
-
_reactnativeworklets.scheduleOnRN.call(void 0, finishClosing);
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}, [finishClosing, opacity, scale, visible]);
|
|
261
|
-
_react.useEffect.call(void 0, () => {
|
|
262
|
-
if (visible && !shouldRender) {
|
|
263
|
-
setShouldRender(true);
|
|
264
|
-
opacity.value = 0;
|
|
265
|
-
scale.value = 0.95;
|
|
266
|
-
opacity.value = _reactnativereanimated.withTiming.call(void 0, 1, { duration: 250 });
|
|
267
|
-
scale.value = _reactnativereanimated.withTiming.call(void 0, 1, { duration: 250 });
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (!visible && shouldRender) {
|
|
271
|
-
handleClose();
|
|
272
|
-
}
|
|
273
|
-
}, [visible, shouldRender, opacity, scale, handleClose]);
|
|
274
|
-
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
275
|
-
opacity: opacity.value,
|
|
276
|
-
transform: [{ scale: scale.value }]
|
|
277
|
-
}));
|
|
278
|
-
const IconComponent = _nullishCoalesce(iconMap[themeColor], () => ( InfoIcon));
|
|
279
|
-
const shouldShowClose = Boolean(closeButton || isClosable || onClose);
|
|
280
|
-
const renderIcon = () => {
|
|
281
|
-
if (hideIcon) return null;
|
|
282
|
-
if (icon && _react.isValidElement.call(void 0, icon)) {
|
|
283
|
-
return _react.cloneElement.call(void 0, icon, { color: iconColor, size: 22 });
|
|
284
|
-
}
|
|
285
|
-
if (icon) {
|
|
286
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.iconText, { color: iconColor }] }, icon);
|
|
287
|
-
}
|
|
288
|
-
return /* @__PURE__ */ _react2.default.createElement(IconComponent, { color: iconColor, size: 22 });
|
|
289
|
-
};
|
|
290
|
-
const renderContentText = (content) => {
|
|
291
|
-
if (content === null || content === void 0) return null;
|
|
292
|
-
if (typeof content === "string" || typeof content === "number") {
|
|
293
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
294
|
-
_reactnative.Text,
|
|
295
|
-
{
|
|
296
|
-
style: [
|
|
297
|
-
styles.description,
|
|
298
|
-
descriptionStyles,
|
|
299
|
-
_optionalChain([customAppearance, 'optionalAccess', _3 => _3.description])
|
|
300
|
-
]
|
|
301
|
-
},
|
|
302
|
-
content
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
return content;
|
|
306
|
-
};
|
|
307
|
-
const titleNode = _react.useMemo.call(void 0, () => {
|
|
308
|
-
if (title === null || title === void 0) return null;
|
|
309
|
-
if (typeof title === "string" || typeof title === "number") {
|
|
310
|
-
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.title, titleStyles, _optionalChain([customAppearance, 'optionalAccess', _4 => _4.title])] }, title);
|
|
311
|
-
}
|
|
312
|
-
return title;
|
|
313
|
-
}, [title, _optionalChain([customAppearance, 'optionalAccess', _5 => _5.title]), titleStyles]);
|
|
314
|
-
const descriptionNode = renderContentText(description);
|
|
315
|
-
const childrenNode = renderContentText(children);
|
|
316
|
-
const closeButtonNode = _react.useMemo.call(void 0, () => {
|
|
317
|
-
if (!closeButton) return null;
|
|
318
|
-
if (!_react.isValidElement.call(void 0, closeButton)) return closeButton;
|
|
319
|
-
const existingOnPress = closeButton.props.onPress;
|
|
320
|
-
return _react.cloneElement.call(void 0, closeButton, {
|
|
321
|
-
onPress: (event) => {
|
|
322
|
-
_optionalChain([existingOnPress, 'optionalCall', _6 => _6(event)]);
|
|
323
|
-
handleClose();
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}, [closeButton, handleClose]);
|
|
327
|
-
if (!shouldRender) return null;
|
|
328
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
329
|
-
_reactnativereanimated2.default.View,
|
|
330
|
-
{
|
|
331
|
-
accessibilityRole: "alert",
|
|
332
|
-
style: [
|
|
333
|
-
styles.container,
|
|
334
|
-
containerStyles,
|
|
335
|
-
radiusStyles,
|
|
336
|
-
_optionalChain([customAppearance, 'optionalAccess', _7 => _7.container]),
|
|
337
|
-
animatedStyle
|
|
338
|
-
]
|
|
339
|
-
},
|
|
340
|
-
!hideIcon && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.iconWrapper, iconWrapperStyles] }, renderIcon()),
|
|
341
|
-
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.mainWrapper }, titleNode, descriptionNode, childrenNode && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.extraContent }, childrenNode)),
|
|
342
|
-
shouldShowClose && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, null, _nullishCoalesce(closeButtonNode, () => ( /* @__PURE__ */ _react2.default.createElement(
|
|
343
|
-
_reactnative.Pressable,
|
|
344
|
-
{
|
|
345
|
-
accessibilityRole: "button",
|
|
346
|
-
accessibilityLabel: "Close",
|
|
347
|
-
onPress: handleClose,
|
|
348
|
-
style: styles.closeButton
|
|
349
|
-
},
|
|
350
|
-
/* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { size: 20, color: closeButtonColor })
|
|
351
|
-
))))
|
|
352
|
-
);
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
exports.Alert = Alert;
|
package/dist/alert/index.d.cts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type AlertVariant = 'solid' | 'bordered' | 'flat' | 'faded';
|
|
6
|
-
type AlertRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
7
|
-
type AlertEvents = {
|
|
8
|
-
/**
|
|
9
|
-
* Callback fired when the alert is closed.
|
|
10
|
-
*/
|
|
11
|
-
onClose?: () => void;
|
|
12
|
-
/**
|
|
13
|
-
* Callback fired when the alert visibility changes.
|
|
14
|
-
*/
|
|
15
|
-
onVisibleChange?: (isVisible: boolean) => void;
|
|
16
|
-
};
|
|
17
|
-
type AlertCustomAppearance = {
|
|
18
|
-
/**
|
|
19
|
-
* Custom style for the alert container.
|
|
20
|
-
*/
|
|
21
|
-
container?: ViewStyle;
|
|
22
|
-
/**
|
|
23
|
-
* Custom style for the alert title.
|
|
24
|
-
*/
|
|
25
|
-
title?: TextStyle;
|
|
26
|
-
/**
|
|
27
|
-
* Custom style for the alert description.
|
|
28
|
-
*/
|
|
29
|
-
description?: TextStyle;
|
|
30
|
-
};
|
|
31
|
-
type AlertProps = {
|
|
32
|
-
/**
|
|
33
|
-
* The title of the alert.
|
|
34
|
-
*/
|
|
35
|
-
title?: ReactNode;
|
|
36
|
-
/**
|
|
37
|
-
* The description content of the alert.
|
|
38
|
-
*/
|
|
39
|
-
description?: ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* Custom icon to display inside the alert.
|
|
42
|
-
*/
|
|
43
|
-
icon?: ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* The theme color of the alert.
|
|
46
|
-
* @default 'default'
|
|
47
|
-
*/
|
|
48
|
-
themeColor?: ThemeColor;
|
|
49
|
-
/**
|
|
50
|
-
* The variant of the alert.
|
|
51
|
-
* @default 'flat'
|
|
52
|
-
*/
|
|
53
|
-
variant?: AlertVariant;
|
|
54
|
-
/**
|
|
55
|
-
* The border radius of the alert.
|
|
56
|
-
* @default 'md'
|
|
57
|
-
*/
|
|
58
|
-
radius?: AlertRadius;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the alert can be closed with a close button.
|
|
61
|
-
* @default false
|
|
62
|
-
*/
|
|
63
|
-
isClosable?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Whether to hide the icon.
|
|
66
|
-
* @default false
|
|
67
|
-
*/
|
|
68
|
-
hideIcon?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Custom close button element.
|
|
71
|
-
*/
|
|
72
|
-
closeButton?: ReactNode;
|
|
73
|
-
/**
|
|
74
|
-
* Whether the alert is visible.
|
|
75
|
-
* @default true
|
|
76
|
-
*/
|
|
77
|
-
isVisible?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Custom appearance styles for all alert parts
|
|
80
|
-
*/
|
|
81
|
-
customAppearance?: AlertCustomAppearance;
|
|
82
|
-
/**
|
|
83
|
-
* Additional content rendered below the description.
|
|
84
|
-
*/
|
|
85
|
-
children?: ReactNode;
|
|
86
|
-
} & AlertEvents;
|
|
87
|
-
|
|
88
|
-
declare const Alert: React.FC<AlertProps>;
|
|
89
|
-
|
|
90
|
-
export { Alert, type AlertProps, type AlertRadius, type AlertVariant };
|
package/dist/alert/index.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type AlertVariant = 'solid' | 'bordered' | 'flat' | 'faded';
|
|
6
|
-
type AlertRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
7
|
-
type AlertEvents = {
|
|
8
|
-
/**
|
|
9
|
-
* Callback fired when the alert is closed.
|
|
10
|
-
*/
|
|
11
|
-
onClose?: () => void;
|
|
12
|
-
/**
|
|
13
|
-
* Callback fired when the alert visibility changes.
|
|
14
|
-
*/
|
|
15
|
-
onVisibleChange?: (isVisible: boolean) => void;
|
|
16
|
-
};
|
|
17
|
-
type AlertCustomAppearance = {
|
|
18
|
-
/**
|
|
19
|
-
* Custom style for the alert container.
|
|
20
|
-
*/
|
|
21
|
-
container?: ViewStyle;
|
|
22
|
-
/**
|
|
23
|
-
* Custom style for the alert title.
|
|
24
|
-
*/
|
|
25
|
-
title?: TextStyle;
|
|
26
|
-
/**
|
|
27
|
-
* Custom style for the alert description.
|
|
28
|
-
*/
|
|
29
|
-
description?: TextStyle;
|
|
30
|
-
};
|
|
31
|
-
type AlertProps = {
|
|
32
|
-
/**
|
|
33
|
-
* The title of the alert.
|
|
34
|
-
*/
|
|
35
|
-
title?: ReactNode;
|
|
36
|
-
/**
|
|
37
|
-
* The description content of the alert.
|
|
38
|
-
*/
|
|
39
|
-
description?: ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* Custom icon to display inside the alert.
|
|
42
|
-
*/
|
|
43
|
-
icon?: ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* The theme color of the alert.
|
|
46
|
-
* @default 'default'
|
|
47
|
-
*/
|
|
48
|
-
themeColor?: ThemeColor;
|
|
49
|
-
/**
|
|
50
|
-
* The variant of the alert.
|
|
51
|
-
* @default 'flat'
|
|
52
|
-
*/
|
|
53
|
-
variant?: AlertVariant;
|
|
54
|
-
/**
|
|
55
|
-
* The border radius of the alert.
|
|
56
|
-
* @default 'md'
|
|
57
|
-
*/
|
|
58
|
-
radius?: AlertRadius;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the alert can be closed with a close button.
|
|
61
|
-
* @default false
|
|
62
|
-
*/
|
|
63
|
-
isClosable?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Whether to hide the icon.
|
|
66
|
-
* @default false
|
|
67
|
-
*/
|
|
68
|
-
hideIcon?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Custom close button element.
|
|
71
|
-
*/
|
|
72
|
-
closeButton?: ReactNode;
|
|
73
|
-
/**
|
|
74
|
-
* Whether the alert is visible.
|
|
75
|
-
* @default true
|
|
76
|
-
*/
|
|
77
|
-
isVisible?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Custom appearance styles for all alert parts
|
|
80
|
-
*/
|
|
81
|
-
customAppearance?: AlertCustomAppearance;
|
|
82
|
-
/**
|
|
83
|
-
* Additional content rendered below the description.
|
|
84
|
-
*/
|
|
85
|
-
children?: ReactNode;
|
|
86
|
-
} & AlertEvents;
|
|
87
|
-
|
|
88
|
-
declare const Alert: React.FC<AlertProps>;
|
|
89
|
-
|
|
90
|
-
export { Alert, type AlertProps, type AlertRadius, type AlertVariant };
|