@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/snippet/index.cjs
DELETED
|
@@ -1,314 +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/snippet/snippet.tsx
|
|
8
|
-
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
9
|
-
var _reactnative = require('react-native');
|
|
10
|
-
var _icons = require('@xaui/icons');
|
|
11
|
-
|
|
12
|
-
// src/components/snippet/snippet.style.ts
|
|
13
|
-
|
|
14
|
-
var styles = _reactnative.StyleSheet.create({
|
|
15
|
-
container: {
|
|
16
|
-
flexShrink: 1,
|
|
17
|
-
flexBasis: "auto",
|
|
18
|
-
width: "100%"
|
|
19
|
-
},
|
|
20
|
-
noFullWidth: {
|
|
21
|
-
width: void 0,
|
|
22
|
-
alignSelf: "flex-start"
|
|
23
|
-
},
|
|
24
|
-
snippet: {
|
|
25
|
-
position: "relative",
|
|
26
|
-
borderWidth: 1,
|
|
27
|
-
overflow: "hidden"
|
|
28
|
-
},
|
|
29
|
-
content: {
|
|
30
|
-
minHeight: 64,
|
|
31
|
-
justifyContent: "center",
|
|
32
|
-
paddingHorizontal: 14,
|
|
33
|
-
paddingVertical: 12
|
|
34
|
-
},
|
|
35
|
-
text: {
|
|
36
|
-
fontSize: 14,
|
|
37
|
-
lineHeight: 20,
|
|
38
|
-
fontFamily: "monospace",
|
|
39
|
-
includeFontPadding: false
|
|
40
|
-
},
|
|
41
|
-
topInset: {
|
|
42
|
-
paddingTop: 44
|
|
43
|
-
},
|
|
44
|
-
bottomInset: {
|
|
45
|
-
paddingBottom: 44
|
|
46
|
-
},
|
|
47
|
-
copyButton: {
|
|
48
|
-
position: "absolute",
|
|
49
|
-
flexDirection: "row",
|
|
50
|
-
alignItems: "center",
|
|
51
|
-
gap: 6,
|
|
52
|
-
borderWidth: 1,
|
|
53
|
-
paddingHorizontal: 10,
|
|
54
|
-
paddingVertical: 6
|
|
55
|
-
},
|
|
56
|
-
top: {
|
|
57
|
-
top: 8
|
|
58
|
-
},
|
|
59
|
-
bottom: {
|
|
60
|
-
bottom: 8
|
|
61
|
-
},
|
|
62
|
-
left: {
|
|
63
|
-
left: 8
|
|
64
|
-
},
|
|
65
|
-
right: {
|
|
66
|
-
right: 8
|
|
67
|
-
},
|
|
68
|
-
copyButtonText: {
|
|
69
|
-
fontSize: 12,
|
|
70
|
-
fontWeight: "600",
|
|
71
|
-
includeFontPadding: false
|
|
72
|
-
},
|
|
73
|
-
inlineSnippet: {
|
|
74
|
-
flexDirection: "row",
|
|
75
|
-
alignItems: "center",
|
|
76
|
-
paddingHorizontal: 10,
|
|
77
|
-
paddingVertical: 8,
|
|
78
|
-
gap: 10
|
|
79
|
-
},
|
|
80
|
-
inlineCopyButton: {
|
|
81
|
-
flexShrink: 0,
|
|
82
|
-
flexDirection: "row",
|
|
83
|
-
alignItems: "center",
|
|
84
|
-
gap: 6,
|
|
85
|
-
borderWidth: 1,
|
|
86
|
-
paddingHorizontal: 10,
|
|
87
|
-
paddingVertical: 6
|
|
88
|
-
},
|
|
89
|
-
inlineContent: {
|
|
90
|
-
flex: 1,
|
|
91
|
-
justifyContent: "center"
|
|
92
|
-
},
|
|
93
|
-
disabled: {
|
|
94
|
-
opacity: 0.55
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// src/components/snippet/snippet.hook.ts
|
|
99
|
-
|
|
100
|
-
var _core = require('@xaui/core');
|
|
101
|
-
var useSnippetColors = (themeColor, variant, isDisabled) => {
|
|
102
|
-
const theme = _chunk7UFBLUMVcjs.useXUITheme.call(void 0, );
|
|
103
|
-
return _react.useMemo.call(void 0, () => {
|
|
104
|
-
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
105
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
106
|
-
const isDark = theme.mode === "dark";
|
|
107
|
-
const textColor = isDisabled ? _core.withOpacity.call(void 0, theme.colors.foreground, 0.56) : theme.colors.foreground;
|
|
108
|
-
if (variant === "flat") {
|
|
109
|
-
return {
|
|
110
|
-
containerBackground: colorScheme.container,
|
|
111
|
-
containerBorder: "transparent",
|
|
112
|
-
text: textColor,
|
|
113
|
-
copyButtonBackground: _core.withOpacity.call(void 0, colorScheme.main, isDark ? 0.2 : 0.14),
|
|
114
|
-
copyButtonBorder: "transparent",
|
|
115
|
-
copyButtonText: colorScheme.main
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
if (variant === "light") {
|
|
119
|
-
return {
|
|
120
|
-
containerBackground: _core.withOpacity.call(void 0, colorScheme.main, isDark ? 0.12 : 0.08),
|
|
121
|
-
containerBorder: "transparent",
|
|
122
|
-
text: textColor,
|
|
123
|
-
copyButtonBackground: "transparent",
|
|
124
|
-
copyButtonBorder: "transparent",
|
|
125
|
-
copyButtonText: colorScheme.main
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
containerBackground: theme.colors.background,
|
|
130
|
-
containerBorder: _core.withOpacity.call(void 0, colorScheme.main, isDark ? 0.7 : 0.55),
|
|
131
|
-
text: textColor,
|
|
132
|
-
copyButtonBackground: _core.withOpacity.call(void 0, colorScheme.main, isDark ? 0.16 : 0.08),
|
|
133
|
-
copyButtonBorder: _core.withOpacity.call(void 0, colorScheme.main, isDark ? 0.48 : 0.32),
|
|
134
|
-
copyButtonText: colorScheme.main
|
|
135
|
-
};
|
|
136
|
-
}, [isDisabled, theme, themeColor, variant]);
|
|
137
|
-
};
|
|
138
|
-
var useCopyButtonPositionStyles = (position) => {
|
|
139
|
-
return _react.useMemo.call(void 0,
|
|
140
|
-
() => ({
|
|
141
|
-
isTop: position.startsWith("top"),
|
|
142
|
-
isLeft: position.endsWith("left"),
|
|
143
|
-
isInline: position.startsWith("inline")
|
|
144
|
-
}),
|
|
145
|
-
[position]
|
|
146
|
-
);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// src/components/snippet/snippet.tsx
|
|
150
|
-
var copyText = async (text) => {
|
|
151
|
-
const runtime = globalThis;
|
|
152
|
-
const writeText = _optionalChain([runtime, 'access', _ => _.navigator, 'optionalAccess', _2 => _2.clipboard, 'optionalAccess', _3 => _3.writeText]);
|
|
153
|
-
if (typeof writeText === "function") {
|
|
154
|
-
await writeText(text);
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
const modules = _reactnative.NativeModules;
|
|
158
|
-
const setString = _nullishCoalesce(_optionalChain([modules, 'access', _4 => _4.RNCClipboard, 'optionalAccess', _5 => _5.setString]), () => ( _optionalChain([modules, 'access', _6 => _6.Clipboard, 'optionalAccess', _7 => _7.setString])));
|
|
159
|
-
if (typeof setString === "function") {
|
|
160
|
-
setString(text);
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
return false;
|
|
164
|
-
};
|
|
165
|
-
var Snippet = ({
|
|
166
|
-
value,
|
|
167
|
-
themeColor = "primary",
|
|
168
|
-
variant = "outlined",
|
|
169
|
-
radius = "md",
|
|
170
|
-
copyButtonPosition = "top-right",
|
|
171
|
-
copyLabel = "Copy",
|
|
172
|
-
copiedLabel = "Copied",
|
|
173
|
-
hideCopyLabel = false,
|
|
174
|
-
copyResetDelay = 1500,
|
|
175
|
-
fullWidth = true,
|
|
176
|
-
isDisabled = false,
|
|
177
|
-
numberOfLines,
|
|
178
|
-
fontSize = 14,
|
|
179
|
-
fontWeight = "400",
|
|
180
|
-
onCopy,
|
|
181
|
-
customAppearance
|
|
182
|
-
}) => {
|
|
183
|
-
const [isCopied, setIsCopied] = _react2.default.useState(false);
|
|
184
|
-
const resetTimerRef = _react2.default.useRef(null);
|
|
185
|
-
const radiusStyles = _chunk7UFBLUMVcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
186
|
-
const colors = useSnippetColors(themeColor, variant, isDisabled);
|
|
187
|
-
const { isTop, isLeft, isInline } = useCopyButtonPositionStyles(copyButtonPosition);
|
|
188
|
-
_react2.default.useEffect(() => {
|
|
189
|
-
return () => {
|
|
190
|
-
if (resetTimerRef.current) {
|
|
191
|
-
clearTimeout(resetTimerRef.current);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}, []);
|
|
195
|
-
const handleCopy = _react2.default.useCallback(async () => {
|
|
196
|
-
if (isDisabled) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
let isSuccess = false;
|
|
200
|
-
try {
|
|
201
|
-
isSuccess = await copyText(value);
|
|
202
|
-
setIsCopied(isSuccess);
|
|
203
|
-
} catch (e) {
|
|
204
|
-
setIsCopied(false);
|
|
205
|
-
}
|
|
206
|
-
_optionalChain([onCopy, 'optionalCall', _8 => _8(value, isSuccess)]);
|
|
207
|
-
if (!isSuccess) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
if (resetTimerRef.current) {
|
|
211
|
-
clearTimeout(resetTimerRef.current);
|
|
212
|
-
}
|
|
213
|
-
resetTimerRef.current = setTimeout(() => {
|
|
214
|
-
setIsCopied(false);
|
|
215
|
-
}, copyResetDelay);
|
|
216
|
-
}, [copyResetDelay, isDisabled, onCopy, value]);
|
|
217
|
-
const copyButtonColors = {
|
|
218
|
-
backgroundColor: colors.copyButtonBackground,
|
|
219
|
-
borderColor: colors.copyButtonBorder
|
|
220
|
-
};
|
|
221
|
-
const copyButton = /* @__PURE__ */ _react2.default.createElement(
|
|
222
|
-
_reactnative.Pressable,
|
|
223
|
-
{
|
|
224
|
-
onPress: handleCopy,
|
|
225
|
-
accessibilityRole: "button",
|
|
226
|
-
accessibilityLabel: isCopied ? copiedLabel : copyLabel,
|
|
227
|
-
disabled: isDisabled,
|
|
228
|
-
style: isInline ? [
|
|
229
|
-
styles.inlineCopyButton,
|
|
230
|
-
radiusStyles,
|
|
231
|
-
copyButtonColors,
|
|
232
|
-
_optionalChain([customAppearance, 'optionalAccess', _9 => _9.copyButton])
|
|
233
|
-
] : [
|
|
234
|
-
styles.copyButton,
|
|
235
|
-
radiusStyles,
|
|
236
|
-
isTop ? styles.top : styles.bottom,
|
|
237
|
-
isLeft ? styles.left : styles.right,
|
|
238
|
-
copyButtonColors,
|
|
239
|
-
_optionalChain([customAppearance, 'optionalAccess', _10 => _10.copyButton])
|
|
240
|
-
]
|
|
241
|
-
},
|
|
242
|
-
/* @__PURE__ */ _react2.default.createElement(_icons.CopyIcon, { size: 14, color: colors.copyButtonText }),
|
|
243
|
-
!hideCopyLabel && /* @__PURE__ */ _react2.default.createElement(
|
|
244
|
-
_reactnative.Text,
|
|
245
|
-
{
|
|
246
|
-
style: [
|
|
247
|
-
styles.copyButtonText,
|
|
248
|
-
{ color: colors.copyButtonText },
|
|
249
|
-
_optionalChain([customAppearance, 'optionalAccess', _11 => _11.copyButtonText])
|
|
250
|
-
]
|
|
251
|
-
},
|
|
252
|
-
isCopied ? copiedLabel : copyLabel
|
|
253
|
-
)
|
|
254
|
-
);
|
|
255
|
-
return /* @__PURE__ */ _react2.default.createElement(
|
|
256
|
-
_reactnative.View,
|
|
257
|
-
{
|
|
258
|
-
style: [
|
|
259
|
-
styles.container,
|
|
260
|
-
!fullWidth && styles.noFullWidth,
|
|
261
|
-
isDisabled && styles.disabled,
|
|
262
|
-
_optionalChain([customAppearance, 'optionalAccess', _12 => _12.container])
|
|
263
|
-
]
|
|
264
|
-
},
|
|
265
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
266
|
-
_reactnative.View,
|
|
267
|
-
{
|
|
268
|
-
style: [
|
|
269
|
-
styles.snippet,
|
|
270
|
-
isInline && styles.inlineSnippet,
|
|
271
|
-
radiusStyles,
|
|
272
|
-
{
|
|
273
|
-
backgroundColor: colors.containerBackground,
|
|
274
|
-
borderColor: colors.containerBorder
|
|
275
|
-
}
|
|
276
|
-
]
|
|
277
|
-
},
|
|
278
|
-
isInline && isLeft && copyButton,
|
|
279
|
-
!isInline && copyButton,
|
|
280
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
281
|
-
_reactnative.View,
|
|
282
|
-
{
|
|
283
|
-
style: [
|
|
284
|
-
isInline ? styles.inlineContent : styles.content,
|
|
285
|
-
!isInline && (isTop ? styles.topInset : styles.bottomInset),
|
|
286
|
-
_optionalChain([customAppearance, 'optionalAccess', _13 => _13.content])
|
|
287
|
-
]
|
|
288
|
-
},
|
|
289
|
-
/* @__PURE__ */ _react2.default.createElement(
|
|
290
|
-
_reactnative.Text,
|
|
291
|
-
{
|
|
292
|
-
selectable: true,
|
|
293
|
-
numberOfLines,
|
|
294
|
-
style: [
|
|
295
|
-
styles.text,
|
|
296
|
-
{
|
|
297
|
-
color: colors.text,
|
|
298
|
-
fontSize,
|
|
299
|
-
lineHeight: Math.round(fontSize * 1.45),
|
|
300
|
-
fontWeight
|
|
301
|
-
},
|
|
302
|
-
_optionalChain([customAppearance, 'optionalAccess', _14 => _14.text])
|
|
303
|
-
]
|
|
304
|
-
},
|
|
305
|
-
value
|
|
306
|
-
)
|
|
307
|
-
),
|
|
308
|
-
isInline && !isLeft && copyButton
|
|
309
|
-
)
|
|
310
|
-
);
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
exports.Snippet = Snippet;
|
package/dist/snippet/index.d.cts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TextStyle, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor, Radius } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type SnippetVariant = 'outlined' | 'flat' | 'light';
|
|
6
|
-
type CopyButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'inline-left' | 'inline-right';
|
|
7
|
-
type SnippetCustomAppearance = {
|
|
8
|
-
container?: StyleProp<ViewStyle>;
|
|
9
|
-
content?: StyleProp<ViewStyle>;
|
|
10
|
-
text?: StyleProp<TextStyle>;
|
|
11
|
-
copyButton?: StyleProp<ViewStyle>;
|
|
12
|
-
copyButtonText?: StyleProp<TextStyle>;
|
|
13
|
-
};
|
|
14
|
-
type SnippetProps = {
|
|
15
|
-
/**
|
|
16
|
-
* Text content displayed in the snippet.
|
|
17
|
-
*/
|
|
18
|
-
value: string;
|
|
19
|
-
/**
|
|
20
|
-
* Theme color used for variant styling.
|
|
21
|
-
* @default 'primary'
|
|
22
|
-
*/
|
|
23
|
-
themeColor?: ThemeColor;
|
|
24
|
-
/**
|
|
25
|
-
* Visual style variant.
|
|
26
|
-
* @default 'outlined'
|
|
27
|
-
*/
|
|
28
|
-
variant?: SnippetVariant;
|
|
29
|
-
/**
|
|
30
|
-
* Snippet border radius.
|
|
31
|
-
* @default 'md'
|
|
32
|
-
*/
|
|
33
|
-
radius?: Radius;
|
|
34
|
-
/**
|
|
35
|
-
* Position of the copy button in the snippet container.
|
|
36
|
-
* @default 'top-right'
|
|
37
|
-
*/
|
|
38
|
-
copyButtonPosition?: CopyButtonPosition;
|
|
39
|
-
/**
|
|
40
|
-
* Copy button label.
|
|
41
|
-
* @default 'Copy'
|
|
42
|
-
*/
|
|
43
|
-
copyLabel?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Hide the copy/copied text label, showing only the icon.
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
hideCopyLabel?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Label shown after a successful copy action.
|
|
51
|
-
* @default 'Copied'
|
|
52
|
-
*/
|
|
53
|
-
copiedLabel?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Delay in milliseconds before reverting copied state.
|
|
56
|
-
* @default 1500
|
|
57
|
-
*/
|
|
58
|
-
copyResetDelay?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the snippet should occupy all available width.
|
|
61
|
-
* @default true
|
|
62
|
-
*/
|
|
63
|
-
fullWidth?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Whether the snippet is disabled.
|
|
66
|
-
* @default false
|
|
67
|
-
*/
|
|
68
|
-
isDisabled?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Number of lines to clamp the snippet text.
|
|
71
|
-
*/
|
|
72
|
-
numberOfLines?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Font size for snippet text.
|
|
75
|
-
* @default 14
|
|
76
|
-
*/
|
|
77
|
-
fontSize?: number;
|
|
78
|
-
/**
|
|
79
|
-
* Font weight for snippet text.
|
|
80
|
-
* @default '400'
|
|
81
|
-
*/
|
|
82
|
-
fontWeight?: TextStyle['fontWeight'];
|
|
83
|
-
/**
|
|
84
|
-
* Callback fired after copy action.
|
|
85
|
-
*/
|
|
86
|
-
onCopy?: (value: string, isSuccess: boolean) => void;
|
|
87
|
-
/**
|
|
88
|
-
* Optional custom styles for snippet parts.
|
|
89
|
-
*/
|
|
90
|
-
customAppearance?: SnippetCustomAppearance;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
declare const Snippet: React.FC<SnippetProps>;
|
|
94
|
-
|
|
95
|
-
export { type CopyButtonPosition, Snippet, type SnippetCustomAppearance, type SnippetProps, type SnippetVariant };
|
package/dist/snippet/index.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TextStyle, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor, Radius } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type SnippetVariant = 'outlined' | 'flat' | 'light';
|
|
6
|
-
type CopyButtonPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'inline-left' | 'inline-right';
|
|
7
|
-
type SnippetCustomAppearance = {
|
|
8
|
-
container?: StyleProp<ViewStyle>;
|
|
9
|
-
content?: StyleProp<ViewStyle>;
|
|
10
|
-
text?: StyleProp<TextStyle>;
|
|
11
|
-
copyButton?: StyleProp<ViewStyle>;
|
|
12
|
-
copyButtonText?: StyleProp<TextStyle>;
|
|
13
|
-
};
|
|
14
|
-
type SnippetProps = {
|
|
15
|
-
/**
|
|
16
|
-
* Text content displayed in the snippet.
|
|
17
|
-
*/
|
|
18
|
-
value: string;
|
|
19
|
-
/**
|
|
20
|
-
* Theme color used for variant styling.
|
|
21
|
-
* @default 'primary'
|
|
22
|
-
*/
|
|
23
|
-
themeColor?: ThemeColor;
|
|
24
|
-
/**
|
|
25
|
-
* Visual style variant.
|
|
26
|
-
* @default 'outlined'
|
|
27
|
-
*/
|
|
28
|
-
variant?: SnippetVariant;
|
|
29
|
-
/**
|
|
30
|
-
* Snippet border radius.
|
|
31
|
-
* @default 'md'
|
|
32
|
-
*/
|
|
33
|
-
radius?: Radius;
|
|
34
|
-
/**
|
|
35
|
-
* Position of the copy button in the snippet container.
|
|
36
|
-
* @default 'top-right'
|
|
37
|
-
*/
|
|
38
|
-
copyButtonPosition?: CopyButtonPosition;
|
|
39
|
-
/**
|
|
40
|
-
* Copy button label.
|
|
41
|
-
* @default 'Copy'
|
|
42
|
-
*/
|
|
43
|
-
copyLabel?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Hide the copy/copied text label, showing only the icon.
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
hideCopyLabel?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Label shown after a successful copy action.
|
|
51
|
-
* @default 'Copied'
|
|
52
|
-
*/
|
|
53
|
-
copiedLabel?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Delay in milliseconds before reverting copied state.
|
|
56
|
-
* @default 1500
|
|
57
|
-
*/
|
|
58
|
-
copyResetDelay?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the snippet should occupy all available width.
|
|
61
|
-
* @default true
|
|
62
|
-
*/
|
|
63
|
-
fullWidth?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Whether the snippet is disabled.
|
|
66
|
-
* @default false
|
|
67
|
-
*/
|
|
68
|
-
isDisabled?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Number of lines to clamp the snippet text.
|
|
71
|
-
*/
|
|
72
|
-
numberOfLines?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Font size for snippet text.
|
|
75
|
-
* @default 14
|
|
76
|
-
*/
|
|
77
|
-
fontSize?: number;
|
|
78
|
-
/**
|
|
79
|
-
* Font weight for snippet text.
|
|
80
|
-
* @default '400'
|
|
81
|
-
*/
|
|
82
|
-
fontWeight?: TextStyle['fontWeight'];
|
|
83
|
-
/**
|
|
84
|
-
* Callback fired after copy action.
|
|
85
|
-
*/
|
|
86
|
-
onCopy?: (value: string, isSuccess: boolean) => void;
|
|
87
|
-
/**
|
|
88
|
-
* Optional custom styles for snippet parts.
|
|
89
|
-
*/
|
|
90
|
-
customAppearance?: SnippetCustomAppearance;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
declare const Snippet: React.FC<SnippetProps>;
|
|
94
|
-
|
|
95
|
-
export { type CopyButtonPosition, Snippet, type SnippetCustomAppearance, type SnippetProps, type SnippetVariant };
|