@xaui/native 0.0.26 → 0.0.28
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/LICENSE +21 -0
- package/README.md +105 -228
- package/dist/alert/index.cjs +92 -166
- package/dist/alert/index.js +2 -1
- package/dist/app-bar/index.cjs +24 -98
- package/dist/app-bar/index.js +2 -1
- package/dist/autocomplete/index.cjs +192 -281
- package/dist/autocomplete/index.js +36 -48
- package/dist/avatar/index.cjs +59 -133
- package/dist/avatar/index.js +2 -1
- package/dist/badge/index.cjs +26 -99
- package/dist/badge/index.js +2 -1
- package/dist/bottom-sheet/index.cjs +5 -456
- package/dist/bottom-sheet/index.js +4 -363
- package/dist/bottom-tab-bar/index.cjs +93 -167
- package/dist/bottom-tab-bar/index.js +2 -2
- package/dist/button/index.cjs +73 -525
- package/dist/button/index.js +3 -2
- package/dist/card/index.cjs +76 -169
- package/dist/card/index.js +2 -2
- package/dist/carousel/index.cjs +68 -145
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +132 -173
- package/dist/checkbox/index.cjs +70 -143
- package/dist/checkbox/index.js +2 -1
- package/dist/chip/index.cjs +89 -164
- package/dist/chip/index.js +2 -1
- package/dist/chunk-BD72HIPR.cjs +75 -0
- package/dist/chunk-DHSTKO3K.cjs +19 -0
- package/dist/{chunk-CZFDZPAS.js → chunk-DXXNBF5P.js} +5 -0
- package/dist/{chunk-UI5L26KD.js → chunk-F7WH4DMG.js} +1 -1
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/chunk-HC2SSHNU.js +368 -0
- package/dist/chunk-HSPTLUFA.cjs +7 -0
- package/dist/chunk-JEGEPGVU.js +287 -0
- package/dist/chunk-KTLGDLCB.cjs +287 -0
- package/dist/{chunk-GHCVNQET.js → chunk-LTKYHG5V.js} +5 -12
- package/dist/{chunk-ULJSCNPE.js → chunk-LUBWRVI2.js} +1 -1
- package/dist/chunk-OQ2BLOOG.cjs +138 -0
- package/dist/chunk-QMYWIWSX.cjs +384 -0
- package/dist/chunk-XFPPR2VB.cjs +368 -0
- package/dist/core/index.cjs +22 -168
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +5 -3
- package/dist/datepicker/index.cjs +239 -320
- package/dist/datepicker/index.js +2 -1
- package/dist/divider/index.cjs +5 -145
- package/dist/divider/index.js +3 -2
- package/dist/drawer/index.cjs +39 -112
- package/dist/drawer/index.js +2 -1
- package/dist/expansion-panel/index.cjs +91 -230
- package/dist/expansion-panel/index.js +3 -2
- package/dist/fab/index.cjs +6 -722
- package/dist/fab/index.js +4 -3
- package/dist/fab-menu/index.cjs +81 -814
- package/dist/fab-menu/index.js +4 -3
- package/dist/feature-discovery/index.cjs +72 -139
- package/dist/feature-discovery/index.js +2 -2
- package/dist/index.cjs +1 -18
- package/dist/indicator/index.cjs +5 -445
- package/dist/indicator/index.js +3 -2
- package/dist/input/index.cjs +214 -282
- package/dist/input/index.js +2 -2
- package/dist/list/index.cjs +71 -146
- package/dist/list/index.js +2 -1
- package/dist/menu/index.cjs +59 -127
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +60 -132
- package/dist/menubox/index.js +2 -1
- package/dist/pager/index.cjs +42 -80
- package/dist/progress/index.cjs +43 -114
- package/dist/progress/index.js +2 -1
- package/dist/radio/index.cjs +82 -154
- package/dist/radio/index.js +2 -1
- package/dist/segment-button/index.cjs +60 -147
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.cjs +149 -224
- package/dist/select/index.js +10 -22
- package/dist/skeleton/index.cjs +23 -94
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +77 -156
- package/dist/slider/index.js +2 -1
- package/dist/snackbar/index.cjs +420 -0
- package/dist/snackbar/index.d.cts +175 -0
- package/dist/snackbar/index.d.ts +175 -0
- package/dist/snackbar/index.js +420 -0
- package/dist/stepper/index.cjs +121 -195
- package/dist/stepper/index.js +2 -1
- package/dist/switch/index.cjs +48 -121
- package/dist/switch/index.js +2 -1
- package/dist/tabs/index.cjs +67 -151
- package/dist/tabs/index.js +2 -1
- package/dist/timepicker/index.cjs +135 -593
- package/dist/timepicker/index.js +24 -383
- package/dist/toolbar/index.cjs +59 -128
- package/dist/toolbar/index.js +2 -1
- package/dist/typography/index.cjs +37 -92
- package/dist/typography/index.d.cts +1 -1
- package/dist/typography/index.d.ts +1 -1
- package/dist/typography/index.js +20 -1
- package/dist/view/index.cjs +178 -223
- package/package.json +7 -1
- package/dist/chunk-3XSXTM3G.js +0 -661
- package/dist/chunk-4KSZLONZ.js +0 -79
- package/dist/chunk-I4V5Y5GD.js +0 -76
- package/dist/chunk-URBEEDFX.js +0 -79
package/dist/alert/index.cjs
CHANGED
|
@@ -1,47 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
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-HSPTLUFA.cjs');
|
|
2
|
+
|
|
29
3
|
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
__export(alert_exports, {
|
|
33
|
-
Alert: () => Alert
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(alert_exports);
|
|
4
|
+
|
|
5
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
36
6
|
|
|
37
7
|
// src/components/alert/alert.tsx
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
+
|
|
22
|
+
var _reactnativereanimated = require('react-native-reanimated'); var _reactnativereanimated2 = _interopRequireDefault(_reactnativereanimated);
|
|
41
23
|
|
|
42
24
|
// src/components/alert/alert.style.ts
|
|
43
|
-
|
|
44
|
-
var styles =
|
|
25
|
+
|
|
26
|
+
var styles = _reactnative.StyleSheet.create({
|
|
45
27
|
container: {
|
|
46
28
|
flexDirection: "row",
|
|
47
29
|
alignItems: "center",
|
|
@@ -79,66 +61,11 @@ var styles = import_react_native.StyleSheet.create({
|
|
|
79
61
|
});
|
|
80
62
|
|
|
81
63
|
// src/components/alert/alert.hook.ts
|
|
82
|
-
var import_react6 = require("react");
|
|
83
|
-
var import_core = require("@xaui/core");
|
|
84
64
|
|
|
85
|
-
|
|
86
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
87
|
-
var import_react_native3 = require("react-native");
|
|
88
|
-
var import_theme = require("@xaui/core/theme");
|
|
89
|
-
var import_palette = require("@xaui/core/palette");
|
|
90
|
-
|
|
91
|
-
// src/core/portal/portal.tsx
|
|
92
|
-
var import_react2 = require("react");
|
|
93
|
-
|
|
94
|
-
// src/core/portal/portal-context.ts
|
|
95
|
-
var import_react = require("react");
|
|
96
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
97
|
-
|
|
98
|
-
// src/core/portal/portal-host.tsx
|
|
99
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
100
|
-
var import_react_native2 = require("react-native");
|
|
101
|
-
var hostStyles = import_react_native2.StyleSheet.create({
|
|
102
|
-
container: {
|
|
103
|
-
flex: 1
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// src/core/theme-context.tsx
|
|
108
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
109
|
-
|
|
110
|
-
// src/core/theme-hooks.ts
|
|
111
|
-
var import_react5 = require("react");
|
|
112
|
-
var import_react_native4 = require("react-native");
|
|
113
|
-
function useXUITheme() {
|
|
114
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
115
|
-
if (!theme) {
|
|
116
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
117
|
-
}
|
|
118
|
-
return theme;
|
|
119
|
-
}
|
|
120
|
-
function useBorderRadiusStyles(radius) {
|
|
121
|
-
const theme = useXUITheme();
|
|
122
|
-
const borderRadius = (0, import_react5.useMemo)(() => {
|
|
123
|
-
const radiusMap = {
|
|
124
|
-
none: theme.borderRadius.none,
|
|
125
|
-
sm: theme.borderRadius.sm,
|
|
126
|
-
md: theme.borderRadius.md,
|
|
127
|
-
lg: theme.borderRadius.lg,
|
|
128
|
-
full: theme.borderRadius.full
|
|
129
|
-
};
|
|
130
|
-
return { borderRadius: radiusMap[radius] };
|
|
131
|
-
}, [radius, theme]);
|
|
132
|
-
return borderRadius;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// src/core/index.ts
|
|
136
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
137
|
-
|
|
138
|
-
// src/components/alert/alert.hook.ts
|
|
65
|
+
var _core = require('@xaui/core');
|
|
139
66
|
var useAlertColorScheme = (themeColor) => {
|
|
140
|
-
const theme = useXUITheme();
|
|
141
|
-
const safeThemeColor = (0,
|
|
67
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
68
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
142
69
|
return {
|
|
143
70
|
theme,
|
|
144
71
|
colorScheme: theme.colors[safeThemeColor],
|
|
@@ -147,10 +74,10 @@ var useAlertColorScheme = (themeColor) => {
|
|
|
147
74
|
};
|
|
148
75
|
var useAlertContainerStyles = (themeColor, variant) => {
|
|
149
76
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
150
|
-
const containerStyles = (0,
|
|
151
|
-
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.background : variant === "faded" ? (0,
|
|
77
|
+
const containerStyles = _react.useMemo.call(void 0, () => {
|
|
78
|
+
const backgroundColor = variant === "solid" ? colorScheme.main : variant === "flat" ? colorScheme.background : variant === "faded" ? _core.withOpacity.call(void 0, colorScheme.background, 0.75) : "transparent";
|
|
152
79
|
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.md : 0;
|
|
153
|
-
const borderColor = variant === "bordered" ? (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";
|
|
154
81
|
return {
|
|
155
82
|
backgroundColor,
|
|
156
83
|
borderColor,
|
|
@@ -163,10 +90,10 @@ var useAlertContainerStyles = (themeColor, variant) => {
|
|
|
163
90
|
};
|
|
164
91
|
var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
165
92
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
166
|
-
const iconWrapperStyles = (0,
|
|
167
|
-
const backgroundColor = variant === "solid" ? (0,
|
|
93
|
+
const iconWrapperStyles = _react.useMemo.call(void 0, () => {
|
|
94
|
+
const backgroundColor = variant === "solid" ? _core.withOpacity.call(void 0, colorScheme.foreground, 0.16) : _core.withOpacity.call(void 0, isDefault ? theme.colors.foreground : colorScheme.main, 0.12);
|
|
168
95
|
const borderWidth = variant === "bordered" || variant === "faded" ? theme.borderWidth.xs : 0;
|
|
169
|
-
const borderColor = (0,
|
|
96
|
+
const borderColor = _core.withOpacity.call(void 0,
|
|
170
97
|
isDefault ? theme.colors.foreground : colorScheme.main,
|
|
171
98
|
0.2
|
|
172
99
|
);
|
|
@@ -180,7 +107,7 @@ var useAlertIconWrapperStyles = (themeColor, variant) => {
|
|
|
180
107
|
};
|
|
181
108
|
var useAlertTextStyles = (themeColor, variant) => {
|
|
182
109
|
const { theme, colorScheme, isDefault } = useAlertColorScheme(themeColor);
|
|
183
|
-
const textStyles = (0,
|
|
110
|
+
const textStyles = _react.useMemo.call(void 0, () => {
|
|
184
111
|
const baseTextColor = variant === "solid" ? colorScheme.foreground : isDefault ? theme.colors.foreground : colorScheme.main;
|
|
185
112
|
return {
|
|
186
113
|
titleStyles: {
|
|
@@ -189,7 +116,7 @@ var useAlertTextStyles = (themeColor, variant) => {
|
|
|
189
116
|
fontWeight: theme.fontWeights.semibold
|
|
190
117
|
},
|
|
191
118
|
descriptionStyles: {
|
|
192
|
-
color: (0,
|
|
119
|
+
color: _core.withOpacity.call(void 0, baseTextColor, 0.75),
|
|
193
120
|
fontSize: theme.fontSizes.xs,
|
|
194
121
|
fontWeight: theme.fontWeights.normal
|
|
195
122
|
},
|
|
@@ -201,11 +128,11 @@ var useAlertTextStyles = (themeColor, variant) => {
|
|
|
201
128
|
};
|
|
202
129
|
|
|
203
130
|
// src/components/alert/alert-icons.tsx
|
|
204
|
-
|
|
205
|
-
var
|
|
131
|
+
|
|
132
|
+
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
206
133
|
function InfoIcon({ color, size }) {
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
|
|
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,
|
|
209
136
|
{
|
|
210
137
|
x1: 12,
|
|
211
138
|
y1: 10,
|
|
@@ -215,11 +142,11 @@ function InfoIcon({ color, size }) {
|
|
|
215
142
|
strokeWidth: 2,
|
|
216
143
|
strokeLinecap: "round"
|
|
217
144
|
}
|
|
218
|
-
), /* @__PURE__ */
|
|
145
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 7, r: 1, fill: color }));
|
|
219
146
|
}
|
|
220
147
|
function SuccessIcon({ color, size }) {
|
|
221
|
-
return /* @__PURE__ */
|
|
222
|
-
|
|
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,
|
|
223
150
|
{
|
|
224
151
|
d: "M7 12.5L10.2 15.5L17 9",
|
|
225
152
|
stroke: color,
|
|
@@ -230,16 +157,16 @@ function SuccessIcon({ color, size }) {
|
|
|
230
157
|
));
|
|
231
158
|
}
|
|
232
159
|
function WarningIcon({ color, size }) {
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
|
|
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,
|
|
235
162
|
{
|
|
236
163
|
d: "M12 3L22 20H2L12 3Z",
|
|
237
164
|
stroke: color,
|
|
238
165
|
strokeWidth: 2,
|
|
239
166
|
strokeLinejoin: "round"
|
|
240
167
|
}
|
|
241
|
-
), /* @__PURE__ */
|
|
242
|
-
|
|
168
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
169
|
+
_reactnativesvg.Line,
|
|
243
170
|
{
|
|
244
171
|
x1: 12,
|
|
245
172
|
y1: 9,
|
|
@@ -249,11 +176,11 @@ function WarningIcon({ color, size }) {
|
|
|
249
176
|
strokeWidth: 2,
|
|
250
177
|
strokeLinecap: "round"
|
|
251
178
|
}
|
|
252
|
-
), /* @__PURE__ */
|
|
179
|
+
), /* @__PURE__ */ _react2.default.createElement(_reactnativesvg.Circle, { cx: 12, cy: 17, r: 1, fill: color }));
|
|
253
180
|
}
|
|
254
181
|
function DangerIcon({ color, size }) {
|
|
255
|
-
return /* @__PURE__ */
|
|
256
|
-
|
|
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,
|
|
257
184
|
{
|
|
258
185
|
x1: 9,
|
|
259
186
|
y1: 9,
|
|
@@ -263,8 +190,8 @@ function DangerIcon({ color, size }) {
|
|
|
263
190
|
strokeWidth: 2,
|
|
264
191
|
strokeLinecap: "round"
|
|
265
192
|
}
|
|
266
|
-
), /* @__PURE__ */
|
|
267
|
-
|
|
193
|
+
), /* @__PURE__ */ _react2.default.createElement(
|
|
194
|
+
_reactnativesvg.Line,
|
|
268
195
|
{
|
|
269
196
|
x1: 15,
|
|
270
197
|
y1: 9,
|
|
@@ -278,7 +205,7 @@ function DangerIcon({ color, size }) {
|
|
|
278
205
|
}
|
|
279
206
|
|
|
280
207
|
// src/components/alert/alert.tsx
|
|
281
|
-
var
|
|
208
|
+
var _icons = require('@xaui/icons');
|
|
282
209
|
var iconMap = {
|
|
283
210
|
default: InfoIcon,
|
|
284
211
|
primary: InfoIcon,
|
|
@@ -304,72 +231,72 @@ var Alert = ({
|
|
|
304
231
|
onClose,
|
|
305
232
|
onVisibleChange
|
|
306
233
|
}) => {
|
|
307
|
-
const [internalVisible, setInternalVisible] = (0,
|
|
308
|
-
const [shouldRender, setShouldRender] = (0,
|
|
234
|
+
const [internalVisible, setInternalVisible] = _react.useState.call(void 0, _nullishCoalesce(isVisible, () => ( true)));
|
|
235
|
+
const [shouldRender, setShouldRender] = _react.useState.call(void 0, _nullishCoalesce(isVisible, () => ( true)));
|
|
309
236
|
const isControlled = typeof isVisible === "boolean";
|
|
310
237
|
const visible = isControlled ? isVisible : internalVisible;
|
|
311
|
-
const opacity = (0,
|
|
312
|
-
const scale = (0,
|
|
313
|
-
const radiusStyles = useBorderRadiusStyles(radius);
|
|
238
|
+
const opacity = _reactnativereanimated.useSharedValue.call(void 0, 1);
|
|
239
|
+
const scale = _reactnativereanimated.useSharedValue.call(void 0, 1);
|
|
240
|
+
const radiusStyles = _chunkOQ2BLOOGcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
314
241
|
const containerStyles = useAlertContainerStyles(themeColor, variant);
|
|
315
242
|
const iconWrapperStyles = useAlertIconWrapperStyles(themeColor, variant);
|
|
316
243
|
const { titleStyles, descriptionStyles, iconColor, closeButtonColor } = useAlertTextStyles(themeColor, variant);
|
|
317
|
-
const finishClosing = (0,
|
|
244
|
+
const finishClosing = _react.useCallback.call(void 0, () => {
|
|
318
245
|
setShouldRender(false);
|
|
319
246
|
if (!isControlled) {
|
|
320
247
|
setInternalVisible(false);
|
|
321
248
|
}
|
|
322
|
-
onVisibleChange
|
|
323
|
-
onClose
|
|
249
|
+
_optionalChain([onVisibleChange, 'optionalCall', _ => _(false)]);
|
|
250
|
+
_optionalChain([onClose, 'optionalCall', _2 => _2()]);
|
|
324
251
|
}, [isControlled, onClose, onVisibleChange]);
|
|
325
|
-
const handleClose = (0,
|
|
252
|
+
const handleClose = _react.useCallback.call(void 0, () => {
|
|
326
253
|
if (!visible) return;
|
|
327
|
-
opacity.value = (0,
|
|
328
|
-
scale.value = (0,
|
|
254
|
+
opacity.value = _reactnativereanimated.withTiming.call(void 0, 0, { duration: 250 });
|
|
255
|
+
scale.value = _reactnativereanimated.withTiming.call(void 0, 0.95, { duration: 250 }, (finished) => {
|
|
329
256
|
if (finished) {
|
|
330
|
-
(0,
|
|
257
|
+
_reactnativereanimated.runOnJS.call(void 0, finishClosing)();
|
|
331
258
|
}
|
|
332
259
|
});
|
|
333
260
|
}, [finishClosing, opacity, scale, visible]);
|
|
334
|
-
(0,
|
|
261
|
+
_react.useEffect.call(void 0, () => {
|
|
335
262
|
if (visible && !shouldRender) {
|
|
336
263
|
setShouldRender(true);
|
|
337
264
|
opacity.value = 0;
|
|
338
265
|
scale.value = 0.95;
|
|
339
|
-
opacity.value = (0,
|
|
340
|
-
scale.value = (0,
|
|
266
|
+
opacity.value = _reactnativereanimated.withTiming.call(void 0, 1, { duration: 250 });
|
|
267
|
+
scale.value = _reactnativereanimated.withTiming.call(void 0, 1, { duration: 250 });
|
|
341
268
|
return;
|
|
342
269
|
}
|
|
343
270
|
if (!visible && shouldRender) {
|
|
344
271
|
handleClose();
|
|
345
272
|
}
|
|
346
273
|
}, [visible, shouldRender, opacity, scale, handleClose]);
|
|
347
|
-
const animatedStyle = (0,
|
|
274
|
+
const animatedStyle = _reactnativereanimated.useAnimatedStyle.call(void 0, () => ({
|
|
348
275
|
opacity: opacity.value,
|
|
349
276
|
transform: [{ scale: scale.value }]
|
|
350
277
|
}));
|
|
351
|
-
const IconComponent = iconMap[themeColor]
|
|
278
|
+
const IconComponent = _nullishCoalesce(iconMap[themeColor], () => ( InfoIcon));
|
|
352
279
|
const shouldShowClose = Boolean(closeButton || isClosable || onClose);
|
|
353
280
|
const renderIcon = () => {
|
|
354
281
|
if (hideIcon) return null;
|
|
355
|
-
if (icon && (0,
|
|
356
|
-
return (0,
|
|
282
|
+
if (icon && _react.isValidElement.call(void 0, icon)) {
|
|
283
|
+
return _react.cloneElement.call(void 0, icon, { color: iconColor, size: 22 });
|
|
357
284
|
}
|
|
358
285
|
if (icon) {
|
|
359
|
-
return /* @__PURE__ */
|
|
286
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.iconText, { color: iconColor }] }, icon);
|
|
360
287
|
}
|
|
361
|
-
return /* @__PURE__ */
|
|
288
|
+
return /* @__PURE__ */ _react2.default.createElement(IconComponent, { color: iconColor, size: 22 });
|
|
362
289
|
};
|
|
363
290
|
const renderContentText = (content) => {
|
|
364
291
|
if (content === null || content === void 0) return null;
|
|
365
292
|
if (typeof content === "string" || typeof content === "number") {
|
|
366
|
-
return /* @__PURE__ */
|
|
367
|
-
|
|
293
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
294
|
+
_reactnative.Text,
|
|
368
295
|
{
|
|
369
296
|
style: [
|
|
370
297
|
styles.description,
|
|
371
298
|
descriptionStyles,
|
|
372
|
-
customAppearance
|
|
299
|
+
_optionalChain([customAppearance, 'optionalAccess', _3 => _3.description])
|
|
373
300
|
]
|
|
374
301
|
},
|
|
375
302
|
content
|
|
@@ -377,54 +304,53 @@ var Alert = ({
|
|
|
377
304
|
}
|
|
378
305
|
return content;
|
|
379
306
|
};
|
|
380
|
-
const titleNode = (0,
|
|
307
|
+
const titleNode = _react.useMemo.call(void 0, () => {
|
|
381
308
|
if (title === null || title === void 0) return null;
|
|
382
309
|
if (typeof title === "string" || typeof title === "number") {
|
|
383
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [styles.title, titleStyles, _optionalChain([customAppearance, 'optionalAccess', _4 => _4.title])] }, title);
|
|
384
311
|
}
|
|
385
312
|
return title;
|
|
386
|
-
}, [title, customAppearance
|
|
313
|
+
}, [title, _optionalChain([customAppearance, 'optionalAccess', _5 => _5.title]), titleStyles]);
|
|
387
314
|
const descriptionNode = renderContentText(description);
|
|
388
315
|
const childrenNode = renderContentText(children);
|
|
389
|
-
const closeButtonNode = (0,
|
|
316
|
+
const closeButtonNode = _react.useMemo.call(void 0, () => {
|
|
390
317
|
if (!closeButton) return null;
|
|
391
|
-
if (!(0,
|
|
318
|
+
if (!_react.isValidElement.call(void 0, closeButton)) return closeButton;
|
|
392
319
|
const existingOnPress = closeButton.props.onPress;
|
|
393
|
-
return (0,
|
|
320
|
+
return _react.cloneElement.call(void 0, closeButton, {
|
|
394
321
|
onPress: (event) => {
|
|
395
|
-
existingOnPress
|
|
322
|
+
_optionalChain([existingOnPress, 'optionalCall', _6 => _6(event)]);
|
|
396
323
|
handleClose();
|
|
397
324
|
}
|
|
398
325
|
});
|
|
399
326
|
}, [closeButton, handleClose]);
|
|
400
327
|
if (!shouldRender) return null;
|
|
401
|
-
return /* @__PURE__ */
|
|
402
|
-
|
|
328
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
329
|
+
_reactnativereanimated2.default.View,
|
|
403
330
|
{
|
|
404
331
|
accessibilityRole: "alert",
|
|
405
332
|
style: [
|
|
406
333
|
styles.container,
|
|
407
334
|
containerStyles,
|
|
408
335
|
radiusStyles,
|
|
409
|
-
customAppearance
|
|
336
|
+
_optionalChain([customAppearance, 'optionalAccess', _7 => _7.container]),
|
|
410
337
|
animatedStyle
|
|
411
338
|
]
|
|
412
339
|
},
|
|
413
|
-
!hideIcon && /* @__PURE__ */
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
shouldShowClose && /* @__PURE__ */
|
|
416
|
-
|
|
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,
|
|
417
344
|
{
|
|
418
345
|
accessibilityRole: "button",
|
|
419
346
|
accessibilityLabel: "Close",
|
|
420
347
|
onPress: handleClose,
|
|
421
348
|
style: styles.closeButton
|
|
422
349
|
},
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
))
|
|
350
|
+
/* @__PURE__ */ _react2.default.createElement(_icons.CloseIcon, { size: 20, color: closeButtonColor })
|
|
351
|
+
))))
|
|
425
352
|
);
|
|
426
353
|
};
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
});
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
exports.Alert = Alert;
|
package/dist/alert/index.js
CHANGED
package/dist/app-bar/index.cjs
CHANGED
|
@@ -1,88 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/components/app-bar/index.ts
|
|
31
|
-
var app_bar_exports = {};
|
|
32
|
-
__export(app_bar_exports, {
|
|
33
|
-
AppBar: () => AppBar,
|
|
34
|
-
AppBarContent: () => AppBarContent,
|
|
35
|
-
AppBarEndContent: () => AppBarEndContent,
|
|
36
|
-
AppBarStartContent: () => AppBarStartContent
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(app_bar_exports);
|
|
39
|
-
|
|
40
|
-
// src/components/app-bar/app-bar.tsx
|
|
41
|
-
var import_react7 = __toESM(require("react"), 1);
|
|
42
|
-
var import_react_native5 = require("react-native");
|
|
43
|
-
var import_core2 = require("@xaui/core");
|
|
44
|
-
|
|
45
|
-
// src/core/theme-context.tsx
|
|
46
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
47
|
-
var import_react_native2 = require("react-native");
|
|
48
|
-
var import_theme = require("@xaui/core/theme");
|
|
49
|
-
var import_palette = require("@xaui/core/palette");
|
|
50
|
-
|
|
51
|
-
// src/core/portal/portal.tsx
|
|
52
|
-
var import_react2 = require("react");
|
|
53
|
-
|
|
54
|
-
// src/core/portal/portal-context.ts
|
|
55
|
-
var import_react = require("react");
|
|
56
|
-
var PortalContext = (0, import_react.createContext)(null);
|
|
57
|
-
|
|
58
|
-
// src/core/portal/portal-host.tsx
|
|
59
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
60
|
-
var import_react_native = require("react-native");
|
|
61
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
62
|
-
container: {
|
|
63
|
-
flex: 1
|
|
64
|
-
}
|
|
65
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-HSPTLUFA.cjs');
|
|
66
2
|
|
|
67
|
-
// src/core/theme-context.tsx
|
|
68
|
-
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
69
3
|
|
|
70
|
-
|
|
71
|
-
var import_react5 = require("react");
|
|
72
|
-
var import_react_native3 = require("react-native");
|
|
73
|
-
function useXUITheme() {
|
|
74
|
-
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
75
|
-
if (!theme) {
|
|
76
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
77
|
-
}
|
|
78
|
-
return theme;
|
|
79
|
-
}
|
|
4
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
80
5
|
|
|
81
|
-
// src/
|
|
82
|
-
var
|
|
6
|
+
// src/components/app-bar/app-bar.tsx
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
8
|
+
var _reactnative = require('react-native');
|
|
9
|
+
var _core = require('@xaui/core');
|
|
83
10
|
|
|
84
11
|
// src/components/app-bar/app-bar.hook.ts
|
|
85
|
-
|
|
12
|
+
|
|
86
13
|
var resolveShadowStyle = (elevation, shadows) => {
|
|
87
14
|
if (elevation <= 1) {
|
|
88
15
|
return shadows.sm;
|
|
@@ -96,8 +23,8 @@ var resolveShadowStyle = (elevation, shadows) => {
|
|
|
96
23
|
return shadows.xl;
|
|
97
24
|
};
|
|
98
25
|
var useAppBarElevationStyles = (elevation = 0) => {
|
|
99
|
-
const theme = useXUITheme();
|
|
100
|
-
return (0,
|
|
26
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
27
|
+
return _react.useMemo.call(void 0, () => {
|
|
101
28
|
if (elevation <= 0) {
|
|
102
29
|
return {};
|
|
103
30
|
}
|
|
@@ -109,8 +36,8 @@ var useAppBarElevationStyles = (elevation = 0) => {
|
|
|
109
36
|
};
|
|
110
37
|
|
|
111
38
|
// src/components/app-bar/app-bar.style.ts
|
|
112
|
-
|
|
113
|
-
var styles =
|
|
39
|
+
|
|
40
|
+
var styles = _reactnative.StyleSheet.create({
|
|
114
41
|
container: {
|
|
115
42
|
width: "100%"
|
|
116
43
|
},
|
|
@@ -164,16 +91,16 @@ var AppBar = ({
|
|
|
164
91
|
children,
|
|
165
92
|
style
|
|
166
93
|
}) => {
|
|
167
|
-
const theme = useXUITheme();
|
|
94
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
168
95
|
const elevationStyles = useAppBarElevationStyles(elevation);
|
|
169
96
|
const isFloating = variant === "floating";
|
|
170
|
-
const safeThemeColor = (0,
|
|
97
|
+
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
171
98
|
const colorScheme = theme.colors[safeThemeColor];
|
|
172
99
|
const isDefaultThemeColor = safeThemeColor === "default";
|
|
173
100
|
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : "#FFFFFF" : colorScheme.background;
|
|
174
101
|
const borderBottomColor = isDefaultThemeColor ? theme.mode === "dark" ? "rgba(255, 255, 255, 0.06)" : "rgba(0, 0, 0, 0.08)" : colorScheme.main;
|
|
175
|
-
return /* @__PURE__ */
|
|
176
|
-
|
|
102
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, isFloating && styles.floatingContainer] }, /* @__PURE__ */ _react2.default.createElement(
|
|
103
|
+
_reactnative.View,
|
|
177
104
|
{
|
|
178
105
|
style: [
|
|
179
106
|
styles.appBar,
|
|
@@ -194,24 +121,23 @@ var AppBarStartContent = ({
|
|
|
194
121
|
children,
|
|
195
122
|
style
|
|
196
123
|
}) => {
|
|
197
|
-
return /* @__PURE__ */
|
|
124
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.startContent, style] }, children);
|
|
198
125
|
};
|
|
199
126
|
var AppBarContent = ({
|
|
200
127
|
children,
|
|
201
128
|
style
|
|
202
129
|
}) => {
|
|
203
|
-
return /* @__PURE__ */
|
|
130
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.content, style] }, children);
|
|
204
131
|
};
|
|
205
132
|
var AppBarEndContent = ({
|
|
206
133
|
children,
|
|
207
134
|
style
|
|
208
135
|
}) => {
|
|
209
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.endContent, style] }, children);
|
|
210
137
|
};
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
});
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
exports.AppBar = AppBar; exports.AppBarContent = AppBarContent; exports.AppBarEndContent = AppBarEndContent; exports.AppBarStartContent = AppBarStartContent;
|