@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
|
@@ -1,49 +1,21 @@
|
|
|
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);
|
|
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; }
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
module.exports = __toCommonJS(expansion_panel_exports);
|
|
3
|
+
var _chunkBD72HIPRcjs = require('../chunk-BD72HIPR.cjs');
|
|
4
|
+
require('../chunk-HSPTLUFA.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
37
9
|
|
|
38
10
|
// src/components/expansion-panel/expansion-panel.tsx
|
|
39
|
-
var
|
|
40
|
-
var
|
|
11
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
12
|
+
var _reactnative = require('react-native');
|
|
41
13
|
|
|
42
14
|
// src/components/expansion-panel/expansion-panel-context.ts
|
|
43
|
-
|
|
44
|
-
var ExpansionPanelContext = (0,
|
|
15
|
+
|
|
16
|
+
var ExpansionPanelContext = _react.createContext.call(void 0, void 0);
|
|
45
17
|
var useExpansionPanelContext = () => {
|
|
46
|
-
const context = (0,
|
|
18
|
+
const context = _react.useContext.call(void 0, ExpansionPanelContext);
|
|
47
19
|
if (!context) {
|
|
48
20
|
throw new Error(
|
|
49
21
|
"ExpansionPanelItem must be used within an ExpansionPanel component"
|
|
@@ -53,59 +25,14 @@ var useExpansionPanelContext = () => {
|
|
|
53
25
|
};
|
|
54
26
|
|
|
55
27
|
// src/components/expansion-panel/expansion-panel.hook.ts
|
|
56
|
-
var import_react7 = require("react");
|
|
57
|
-
|
|
58
|
-
// src/core/theme-context.tsx
|
|
59
|
-
var import_react5 = __toESM(require("react"), 1);
|
|
60
|
-
var import_react_native2 = require("react-native");
|
|
61
|
-
var import_theme = require("@xaui/core/theme");
|
|
62
|
-
var import_palette = require("@xaui/core/palette");
|
|
63
|
-
|
|
64
|
-
// src/core/portal/portal.tsx
|
|
65
|
-
var import_react3 = require("react");
|
|
66
|
-
|
|
67
|
-
// src/core/portal/portal-context.ts
|
|
68
|
-
var import_react2 = require("react");
|
|
69
|
-
var PortalContext = (0, import_react2.createContext)(null);
|
|
70
28
|
|
|
71
|
-
// src/core/portal/portal-host.tsx
|
|
72
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
73
|
-
var import_react_native = require("react-native");
|
|
74
|
-
var hostStyles = import_react_native.StyleSheet.create({
|
|
75
|
-
container: {
|
|
76
|
-
flex: 1
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// src/core/theme-context.tsx
|
|
81
|
-
var XUIThemeContext = (0, import_react5.createContext)(null);
|
|
82
|
-
|
|
83
|
-
// src/core/theme-hooks.ts
|
|
84
|
-
var import_react6 = require("react");
|
|
85
|
-
var import_react_native3 = require("react-native");
|
|
86
|
-
function useXUITheme() {
|
|
87
|
-
const theme = (0, import_react6.useContext)(XUIThemeContext);
|
|
88
|
-
if (!theme) {
|
|
89
|
-
throw new Error("useXUITheme must be used within XUIProvider");
|
|
90
|
-
}
|
|
91
|
-
return theme;
|
|
92
|
-
}
|
|
93
|
-
function useXUIPalette() {
|
|
94
|
-
const theme = useXUITheme();
|
|
95
|
-
return (0, import_react6.useMemo)(() => theme.palette, [theme]);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// src/core/index.ts
|
|
99
|
-
var import_theme2 = require("@xaui/core/theme");
|
|
100
|
-
|
|
101
|
-
// src/components/expansion-panel/expansion-panel.hook.ts
|
|
102
29
|
var useExpansionPanelStyles = ({
|
|
103
30
|
variant,
|
|
104
31
|
fullWidth
|
|
105
32
|
}) => {
|
|
106
|
-
const theme = useXUITheme();
|
|
107
|
-
const palette2 = useXUIPalette();
|
|
108
|
-
const containerStyles = (0,
|
|
33
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
34
|
+
const palette2 = _chunkOQ2BLOOGcjs.useXUIPalette.call(void 0, );
|
|
35
|
+
const containerStyles = _react.useMemo.call(void 0, () => {
|
|
109
36
|
const base = {};
|
|
110
37
|
if (fullWidth) {
|
|
111
38
|
base.width = "100%";
|
|
@@ -129,17 +56,17 @@ var useExpansionPanelSelection = ({
|
|
|
129
56
|
defaultExpandedKeys,
|
|
130
57
|
onSelectionChange
|
|
131
58
|
}) => {
|
|
132
|
-
const [internalExpandedKeys, setInternalExpandedKeys] = (0,
|
|
59
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = _react.useState.call(void 0, defaultExpandedKeys);
|
|
133
60
|
const isControlled = expandedKeys !== void 0;
|
|
134
61
|
const currentExpandedKeys = isControlled ? expandedKeys : internalExpandedKeys;
|
|
135
|
-
const toggleItem = (0,
|
|
62
|
+
const toggleItem = _react.useCallback.call(void 0,
|
|
136
63
|
(key) => {
|
|
137
64
|
const isExpanded = currentExpandedKeys.includes(key);
|
|
138
65
|
const newExpandedKeys = selectionMode === "toggle" ? isExpanded ? [] : [key] : isExpanded ? currentExpandedKeys.filter((k) => k !== key) : [...currentExpandedKeys, key];
|
|
139
66
|
if (!isControlled) {
|
|
140
67
|
setInternalExpandedKeys(newExpandedKeys);
|
|
141
68
|
}
|
|
142
|
-
onSelectionChange
|
|
69
|
+
_optionalChain([onSelectionChange, 'optionalCall', _ => _(newExpandedKeys)]);
|
|
143
70
|
},
|
|
144
71
|
[selectionMode, currentExpandedKeys, isControlled, onSelectionChange]
|
|
145
72
|
);
|
|
@@ -152,7 +79,7 @@ var useExpansionPanelContextValue = (config) => {
|
|
|
152
79
|
defaultExpandedKeys: config.defaultExpandedKeys,
|
|
153
80
|
onSelectionChange: config.onSelectionChange
|
|
154
81
|
});
|
|
155
|
-
return (0,
|
|
82
|
+
return _react.useMemo.call(void 0,
|
|
156
83
|
() => ({
|
|
157
84
|
variant: config.variant,
|
|
158
85
|
hideIndicator: config.hideIndicator,
|
|
@@ -177,12 +104,12 @@ var useExpansionPanelContextValue = (config) => {
|
|
|
177
104
|
};
|
|
178
105
|
|
|
179
106
|
// src/components/expansion-panel/expansion-panel-item.tsx
|
|
180
|
-
|
|
181
|
-
|
|
107
|
+
|
|
108
|
+
|
|
182
109
|
|
|
183
110
|
// src/components/expansion-panel/expansion-panel-item.style.ts
|
|
184
|
-
|
|
185
|
-
var styles =
|
|
111
|
+
|
|
112
|
+
var styles = _reactnative.StyleSheet.create({
|
|
186
113
|
startContent: {
|
|
187
114
|
flexShrink: 0
|
|
188
115
|
},
|
|
@@ -205,62 +132,65 @@ var styles = import_react_native4.StyleSheet.create({
|
|
|
205
132
|
});
|
|
206
133
|
|
|
207
134
|
// src/components/expansion-panel/expansion-panel-item.hook.ts
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
var _palette = require('@xaui/core/palette');
|
|
141
|
+
var _core = require('@xaui/core');
|
|
212
142
|
var useExpansionPanelItemState = (itemKey) => {
|
|
213
143
|
const context = useExpansionPanelContext();
|
|
214
|
-
const resolvedItemKey = itemKey
|
|
144
|
+
const resolvedItemKey = _nullishCoalesce(itemKey, () => ( ""));
|
|
215
145
|
const isExpanded = resolvedItemKey ? context.expandedKeys.includes(resolvedItemKey) : false;
|
|
216
146
|
const isDisabled = resolvedItemKey ? context.disabledKeys.includes(resolvedItemKey) : false;
|
|
217
|
-
const handlePress = (0,
|
|
147
|
+
const handlePress = _react.useCallback.call(void 0, () => {
|
|
218
148
|
if (isDisabled || !resolvedItemKey) return;
|
|
219
149
|
context.toggleItem(resolvedItemKey);
|
|
220
150
|
}, [isDisabled, resolvedItemKey, context]);
|
|
221
151
|
return { ...context, resolvedItemKey, isExpanded, isDisabled, handlePress };
|
|
222
152
|
};
|
|
223
153
|
var useExpansionPanelItemAnimation = (isExpanded, disableAnimation) => {
|
|
224
|
-
const [contentHeight, setContentHeight] = (0,
|
|
225
|
-
const [isMeasured, setIsMeasured] = (0,
|
|
226
|
-
const animatedHeight = (0,
|
|
227
|
-
const animatedRotation = (0,
|
|
228
|
-
const prevContentHeight = (0,
|
|
229
|
-
(0,
|
|
154
|
+
const [contentHeight, setContentHeight] = _react.useState.call(void 0, 0);
|
|
155
|
+
const [isMeasured, setIsMeasured] = _react.useState.call(void 0, false);
|
|
156
|
+
const animatedHeight = _react.useRef.call(void 0, new _reactnative.Animated.Value(isExpanded ? 1 : 0)).current;
|
|
157
|
+
const animatedRotation = _react.useRef.call(void 0, new _reactnative.Animated.Value(isExpanded ? 1 : 0)).current;
|
|
158
|
+
const prevContentHeight = _react.useRef.call(void 0, contentHeight);
|
|
159
|
+
_react.useEffect.call(void 0, () => {
|
|
230
160
|
if (disableAnimation) {
|
|
231
161
|
animatedHeight.setValue(isExpanded ? 1 : 0);
|
|
232
162
|
animatedRotation.setValue(isExpanded ? 1 : 0);
|
|
233
163
|
return;
|
|
234
164
|
}
|
|
235
|
-
|
|
236
|
-
|
|
165
|
+
_reactnative.Animated.parallel([
|
|
166
|
+
_reactnative.Animated.timing(animatedHeight, {
|
|
237
167
|
toValue: isExpanded ? 1 : 0,
|
|
238
168
|
duration: 300,
|
|
239
|
-
easing:
|
|
169
|
+
easing: _reactnative.Easing.bezier(0.4, 0, 0.2, 1),
|
|
240
170
|
useNativeDriver: false
|
|
241
171
|
}),
|
|
242
|
-
|
|
172
|
+
_reactnative.Animated.timing(animatedRotation, {
|
|
243
173
|
toValue: isExpanded ? 1 : 0,
|
|
244
174
|
duration: 300,
|
|
245
|
-
easing:
|
|
175
|
+
easing: _reactnative.Easing.bezier(0.4, 0, 0.2, 1),
|
|
246
176
|
useNativeDriver: true
|
|
247
177
|
})
|
|
248
178
|
]).start();
|
|
249
179
|
}, [isExpanded, disableAnimation, animatedHeight, animatedRotation]);
|
|
250
|
-
(0,
|
|
180
|
+
_react.useEffect.call(void 0, () => {
|
|
251
181
|
if (contentHeight <= 0 || contentHeight === prevContentHeight.current || !isExpanded)
|
|
252
182
|
return;
|
|
253
183
|
prevContentHeight.current = contentHeight;
|
|
254
184
|
if (!disableAnimation && isMeasured) {
|
|
255
|
-
|
|
185
|
+
_reactnative.Animated.timing(animatedHeight, {
|
|
256
186
|
toValue: 1,
|
|
257
187
|
duration: 200,
|
|
258
|
-
easing:
|
|
188
|
+
easing: _reactnative.Easing.out(_reactnative.Easing.ease),
|
|
259
189
|
useNativeDriver: false
|
|
260
190
|
}).start();
|
|
261
191
|
}
|
|
262
192
|
}, [contentHeight, isExpanded, disableAnimation, isMeasured, animatedHeight]);
|
|
263
|
-
const onContentLayout = (0,
|
|
193
|
+
const onContentLayout = _react.useCallback.call(void 0, (event) => {
|
|
264
194
|
const height = event.nativeEvent.layout.height;
|
|
265
195
|
if (height > 0) {
|
|
266
196
|
setContentHeight(height);
|
|
@@ -283,12 +213,12 @@ var useExpansionPanelItemAnimation = (isExpanded, disableAnimation) => {
|
|
|
283
213
|
};
|
|
284
214
|
};
|
|
285
215
|
var useBaseStyles = (variant, isDisabled) => {
|
|
286
|
-
const theme = useXUITheme();
|
|
287
|
-
const baseStyles = (0,
|
|
216
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
217
|
+
const baseStyles = _react.useMemo.call(void 0, () => {
|
|
288
218
|
const base = { overflow: "hidden" };
|
|
289
219
|
if (variant === "splitted") {
|
|
290
220
|
base.paddingHorizontal = theme.spacing.md;
|
|
291
|
-
base.backgroundColor = (0,
|
|
221
|
+
base.backgroundColor = _core.withOpacity.call(void 0, theme.colors.default.background, 0.5);
|
|
292
222
|
base.borderRadius = theme.borderRadius.md;
|
|
293
223
|
base.marginBottom = theme.spacing.xs;
|
|
294
224
|
} else if (variant === "bordered") {
|
|
@@ -302,8 +232,8 @@ var useBaseStyles = (variant, isDisabled) => {
|
|
|
302
232
|
return baseStyles;
|
|
303
233
|
};
|
|
304
234
|
var useTriggerStyles = (variant, isCompact) => {
|
|
305
|
-
const theme = useXUITheme();
|
|
306
|
-
const triggerStyles = (0,
|
|
235
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
236
|
+
const triggerStyles = _react.useMemo.call(void 0, () => {
|
|
307
237
|
const trigger = {
|
|
308
238
|
flexDirection: "row",
|
|
309
239
|
alignItems: "center",
|
|
@@ -318,8 +248,8 @@ var useTriggerStyles = (variant, isCompact) => {
|
|
|
318
248
|
return triggerStyles;
|
|
319
249
|
};
|
|
320
250
|
var useTitleTextStyle = (isCompact) => {
|
|
321
|
-
const theme = useXUITheme();
|
|
322
|
-
const titleTextStyle = (0,
|
|
251
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
252
|
+
const titleTextStyle = _react.useMemo.call(void 0,
|
|
323
253
|
() => ({
|
|
324
254
|
fontSize: isCompact ? theme.fontSizes.md : theme.fontSizes.lg,
|
|
325
255
|
fontWeight: theme.fontWeights.medium,
|
|
@@ -330,11 +260,11 @@ var useTitleTextStyle = (isCompact) => {
|
|
|
330
260
|
return titleTextStyle;
|
|
331
261
|
};
|
|
332
262
|
var useSubtitleTextStyle = () => {
|
|
333
|
-
const theme = useXUITheme();
|
|
334
|
-
const subtitleTextStyle = (0,
|
|
263
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
264
|
+
const subtitleTextStyle = _react.useMemo.call(void 0,
|
|
335
265
|
() => ({
|
|
336
266
|
fontSize: theme.fontSizes.sm,
|
|
337
|
-
color:
|
|
267
|
+
color: _palette.colors.gray[500],
|
|
338
268
|
marginTop: theme.spacing.xs
|
|
339
269
|
}),
|
|
340
270
|
[theme]
|
|
@@ -342,8 +272,8 @@ var useSubtitleTextStyle = () => {
|
|
|
342
272
|
return subtitleTextStyle;
|
|
343
273
|
};
|
|
344
274
|
var useContentContainerStyle = (isCompact, variant) => {
|
|
345
|
-
const theme = useXUITheme();
|
|
346
|
-
const contentContainerStyle = (0,
|
|
275
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
276
|
+
const contentContainerStyle = _react.useMemo.call(void 0,
|
|
347
277
|
() => ({
|
|
348
278
|
paddingBottom: isCompact ? theme.spacing.xs : theme.spacing.sm,
|
|
349
279
|
paddingHorizontal: variant === "light" ? theme.spacing.sm : 0
|
|
@@ -353,19 +283,19 @@ var useContentContainerStyle = (isCompact, variant) => {
|
|
|
353
283
|
return contentContainerStyle;
|
|
354
284
|
};
|
|
355
285
|
var useForegroundColor = () => {
|
|
356
|
-
const theme = useXUITheme();
|
|
286
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
357
287
|
return theme.colors.foreground;
|
|
358
288
|
};
|
|
359
289
|
|
|
360
290
|
// src/components/expansion-panel/chevron-right-icon.tsx
|
|
361
|
-
|
|
362
|
-
var
|
|
291
|
+
|
|
292
|
+
var _reactnativesvg = require('react-native-svg'); var _reactnativesvg2 = _interopRequireDefault(_reactnativesvg);
|
|
363
293
|
var ChevronRightIcon = ({
|
|
364
294
|
color = "#000",
|
|
365
295
|
size = 20
|
|
366
296
|
}) => {
|
|
367
|
-
return /* @__PURE__ */
|
|
368
|
-
|
|
297
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnativesvg2.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ _react2.default.createElement(
|
|
298
|
+
_reactnativesvg.Path,
|
|
369
299
|
{
|
|
370
300
|
d: "M9 18l6-6-6-6",
|
|
371
301
|
stroke: color,
|
|
@@ -398,7 +328,7 @@ var ExpansionPanelItem = ({
|
|
|
398
328
|
} = useExpansionPanelItemState(itemKey);
|
|
399
329
|
const handlePress = () => {
|
|
400
330
|
togglePress();
|
|
401
|
-
onSelected
|
|
331
|
+
_optionalChain([onSelected, 'optionalCall', _2 => _2(!isExpanded)]);
|
|
402
332
|
};
|
|
403
333
|
const { onContentLayout, heightInterpolation, rotationInterpolation } = useExpansionPanelItemAnimation(isExpanded, disableAnimation);
|
|
404
334
|
const baseStyles = useBaseStyles(variant, isDisabled);
|
|
@@ -407,50 +337,50 @@ var ExpansionPanelItem = ({
|
|
|
407
337
|
const subtitleTextStyle = useSubtitleTextStyle();
|
|
408
338
|
const contentContainerStyle = useContentContainerStyle(isCompact, variant);
|
|
409
339
|
const foregroundColor = useForegroundColor();
|
|
410
|
-
return /* @__PURE__ */
|
|
411
|
-
|
|
340
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [baseStyles, _optionalChain([customAppearance, 'optionalAccess', _3 => _3.base])] }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: _optionalChain([customAppearance, 'optionalAccess', _4 => _4.heading]) }, /* @__PURE__ */ _react2.default.createElement(
|
|
341
|
+
_reactnative.Pressable,
|
|
412
342
|
{
|
|
413
|
-
style: [triggerStyles, customAppearance
|
|
343
|
+
style: [triggerStyles, _optionalChain([customAppearance, 'optionalAccess', _5 => _5.trigger])],
|
|
414
344
|
onPress: handlePress,
|
|
415
345
|
disabled: isDisabled,
|
|
416
346
|
accessibilityRole: "button",
|
|
417
347
|
accessibilityState: { expanded: isExpanded, disabled: isDisabled }
|
|
418
348
|
},
|
|
419
|
-
startContent && /* @__PURE__ */
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
!hideIndicator && /* @__PURE__ */
|
|
422
|
-
|
|
349
|
+
startContent && /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.startContent, _optionalChain([customAppearance, 'optionalAccess', _6 => _6.startContent])] }, startContent),
|
|
350
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.titleWrapper }, typeof title === "string" ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [titleTextStyle, _optionalChain([customAppearance, 'optionalAccess', _7 => _7.title])] }, title) : title, subtitle && (typeof subtitle === "string" ? /* @__PURE__ */ _react2.default.createElement(_reactnative.Text, { style: [subtitleTextStyle, _optionalChain([customAppearance, 'optionalAccess', _8 => _8.subtitle])] }, subtitle) : subtitle)),
|
|
351
|
+
!hideIndicator && /* @__PURE__ */ _react2.default.createElement(
|
|
352
|
+
_reactnative.Animated.View,
|
|
423
353
|
{
|
|
424
354
|
style: [
|
|
425
355
|
styles.indicator,
|
|
426
|
-
customAppearance
|
|
356
|
+
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.indicator]),
|
|
427
357
|
{ transform: [{ rotate: rotationInterpolation }] }
|
|
428
358
|
]
|
|
429
359
|
},
|
|
430
|
-
indicator || /* @__PURE__ */
|
|
360
|
+
indicator || /* @__PURE__ */ _react2.default.createElement(ChevronRightIcon, { color: foregroundColor })
|
|
431
361
|
)
|
|
432
|
-
)), /* @__PURE__ */
|
|
433
|
-
|
|
362
|
+
)), /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: styles.hiddenMeasure, pointerEvents: "none" }, /* @__PURE__ */ _react2.default.createElement(
|
|
363
|
+
_reactnative.View,
|
|
434
364
|
{
|
|
435
365
|
onLayout: onContentLayout,
|
|
436
|
-
style: [contentContainerStyle, customAppearance
|
|
366
|
+
style: [contentContainerStyle, _optionalChain([customAppearance, 'optionalAccess', _10 => _10.content])]
|
|
437
367
|
},
|
|
438
368
|
children
|
|
439
|
-
)), /* @__PURE__ */
|
|
440
|
-
|
|
369
|
+
)), /* @__PURE__ */ _react2.default.createElement(
|
|
370
|
+
_reactnative.Animated.View,
|
|
441
371
|
{
|
|
442
372
|
style: [
|
|
443
373
|
styles.contentOverflow,
|
|
444
374
|
disableAnimation ? { height: isExpanded ? void 0 : 0 } : { height: heightInterpolation }
|
|
445
375
|
]
|
|
446
376
|
},
|
|
447
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [contentContainerStyle, _optionalChain([customAppearance, 'optionalAccess', _11 => _11.content])] }, children)
|
|
448
378
|
));
|
|
449
379
|
};
|
|
450
380
|
ExpansionPanelItem.displayName = "ExpansionPanelItem";
|
|
451
381
|
|
|
452
382
|
// src/components/expansion-panel/expansion-panel.utils.ts
|
|
453
|
-
|
|
383
|
+
|
|
454
384
|
var getItemKey = (value, fallback) => {
|
|
455
385
|
if (value === null || value === void 0) return String(fallback);
|
|
456
386
|
if (typeof value === "string" || typeof value === "number") return String(value);
|
|
@@ -460,7 +390,7 @@ var normalizeElementKey = (value) => {
|
|
|
460
390
|
if (typeof value !== "string") return value;
|
|
461
391
|
return value.startsWith(".$") ? value.slice(2) : value.startsWith(".") ? value.slice(1) : value;
|
|
462
392
|
};
|
|
463
|
-
var isExpansionPanelItem = (value) =>
|
|
393
|
+
var isExpansionPanelItem = (value) => _react2.default.isValidElement(value) && (value.type === ExpansionPanelItem || typeof value.type === "function" && value.type.displayName === "ExpansionPanelItem");
|
|
464
394
|
var buildExpansionPanelContextParams = (props) => {
|
|
465
395
|
return {
|
|
466
396
|
variant: props.variant || "light",
|
|
@@ -476,74 +406,6 @@ var buildExpansionPanelContextParams = (props) => {
|
|
|
476
406
|
};
|
|
477
407
|
};
|
|
478
408
|
|
|
479
|
-
// src/components/divider/divider.tsx
|
|
480
|
-
var import_react13 = __toESM(require("react"), 1);
|
|
481
|
-
var import_react_native8 = require("react-native");
|
|
482
|
-
|
|
483
|
-
// src/components/divider/divider.style.ts
|
|
484
|
-
var import_react_native7 = require("react-native");
|
|
485
|
-
var styles2 = import_react_native7.StyleSheet.create({
|
|
486
|
-
horizontal: {
|
|
487
|
-
height: 1,
|
|
488
|
-
flexShrink: 1,
|
|
489
|
-
flexBasis: "auto",
|
|
490
|
-
width: "100%"
|
|
491
|
-
},
|
|
492
|
-
vertical: {
|
|
493
|
-
width: 1,
|
|
494
|
-
alignSelf: "stretch"
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
// src/components/divider/divider.hook.ts
|
|
499
|
-
var import_react12 = require("react");
|
|
500
|
-
var import_core5 = require("@xaui/core");
|
|
501
|
-
var useDividerColor = (themeColor, customColor) => {
|
|
502
|
-
const theme = useXUITheme();
|
|
503
|
-
const dividerColor = (0, import_react12.useMemo)(() => {
|
|
504
|
-
if (customColor) {
|
|
505
|
-
return customColor;
|
|
506
|
-
}
|
|
507
|
-
const safeThemeColor = (0, import_core5.getSafeThemeColor)(themeColor);
|
|
508
|
-
return theme.colors[safeThemeColor].main;
|
|
509
|
-
}, [customColor, themeColor, theme]);
|
|
510
|
-
return dividerColor;
|
|
511
|
-
};
|
|
512
|
-
var useDividerSize = (size, orientation) => {
|
|
513
|
-
const sizeStyles = (0, import_react12.useMemo)(() => {
|
|
514
|
-
if (orientation === "horizontal") {
|
|
515
|
-
return {
|
|
516
|
-
height: size
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
return {
|
|
520
|
-
width: size
|
|
521
|
-
};
|
|
522
|
-
}, [size, orientation]);
|
|
523
|
-
return sizeStyles;
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
// src/components/divider/divider.tsx
|
|
527
|
-
var Divider = ({
|
|
528
|
-
size = 1,
|
|
529
|
-
themeColor = "default",
|
|
530
|
-
color,
|
|
531
|
-
orientation = "horizontal"
|
|
532
|
-
}) => {
|
|
533
|
-
const dividerColor = useDividerColor(themeColor, color);
|
|
534
|
-
const sizeStyles = useDividerSize(size, orientation);
|
|
535
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
536
|
-
import_react_native8.View,
|
|
537
|
-
{
|
|
538
|
-
style: [
|
|
539
|
-
orientation === "horizontal" ? styles2.horizontal : styles2.vertical,
|
|
540
|
-
sizeStyles,
|
|
541
|
-
{ backgroundColor: dividerColor }
|
|
542
|
-
]
|
|
543
|
-
}
|
|
544
|
-
);
|
|
545
|
-
};
|
|
546
|
-
|
|
547
409
|
// src/components/expansion-panel/expansion-panel.tsx
|
|
548
410
|
var ExpansionPanel = (props) => {
|
|
549
411
|
const {
|
|
@@ -559,22 +421,21 @@ var ExpansionPanel = (props) => {
|
|
|
559
421
|
});
|
|
560
422
|
const contextParams = buildExpansionPanelContextParams(props);
|
|
561
423
|
const contextValue = useExpansionPanelContextValue(contextParams);
|
|
562
|
-
const childrenArray =
|
|
563
|
-
return /* @__PURE__ */
|
|
424
|
+
const childrenArray = _react2.default.Children.toArray(children);
|
|
425
|
+
return /* @__PURE__ */ _react2.default.createElement(ExpansionPanelContext.Provider, { value: contextValue }, /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [containerStyles, _optionalChain([customAppearance, 'optionalAccess', _12 => _12.container])] }, childrenArray.map((child, index) => {
|
|
564
426
|
const isLast = index === childrenArray.length - 1;
|
|
565
427
|
const showBottomDivider = (showDivider || variant === "bordered") && !isLast && variant !== "splitted";
|
|
566
428
|
const resolvedChildKey = isExpansionPanelItem(child) ? getItemKey(
|
|
567
|
-
child.props.itemKey
|
|
429
|
+
_nullishCoalesce(child.props.itemKey, () => ( normalizeElementKey(child.key))),
|
|
568
430
|
index
|
|
569
431
|
) : getItemKey(
|
|
570
|
-
|
|
432
|
+
_react2.default.isValidElement(child) ? normalizeElementKey(child.key) : void 0,
|
|
571
433
|
index
|
|
572
434
|
);
|
|
573
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { key: resolvedChildKey, style: _optionalChain([customAppearance, 'optionalAccess', _13 => _13.item]) }, isExpansionPanelItem(child) ? _react2.default.cloneElement(child, { itemKey: resolvedChildKey }) : child, showBottomDivider && /* @__PURE__ */ _react2.default.createElement(_chunkBD72HIPRcjs.Divider, { color: dividerColor, size: 1 }));
|
|
574
436
|
})));
|
|
575
437
|
};
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
});
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
exports.ExpansionPanel = ExpansionPanel; exports.ExpansionPanelItem = ExpansionPanelItem;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Divider
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-LUBWRVI2.js";
|
|
4
|
+
import "../chunk-DXXNBF5P.js";
|
|
4
5
|
import {
|
|
5
6
|
useXUIPalette,
|
|
6
7
|
useXUITheme
|
|
7
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-LTKYHG5V.js";
|
|
8
9
|
|
|
9
10
|
// src/components/expansion-panel/expansion-panel.tsx
|
|
10
11
|
import React4 from "react";
|